delcroip/dolibarr_project_timesheet

Missing Starttime in project Event list

Closed this issue · 0 comments

The Chrono Item does not add the StartTime in the Project event list. In the Chrono manage page starttime is given.

can be fixed by adding

        if($duration > 0 ){
            $this->timespent_withhour = '1';
            $this->timespent_datehour = (time() - $this->timespent_duration);
        }

to TimesheetTask.class.php after Line 1372 before
$newId = $this->addTimeSpent($Submitter, 0);

to fix the problems when edit the note we need to change both filelds manual

change to this will working fine start on line 1349

            $this->timespent_note = $daynote;
            $this->timespent_duration = $duration;
        }
        if ($item['duration']!=$this->timespent_duration || $this->timespent_note!=$item['note']) {
            if ($this->timespent_duration>0 || !empty($daynote)) {

                if($this->timespent_note != $item['note']) {
                  $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET";
                  $sql .= " note = ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null");
                  $sql .= " WHERE rowid = ".((int) $this->timespent_id);
                 if ($this->db->query($sql)) {
                        //OK
                        }
                }
                if ($item['duration']!=$this->timespent_duration ){
                     $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET";
                     $sql .= " task_duration = ".$duration;
                    $sql .= " WHERE rowid = ".((int) $this->timespent_id);
                }
                
                dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG);
                if ($this->db->query($sql)) {
                    $resArray['timeSpendModified']++;
                } else {
                    $resArray['updateError']++;
                }
            } else {