From dccde49388c7385c1a9954e73e3c0a471e0278d7 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Wed, 13 Nov 2024 21:31:22 +0100 Subject: [PATCH 01/23] FIX calculate start date of cloned task from cloned project (#31799) * FIX calculate start date of cloned task from cloned project * Fix wrong strat comment --- htdocs/projet/class/task.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 94f04c401fe..d54e2080cf6 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1984,15 +1984,15 @@ class Task extends CommonObjectLine $projectstatic = new Project($this->db); $projectstatic->fetch($ori_project_id); - //Origin project strat date - $orign_project_dt_start = $projectstatic->date_start; + // Origin project start date + $orign_project_dt_start = (!isset($projectstatic->date_start) || $projectstatic->date_start == '') ? $projectstatic->date_c : $projectstatic->date_start; - //Calcultate new task start date with difference between origin proj start date and origin task start date + // Calculate new task start date with difference between origin proj start date and origin task start date if (!empty($clone_task->date_start)) { $clone_task->date_start = $now + $clone_task->date_start - $orign_project_dt_start; } - //Calcultate new task end date with difference between origin proj end date and origin task end date + // Calculate new task end date with difference between origin proj start date and origin task end date if (!empty($clone_task->date_end)) { $clone_task->date_end = $now + $clone_task->date_end - $orign_project_dt_start; } From 4feb9def4ee0f5100e2dce1c3d0a429e03ca81d5 Mon Sep 17 00:00:00 2001 From: MaximilienR-easya <122890855+MaximilienR-easya@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:52:42 +0100 Subject: [PATCH 02/23] Fix Preview present even when there is no corresponding file (#30585) * Fix cas de previews de fichier non existant * another way to detect missing or missnamed file than using file_exists function --- htdocs/comm/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index e49beb53e0d..8b4949cd770 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -868,9 +868,9 @@ if ($object->id > 0) { $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -980,9 +980,9 @@ if ($object->id > 0) { $filedir = $conf->commande->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1074,9 +1074,9 @@ if ($object->id > 0) { $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1180,9 +1180,9 @@ if ($object->id > 0) { $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1271,9 +1271,9 @@ if ($object->id > 0) { $filedir = $conf->ficheinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1471,9 +1471,9 @@ if ($object->id > 0) { $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { From ce9a1b36618beac106cdc4eaa9dfe83d61396096 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:10:35 +0100 Subject: [PATCH 03/23] FIX: swiftmailer: correctly set errors-to header (#31826) --- htdocs/core/class/CMailFile.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index db8b30ed249..319969bbd18 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -577,7 +577,7 @@ class CMailFile if (!empty($this->errors_to)) { try { - $headers->addTextHeader('Errors-To', $this->getArrayAddress($this->errors_to)); + $headers->addTextHeader('Errors-To', $this->getValidAddress($this->errors_to, 0)); } catch (Exception $e) { $this->errors[] = $e->getMessage(); } @@ -644,7 +644,6 @@ class CMailFile $this->errors[] = $e->getMessage(); } } - //if (!empty($this->errors_to)) $this->message->setErrorsTo($this->getArrayAddress($this->errors_to)); if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) { try { $this->message->setReadReceiptTo($this->getArrayAddress($this->addr_from)); From fd3482f3312af692cbee1c9d760d30b89f04a57b Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:13:05 +0200 Subject: [PATCH 04/23] fix #31798 End of month incorrect button value(clone salary) (#31827) --- htdocs/salaries/card.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index df548b3d709..e09c663b181 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -760,8 +760,18 @@ if ($id > 0) { $('#fill_end_of_month').click(function(){ var clone_date_startmonth = +$('#clone_date_startmonth').val(); var clone_date_startyear = +$('#clone_date_startyear').val(); - var end_date = new Date(clone_date_startyear, clone_date_startmonth, 0); - end_date.setMonth(clone_date_startmonth - 1); + var end_date; + if (clone_date_startmonth && clone_date_startyear) { + end_date = new Date(clone_date_startyear, clone_date_startmonth , 0); + } else { + var currentDate = new Date(); + var currentDay = currentDate.getDate(); + if (currentDay <= 15) { + end_date = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0); + } else { + end_date = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0); + } + } $('#clone_date_end').val(formatDate(end_date,'".$langs->trans("FormatDateShortJavaInput")."')); $('#clone_date_endday').val(end_date.getDate()); $('#clone_date_endmonth').val(end_date.getMonth() + 1); From f408803ae074ca3ff2afce68781b4e80bafbc5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= <85104766+Kazimir42@users.noreply.github.com> Date: Fri, 15 Nov 2024 16:02:11 +0100 Subject: [PATCH 05/23] list contact check by module (#31845) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rémi Champlon --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 09512e9df32..7186e44a767 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1572,7 +1572,7 @@ abstract class CommonObject $tab = array(); - $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle as type_label, tc.position, tc.element"; + $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle as type_label, tc.position, tc.element, tc.module"; $sql .= " FROM ".$this->db->prefix()."c_type_contact as tc"; $sqlWhere = array(); @@ -1609,7 +1609,7 @@ abstract class CommonObject $langs->loadLangs(array("propal", "orders", "bills", "suppliers", "contracts", "supplier_proposal")); while ($obj = $this->db->fetch_object($resql)) { - $modulename = $obj->element; + $modulename = $obj->module ?? $obj->element; if (strpos($obj->element, 'project') !== false) { $modulename = 'projet'; } elseif ($obj->element == 'contrat') { From ef67a4c31b36a26a505dccfdc62dc014f1a6e4e5 Mon Sep 17 00:00:00 2001 From: Eric - CAP-REL <1468823+rycks@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:26:05 +0100 Subject: [PATCH 06/23] fix #27534 (#31896) --- htdocs/product/stock/stocktransfer/stocktransfer_list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_list.php b/htdocs/product/stock/stocktransfer/stocktransfer_list.php index 163db565a2e..2d818515796 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_list.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_list.php @@ -44,6 +44,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'stocktransferlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $id = GETPOST('id', 'int'); From 230eee4ead39a888c9e684bce9295a0da639eb74 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 15 Nov 2024 23:31:12 +0100 Subject: [PATCH 07/23] FIX issue #28222 Edit date extrafield diplayed on all on lines (#31914) * FIX issue #28222 Edit date extrafield diplayed on all on lines * wrong id --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8c5a84c9120..905d8cbc2c5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8329,7 +8329,7 @@ abstract class CommonObject } } $datekey = $keyprefix.'options_'.$key.$keysuffix; - $value = (GETPOSTISSET($datekey)) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring; + $value = (GETPOSTISSET($datekey) && $this->id == GETPOST('elrowid', 'int')) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring; } if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) { $datenotinstring = null; From bab49d66c5e7a9a542cc532decc6d8e1a856379d Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 15 Nov 2024 23:36:54 +0100 Subject: [PATCH 08/23] Backported default ticket type fix (#31912) --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 47f9c6d0778..9ccf2517a52 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -753,7 +753,7 @@ class FormTicket print ' selected="selected"'; } elseif (in_array($id, $selected)) { print ' selected="selected"'; - } elseif ($arraytypes['use_default'] == "1" && !$selected && !$empty) { + } elseif ($arraytypes['use_default'] == "1" && empty($selected)) { print ' selected="selected"'; } From 038f8d5dff24376b25dbeaf1b6e127779eab965c Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 15 Nov 2024 23:44:08 +0100 Subject: [PATCH 09/23] Backported default ticket severity fix (#31908) --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 9ccf2517a52..f30da8bc8b0 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1199,7 +1199,7 @@ class FormTicket print ' selected="selected"'; } elseif (isset($selected) && $selected == $id) { print ' selected="selected"'; - } elseif ($arrayseverities['use_default'] == "1" && !$selected && !$empty) { + } elseif ($arrayseverities['use_default'] == "1" && empty($selected)) { print ' selected="selected"'; } From d0323fa27d9c704503f6d97b5679de2d5dbf64a4 Mon Sep 17 00:00:00 2001 From: kkhelifa-opendsi Date: Fri, 15 Nov 2024 23:53:04 +0100 Subject: [PATCH 10/23] FIX : Update on a sold line of bank entrie set the type to empty, now it's fixed #22539 (#31888) --- htdocs/compta/bank/line.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index d8517391e17..74fecf8ecbb 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -163,7 +163,8 @@ if ($user->rights->banque->modifier && $action == "update") { $sql .= " SET "; // Always opened if (GETPOSTISSET('value')) { - $sql .= " fk_type='".$db->escape(GETPOST('value'))."',"; + $type = GETPOST('value'); + $sql .= " fk_type='".$db->escape(empty($type) && $object->fk_type == 'SOLD' ? 'SOLD' : $type)."',"; } if (GETPOSTISSET('num_chq')) { $sql .= " num_chq='".$db->escape(GETPOST("num_chq"))."',"; From 5d9d282f1be0767e9adac33bbee5cac07e6268d1 Mon Sep 17 00:00:00 2001 From: alex10843 Date: Fri, 15 Nov 2024 23:56:14 +0100 Subject: [PATCH 11/23] FIX: Takepos: set the country of the default customer (#31915) * FIX: Takepos: set the country of the default customer * Update modTakePos.class.php --------- Co-authored-by: Alex - Solauv Co-authored-by: Laurent Destailleur --- htdocs/core/modules/modTakePos.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 06b5b79dbf3..447e43f5399 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -283,6 +283,7 @@ class modTakePos extends DolibarrModules $societe->client = 1; $societe->code_client = -1; $societe->code_fournisseur = -1; + $societe->country_id = $mysoc->country_id ? $mysoc->country_id : 1; // By default we consider the default customer is in the same country than the company $societe->note_private = "Default customer automaticaly created by Point Of Sale module activation. Can be used as the default generic customer in the Point Of Sale setup. Can also be edited or removed if you don't need a generic customer."; $searchcompanyid = $societe->create($user); From adf59f259911ef0a1727308421be276e05032137 Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 00:00:05 +0100 Subject: [PATCH 12/23] Fix mod_facture_fournisseur_tulip::getExample & get_next_value if no object in parameter (#31878) --- .../modules/supplier_invoice/mod_facture_fournisseur_tulip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index e6838b9c4c4..5454c810e8d 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -176,7 +176,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices } // Supplier invoices take invoice date instead of creation date for the mask - $numFinal = get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, $object->date); + $numFinal = get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, is_object($object) ?$object->date :''); return $numFinal; } From 348981a4190d12c54df4974ac59ce1a6899ea2da Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 00:06:15 +0100 Subject: [PATCH 13/23] Fix show payment URL in massaction context when not one email per recipient (#31927) --- htdocs/core/actions_massactions.inc.php | 7 ++++++- htdocs/core/class/html.formmail.class.php | 11 ++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ca8232c584b..5ff3a0973fd 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -464,7 +464,12 @@ if (!$error && $massaction == 'confirm_presend') { $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref); $substitutionarray['__EMAIL__'] = $thirdparty->email; $substitutionarray['__CHECK_READ__'] = ''; - + + if ($oneemailperrecipient) { + $substitutionarray['__ONLINE_PAYMENT_URL__'] = ''; + $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ''; + } + $parameters = array('mode'=>'formemail'); if (!empty($listofobjectthirdparties)) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 21d7f071043..cc45aaa2e91 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -863,12 +863,12 @@ class FormMail extends Form // Complete substitution array with the url to make online payment $paymenturl = ''; - $validpaymentmethod = array(); + // Set the online payment url link into __ONLINE_PAYMENT_URL__ key + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + $validpaymentmethod = getValidOnlinePaymentMethods(''); if (empty($this->substit['__REF__'])) { $paymenturl = ''; } else { - // Set the online payment url link into __ONLINE_PAYMENT_URL__ key - require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->loadLangs(array('paypal', 'other')); $typeforonlinepayment = 'free'; if ($this->param["models"] == 'order' || $this->param["models"] == 'order_send') { @@ -882,14 +882,15 @@ class FormMail extends Form } $url = getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']); $paymenturl = $url; - - $validpaymentmethod = getValidOnlinePaymentMethods(''); } if (count($validpaymentmethod) > 0 && $paymenturl) { $langs->load('other'); $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl)); $this->substit['__ONLINE_PAYMENT_URL__'] = $paymenturl; + } elseif (count($validpaymentmethod) > 0) { + $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = '__ONLINE_PAYMENT_TEXT_AND_URL__'; + $this->substit['__ONLINE_PAYMENT_URL__'] = '__ONLINE_PAYMENT_URL__'; } else { $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ''; $this->substit['__ONLINE_PAYMENT_URL__'] = ''; From cd6ed63768a2a0f4c7f66366db62b98f423fdd2c Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 10:45:01 +0100 Subject: [PATCH 14/23] Fix Specimen warning in supplier admin when database has no products (#31867) --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b7c01fa4306..b50bce3bd6c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2938,7 +2938,7 @@ class CommandeFournisseur extends CommonOrder $sql .= $this->db->order("rowid", "ASC"); $sql .= $this->db->plimit(1); $resql = $this->db->query($sql); - if ($resql) { + if ($resql && $this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); $prodid = $obj->rowid; } From 976399c2d9840386be879ac2e16e4e4259efbf73 Mon Sep 17 00:00:00 2001 From: "Thomas C." <56068416+Thomas905@users.noreply.github.com> Date: Sat, 16 Nov 2024 10:57:03 +0100 Subject: [PATCH 15/23] fix (#31683) --- htdocs/core/lib/company.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 82e42792144..2146f00ba66 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2193,7 +2193,7 @@ function show_subsidiaries($conf, $langs, $db, $object) $i = -1; - $sql = "SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas"; + $sql = "SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas, s.status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.parent = ".((int) $object->id); $sql .= " AND s.entity IN (".getEntity('societe').")"; @@ -2233,6 +2233,7 @@ function show_subsidiaries($conf, $langs, $db, $object) $socstatic->canvas = $obj->canvas; $socstatic->client = $obj->client; $socstatic->fournisseur = $obj->fournisseur; + $socstatic->status = $obj->status; print ''; From fac36d2376d42e01f4e0e63a4f684f1b59c1daa3 Mon Sep 17 00:00:00 2001 From: Sami Filali <139965072+samifilali@users.noreply.github.com> Date: Sat, 16 Nov 2024 14:51:24 +0100 Subject: [PATCH 16/23] add hook (#31938) --- htdocs/admin/mails_templates.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index b19093eeeb0..90ce91457db 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1103,6 +1103,10 @@ if ($num) { if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) { $fieldsforcontent[] = 'content_lines'; } + + $parameters = array('fieldsforcontent' => &$fieldsforcontent, 'tabname' => $tabname[$id]); + $hookmanager->executeHooks('editEmailTemplateFieldsForContent', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + foreach ($fieldsforcontent as $tmpfieldlist) { $showfield = 1; $css = "left"; From a960be440bf7d88de3246cb0577f7841d354143d Mon Sep 17 00:00:00 2001 From: noec764 <58433943+noec764@users.noreply.github.com> Date: Sun, 17 Nov 2024 00:06:33 +0100 Subject: [PATCH 17/23] FIX: All contacts were loaded even if no thirdparty was selected (#31877) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FIX: All contact were loaded even if no thirdparty selected * Update card.php --------- Co-authored-by: Noé Co-authored-by: Laurent Destailleur --- htdocs/comm/action/card.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 2b004f0ff10..3076f3d4854 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -2067,7 +2067,27 @@ if ($id > 0) { // related contact print ''.$langs->trans("ActionOnContact").''; print '
'; - print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(!getDolGlobalString('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT') ? $object->socid : 0, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'minwidth300 widthcentpercentminusx', false, 0, 0, array(), 'multiple', 'contactid'); + + $searchSocid = ($object->socid > 0) ? $object->socid : (getDolGlobalString('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT') ? 0 : -1); + + print img_picto('', 'contact', 'class="paddingrightonly"'); + print $form->selectcontacts( + $searchSocid, + array_keys($object->socpeopleassigned), + 'socpeopleassigned[]', + 1, + '', + '', + 1, + 'minwidth300 widthcentpercentminusx', + false, + 0, + 0, + array(), + 'multiple', + 'contactid' + ); + print '
'; print ''; print ''; From 7ca9f0022aeee2939955f48452ac212f86a903a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2024 10:31:11 +0100 Subject: [PATCH 18/23] Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 18.0 --- htdocs/commande/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7128688a7cc..7002ba580eb 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -871,17 +871,17 @@ if (empty($reshook)) { // Set unit price to use if (!empty($price_ht) || $price_ht === '0') { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = (float) price2num($price_ht, 'MU'); + $pu_ttc = (float) price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } elseif (!empty($price_ttc) || $price_ttc === '0') { - $pu_ttc = price2num($price_ttc, 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ttc = (float) price2num($price_ttc, 'MU'); + $pu_ht = (float) price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } elseif ($tmpvat != $tmpprodvat) { // Is this still used ? if ($price_base_type != 'HT') { - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = (float) price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } else { - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $pu_ttc = (float) price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } From 98d106e6b595da00ecf44b769e98727dc3e8be02 Mon Sep 17 00:00:00 2001 From: uvaldenaire-opendsi Date: Mon, 18 Nov 2024 14:55:20 +0100 Subject: [PATCH 19/23] Fix delete project when mrp module never enabled (#31982) Co-authored-by: Laurent Destailleur --- htdocs/projet/class/project.class.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 94b213cf17d..a21203bfaff 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -897,14 +897,19 @@ class Project extends CommonObject // Set fk_projet into elements to null $listoftables = array( - 'propal'=>'fk_projet', 'commande'=>'fk_projet', 'facture'=>'fk_projet', - 'supplier_proposal'=>'fk_projet', 'commande_fournisseur'=>'fk_projet', 'facture_fourn'=>'fk_projet', - 'expensereport_det'=>'fk_projet', 'contrat'=>'fk_projet', - 'fichinter'=>'fk_projet', - 'don'=>array('field'=>'fk_projet', 'module'=>'don'), - 'actioncomm'=>'fk_project', - 'mrp_mo'=>'fk_project', - 'entrepot'=>'fk_project' + 'propal' => 'fk_projet', + 'commande' => 'fk_projet', + 'facture' => 'fk_projet', + 'supplier_proposal' => 'fk_projet', + 'commande_fournisseur' => 'fk_projet', + 'facture_fourn' => 'fk_projet', + 'expensereport_det' => 'fk_projet', + 'contrat' => 'fk_projet', + 'fichinter' => 'fk_projet', + 'don' => array('field' => 'fk_projet', 'module' => 'don'), + 'actioncomm' => 'fk_project', + 'mrp_mo' => array('field' => 'fk_project', 'module' => 'mrp'), + 'entrepot' => 'fk_project', ); foreach ($listoftables as $key => $value) { if (is_array($value)) { From 580d789a00a7c7fad6e3552bf92f709dafc446dd Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Mon, 18 Nov 2024 14:56:09 +0100 Subject: [PATCH 20/23] FIX send mail to BCC when email formated as Fullname (#31983) --- htdocs/core/actions_sendmails.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 21427edba07..edf7f275f23 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -310,7 +310,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO // $message = preg_replace('/()/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message); - $sendtobcc = GETPOST('sendtoccc'); + $sendtobcc = GETPOST('sendtoccc', 'alphawithlgt'); // Autocomplete the $sendtobcc // $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO... if (!empty($autocopy)) { From 02eb16a703558181a8935acb12ab333ee2cb9523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:49:52 +0100 Subject: [PATCH 21/23] FIX#31159 - TVA Account by country is not used (#31984) * FIX#31159 * FIX#31159 --- htdocs/accountancy/journal/sellsjournal.php | 8 ++++++++ htdocs/core/lib/functions.lib.php | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 7763f0eb5b0..727c5e13e95 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -225,6 +225,14 @@ if ($result) { $vatdata = $vatdata_cache[$tax_id]; } else { $vatdata = getTaxesFromId($tax_id, $mysoc, $mysoc, 0); + if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { + $buyer = new Societe($db); + $buyer->fetch($obj->socid); + } else { + $buyer = null; // We don't need the buyer in this case + } + $seller = $mysoc; + $vatdata = getTaxesFromId($tax_id, $buyer, $seller, 0); $vatdata_cache[$tax_id] = $vatdata; } $compta_tva = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index da19e806fe1..6896113399d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6615,7 +6615,12 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid $sql .= ", ".MAIN_DB_PREFIX."c_country as c"; /*if ($mysoc->country_code == 'ES') $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($buyer->country_code)."'"; // vat in spain use the buyer country ?? else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($seller->country_code)."'";*/ - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($seller->country_code)."'"; + $sql .= " WHERE t.fk_pays = c.rowid"; + if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { + $sql .= " AND c.code = '".$db->escape($buyer->country_code)."'"; + } else { + $sql .= " AND c.code = '".$db->escape($seller->country_code)."'"; + } $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; $sql .= " AND t.entity IN (".getEntity('c_tva').")"; if ($vatratecode) { From f10d9464a10b4f0bc304c740426b32cce0cdf2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20PASCAL?= Date: Mon, 18 Nov 2024 17:58:25 +0100 Subject: [PATCH 22/23] fix: get file link in invoice list with multicompany (#31966) --- htdocs/compta/facture/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d3469f3f74d..5cda4841905 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2005,6 +2005,8 @@ if ($resql) { $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $filepath = $conf->invoice->multidir_output[$obj->entity] ?? $conf->invoice->dir_output; + $filedir = $filepath . '/' . $filename; $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->id; print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print ''; From f2f3e478d1fdea6f1073b772e720e80a61a6f54a Mon Sep 17 00:00:00 2001 From: Florian Charlaix Date: Mon, 18 Nov 2024 17:58:56 +0100 Subject: [PATCH 23/23] New Add a workflow to let @lvessiller-opendsi and @rycks merge 18.0 PR by accepting reviews (#31898) * Add a workflow to let @lvessiller-opendsi and @crycks merge 18.0 PR by accepting reviews * Try to fix permissions --- .github/workflows/pr-18.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/pr-18.yaml diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml new file mode 100644 index 00000000000..376bf29454f --- /dev/null +++ b/.github/workflows/pr-18.yaml @@ -0,0 +1,20 @@ +on: + pull_request: + types: + - opened + branches: + - "18.0" + +jobs: + run: + runs-on: ubuntu-22.04 + permissions: + pull-requests: write + steps: + - name: Create PR review request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + url: ${{ github.event.pull_request.html_url }} + run: | + gh pr edit "$url" --add-assignee lvessiller-opendsi,rycks --add-reviewer lvessiller-opendsi,rycks + gh pr merge "$url" --merge --auto