From 9505325b6d3ccb0179a9a909f08c2923e1f4d327 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Sep 2024 16:36:03 +0200 Subject: [PATCH 1/8] Debug v20 - Fix sql --- htdocs/website/class/websitepage.class.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 93725632f87..0bdc8cc65fe 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -569,10 +569,6 @@ class WebsitePage extends CommonObject return -1; } - if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; - } - $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); From d40e0c602618485fe17d7df588544bd54cbd0d46 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 12 Sep 2024 21:09:28 +0200 Subject: [PATCH 2/8] Fix api_setup.class.php (#30938) new fix because old disappared --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index a1dfc3f5d03..444bd0dd0a4 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1142,7 +1142,7 @@ class Setup extends DolibarrApi $sql = "SELECT t.rowid as id, t.name, t.entity, t.elementtype, t.label, t.type, t.size, t.fieldcomputed, t.fielddefault,"; $sql .= " t.fieldunique, t.fieldrequired, t.perms, t.enabled, t.pos, t.alwayseditable, t.param, t.list, t.printable,"; - $sql .= " t.totalizable, t.langs, t.help, t.css, t.cssview, t.fk_user_author, t.fk_user_modif, t.datec, t.tms"; + $sql .= " t.totalizable, t.langs, t.help, t.css, t.cssview, t.csslist, t.fk_user_author, t.fk_user_modif, t.datec, t.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."extrafields as t"; $sql .= " WHERE t.entity IN (".getEntity('extrafields').")"; if (!empty($elementtype)) { From aaa65ddf6baffcd21327851cfe2a0d074d858743 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 12 Sep 2024 21:10:01 +0200 Subject: [PATCH 3/8] Fix v20 php8 patch001 (#30932) * Fix PHP 8 notices, warninngs, fatal * precommit --- htdocs/core/lib/company.lib.php | 2 +- .../modules/expedition/mod_expedition_ribera.php | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 77d24c891b5..411fe6d0663 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2233,7 +2233,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr foreach ($histo as $key => $value) { $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo - $actionstatic->type_picto = $histo[$key]['apicto']; + $actionstatic->type_picto = $histo[$key]['apicto'] ?? ''; $actionstatic->type_code = $histo[$key]['acode']; $out .= ''; diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index 7874672bb82..dc5bcb320cc 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -98,13 +98,21 @@ class mod_expedition_ribera extends ModelNumRefExpedition */ public function getExample() { - global $langs, $mysoc; + global $langs, $mysoc, $db; $old_code_client = $mysoc->code_client; $old_code_type = $mysoc->typent_code; $mysoc->code_client = 'CCCCCCCCCC'; $mysoc->typent_code = 'TTTTTTTTTT'; - $numExample = $this->getNextValue($mysoc, ''); + + + if (!class_exists('Expedition')) { + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; + } + + $expedition = new Expedition($db); + + $numExample = $this->getNextValue($mysoc, $expedition); $mysoc->code_client = $old_code_client; $mysoc->typent_code = $old_code_type; @@ -134,7 +142,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition return 0; } - $date = $shipment->date_expedition; + $date = $shipment->date_shipping; $numFinal = get_next_value($db, $mask, 'expedition', 'ref', '', $objsoc, $date); From 33801159080a6da2c3c91e24717a20dacc38c6c4 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 12 Sep 2024 21:11:45 +0200 Subject: [PATCH 4/8] Fix v20 php8 patch002 (#30931) * Fix PHP 8 notices, warninngs, fatal * precommit * fix php 8 errors * use this db --------- Co-authored-by: Laurent Destailleur --- htdocs/fourn/commande/dispatch.php | 4 +- .../class/supplier_proposal.class.php | 87 ++++++++++--------- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 302dfca853d..4d8fc56e4dd 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1168,14 +1168,14 @@ if ($id > 0 || !empty($ref)) { $sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec"; $sql .= " ,cd.rowid, cd.subprice"; - if ($conf->reception->enabled) { + if (isModEnabled('reception')) { $sql .= " ,cfd.fk_reception, r.date_delivery"; } $sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; $sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cd ON cd.rowid = cfd.fk_elementdet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; - if ($conf->reception->enabled) { + if (isModEnabled('reception')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."reception as r ON cfd.fk_reception = r.rowid"; } $sql .= " WHERE cfd.fk_element = ".((int) $object->id); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index be52049971a..959533d131d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -3003,57 +3003,58 @@ class SupplierProposalLine extends CommonObjectLine $result = $this->db->query($sql); if ($result) { - $objp = $this->db->fetch_object($result); + if ($objp = $this->db->fetch_object($result)) { + $this->id = $objp->rowid; + $this->fk_supplier_proposal = $objp->fk_supplier_proposal; + $this->fk_parent_line = $objp->fk_parent_line; + $this->label = $objp->custom_label; + $this->desc = $objp->description; + $this->qty = $objp->qty; + $this->subprice = $objp->subprice; + $this->tva_tx = $objp->tva_tx; + $this->remise_percent = $objp->remise_percent; + $this->fk_remise_except = $objp->fk_remise_except; + $this->fk_product = $objp->fk_product; + $this->info_bits = $objp->info_bits; + $this->date_start = $this->db->jdate($objp->date_start); + $this->date_end = $this->db->jdate($objp->date_end); - $this->id = $objp->rowid; - $this->fk_supplier_proposal = $objp->fk_supplier_proposal; - $this->fk_parent_line = $objp->fk_parent_line; - $this->label = $objp->custom_label; - $this->desc = $objp->description; - $this->qty = $objp->qty; - $this->subprice = $objp->subprice; - $this->tva_tx = $objp->tva_tx; - $this->remise_percent = $objp->remise_percent; - $this->fk_remise_except = $objp->fk_remise_except; - $this->fk_product = $objp->fk_product; - $this->info_bits = $objp->info_bits; - $this->date_start = $this->db->jdate($objp->date_start); - $this->date_end = $this->db->jdate($objp->date_end); + $this->total_ht = $objp->total_ht; + $this->total_tva = $objp->total_tva; + $this->total_ttc = $objp->total_ttc; - $this->total_ht = $objp->total_ht; - $this->total_tva = $objp->total_tva; - $this->total_ttc = $objp->total_ttc; + $this->fk_fournprice = $objp->fk_fournprice; - $this->fk_fournprice = $objp->fk_fournprice; + $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht); + $this->pa_ht = $marginInfos[0]; + $this->marge_tx = $marginInfos[1]; + $this->marque_tx = $marginInfos[2]; - $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht); - $this->pa_ht = $marginInfos[0]; - $this->marge_tx = $marginInfos[1]; - $this->marque_tx = $marginInfos[2]; + $this->special_code = $objp->special_code; + $this->product_type = $objp->product_type; + $this->rang = $objp->rang; - $this->special_code = $objp->special_code; - $this->product_type = $objp->product_type; - $this->rang = $objp->rang; + $this->ref = $objp->product_ref; // deprecated + $this->product_ref = $objp->product_ref; + $this->libelle = $objp->product_label; // deprecated + $this->product_label = $objp->product_label; + $this->product_desc = $objp->product_desc; - $this->ref = $objp->product_ref; // deprecated - $this->product_ref = $objp->product_ref; - $this->libelle = $objp->product_label; // deprecated - $this->product_label = $objp->product_label; - $this->product_desc = $objp->product_desc; + $this->ref_fourn = $objp->ref_produit_fourn; - $this->ref_fourn = $objp->ref_produit_fourn; + // Multicurrency + $this->fk_multicurrency = $objp->fk_multicurrency; + $this->multicurrency_code = $objp->multicurrency_code; + $this->multicurrency_subprice = $objp->multicurrency_subprice; + $this->multicurrency_total_ht = $objp->multicurrency_total_ht; + $this->multicurrency_total_tva = $objp->multicurrency_total_tva; + $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $this->fk_unit = $objp->fk_unit; - // Multicurrency - $this->fk_multicurrency = $objp->fk_multicurrency; - $this->multicurrency_code = $objp->multicurrency_code; - $this->multicurrency_subprice = $objp->multicurrency_subprice; - $this->multicurrency_total_ht = $objp->multicurrency_total_ht; - $this->multicurrency_total_tva = $objp->multicurrency_total_tva; - $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - $this->fk_unit = $objp->fk_unit; - - $this->db->free($result); - return 1; + $this->db->free($result); + return 1; + } + return 0; } else { dol_print_error($this->db); return -1; From 7169c9258bc11b22b7524f10e1360be42cc5bb8e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 12 Sep 2024 21:13:03 +0200 Subject: [PATCH 5/8] Fix for SHIPMENT_SUPPORTS_SERVICES option (#30934) add correct quantity of service and not. 0 only for a service with the hidden option SHIPMENT_SUPPORTS_SERVICES activated --- htdocs/expedition/card.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e41e2caff7d..d16c964d4cb 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1745,7 +1745,7 @@ if ($action == 'create') { print ''; print ''; - if ($line->product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES') || getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) { + if ($line->product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { $disabled = ''; if (isModEnabled('productbatch') && $product->hasbatch()) { $disabled = 'disabled="disabled"'; @@ -1757,6 +1757,18 @@ if ($action == 'create') { if (empty($disabled) && getDolGlobalString('STOCK_ALLOW_NEGATIVE_TRANSFER')) { print ''; } + } elseif ($line->product_type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) { + $disabled = ''; + if (isModEnabled('productbatch') && $product->hasbatch()) { + $disabled = 'disabled="disabled"'; + } + if ($warehouse_selected_id <= 0) { // We did not force a given warehouse, so we won't have no warehouse to change qty. + $disabled = 'disabled="disabled"'; + } + print ' '; + if (empty($disabled) && getDolGlobalString('STOCK_ALLOW_NEGATIVE_TRANSFER')) { + print ''; + } } else { print $langs->trans("NA"); } From b0b6dcc6cf87b98d74adcb441a2fd80343db40e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 12 Sep 2024 21:22:24 +0200 Subject: [PATCH 6/8] =?UTF-8?q?FIX=20=F0=9F=9B=9F=20phan=20(#30921)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e725e95a8ba..66df4aa33c3 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3589,7 +3589,7 @@ if ($module == 'initmodule') { if ($moduledescritpionautotrans != "Module".$moduleobj->name."Desc") { // $moduledescritpionautotrans has been found into a translation file print ' '.$form->textwithpicto('', $langs->trans("ModuleTranslatedIntoLangForKeyInto", "Module".$moduleobj->name."Desc", $moduledescritpionautotrans)); - } elseif ($moduledescritpionautotrans != "Module".$moduleobj->numeroc."Desc") { + } elseif ($moduledescritpionautotrans != "Module".$moduleobj->numero."Desc") { // $moduledescritpionautotrans has been found into a translation file print ' '.$form->textwithpicto('', $langs->trans("ModuleTranslatedIntoLangForKeyInto", "Module".$moduleobj->numero."Desc", $moduledescritpionautotrans)); } From 7a8250aa0025e48df53e9ff34d70f7864bf91994 Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Thu, 12 Sep 2024 21:36:13 +0200 Subject: [PATCH 7/8] Use NDF_CC_EMAILS on ndf approval (#30937) --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 611e8aff341..47593625334 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -682,7 +682,7 @@ if (empty($reshook)) { } */ - $mailfile = new CMailFile($subject, $emailTo, $emailFrom, $message, $filedir, $mimetype, $filename, '', '', 0, -1); + $mailfile = new CMailFile($subject, $emailTo, $emailFrom, $message, $filedir, $mimetype, $filename, $emailCC, '', 0, -1); if ($mailfile) { // SEND From ffcaeba4c3010fe53e86b5ddf488aa6978477d95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Sep 2024 21:47:13 +0200 Subject: [PATCH 8/8] Fix compatibility --- htdocs/website/class/websitepage.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 0bdc8cc65fe..bdeb6e734db 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -510,7 +510,7 @@ class WebsitePage extends CommonObject * @param string $filtermode Filter mode (AND or OR) * @return int int <0 if KO, array of pages if OK */ - public function countAll($websiteid, string $filter = '', $filtermode = 'AND') + public function countAll($websiteid, $filter = '', $filtermode = 'AND') { dol_syslog(__METHOD__, LOG_DEBUG);