From 87c3576a86f75d2a1dfd65597b5984088288a81f Mon Sep 17 00:00:00 2001 From: Vaadasch Date: Tue, 8 Apr 2025 15:21:38 +0200 Subject: [PATCH 1/3] BUG duration minutes (#33767) Co-authored-by: Laurent Destailleur --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6fbdecee407..abc6b775b03 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2726,7 +2726,7 @@ class ExtraFields $value_key = dol_mktime(GETPOSTINT("options_".$key."hour"), GETPOSTINT("options_".$key."min"), GETPOSTINT("options_".$key."sec"), GETPOSTINT("options_".$key."month"), GETPOSTINT("options_".$key."day"), GETPOSTINT("options_".$key."year"), 'gmt'); } elseif (in_array($key_type, array('duration'))) { $value_hours = GETPOSTINT("options_" . $key . "hour"); - $value_minutes = GETPOSTINT("options_" . $key . "minute"); + $value_minutes = GETPOSTINT("options_" . $key . "min"); $value_key = $value_hours * 3600 + $value_minutes * 60; } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { $value_arr = GETPOST("options_".$key, 'array'); // check if an array From ebdf69ca69980555f3ed4e5079995942c9aa34c3 Mon Sep 17 00:00:00 2001 From: Yannis Hoareau <93135242+YannisHoareau@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:22:48 +0200 Subject: [PATCH 2/3] Fix extrafields warning (#33761) --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index abc6b775b03..df52b10df70 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -999,7 +999,7 @@ class ExtraFields $elementtype = 'commande_fournisseur'; } - if ($elementtype != 'all' && isset($this->attributes[$elementtype]) && $this->attributes[$elementtype]['loaded'] == 1 && !$forceload) { + if ($elementtype != 'all' && isset($this->attributes[$elementtype]) && $this->attributes[$elementtype]['loaded'] == 1 && !$forceload && isset($this->attributes[$elementtype]['label'])) { return $this->attributes[$elementtype]['label']; } From facb31000d7fec39b25847b765f36e3fd0c7a261 Mon Sep 17 00:00:00 2001 From: Vaadasch Date: Tue, 8 Apr 2025 15:28:41 +0200 Subject: [PATCH 3/3] FIX $object not initialised in extrafields_list_print for propals (#33753) * FIX object->id not initialise for propal / objectoffield * Update extrafields_list_print_fields.tpl.php * Update extrafields_list_print_fields.tpl.php * Update list.php * Update list.php * Update list.php --------- Co-authored-by: Arnaud Serrut Co-authored-by: Laurent Destailleur --- htdocs/comm/propal/list.php | 36 +++++++++---------- .../tpl/extrafields_list_print_fields.tpl.php | 2 +- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 0415e494457..9facbea7b9e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -572,6 +572,7 @@ if (isModEnabled('margin')) { $companystatic = new Societe($db); $projectstatic = new Project($db); $formcompany = new FormCompany($db); +$userstatic = new User($db); $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields @@ -891,9 +892,6 @@ if (!$resql) { exit; } -$objectstatic = new Propal($db); -$userstatic = new User($db); - if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); @@ -1782,13 +1780,13 @@ while ($i < $imaxinloop) { $param .= "&search_option=".urlencode($search_option); } - $objectstatic->id = $obj->rowid; - $objectstatic->ref = $obj->ref; - $objectstatic->ref_customer = $obj->ref_client; - $objectstatic->note_public = $obj->note_public; - $objectstatic->note_private = $obj->note_private; - $objectstatic->statut = $obj->status; - $objectstatic->status = $obj->status; + $object->id = $obj->rowid; + $object->ref = $obj->ref; + $object->ref_customer = $obj->ref_client; + $object->note_public = $obj->note_public; + $object->note_private = $obj->note_private; + $object->statut = $obj->status; + $object->status = $obj->status; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; @@ -1812,7 +1810,7 @@ while ($i < $imaxinloop) { $multicurrency_totalInvoicedHT = 0; $multicurrency_totalInvoicedTTC = 0; - $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid); + $TInvoiceData = $object->InvoiceArrayList($object->id); if (!empty($TInvoiceData)) { foreach ($TInvoiceData as $invoiceData) { @@ -1832,8 +1830,8 @@ while ($i < $imaxinloop) { $marginInfo = array(); if ($with_margin_info) { - $objectstatic->fetch_lines(); - $marginInfo = $formmargin->getMarginInfosArray($objectstatic); + $object->fetch_lines(); + $marginInfo = $formmargin->getMarginInfosArray($object); $total_ht += $obj->total_ht; $total_margin += $marginInfo['total_margin']; } @@ -1844,16 +1842,16 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban - $objectstatic->thirdparty = $companystatic; + $object->thirdparty = $companystatic; $userstatic->fetch($obj->fk_user_author); $arrayofparams = array('selected' => in_array($object->id, $arrayofselected), 'authorlink' => $userstatic->getNomUrl(-2), 'projectlink' => $projectstatic->getNomUrl(2)); - print $objectstatic->getKanbanView('', $arrayofparams); + print $object->getKanbanView('', $arrayofparams); if ($i == ($imaxinloop - 1)) { print '
'; print ''; } } else { - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -1877,7 +1875,7 @@ while ($i < $imaxinloop) { print ''; // Picto + Ref print ''; // Warning $warnornote = ''; @@ -1894,7 +1892,7 @@ while ($i < $imaxinloop) { $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print $formfile->getDocumentsLink($object->element, $filename, $filedir); print '
'; - print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); + print $object->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); print '
'; print "\n"; @@ -2410,7 +2408,7 @@ while ($i < $imaxinloop) { // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''.$objectstatic->getLibStatut(5).''; + print ''.$object->getLibStatut(5).''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 0d679c78fc4..c521292945a 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -69,7 +69,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield } // If field is a computed field, we make computation to get value if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) { - $objectoffield = $object; // For compatibility with the computed formula + $objectoffield = $object; // For compatibility with the computed formula. $objectoffield is exported by dol_eval(). $value = dol_eval((string) $extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '2'); if (is_numeric(price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { $obj->$tmpkey = price2num($value);