From 36cf05318bf58a447b2123169d95cf15a9b542de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Jan 2023 21:17:06 +0100 Subject: [PATCH] Debug v17 --- htdocs/core/class/html.formprojet.class.php | 5 +++++ htdocs/core/lib/functions.lib.php | 16 ++++++++----- htdocs/core/lib/security.lib.php | 4 +++- htdocs/core/modules/modTicket.class.php | 2 +- htdocs/projet/card.php | 4 +++- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/element.php | 25 ++++++++++----------- htdocs/projet/ganttview.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/task.php | 2 +- htdocs/projet/tasks/time.php | 4 ++-- htdocs/ticket/class/ticket.class.php | 2 +- 13 files changed, 42 insertions(+), 30 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index a0e74c5cdd5..e05931f437d 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -39,6 +39,9 @@ class FormProjets */ public $error = ''; + public $errors = array(); + + public $nboftasks; @@ -622,6 +625,8 @@ class FormProjets if ($resql) { $num = $this->db->num_rows($resql); $i = 0; + $sellist = ''; + if ($num > 0) { $sellist = ''; - print ''; + print ''; print ''; print '
'; print $form->selectDate($dates, 'dates', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); @@ -730,7 +729,7 @@ $tooltiponprofitplus = $tooltiponprofitminus = ''; foreach ($listofreferent as $key => $value) { $name = $langs->trans($value['name']); $qualified = $value['test']; - $margin = $value['margin']; + $margin = empty($value['margin']) ? 0 : $value['margin']; if ($qualified && isset($margin)) { // If this element must be included into profit calculation ($margin is 'minus' or 'add') if ($margin == 'add') { $tooltiponprofitplus .= ' > '.$name." (+)
\n"; @@ -777,8 +776,8 @@ foreach ($listofreferent as $key => $value) { $tablename = $value['table']; $datefieldname = $value['datefieldname']; $qualified = $value['test']; - $margin = $value['margin']; - $project_field = $value['project_field']; + $margin = empty($value['margin']) ? 0 : $value['margin']; + $project_field = empty($value['project_field']) ? '' : $value['project_field']; if ($qualified && isset($margin)) { // If this element must be included into profit calculation ($margin is 'minus' or 'add') $element = new $classname($db); @@ -990,11 +989,11 @@ foreach ($listofreferent as $key => $value) { $tablename = $value['table']; $datefieldname = $value['datefieldname']; $qualified = $value['test']; - $langtoload = $value['lang']; - $urlnew = $value['urlnew']; - $buttonnew = $value['buttonnew']; - $testnew = $value['testnew']; - $project_field = $value['project_field']; + $langtoload = empty($value['lang']) ? '' : $value['lang']; + $urlnew = empty($value['urlnew']) ? '' : $value['urlnew']; + $buttonnew = empty($value['buttonnew']) ? '' : $value['buttonnew']; + $testnew = empty($value['testnew']) ? '' : $value['testnew']; + $project_field = empty($value['project_field']) ? '' : $value['project_field']; $exclude_select_element = array('payment_various'); if (!empty($value['exclude_select_element'])) { diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index f2889d7c469..dea34c4badc 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -181,7 +181,7 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { // Budget print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { + if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency); } print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 3322b63b171..d3097631a6f 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -616,7 +616,7 @@ if ($id > 0 || !empty($ref)) { // Budget print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { + if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; } print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index fccf9d2ffe1..dfa26202a2d 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -632,7 +632,7 @@ if ($id > 0 || !empty($ref)) { // Budget print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { + if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print ''.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; } print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 94ed0edaffd..139a1711658 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1004,7 +1004,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Budget print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { + if (!is_null($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) { print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; } print ''; @@ -2616,7 +2616,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!count($tasks)) { $totalnboffields = 1; foreach ($arrayfields as $value) { - if ($value['checked']) { + if (!empty($value['checked'])) { $totalnboffields++; } } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index d4e0148f662..05c724b718e 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -294,7 +294,7 @@ class Ticket extends CommonObject 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'), 'email_date' => array('type'=>'datetime', 'label'=>'EmailDate', 'visible'=>-2, 'enabled'=>1, 'position'=>541), 'progress' => array('type'=>'integer', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>2, 'csslist'=>'width50'), - 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'$conf->global->TICKET_ENABLE_RESOLUTION', 'position'=>550, 'notnull'=>1), + 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'getDolGlobalString("TICKET_ENABLE_RESOLUTION")', 'position'=>550, 'notnull'=>1), 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), );