diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 79d998d5970..ccac883e1ad 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -435,7 +435,7 @@ class pdf_beluga extends ModelePDFProjects } //var_dump("$key, $tablename, $datefieldname, $dates, $datee"); - $elementarray = $object->get_element_list($key, $tablename, $datefieldname, '', '', $projectField); + $elementarray = $object->get_element_list($key, $tablename, $datefieldname, null, null, $projectField); $num = count($elementarray); if ($num >= 0) { diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 8602f976075..8be73099cac 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -409,10 +409,10 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_SHO // This list can be very long, so we don't show it by default on task area. We prefer to use the list page. // Add constant PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA to show this list - $max = (!getDolGlobalString('PROJECT_LIMIT_TASK_PROJECT_AREA') ? 1000 : $conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA); + $max = getDolGlobalInt('PROJECT_LIMIT_TASK_PROJECT_AREA', 1000); - $sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.public, p.dateo as projdateo, p.datee as projdatee,"; - $sql .= " t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.element_duration) as timespent"; + $sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.public, p.dateo as projdate_start, p.datee as projdate_end,"; + $sql .= " t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo as date_start, t.datee as date_end, SUM(tasktime.element_duration) as timespent"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; @@ -432,8 +432,8 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_SHO $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")"; } $sql .= " AND p.fk_statut=1"; - $sql .= " GROUP BY p.ref, p.title, p.rowid, p.fk_statut, p.fk_opp_status, p.public, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; - $sql .= " ORDER BY t.dateo desc, t.rowid desc, t.datee"; + $sql .= " GROUP BY p.ref, p.title, p.rowid, p.fk_statut, p.fk_opp_status, p.public, p.dateo, p.datee, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; + $sql .= " ORDER BY t.dateo DESC, t.rowid DESC, t.datee DESC"; $sql .= $db->plimit($max + 1); // We want more to know if we have more than limit dol_syslog('projet:index.php: affectationpercent', LOG_DEBUG); @@ -469,14 +469,16 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_SHO $projectstatic->title = $obj->title; $projectstatic->statut = $obj->status; $projectstatic->public = $obj->public; - $projectstatic->dateo = $db->jdate($obj->projdateo); - $projectstatic->datee = $db->jdate($obj->projdatee); + $projectstatic->date_start = $db->jdate($obj->projdate_start); + $projectstatic->date_end = $db->jdate($obj->projdate_end); $taskstatic->projectstatus = $obj->projectstatus; $taskstatic->progress = $obj->progress; $taskstatic->fk_statut = $obj->status; - $taskstatic->dateo = $db->jdate($obj->dateo); - $taskstatic->datee = $db->jdate($obj->datee); + $taskstatic->date_start = $db->jdate($obj->date_start); + $taskstatic->date_end = $db->jdate($obj->date_end); + $taskstatic->dateo = $db->jdate($obj->date_start); + $taskstatic->datee = $db->jdate($obj->date_end); $username = ''; if ($obj->userid && $userstatic->id != $obj->userid) { // We have a user and it is not last loaded user @@ -512,8 +514,8 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_SHO print $langs->trans("NoTasks"); } print ''; - print ''.dol_print_date($db->jdate($obj->dateo), 'day').''; - print ''.dol_print_date($db->jdate($obj->datee), 'day'); + print ''.dol_print_date($db->jdate($obj->date_start), 'day').''; + print ''.dol_print_date($db->jdate($obj->date_end), 'day'); if ($taskstatic->hasDelay()) { print img_warning($langs->trans("Late")); } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 77933988bf6..f79bb10a1b9 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -819,7 +819,7 @@ class Project extends CommonObject * @param string $projectkey Equivalent key to fk_projet for actual type * @return mixed Array list of object ids linked to project, < 0 or string if error */ - public function get_element_list($type, $tablename, $datefieldname = '', $date_start = '', $date_end = '', $projectkey = 'fk_projet') + public function get_element_list($type, $tablename, $datefieldname = '', $date_start = null, $date_end = null, $projectkey = 'fk_projet') { // phpcs:enable diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 324d51b8072..c3cbe241739 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -83,15 +83,22 @@ class Task extends CommonObjectLine public $duration_effective; // total of time spent on this task public $planned_workload; public $date_c; - public $date_start; - public $date_end; public $progress; + /** + * @deprecated Use date_start instead + */ + public $dateo; + + public $date_start; + /** * @deprecated Use date_end instead */ public $datee; + public $date_end; + /** * @var int ID */ @@ -324,8 +331,8 @@ class Task extends CommonObjectLine $sql .= " t.duration_effective,"; $sql .= " t.planned_workload,"; $sql .= " t.datec,"; - $sql .= " t.dateo,"; - $sql .= " t.datee,"; + $sql .= " t.dateo as date_start,"; + $sql .= " t.datee as date_end,"; $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_valid,"; $sql .= " t.fk_statut,"; @@ -369,8 +376,8 @@ class Task extends CommonObjectLine $this->duration_effective = $obj->duration_effective; $this->planned_workload = $obj->planned_workload; $this->date_c = $this->db->jdate($obj->datec); - $this->date_start = $this->db->jdate($obj->dateo); - $this->date_end = $this->db->jdate($obj->datee); + $this->date_start = $this->db->jdate($obj->date_start); + $this->date_end = $this->db->jdate($obj->date_end); $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_valid = $obj->fk_user_valid; $this->fk_statut = $obj->fk_statut; @@ -2275,7 +2282,7 @@ class Task extends CommonObjectLine // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,"; $sql .= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,"; - $sql .= " t.dateo as date_start, t.datee as datee"; + $sql .= " t.dateo as date_start, t.datee as date_end"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; //if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; @@ -2314,7 +2321,8 @@ class Task extends CommonObjectLine $task_static->projectstatus = $obj->projectstatus; $task_static->progress = $obj->progress; $task_static->fk_statut = $obj->status; - $task_static->date_end = $this->db->jdate($obj->datee); + $task_static->date_start = $this->db->jdate($obj->date_start); + $task_static->date_end = $this->db->jdate($obj->date_end); if ($task_static->hasDelay()) { $response->nbtodolate++; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 51b7e3c47d4..3c5a8467a5d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -150,14 +150,14 @@ if (isModEnabled('eventorganization')) { $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$datesrfc = GETPOST('datesrfc'); -$dateerfc = GETPOST('dateerfc'); +$datesrfc = GETPOST('datesrfc'); // deprecated +$dateerfc = GETPOST('dateerfc'); // deprecated $dates = dol_mktime(0, 0, 0, GETPOST('datesmonth'), GETPOST('datesday'), GETPOST('datesyear')); $datee = dol_mktime(23, 59, 59, GETPOST('dateemonth'), GETPOST('dateeday'), GETPOST('dateeyear')); -if (empty($dates) && !empty($datesrfc)) { +if (empty($dates) && !empty($datesrfc)) { // deprecated $dates = dol_stringtotime($datesrfc); } -if (empty($datee) && !empty($dateerfc)) { +if (empty($datee) && !empty($dateerfc)) { // deprecated $datee = dol_stringtotime($dateerfc); } if (!GETPOSTISSET('datesrfc') && !GETPOSTISSET('datesday') && getDolGlobalString('PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR')) { diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 2c1bcf28662..959cc1e84b3 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -200,7 +200,7 @@ print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppst print '
'; // Latest modified projects -$sql = "SELECT p.rowid, p.ref, p.title, p.dateo, p.datee, p.fk_statut as status, p.tms as datem"; +$sql = "SELECT p.rowid, p.ref, p.title, p.dateo as date_start, p.datee as date_end, p.fk_statut as status, p.tms as datem"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; @@ -241,6 +241,8 @@ if ($resql) { $projectstatic->title = $obj->title; $projectstatic->thirdparty_name = $obj->name; $projectstatic->status = $obj->status; + $projectstatic->date_start = $db->jdate($obj->date_start); + $projectstatic->date_end = $db->jdate($obj->date_end); $companystatic->id = $obj->socid; $companystatic->name = $obj->name; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index bdaeb4df9d6..0e0381fd831 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -310,8 +310,8 @@ if ($action == 'createtask' && $user->hasRight('projet', 'creer')) { $error = 0; // If we use user timezone, we must change also view/list to use user timezone everywhere - $date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); - $date_end = dol_mktime(GETPOST('dateehour', 'int'), GETPOST('dateemin', 'int'), 0, GETPOST('dateemonth', 'int'), GETPOST('dateeday', 'int'), GETPOST('dateeyear', 'int')); + $date_start = dol_mktime(GETPOST('date_starthour', 'int'), GETPOST('date_startmin', 'int'), 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); + $date_end = dol_mktime(GETPOST('date_endhour', 'int'), GETPOST('date_endmin', 'int'), 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); if (!$cancel) { if (empty($taskref)) { @@ -789,13 +789,13 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- // Date start task print ''.$langs->trans("DateStart").''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate((!empty($date_start) ? $date_start : ''), 'dateo', 1, 1, 0, '', 1, 1); + print $form->selectDate((!empty($date_start) ? $date_start : ''), 'date_start', 1, 1, 0, '', 1, 1); print ''; // Date end task print ''.$langs->trans("DateEnd").''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate((!empty($date_end) ? $date_end : -1), 'datee', -1, 1, 0, '', 1, 1); + print $form->selectDate((!empty($date_end) ? $date_end : -1), 'date_end', -1, 1, 0, '', 1, 1); print ''; // Planned workload diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index d4bf3aa2099..c9a6c4d3aa4 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -108,8 +108,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('projet', 'cree } $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; - $object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); - $object->date_end = dol_mktime(GETPOST('dateehour', 'int'), GETPOST('dateemin', 'int'), 0, GETPOST('dateemonth', 'int'), GETPOST('dateeday', 'int'), GETPOST('dateeyear', 'int')); + $object->date_start = dol_mktime(GETPOST('date_starthour', 'int'), GETPOST('date_startmin', 'int'), 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); + $object->date_end = dol_mktime(GETPOST('date_endhour', 'int'), GETPOST('date_endmin', 'int'), 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $object->progress = price2num(GETPOST('progress', 'alphanohtml')); $object->budget_amount = price2num(GETPOST('budget_amount', 'alphanohtml')); @@ -473,12 +473,12 @@ if ($id > 0 || !empty($ref)) { // Date start print ''.$langs->trans("DateStart").''; - print $form->selectDate($object->date_start, 'dateo', 1, 1, 0, '', 1, 0); + print $form->selectDate($object->date_start, 'date_start', 1, 1, 0, '', 1, 0); print ''; // Date end print ''.$langs->trans("Deadline").''; - print $form->selectDate($object->date_end ? $object->date_end : -1, 'datee', 1, 1, 0, '', 1, 0); + print $form->selectDate($object->date_end ? $object->date_end : -1, 'date_end', 1, 1, 0, '', 1, 0); print ''; // Planned workload diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index be392ae8810..e5f3cdee9ee 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2120,7 +2120,7 @@ class SupplierProposal extends CommonObject public function info($id) { $sql = "SELECT c.rowid, "; - $sql .= " c.datec, c.date_valid as datev, c.date_cloture as dateo,"; + $sql .= " c.datec as date_creation, c.date_valid as date_validation, c.date_cloture as date_closure,"; $sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_cloture"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as c"; $sql .= " WHERE c.rowid = ".((int) $id); @@ -2133,9 +2133,9 @@ class SupplierProposal extends CommonObject $this->id = $obj->rowid; - $this->date_creation = $this->db->jdate($obj->datec); - $this->date_validation = $this->db->jdate($obj->datev); - $this->date_cloture = $this->db->jdate($obj->dateo); + $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_validation = $this->db->jdate($obj->date_validation); + $this->date_cloture = $this->db->jdate($obj->date_closure); $this->user_creation_id = $obj->fk_user_author; $this->user_validation_id = $obj->fk_user_valid;