From 768846191b0a92f4ebd473ffddd2ea485670e6da Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Sat, 27 Apr 2024 12:49:27 +0200 Subject: [PATCH 1/6] fix: when invoice is created by WORKFLOW_ORDER_AUTOCREATE_INVOICE on ORDER_CLOSE, the invoice must have the default bank account of the thirdparty is it's empty on order (#29462) * fix: when invoice is created by WORKFLOW_ORDER_AUTOCREATE_INVOICE on ORDER_CLOSE, the invoice must have the default bank account of the thirdparty is it's empty on order * fix: add control on back stattement --- .../interface_20_modWorkflow_WorkflowManager.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index f85a26697b7..c7fa2290f18 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -116,6 +116,14 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($ret < 0) { $this->error = $newobject->error; $this->errors[] = $newobject->error; + } else { + if (empty($object->fk_account) && !empty($object->thirdparty->fk_account) && !getDolGlobalInt('BANK_ASK_PAYMENT_BANK_DURING_ORDER')) { + $res = $newobject->setBankAccount($object->thirdparty->fk_account, true, $user); + if ($ret < 0) { + $this->error = $newobject->error; + $this->errors[] = $newobject->error; + } + } } $object->clearObjectLinkedCache(); From 661582875a03c5357cbc5b657ace0ae518df851c Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Sat, 27 Apr 2024 18:14:20 +0200 Subject: [PATCH 2/6] Fix : Warning: Undefined property: stdClass::$PRODUIT_DEFAULT_BARCODE_TYPE in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/core/modules/barcode/mod_barcode_product_standard.php on line 187 (#29479) * fix : Warning: Undefined variable in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/compta/bank/various_payment/list.php on line 370 * backward * fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/core/modules/barcode/mod_barcode_product_standard.php on line 187 * fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php on line 188 * fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/core/class/html.formbarcode.class.php on line 83 * fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/core/class/html.formbarcode.class.php on line 84 * fix :Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/admin/barcode.php on line 460 * fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/admin/barcode.php on line 471 * Update mod_barcode_product_standard.php * Update mod_barcode_thirdparty_standard.php --------- Co-authored-by: Laurent Destailleur --- htdocs/admin/barcode.php | 4 ++-- htdocs/core/class/html.formbarcode.class.php | 4 ++-- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 5 +++-- .../core/modules/barcode/mod_barcode_thirdparty_standard.php | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 9a476798c20..a9fca329dda 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -457,7 +457,7 @@ if (isModEnabled('product')) { print ''; print ''.$langs->trans("SetDefaultBarcodeTypeProducts").''; print ''; - print $formbarcode->selectBarcodeType($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE, "PRODUIT_DEFAULT_BARCODE_TYPE", 1); + print $formbarcode->selectBarcodeType(getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE'), "PRODUIT_DEFAULT_BARCODE_TYPE", 1); print ''; print ' '; print ''; @@ -468,7 +468,7 @@ if (isModEnabled('societe')) { print ''; print ''.$langs->trans("SetDefaultBarcodeTypeThirdParties").''; print ''; - print $formbarcode->selectBarcodeType($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY, "GENBARCODE_BARCODETYPE_THIRDPARTY", 1); + print $formbarcode->selectBarcodeType(getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY'), "GENBARCODE_BARCODETYPE_THIRDPARTY", 1); print ''; print ' '; print ''; diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index e8dd0e9daa9..4ea8160e323 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -80,8 +80,8 @@ class FormBarCode } // We check if barcode is already selected by default - if (((isModEnabled("product") || isModEnabled("service")) && $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE == $code_id) || - (isModEnabled("societe") && $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY == $code_id)) { + if (((isModEnabled("product") || isModEnabled("service")) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE') == $code_id) || + (isModEnabled("societe") && getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY') == $code_id)) { $disable = 'disabled'; } diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 57fad5e1177..f747c8cbed1 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -183,9 +183,10 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean) + // Get barcode type configuration for products if $type not set if (empty($type)) { - $type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; - } //get barcode type configuration for products if $type not set + $type = getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE'); + } // TODO diff --git a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php index 3037f29d33d..de5f15708d1 100644 --- a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php @@ -184,9 +184,10 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean) + // Get barcode type configuration for products if $type not set if (empty($type)) { - $type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY; - } //get barcode type configuration for companies if $type not set + $type = getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY'); + } // TODO From 3df149045d0ff4f2742ae90e61549cd224b7ecd3 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Sun, 28 Apr 2024 01:17:09 +0200 Subject: [PATCH 3/6] FIX : Display the date according to user language on subsitutions (#29510) See : https://www.dolibarr.fr/forum/t/format-date-dune-variable-de-substitution-dans-un-modele-de-courriel/40705 --- htdocs/core/lib/functions.lib.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7181a131a93..dd1536e1245 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7780,12 +7780,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__MEMBER_PHONEPRO__'] = (isset($object->phone_perso) ? dol_print_phone($object->phone_perso) : ''); $substitutionarray['__MEMBER_PHONEMOBILE__'] = (isset($object->phone_mobile) ? dol_print_phone($object->phone_mobile) : ''); $substitutionarray['__MEMBER_TYPE__'] = (isset($object->type) ? $object->type : ''); - $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'dayrfc'); - $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = (isset($object->first_subscription_date_start) ? dol_print_date($object->first_subscription_date_start, 'dayrfc') : ''); - $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = (isset($object->first_subscription_date_end) ? dol_print_date($object->first_subscription_date_end, 'dayrfc') : ''); - $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE__'] = dol_print_date($object->last_subscription_date, 'dayrfc'); - $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->last_subscription_date_start, 'dayrfc'); - $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->last_subscription_date_end, 'dayrfc'); + $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'day'); + $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = (isset($object->first_subscription_date_start) ? dol_print_date($object->first_subscription_date_start, 'day') : ''); + $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = (isset($object->first_subscription_date_end) ? dol_print_date($object->first_subscription_date_end, 'day') : ''); + $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE__'] = dol_print_date($object->last_subscription_date, 'day'); + $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->last_subscription_date_start, 'day'); + $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->last_subscription_date_end, 'day'); } if (is_object($object) && $object->element == 'societe') { @@ -7882,9 +7882,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $datenextexpiration = $line->date_end; } } - $substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATE__'] = dol_print_date($dateplannedstart, 'dayrfc'); + $substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATE__'] = dol_print_date($dateplannedstart, 'day'); $substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATETIME__'] = dol_print_date($dateplannedstart, 'standard'); - $substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc'); + $substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'day'); $substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard'); } // add substition variable for ticket From d488ca2070a01e2dae2df3ad3a8b15b227dbd6ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Apr 2024 09:23:40 +0200 Subject: [PATCH 4/6] FIX #26015 --- htdocs/emailcollector/class/emailcollector.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 21aec87bc9f..25cc8a45fe7 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1683,6 +1683,7 @@ class EmailCollector extends CommonObject $operationslog .= " - ".dol_escape_htmltag((string) $imapemail); } $operationslog .= " - References: ".dol_escape_htmltag($headers['References']??'')." - Subject: ".dol_escape_htmltag($headers['Subject']); + dol_syslog("** Process email ".$iforemailloop." References: ".($headers['References']??'')." Subject: ".$headers['Subject']); @@ -1703,7 +1704,7 @@ class EmailCollector extends CommonObject if (empty($trackidfoundintorecipienttype)) { if (empty($headers['References']) || !preg_match('/@'.preg_quote($host, '/').'/', $headers['References'])) { $nbemailprocessed++; - dol_syslog(" Discarded - No suffix in email recipient and no Header References found matching signature of application so with a trackid"); + dol_syslog(" Discarded - No suffix in email recipient and no Header References found matching the signature of the application, so with a trackid coming from the application"); continue; // Exclude email } } @@ -2048,7 +2049,7 @@ class EmailCollector extends CommonObject }*/ } elseif (preg_match('/<(.*@.*)>/', $reference, $reg)) { // This is an external reference, we check if we have it in our database - if (!is_object($objectemail)) { + if (!is_object($objectemail) && isModEnabled('ticket')) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."ticket where email_msgid = '".$this->db->escape($reg[1])."'"; $resql = $this->db->query($sql); if ($resql) { @@ -2063,7 +2064,7 @@ class EmailCollector extends CommonObject } } - if (!is_object($objectemail)) { + if (!is_object($objectemail) && isModEnabled('project')) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."projet where email_msgid = '".$this->db->escape($reg[1])."'"; $resql = $this->db->query($sql); if ($resql) { @@ -2078,7 +2079,7 @@ class EmailCollector extends CommonObject } } - if (!is_object($objectemail)) { + if (!is_object($objectemail) && isModEnabled('recruitment')) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature where email_msgid = '".$this->db->escape($reg[1])."'"; $resql = $this->db->query($sql); if ($resql) { From a4535dec61ee01a529d951b8cc0eb9f08375608c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Apr 2024 13:29:40 +0200 Subject: [PATCH 5/6] Fix regression in permission test --- htdocs/holiday/month_report.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 35247d19e51..c1e33f6ece7 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -73,8 +73,10 @@ if ($user->socid > 0) { // Protection if external user //$socid = $user->socid; accessforbidden(); } -$result = restrictedArea($user, 'holiday', $id, '', 'readall'); - +$result = restrictedArea($user, 'holiday', $id, '', ''); +if (!$user->hasRight('holiday', 'readall')) { + accessforbidden(); +} /* * Actions From ff54b1cb5a4b0f7d66c19755c9150ba6058888b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Apr 2024 13:31:41 +0200 Subject: [PATCH 6/6] Fix regression in permission test for list of holiday --- htdocs/holiday/month_report.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 070220495d6..0968d4c9b9d 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -43,7 +43,7 @@ if ($user->socid > 0) { // Protection if external user //$socid = $user->socid; accessforbidden(); } -$result = restrictedArea($user, 'holiday', $id, '', 'readall'); +$result = restrictedArea($user, 'holiday', $id); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; $massaction = GETPOST('massaction', 'alpha'); @@ -76,6 +76,11 @@ $hookmanager->initHooks(array('leavemovementlist')); $arrayfields = array(); $arrayofmassactions = array(); +if (!$user->hasRight('holiday', 'readall')) { + accessforbidden(); +} + + /* * Actions */