From 2a93168d48a01079bc46e3beb3d752ceadc84b32 Mon Sep 17 00:00:00 2001 From: Eric <1468823+rycks@users.noreply.github.com> Date: Sun, 14 Apr 2024 00:52:01 +0200 Subject: [PATCH 01/10] object tasks: priority is fetch but not updated and others... (#29340) * priority is fetch but not updated and others... * insert too --- htdocs/projet/class/task.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 2663053b549..b72462c40e8 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -172,6 +172,7 @@ class Task extends CommonObject $sql .= ", datee"; $sql .= ", planned_workload"; $sql .= ", progress"; + $sql .= ", priority"; $sql .= ") VALUES ("; $sql .= ((int) $conf->entity); $sql .= ", ".((int) $this->fk_project); @@ -185,6 +186,7 @@ class Task extends CommonObject $sql .= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : 'null'); $sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? $this->planned_workload : 'null'); $sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null'); + $sql .= ", ".(($this->priority != '' && $this->priority >= 0) ? $this->priority : 'null'); $sql .= ")"; $this->db->begin(); @@ -383,6 +385,7 @@ class Task extends CommonObject $sql .= " datee=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null').","; $sql .= " progress=".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null').","; $sql .= " rang=".((!empty($this->rang)) ? $this->rang : "0"); + $sql .= " priority=".((!empty($this->priority)) ? $this->priority : "0"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -751,6 +754,7 @@ class Task extends CommonObject $this->duration_effective = ''; $this->fk_user_creat = null; $this->progress = '25'; + $this->priority = 0; $this->fk_statut = null; $this->note = 'This is a specimen task not'; } @@ -790,7 +794,7 @@ class Task extends CommonObject } $sql .= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.usage_bill_time,"; $sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; - $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; + $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang, t.priority"; $sql .= " t.description, "; $sql .= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; @@ -896,7 +900,7 @@ class Task extends CommonObject $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.usage_bill_time,"; $sql .= " t.datec, t.dateo, t.datee, t.tms,"; $sql .= " t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; - $sql .= " t.dateo, t.datee, t.planned_workload, t.rang,"; + $sql .= " t.dateo, t.datee, t.planned_workload, t.rang, t.priority"; $sql .= " t.description, "; $sql .= " s.rowid, s.nom, s.email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; @@ -971,6 +975,7 @@ class Task extends CommonObject $tasks[$i]->date_start = $this->db->jdate($obj->date_start); $tasks[$i]->date_end = $this->db->jdate($obj->date_end); $tasks[$i]->rang = $obj->rang; + $tasks[$i]->priority = $obj->priority; $tasks[$i]->socid = $obj->thirdparty_id; // For backward compatibility $tasks[$i]->thirdparty_id = $obj->thirdparty_id; @@ -1712,6 +1717,7 @@ class Task extends CommonObject $clone_task->date_c = $datec; $clone_task->planned_workload = $origin_task->planned_workload; $clone_task->rang = $origin_task->rang; + $clone_task->priority = $origin_task->priority; //Manage Task Date if ($clone_change_dt) { From 459ff727329f343a0d934f2cb04593c59473da8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Apr 2024 02:56:17 +0200 Subject: [PATCH 02/10] FIX Regression #29340 --- htdocs/projet/class/task.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index b72462c40e8..78d949c487c 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -900,7 +900,7 @@ class Task extends CommonObject $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.usage_bill_time,"; $sql .= " t.datec, t.dateo, t.datee, t.tms,"; $sql .= " t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; - $sql .= " t.dateo, t.datee, t.planned_workload, t.rang, t.priority"; + $sql .= " t.dateo, t.datee, t.planned_workload, t.rang, t.priority,"; $sql .= " t.description, "; $sql .= " s.rowid, s.nom, s.email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; From 2768d80b9b95992b9e42dc7d3f7160c2eefd48c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Apr 2024 03:15:49 +0200 Subject: [PATCH 03/10] FIX Regression #29340 --- htdocs/projet/class/task.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 78d949c487c..ad44dd8f2fc 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -794,7 +794,7 @@ class Task extends CommonObject } $sql .= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.usage_bill_time,"; $sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; - $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang, t.priority"; + $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang, t.priority,"; $sql .= " t.description, "; $sql .= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; From c24fda189fc3628089e95152d85cd69fed14ebbb Mon Sep 17 00:00:00 2001 From: HiroKX Date: Thu, 18 Apr 2024 12:19:16 +0200 Subject: [PATCH 04/10] fix : #29372 month_report is accessible even without the readall permission (#29385) Co-authored-by: robin --- htdocs/holiday/month_report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 9b611c18852..070220495d6 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, ''); +$result = restrictedArea($user, 'holiday', $id, '', 'readall'); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; $massaction = GETPOST('massaction', 'alpha'); From be14db7b73bd7a13d11eb28c50405f0f2ee3cc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= <81741011+altairis-noe@users.noreply.github.com> Date: Thu, 18 Apr 2024 12:41:21 +0200 Subject: [PATCH 05/10] FIX: background color for enabled modules (#29378) --- htdocs/theme/md/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d1012802c15..a1ca45245ac 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -354,7 +354,7 @@ print '*/'."\n"; --amountremaintopaybackcolor:none; --productlinestockod: #002200; --productlinestocktoolow: #884400; - --infoboxmoduleenabledbgcolor : linear-gradient(0.4turn, #2b2d2f, #2b2d2f, #2b2d2f, #e4efe8); + --infoboxmoduleenabledbgcolor : linear-gradient(0.4turn, #fff, #fff, #fff, #e4efe8); --tablevalidbgcolor: rgb(252, 248, 227); --butactionbg : #; --textbutaction : #; From 483c1375358cac2da6fa14b64bda0408907c4c91 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Thu, 18 Apr 2024 14:11:12 +0200 Subject: [PATCH 06/10] FIX not redirtect when error occurs on updating card (#29388) --- htdocs/contact/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 2c9591d590d..29359e584fc 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -477,6 +477,7 @@ if (empty($reshook)) { $action = 'view'; } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } From 370785d515176f8203e1176cc45e9b3e47cbf5e5 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Sat, 20 Apr 2024 23:18:10 +0200 Subject: [PATCH 07/10] FIX accounting FEC import (Issue #28306) (#29414) --- htdocs/accountancy/class/accountancyimport.class.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index 5f4d76bc4c5..ef22ceafa52 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -93,10 +93,9 @@ class AccountancyImport public function computeAmount(&$arrayrecord, $listfields, $record_key) { // get fields indexes - $field_index_list = array_flip($listfields); - if (isset($field_index_list['debit']) && isset($field_index_list['credit'])) { - $debit_index = $field_index_list['debit']; - $credit_index = $field_index_list['credit']; + if (isset($listfields['b.debit']) && isset($listfields['b.credit'])) { + $debit_index = $listfields['b.debit']; + $credit_index = $listfields['b.credit']; $debit = floatval($arrayrecord[$debit_index]['val']); $credit = floatval($arrayrecord[$credit_index]['val']); @@ -123,9 +122,8 @@ class AccountancyImport */ public function computeDirection(&$arrayrecord, $listfields, $record_key) { - $field_index_list = array_flip($listfields); - if (isset($field_index_list['debit'])) { - $debit_index = $field_index_list['debit']; + if (isset($listfields['b.debit'])) { + $debit_index = $listfields['b.debit']; $debit = floatval($arrayrecord[$debit_index]['val']); if (!empty($debit)) { From 89493540531228308cfd0e0feef2a1edfc5a3a32 Mon Sep 17 00:00:00 2001 From: spooky360 Date: Sat, 20 Apr 2024 23:19:36 +0200 Subject: [PATCH 08/10] FIX: an error occured when doing a mass vat change de 0% on supplier invoice (#29417) On a supplier invoice, when you want to set all lines VAT to 0, the check performed in card.php fails and an error occurs. The 0 value was interpreted as false so we never enter in the "if" condition. We now check that the value is not an empty string --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 022fddd125e..a8a9c5eab28 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1520,7 +1520,7 @@ if (empty($reshook)) { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha') && $usercancreate) { + } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha') != '' && $usercancreate) { // Define vat_rate $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); $vat_rate = str_replace('*', '', $vat_rate); From 5f981897296082abb3b389eb66202265cb571869 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sun, 21 Apr 2024 00:33:57 +0300 Subject: [PATCH 09/10] fix #29381 backport #28039 in v. 19 (#29400) --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 849a7c9fefa..7701d9a8b18 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2129,7 +2129,7 @@ if ($action == 'create') { if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 1, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); From 54caae51e0f0cd93583edde72a481e7d7159608d Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Sat, 20 Apr 2024 23:44:26 +0200 Subject: [PATCH 10/10] FIX 16.0 - the e-mail templates configured in the notification module are not used if the recipient is a fixed e-mail address (#29407) --- htdocs/core/class/notify.class.php | 34 +++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 5e12a30ba0e..1f8c9cf3225 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -847,12 +847,36 @@ class Notify $mimefilename_list[] = $ref.".pdf"; } - $message = ''; - $message .= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n"; - $message .= "\n"; - $message .= $mesg; + // if an e-mail template is configured for this notification code (for instance + // 'SHIPPING_VALIDATE_TEMPLATE'), we fetch this template by its label. Otherwise, a default message + // content will be sent. + $mailTemplateLabel = isset($conf->global->{$notifcode.'_TEMPLATE'}) ? $conf->global->{$notifcode.'_TEMPLATE'} : ''; + $emailTemplate = null; + if (!empty($mailTemplateLabel)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($this->db); + $emailTemplate = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse); + } + if (!empty($mailTemplateLabel) && is_object($emailTemplate) && $emailTemplate->id > 0) { + // Set output language + $outputlangs = $langs; + if ($obj->default_lang && $obj->default_lang != $langs->defaultlang) { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($obj->default_lang); + $outputlangs->loadLangs(array('main', 'other')); + } + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + $subject = make_substitutions($emailTemplate->topic, $substitutionarray, $outputlangs); + $message = make_substitutions($emailTemplate->content, $substitutionarray, $outputlangs); + } else { + $message = ''; + $message .= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n"; + $message .= "\n"; + $message .= $mesg; - $message = nl2br($message); + $message = nl2br($message); + } // Replace keyword __SUPERVISOREMAIL__ if (preg_match('/__SUPERVISOREMAIL__/', $sendto)) {