From 7210e7ce1a9cee12fd297de068c199b25820c7d4 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 19 May 2023 11:43:44 +0200 Subject: [PATCH 001/862] NEW : TakePOS - add constant to sho line subprices --- htdocs/takepos/invoice.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 6f5e829ca47..0ca2155feb1 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1347,6 +1347,9 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e print $hookmanager->resPrint; if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { + if ($conf->global->TAKEPOS_SHOW_SUBPRICE) { + print ''.$langs->trans('PriceUHT').''; + } print ''.$langs->trans('ReductionShort').''; print ''.$langs->trans('Qty').''; if (getDolGlobalString('TAKEPOS_SHOW_HT')) { @@ -1602,6 +1605,9 @@ if ($placeid > 0) { if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $htmlforlines .= $hookmanager->resPrint; + if ($conf->global->TAKEPOS_SHOW_SUBPRICE) { + $htmlforlines .= ''.price($line->subprice).''; + } $htmlforlines .= ''.vatrate($line->remise_percent, true).''; $htmlforlines .= ''; if (isModEnabled('stock') && !empty($user->rights->stock->mouvement->lire)) { From 8e7d1a9f23a2691384161c0579e7186067ae7475 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 19 May 2023 11:54:21 +0200 Subject: [PATCH 002/862] NEW : TAkePOS - dont allow payment if no thirdparty selected --- htdocs/takepos/index.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 7e1c648d460..c2bde7b3dc2 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -532,6 +532,17 @@ function Reduction() { function CloseBill() { invoiceid = $("#invoiceid").val(); console.log("Open popup to enter payment on invoiceid="+invoiceid); + global->TAKEPOS_NO_GENERIC_THIRDPARTY) { ?> + if ($("#idcustomer").val() == "") { + alert("trans('TakePosCustomerMandatory'); ?>"); + global->TAKEPOS_CHOOSE_CONTACT) { ?> + Contact(); + + Customer(); + + return; + } + global->TAKEPOS_HIDE_HEAD_BAR)) {
+
From 482b9756a28e2d2dbd3e9fb32212cbf3c8a074e5 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 19 May 2023 11:54:51 +0200 Subject: [PATCH 003/862] typo --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index c2bde7b3dc2..7b284762ba1 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -542,7 +542,7 @@ function CloseBill() { return; } - $.colorbox({href:"pay.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""}); } From 5de555222c423569b99f1cfd665d7567d54bd395 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 19 May 2023 16:37:41 +0200 Subject: [PATCH 004/862] add missing trans --- htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/langs/fr_FR/cashdesk.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 9cde66460d3..c8fb62e1d45 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -145,3 +145,4 @@ ShowProductReference=Show reference of products UsePriceHT=Use price excl. taxes and not price incl. taxes TerminalName=Terminal %s TerminalNameDesc=Terminal name +TakePosCustomerMandatory=You must choose a customer diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 049ee169cef..91496e9ccf2 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -145,3 +145,4 @@ ShowProductReference=Afficher la référence des produits UsePriceHT=Utiliser le prix HT et non le prix TTC TerminalName=Terminal %s TerminalNameDesc=Nom du terminal +TakePosCustomerMandatory=Vous devez choisir un client From b2dd9bfb40de2a27a16d0cd33792cd0d1c2811c1 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 21 May 2023 09:51:56 +0200 Subject: [PATCH 005/862] fix php8 --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 0ca2155feb1..9eb94b9c9ee 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1347,7 +1347,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e print $hookmanager->resPrint; if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { - if ($conf->global->TAKEPOS_SHOW_SUBPRICE) { + if (getDolGlobalString("TAKEPOS_SHOW_SUBPRICE")) { print ''.$langs->trans('PriceUHT').''; } print ''.$langs->trans('ReductionShort').''; From 3f337000d9f6c2d8fbc0881006f28ea2886198b6 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 21 May 2023 09:52:59 +0200 Subject: [PATCH 006/862] fix php8 --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 9eb94b9c9ee..d97eb5e6f0d 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1605,7 +1605,7 @@ if ($placeid > 0) { if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $htmlforlines .= $hookmanager->resPrint; - if ($conf->global->TAKEPOS_SHOW_SUBPRICE) { + if (getDolGlobalString("TAKEPOS_SHOW_SUBPRICE")) { $htmlforlines .= ''.price($line->subprice).''; } $htmlforlines .= ''.vatrate($line->remise_percent, true).''; From 823b479908091d581813189fd554054ab599dc12 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 21 May 2023 10:26:44 +0200 Subject: [PATCH 007/862] fix php8 --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 7b284762ba1..93d0c478312 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -532,7 +532,7 @@ function Reduction() { function CloseBill() { invoiceid = $("#invoiceid").val(); console.log("Open popup to enter payment on invoiceid="+invoiceid); - global->TAKEPOS_NO_GENERIC_THIRDPARTY) { ?> + if ($("#idcustomer").val() == "") { alert("trans('TakePosCustomerMandatory'); ?>"); global->TAKEPOS_CHOOSE_CONTACT) { ?> From cdf16d965c107605ac0d5fa2dee279833e14b0cd Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 21 May 2023 19:01:50 +0200 Subject: [PATCH 008/862] fix --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 93d0c478312..cf9e8732951 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -532,7 +532,7 @@ function Reduction() { function CloseBill() { invoiceid = $("#invoiceid").val(); console.log("Open popup to enter payment on invoiceid="+invoiceid); - + if ($("#idcustomer").val() == "") { alert("trans('TakePosCustomerMandatory'); ?>"); global->TAKEPOS_CHOOSE_CONTACT) { ?> From d9fd46caed3fb41b8415b5e4ed01428d527779b3 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 21 May 2023 19:03:00 +0200 Subject: [PATCH 009/862] fix --- htdocs/takepos/invoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index d97eb5e6f0d..577205621bb 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1347,7 +1347,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e print $hookmanager->resPrint; if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { - if (getDolGlobalString("TAKEPOS_SHOW_SUBPRICE")) { + if (getDolGlobalInt("TAKEPOS_SHOW_SUBPRICE")) { print ''.$langs->trans('PriceUHT').''; } print ''.$langs->trans('ReductionShort').''; @@ -1605,7 +1605,7 @@ if ($placeid > 0) { if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $htmlforlines .= $hookmanager->resPrint; - if (getDolGlobalString("TAKEPOS_SHOW_SUBPRICE")) { + if (getDolGlobalInt("TAKEPOS_SHOW_SUBPRICE")) { $htmlforlines .= ''.price($line->subprice).''; } $htmlforlines .= ''.vatrate($line->remise_percent, true).''; From 382f9ce95dd6d3def274c467bd3fa3b46cfda0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Fri, 8 Dec 2023 00:24:44 +0100 Subject: [PATCH 010/862] Fix #27029 --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 2f4d4fe2f83..deb14e0b06d 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -1051,7 +1051,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.rowid IN (".$db->sanitize($objectid, 1).")"; $sql .= " AND dbt.".$dbt_keyfield." = ".((int) $user->socid); - } elseif (isModEnabled("societe") && empty($user->rights->societe->client->voir)) { + } elseif (isModEnabled("societe") && empty($user->rights->societe->client->voir)&& ($feature != 'knowledgemanagement')) { // If internal user without permission to see all thirdparties: Check permission for internal users that are restricted on their objects if ($feature != 'ticket') { if (empty($dbt_keyfield)) { From 5c907df092dd581c25c749653ca2715efb35d52a Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 13 Dec 2023 14:52:40 +0100 Subject: [PATCH 011/862] clean altairis comments --- htdocs/core/class/html.formticket.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index fe0f6c71e1f..7c4c1b06f08 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -546,7 +546,7 @@ class FormTicket // Customer or supplier if ($this->withcompany) { - // altairis: force company and contact id for external user + // force company and contact id for external user if (empty($user->socid)) { // Company print ''.$langs->trans("ThirdParty").''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 198d8f7ce3c..d632bf16640 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2799,7 +2799,7 @@ class Ticket extends CommonObject $message .= '

'; foreach ($external_contacts as $key => $info_sendto) { - // altairis: avoid duplicate emails to external contacts + // avoid duplicate emails to external contacts if ($info_sendto['id'] == $user->contact_id) { continue; } From cb15d8c7beb0db960202c0207fe164e65e59349c Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 13 Dec 2023 14:55:54 +0100 Subject: [PATCH 012/862] add constant TICKETS_NO_COMPANY_ON_FORM --- 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 7c4c1b06f08..c8191ddbc44 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -135,7 +135,7 @@ class FormTicket $this->action = 'add'; - $this->withcompany = isModEnabled("societe"); + $this->withcompany = !getDolGlobalInt("TICKETS_NO_COMPANY_ON_FORM") && isModEnabled("societe"); $this->withfromsocid = 0; $this->withfromcontactid = 0; $this->withreadid=0; From e50f144bc733b1ae6ccf98b1294428b3d42c0a1d Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 13 Dec 2023 15:15:04 +0100 Subject: [PATCH 013/862] display html notes --- htdocs/commande/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 8c8f661fac8..b3c52ee3318 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2579,8 +2579,8 @@ while ($i < $imaxinloop) { // Note public if (!empty($arrayfields['c.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); + print ''; + print dol_string_onlythesehtmltags($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2589,8 +2589,8 @@ while ($i < $imaxinloop) { // Note private if (!empty($arrayfields['c.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); + print ''; + print dol_string_onlythesehtmltags($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; From 19d440bf9df808ba542411e0aef8f1576f71b074 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 13 Dec 2023 15:18:14 +0100 Subject: [PATCH 014/862] display html notes on propals --- htdocs/comm/propal/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 97e2a1d4307..e19b3916419 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -2321,8 +2321,8 @@ if ($search_date_signature_endyear) { } // Note public if (!empty($arrayfields['p.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); + print ''; + print dol_string_onlythesehtmltags($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2330,8 +2330,8 @@ if ($search_date_signature_endyear) { } // Note private if (!empty($arrayfields['p.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); + print ''; + print dol_string_onlythesehtmltags($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; From 19c44826633f8e474f0c7cc6f6993f4cdc66b72f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 14 Dec 2023 09:47:57 +0100 Subject: [PATCH 015/862] better fix --- htdocs/comm/propal/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e19b3916419..cd0e876c642 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -2322,7 +2322,7 @@ if ($search_date_signature_endyear) { // Note public if (!empty($arrayfields['p.note_public']['checked'])) { print ''; - print dol_string_onlythesehtmltags($obj->note_public); + print dolPrintHTML($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2331,7 +2331,7 @@ if ($search_date_signature_endyear) { // Note private if (!empty($arrayfields['p.note_private']['checked'])) { print ''; - print dol_string_onlythesehtmltags($obj->note_private); + print dolPrintHTML($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; From d97dcb25388ea52549257e23787463a5db70677f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 14 Dec 2023 09:49:18 +0100 Subject: [PATCH 016/862] better fix --- htdocs/commande/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b3c52ee3318..7d3815d40ec 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2580,7 +2580,7 @@ while ($i < $imaxinloop) { // Note public if (!empty($arrayfields['c.note_public']['checked'])) { print ''; - print dol_string_onlythesehtmltags($obj->note_public); + print dolPrintHTML($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2590,7 +2590,7 @@ while ($i < $imaxinloop) { // Note private if (!empty($arrayfields['c.note_private']['checked'])) { print ''; - print dol_string_onlythesehtmltags($obj->note_private); + print dolPrintHTML($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; From 28769a13ebeec17db4745a949a9d6747a0c247f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Wed, 27 Dec 2023 00:08:18 +0100 Subject: [PATCH 017/862] Update security.lib.php Better fix as proposed by eldy --- htdocs/core/lib/security.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index deb14e0b06d..893cb3d8355 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -892,7 +892,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $checkonentitydone = 0; // Array to define rules of checks to do - $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales'); // Test on entity only (Objects with no link to company) + $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales', 'knowledgemanagement'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for object Societe $checkparentsoc = array('agenda', 'contact', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet', 'project'); // Test for project object @@ -1051,7 +1051,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.rowid IN (".$db->sanitize($objectid, 1).")"; $sql .= " AND dbt.".$dbt_keyfield." = ".((int) $user->socid); - } elseif (isModEnabled("societe") && empty($user->rights->societe->client->voir)&& ($feature != 'knowledgemanagement')) { + } elseif (isModEnabled("societe") && empty($user->rights->societe->client->voir)) { // If internal user without permission to see all thirdparties: Check permission for internal users that are restricted on their objects if ($feature != 'ticket') { if (empty($dbt_keyfield)) { From ab206910ab509c76bd592501463688a2a9154d7f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 15 Jan 2024 09:40:59 +0100 Subject: [PATCH 018/862] change to receptiondet_batch into scripts --- ...php => receptiondet_batch_extrafields.php} | 4 ++-- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/lib/reception.lib.php | 6 ++--- htdocs/core/modules/modReception.class.php | 6 ++--- htdocs/expedition/dispatch.php | 2 +- .../class/fournisseur.commande.class.php | 8 +++---- .../fournisseur.commande.dispatch.class.php | 2 +- htdocs/fourn/commande/dispatch.php | 4 ++-- htdocs/product/class/product.class.php | 2 +- .../product/stock/class/productlot.class.php | 4 ++-- .../product/stock/lib/replenishment.lib.php | 2 +- htdocs/product/stock/replenish.php | 2 +- .../stock/stats/commande_fournisseur.php | 2 +- htdocs/product/stock/stats/reception.php | 2 +- htdocs/reception/card.php | 4 ++-- htdocs/reception/class/reception.class.php | 24 +++++++++---------- htdocs/reception/dispatch.php | 4 ++-- 17 files changed, 40 insertions(+), 40 deletions(-) rename htdocs/admin/{commande_fournisseur_dispatch_extrafields.php => receptiondet_batch_extrafields.php} (94%) diff --git a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php b/htdocs/admin/receptiondet_batch_extrafields.php similarity index 94% rename from htdocs/admin/commande_fournisseur_dispatch_extrafields.php rename to htdocs/admin/receptiondet_batch_extrafields.php index 277d61e1b2f..ea98618dda0 100644 --- a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php +++ b/htdocs/admin/receptiondet_batch_extrafields.php @@ -25,7 +25,7 @@ */ /** - * \file htdocs/admin/commande_fournisseur_dispatch_extrafields.php + * \file htdocs/admin/receptiondet_batch.php * \ingroup reception * \brief Page to setup extra fields of reception */ @@ -56,7 +56,7 @@ foreach ($tmptype2label as $key => $val) { $action = GETPOST('action', 'aZ09'); $attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'commande_fournisseur_dispatch'; //Must be the $table_element of the class that manage extrafield +$elementtype = 'receptiondet_batch'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) { accessforbidden(); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 75fd4a5e47a..4dc6a6dad58 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4535,7 +4535,7 @@ abstract class CommonObject if ($elementTable == 'expensereport') { $fieldstatus = "fk_statut"; } - if ($elementTable == 'commande_fournisseur_dispatch') { + if ($elementTable == 'receptiondet_batch') { $fieldstatus = "status"; } if ($elementTable == 'prelevement_bons') { diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index 2dce74e6a11..b5f5a0c7067 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -122,7 +122,7 @@ function reception_admin_prepare_head() $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label('reception'); - $extrafields->fetch_name_optionals_label('commande_fournisseur_dispatch'); + $extrafields->fetch_name_optionals_label('receptiondet_batch'); $h = 0; $head = array(); @@ -146,9 +146,9 @@ function reception_admin_prepare_head() } if (getDolGlobalString('MAIN_SUBMODULE_RECEPTION')) { - $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; + $head[$h][0] = DOL_URL_ROOT.'/admin/receptiondet_batch_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); - $nbExtrafields = $extrafields->attributes['commande_fournisseur_dispatch']['count']; + $nbExtrafields = $extrafields->attributes['receptiondet_batch']['count']; if ($nbExtrafields > 0) { $head[$h][1] .= ''.$nbExtrafields.''; } diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php index f5f8429f5db..f0327612b7d 100644 --- a/htdocs/core/modules/modReception.class.php +++ b/htdocs/core/modules/modReception.class.php @@ -218,7 +218,7 @@ class modReception extends DolibarrModules $keyforelement = 'reception'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'commande_fournisseur_dispatch'; + $keyforselect = 'receptiondet_batch'; $keyforelement = 'reception_line'; $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; @@ -232,8 +232,8 @@ class modReception extends DolibarrModules } $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; - $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch as ed'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch_extrafields as extra2 ON ed.rowid = extra2.fk_object'; + $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'receptiondet_batch as ed'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'receptiondet_batch_extrafields as extra2 ON ed.rowid = extra2.fk_object'; $this->export_sql_end[$r] .= ' , '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; if ($idcontacts && getDolGlobalString('RECEPTION_ADD_CONTACTS_IN_EXPORT')) { diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 8ba6e6d7768..1daba85e87f 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -774,7 +774,7 @@ if ($object->id > 0 || !empty($object->ref)) { print ''; // Warehouse column /*$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product"; - $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; $sql .= " WHERE cfd.fk_commandefourndet = ".(int) $objp->rowid;*/ $sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot,"; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 81570e7e320..102399eb4d9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2103,7 +2103,7 @@ class CommandeFournisseur extends CommonOrder /** - * Save a receiving into the tracking table of receiving (commande_fournisseur_dispatch) and add product into stock warehouse. + * Save a receiving into the tracking table of receiving (receptiondet_batch) and add product into stock warehouse. * * @param User $user User object making change * @param int $product Id of product to dispatch @@ -2148,7 +2148,7 @@ class CommandeFournisseur extends CommonOrder if (($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY || $this->statut == self::STATUS_RECEIVED_COMPLETELY)) { $this->db->begin(); - $sql = "INSERT INTO ".$this->db->prefix()."commande_fournisseur_dispatch"; + $sql = "INSERT INTO ".$this->db->prefix()."receptiondet_batch"; $sql .= " (fk_commande, fk_product, qty, fk_entrepot, fk_user, datec, fk_commandefourndet, status, comment, eatby, sellby, batch, fk_reception) VALUES"; $sql .= " ('".$this->id."','".$product."','".$qty."',".($entrepot > 0 ? "'".$entrepot."'" : "null").",'".$user->id."','".$this->db->idate($now)."','".$fk_commandefourndet."', ".$dispatchstatus.", '".$this->db->escape($comment)."', "; $sql .= ($eatby ? "'".$this->db->idate($eatby)."'" : "null").", ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", ".($batch ? "'".$this->db->escape($batch)."'" : "null").", ".($fk_reception > 0 ? "'".$this->db->escape($fk_reception)."'" : "null"); @@ -2395,7 +2395,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; $sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.fk_commandefourndet"; $sql .= " FROM ".$this->db->prefix()."product as p,"; - $sql .= " ".$this->db->prefix()."commande_fournisseur_dispatch as cfd"; + $sql .= " ".$this->db->prefix()."receptiondet_batch as cfd"; $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e ON cfd.fk_entrepot = e.rowid"; $sql .= " WHERE cfd.fk_commande = ".((int) $this->id); $sql .= " AND cfd.fk_product = p.rowid"; @@ -3556,7 +3556,7 @@ class CommandeFournisseur extends CommonOrder $sql = 'SELECT cd.rowid, cd.fk_product,'; $sql .= ' sum(cfd.qty) as qty'; - $sql .= ' FROM '.$this->db->prefix().'commande_fournisseur_dispatch as cfd,'; + $sql .= ' FROM '.$this->db->prefix().'receptiondet_batch as cfd,'; if ($filtre_statut >= 0) { $sql .= ' '.$this->db->prefix().'reception as e,'; } diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 044a14119c9..7374ccb9111 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -56,7 +56,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine /** * @var string Name of table without prefix where object is stored */ - public $table_element = 'commande_fournisseur_dispatch'; //!< Name of table without prefix where object is stored + public $table_element = 'receptiondet_batch'; //!< Name of table without prefix where object is stored public $lines = array(); /** diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 6241d2bd202..5c0a245310e 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -655,7 +655,7 @@ if ($id > 0 || !empty($ref)) { // Set $products_dispatched with qty dispatched for each product id $products_dispatched = array(); $sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty"; - $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet"; $sql .= " WHERE cfd.fk_commande = ".((int) $object->id); $sql .= " GROUP BY l.rowid, cfd.fk_product"; @@ -1158,7 +1158,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " ,cfd.fk_reception, r.date_delivery"; } $sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; - $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; + $sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cd ON cd.rowid = cfd.fk_commandefourndet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; if ($conf->reception->enabled) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5a7ae18ee1d..99279e0b173 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3427,7 +3427,7 @@ class Product extends CommonObject $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_suppliers, COUNT(DISTINCT cf.rowid) as nb,"; $sql .= " COUNT(fd.rowid) as nb_rows, SUM(fd.qty) as qty"; - $sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as fd"; + $sql .= " FROM ".$this->db->prefix()."receptiondet_batch as fd"; $sql .= ", ".$this->db->prefix()."commande_fournisseur as cf"; $sql .= ", ".$this->db->prefix()."societe as s"; if (!$user->hasRight('societe', 'client', 'voir') && !$forVirtualStock) { diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 0e9852fba82..9c145073f94 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -835,7 +835,7 @@ class Productlot extends CommonObject $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,"; $sql .= " COUNT(cfd.rowid) as nb_rows, SUM(cfdi.qty) as qty"; - $sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as cfdi"; + $sql .= " FROM ".$this->db->prefix()."receptiondet_batch as cfdi"; $sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseurdet as cfd ON (cfd.rowid = cfdi.fk_commandefourndet)"; $sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseur as cf ON (cf.rowid = cfd.fk_commande)"; // $sql .= ", ".$this->db->prefix()."societe as s"; @@ -910,7 +910,7 @@ class Productlot extends CommonObject $sql = "SELECT COUNT(DISTINCT recep.fk_soc) as nb_customers, COUNT(DISTINCT recep.rowid) as nb,"; $sql .= " COUNT(cfdi.rowid) as nb_rows, SUM(cfdi.qty) as qty"; - $sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as cfdi"; + $sql .= " FROM ".$this->db->prefix()."receptiondet_batch as cfdi"; $sql .= " INNER JOIN ".$this->db->prefix()."reception as recep ON (recep.rowid = cfdi.fk_reception)"; // $sql .= ", ".$this->db->prefix()."societe as s"; if (!$user->hasRight('societe', 'client', 'voir')) { diff --git a/htdocs/product/stock/lib/replenishment.lib.php b/htdocs/product/stock/lib/replenishment.lib.php index 8751935cb13..e6bf9d8a060 100644 --- a/htdocs/product/stock/lib/replenishment.lib.php +++ b/htdocs/product/stock/lib/replenishment.lib.php @@ -38,7 +38,7 @@ function dolDispatchToDo($order_id) $ordered = array(); // Count nb of quantity dispatched per product - $sql = 'SELECT fk_product, SUM(qty) as qtydispatched FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; + $sql = 'SELECT fk_product, SUM(qty) as qtydispatched FROM '.MAIN_DB_PREFIX.'receptiondet_batch'; $sql .= ' WHERE fk_commande = '.((int) $order_id); $sql .= ' GROUP BY fk_product'; $sql .= ' ORDER by fk_product'; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index a9ae3c62195..b3e9b4aa510 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -451,7 +451,7 @@ if ($usevirtualstock) { $sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd4.qty) IS NULL", "0", "SUM(fd4.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlReceptionFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf4,"; - $sqlReceptionFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd4"; + $sqlReceptionFourn .= " ".MAIN_DB_PREFIX."receptiondet_batch as fd4"; $sqlReceptionFourn .= " WHERE fd4.fk_commande = cf4.rowid AND cf4.entity IN (".getEntity(getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")"; $sqlReceptionFourn .= " AND fd4.fk_product = p.rowid"; $sqlReceptionFourn .= " AND cf4.fk_statut IN (3,4))"; diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php index 756f814f575..4365c91e460 100644 --- a/htdocs/product/stock/stats/commande_fournisseur.php +++ b/htdocs/product/stock/stats/commande_fournisseur.php @@ -224,7 +224,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur as cf ON (cf.fk_soc = s.rowid)"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cfd ON (cfd.fk_commande = cf.rowid)"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfdi ON (cfdi.fk_commandefourndet = cfd.rowid)"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."receptiondet_batch as cfdi ON (cfdi.fk_commandefourndet = cfd.rowid)"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php index 63c4b942310..cc7165e3f4b 100644 --- a/htdocs/product/stock/stats/reception.php +++ b/htdocs/product/stock/stats/reception.php @@ -223,7 +223,7 @@ if ($id > 0 || !empty($ref)) { } $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."reception as recep ON (recep.fk_soc = s.rowid)"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as d ON (d.fk_reception = recep.rowid)"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."receptiondet_batch as d ON (d.fk_reception = recep.rowid)"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 0498c8d06bc..96835b53dc5 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1035,7 +1035,7 @@ if ($action == 'create') { // Note that if an extrafield with the same name exists in the origin supplier order line, the value // from the HTTP query will be ignored foreach ($suffix2numAsked as $suffix => $n) { - $dispatchLines[$n]['array_options'] = $extrafields->getOptionalsFromPost('commande_fournisseur_dispatch', '_' . $suffix, ''); + $dispatchLines[$n]['array_options'] = $extrafields->getOptionalsFromPost('receptiondet_batch', '_' . $suffix, ''); } print ' From a4d85d870671ae610a51af9ad017d679f5c3784f Mon Sep 17 00:00:00 2001 From: jyhere Date: Thu, 14 Mar 2024 10:11:54 +0100 Subject: [PATCH 076/862] UPDATE: improved extrafields code autofill Add normalize() (to convert accented chars to unaccented chars) and replace whitespaces by underscores to make the db column name more readable. --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 19245020f26..7b8092ef81d 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -140,7 +140,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con global->MAIN_EXTRAFIELDS_CODE_AUTOFILL_DISABLED)) : ?> jQuery("#label").keyup(function() { console.log("Update new field"); - $("#attrname").val( $(this).val().replace(/[^a-zA-Z0-9_]/g, '').toLowerCase() ); + $("#attrname").val( $(this).val().normalize('NFD').replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, '').toLowerCase() ); }); }); From fc753daa26352a838228982f5d01faf042eda0c1 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 14 Mar 2024 11:58:23 +0100 Subject: [PATCH 077/862] NEW functionality for delete contact of company list --- htdocs/core/lib/company.lib.php | 14 ++++++++++++++ htdocs/langs/en_US/users.lang | 2 ++ htdocs/societe/contact.php | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d8113ce1356..62e6840351d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1417,6 +1417,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl print ''; } + // Delete + if ($user->hasRight('societe', 'contact', 'delete')) { + print ''; + print img_delete(); + print ''; + } + print ''; } @@ -1513,6 +1520,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl print ''; } + // Delete + if ($user->hasRight('societe', 'contact', 'delete')) { + print ''; + print img_delete(); + print ''; + } + print ''; } diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index c4695d86791..3cfa2ee7236 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -134,3 +134,5 @@ UserPublicPageDesc=You can enable a virtual card for this user. An url with the EnablePublicVirtualCard=Enable the user's virtual business card UserEnabledDisabled=User status changed: %s AlternativeEmailForOAuth2=Alternative Email for OAuth2 login +ConfirmDeleteContact= Are you sure that you want delete this contact ? +ContactDeleted= Contact has been delete successfully diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 1fd810a9793..c56ca5ccfb4 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -133,6 +133,27 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; } +if ($action == 'confirm_delete') { + $id = GETPOST('id', 'int'); + if (!empty($id) && $socid > 0) { + $sql = "DELETE t, et FROM llx_socpeople AS t"; + $sql .= " LEFT JOIN llx_socpeople_extrafields AS et ON t.rowid = et.fk_object"; + $sql .= " WHERE t.fk_soc = ".((int) $socid); + $sql .= " AND t.rowid = ".((int) $id); + $sql .= " AND ((t.fk_user_creat = ".((int) $user->id)." AND t.priv = 1) OR t.priv = 0)"; + + $result = $db->query($sql); + if (!$result) { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + } else { + $db->commit(); + setEventMessages('ContactDeleted', null, 'mesgs'); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$socid); + exit(); + } + } +} /* * View @@ -184,6 +205,18 @@ if ($action != 'presend') { $result = show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1); } } +if ($action == 'delete') { + $formconfirm = $form->formconfirm( + $_SERVER["PHP_SELF"].'?id='.GETPOST('id').'&socid='.$object->id, + $langs->trans('Delete'), + $langs->trans('ConfirmDeleteContact', GETPOST('id', 'alpha')), + 'confirm_delete', + '', + 0, + 1 + ); + print $formconfirm; +} // End of page llxFooter(); From a25e8ee14de2c08067dba4ad24bdea1f8a51a682 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 14 Mar 2024 15:09:44 +0100 Subject: [PATCH 078/862] FIX PHPStan warnings --- htdocs/core/modules/member/doc/pdf_standard.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 8585f4ee1b4..5ce0565f4eb 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -263,7 +263,7 @@ class pdf_standard extends CommonStickerGenerator /** * Function to build PDF on disk, then output on HTTP stream. * - * @param Adherent $object Member object. Old usage: Array of record information (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>) + * @param mixed $object Member object. Old usage: Array of record information (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>) * @param Translate $outputlangs Lang object for output language * @param string $srctemplatepath Full path of source filename for generator using a template file. Example: '5161', 'AVERYC32010', 'CARD', ... * @param string $mode Tell if doc module is called for 'member', ... From 3c7f5391e5b27a64232bb0534698bc685709cfdf Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 14 Mar 2024 16:00:43 +0100 Subject: [PATCH 079/862] FIX variable by adding a type BOMLine (PHPStan warnings) --- htdocs/mrp/class/mo.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 2a1c580a03b..da5b1caf030 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -231,7 +231,7 @@ class Mo extends CommonObject protected $childtablesoncascade = array('mrp_production'); /** - * @var MoLine[] Array of subtable lines + * @var MoLine[]|BOMLine[] Array of subtable lines */ public $lines = array(); From 8ae32dd865f29845d7e77f483ff1715b0d1bf631 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 14 Mar 2024 16:19:41 +0100 Subject: [PATCH 080/862] FIX variable by casting it with int --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 747604f0f70..30b9502a78a 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -292,7 +292,7 @@ if (empty($reshook)) { $newlocaltax2_type = GETPOST('localtax2_type', 'array'); //Shall we generate prices using price rules? - $object->price_autogen = GETPOST('usePriceRules') == 'on'; + $object->price_autogen = (int) GETPOST('usePriceRules') == 'on'; for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { if (!isset($newprice[$i])) { From 2c1be590d9f752ae456f6c6019b44c7c9b64de19 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 14 Mar 2024 18:03:32 +0100 Subject: [PATCH 081/862] FIX variables in project class (PHPStan Warnings) --- htdocs/projet/class/project.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 13d4c426bc7..e8911500494 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2670,10 +2670,10 @@ class Project extends CommonObject $actioncomm->email_sender = ''; $actioncomm->email_to = $to; - $actioncomm->errors_to = $errors_to; + $actioncomm->errors_to = (string) $errors_to; $actioncomm->elementtype = 'project_task'; - $actioncomm->fk_element = $this->element; + $actioncomm->fk_element = (int) $this->element; $actioncomm->create($user); } else { @@ -2704,10 +2704,10 @@ class Project extends CommonObject $actioncomm->email_sender = ''; $actioncomm->email_to = $to; - $actioncomm->errors_to = $errors_to; + $actioncomm->errors_to = (string) $errors_to; $actioncomm->elementtype = 'project_task'; - $actioncomm->fk_element = $this->element; + $actioncomm->fk_element = (int) $this->element; $actioncomm->create($user); } From 18f3e3d20d73d77be3b3d28ff69819093f43772d Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Thu, 14 Mar 2024 18:20:37 +0100 Subject: [PATCH 082/862] to remove php-stan complaints --- htdocs/core/class/notify.class.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 75ff4f52d56..1eaa370d502 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -48,11 +48,37 @@ class Notify */ public $type; + /** + * @var string email + */ + public $email; + + /** + * @var string threshold + */ + public $threshold; + + /** + * @var string context + */ + public $context; + /** * @var int Thirdparty ID */ public $socid; + /** + * @var int Event action + */ + public $event; + + /** + * @var int (thirdparty) Contact ID + */ + public $target; + + /** * Date creation record (datec) * From 5eaa6c84f1c2673511747db66903905b2b9962ac Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Thu, 14 Mar 2024 18:30:19 +0100 Subject: [PATCH 083/862] missing one --- htdocs/core/class/notify.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 1eaa370d502..2df7f9d7b5c 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -48,6 +48,11 @@ class Notify */ public $type; + /** + * @var string fk_user + */ + public $fk_user; + /** * @var string email */ From 69be3bbca66c9abb0d309e13cfb75d14cad5aeec Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 18:37:54 +0100 Subject: [PATCH 084/862] Fix PhanTypeInvalidUnaryOperandNumeric & remove from exceptions # Fix PhanTypeInvalidUnaryOperandNumeric & remove from exceptions Fix by casting result of date() or by adding typing hints. (This notification indicates a unary '-' or similar is performed on a value that may not be a number). --- dev/tools/phan/baseline.txt | 9 +--- htdocs/comm/action/index.php | 6 +-- htdocs/compta/accounting-files.php | 46 +++++++++++-------- .../class/paymentsocialcontribution.class.php | 16 +++++-- htdocs/compta/tva/class/paymentvat.class.php | 15 ++++-- .../class/paymentexpensereport.class.php | 16 ++++++- htdocs/loan/class/paymentloan.class.php | 28 +++++++++-- htdocs/public/bookcal/index.php | 7 +-- 8 files changed, 99 insertions(+), 44 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 68fc0c015e7..86cd01fc014 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -14,7 +14,6 @@ return [ // PhanUndeclaredConstant : 15+ occurrences // PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences // PhanTypeArraySuspiciousNull : 10+ occurrences - // PhanTypeInvalidUnaryOperandNumeric : 8 occurrences // PhanRedefineFunctionInternal : 6 occurrences // PhanPluginUnsafeEval : 5 occurrences // PhanParamSuspiciousOrder : 4 occurrences @@ -39,11 +38,10 @@ return [ 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected'], 'htdocs/categories/viewcat.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/collab/index.php' => ['PhanParamTooMany'], - 'htdocs/comm/action/index.php' => ['PhanPluginSuspiciousParamPosition', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidUnaryOperandNumeric'], + 'htdocs/comm/action/index.php' => ['PhanPluginSuspiciousParamPosition', 'PhanTypeArraySuspiciousNull'], 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/comm/mailing/cibles.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/comm/mailing/info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/accounting-files.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/compta/bank/various_payment/card.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginSuspiciousParamPosition'], @@ -52,11 +50,9 @@ return [ 'htdocs/compta/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany'], 'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/compta/sociales/document.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/sociales/info.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/sociales/note.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/compta/tva/document.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/actions_massactions.inc.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/class/commondocgenerator.class.php' => ['PhanTypeArraySuspiciousNull'], @@ -85,12 +81,10 @@ return [ 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'], 'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], - 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/fourn/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/intracommreport/list.php' => ['PhanAccessPropertyStaticAsNonStatic'], 'htdocs/loan/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/class/paymentloan.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/loan/document.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/loan/info.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/loan/note.php' => ['PhanPluginSuspiciousParamPosition'], @@ -100,7 +94,6 @@ return [ 'htdocs/product/admin/product_tools.php' => ['PhanNoopStringLiteral'], 'htdocs/product/card.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/projet/tasks/list.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/public/bookcal/index.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/public/opensurvey/index.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/public/recruitment/index.php' => ['PhanPluginSuspiciousParamOrder'], diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 68e6b4d7169..44bb2d8b05a 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -319,10 +319,10 @@ if (empty($mode) || $mode == 'show_month') { $next_year = $next['year']; $next_month = $next['month']; - $max_day_in_prev_month = date("t", dol_mktime(12, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month - $max_day_in_month = date("t", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')); // Nb of days in next month + $max_day_in_prev_month = (int) date("t", dol_mktime(12, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month + $max_day_in_month = (int) date("t", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')); // Nb of days in next month // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) - $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday + $tmpday = - (int) date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1); if ($tmpday >= 1) { $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index bb4b30474b7..05351d41713 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -5,6 +5,7 @@ * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2022-2024 Alexandre Spangaro + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,15 +97,15 @@ if (!$sortorder) { $arrayfields = array( - 'type'=>array('label'=>"Type", 'checked'=>1), - 'date'=>array('label'=>"Date", 'checked'=>1), - 'date_due'=>array('label'=>"DateDue", 'checked'=>1), - 'ref'=>array('label'=>"Ref", 'checked'=>1), - 'documents'=>array('label'=>"Documents", 'checked'=>1), - 'paid'=>array('label'=>"Paid", 'checked'=>1), - 'total_ht'=>array('label'=>"TotalHT", 'checked'=>1), - 'total_ttc'=>array('label'=>"TotalTTC", 'checked'=>1), - 'total_vat'=>array('label'=>"TotalVAT", 'checked'=>1), + 'type' => array('label' => "Type", 'checked' => 1), + 'date' => array('label' => "Date", 'checked' => 1), + 'date_due' => array('label' => "DateDue", 'checked' => 1), + 'ref' => array('label' => "Ref", 'checked' => 1), + 'documents' => array('label' => "Documents", 'checked' => 1), + 'paid' => array('label' => "Paid", 'checked' => 1), + 'total_ht' => array('label' => "TotalHT", 'checked' => 1), + 'total_ttc' => array('label' => "TotalTTC", 'checked' => 1), + 'total_vat' => array('label' => "TotalVAT", 'checked' => 1), //... ); @@ -135,14 +136,14 @@ if (empty($entity)) { $error = 0; $listofchoices = array( - 'selectinvoices'=>array('label'=>'Invoices', 'picto'=>'bill', 'lang'=>'bills', 'enabled' => isModEnabled('invoice'), 'perms' => $user->hasRight('facture', 'lire')), - 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'picto'=>'supplier_invoice', 'lang'=>'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => $user->hasRight('fournisseur', 'facture', 'lire')), - 'selectexpensereports'=>array('label'=>'ExpenseReports', 'picto'=>'expensereport', 'lang'=>'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => $user->hasRight('expensereport', 'lire')), - 'selectdonations'=>array('label'=>'Donations', 'picto'=>'donation', 'lang'=>'donation', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('don', 'lire')), - 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'picto'=>'bill', 'enabled' => isModEnabled('tax'), 'perms' => $user->hasRight('tax', 'charges', 'lire')), - 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'picto'=>'salary', 'lang'=>'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => $user->hasRight('salaries', 'read')), - 'selectvariouspayment'=>array('label'=>'VariousPayment', 'picto'=>'payment', 'enabled' => isModEnabled('bank'), 'perms' => $user->hasRight('banque', 'lire')), - 'selectloanspayment'=>array('label'=>'PaymentLoan','picto'=>'loan', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('loan', 'read')), + 'selectinvoices' => array('label' => 'Invoices', 'picto' => 'bill', 'lang' => 'bills', 'enabled' => isModEnabled('invoice'), 'perms' => $user->hasRight('facture', 'lire')), + 'selectsupplierinvoices' => array('label' => 'BillsSuppliers', 'picto' => 'supplier_invoice', 'lang' => 'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => $user->hasRight('fournisseur', 'facture', 'lire')), + 'selectexpensereports' => array('label' => 'ExpenseReports', 'picto' => 'expensereport', 'lang' => 'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => $user->hasRight('expensereport', 'lire')), + 'selectdonations' => array('label' => 'Donations', 'picto' => 'donation', 'lang' => 'donation', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('don', 'lire')), + 'selectsocialcontributions' => array('label' => 'SocialContributions', 'picto' => 'bill', 'enabled' => isModEnabled('tax'), 'perms' => $user->hasRight('tax', 'charges', 'lire')), + 'selectpaymentsofsalaries' => array('label' => 'SalariesPayments', 'picto' => 'salary', 'lang' => 'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => $user->hasRight('salaries', 'read')), + 'selectvariouspayment' => array('label' => 'VariousPayment', 'picto' => 'payment', 'enabled' => isModEnabled('bank'), 'perms' => $user->hasRight('banque', 'lire')), + 'selectloanspayment' => array('label' => 'PaymentLoan','picto' => 'loan', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('loan', 'read')), ); @@ -157,6 +158,9 @@ $listofchoices = array( //if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $filesarray = array(); + +'@phan-var-force array $filesarray'; + $result = false; if (($action == 'searchfiles' || $action == 'dl')) { if (empty($date_start)) { @@ -411,6 +415,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { $nofile['link'] = ''; $nofile['name'] = ''; + $filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile; } else { foreach ($files as $key => $file) { @@ -446,8 +451,8 @@ if (($action == 'searchfiles' || $action == 'dl')) { } $filesarray[$file['item'].'_'.$file['id']]['files'][] = array( 'link' => $link.urlencode($file['name']), - 'name'=>$file['name'], - 'ref'=>$file['ref'], + 'name' => $file['name'], + 'ref' => $file['ref'], 'fullname' => $file['fullname'], 'relpath' => '/'.$file['name'], 'relpathnamelang' => $langs->trans($file['item']).'/'.$file['name'], @@ -522,7 +527,7 @@ if ($result && $action == "dl" && !$error) { $zipname .= '_'.$project->ref; } } - $zipname .='_export.zip'; + $zipname .= '_export.zip'; dol_delete_file($zipname); @@ -689,6 +694,7 @@ if (!empty($date_start) && !empty($date_stop)) { } $TData = dol_sort_array($filesarray, $sortfield, $sortorder); + '@phan-var-force array $TData'; $filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip'; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 2a724f56d42..6713da39db7 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,12 +83,19 @@ class PaymentSocialContribution extends CommonObject public $bank_line; /** - * @deprecated + * @deprecated Use $amount instead. * @see $amount + * @var float|int */ public $total; + /** + * @var float|int + */ public $amount; // Total amount of payment + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -97,7 +105,7 @@ class PaymentSocialContribution extends CommonObject /** * @var string - * @deprecated + * @deprecated Use $num_payment instead * @see $num_payment */ public $num_paiement; @@ -318,8 +326,10 @@ class PaymentSocialContribution extends CommonObject $this->tms = $this->db->jdate($obj->tms); $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; + $this->total = $obj->amount; $this->fk_typepaiement = $obj->fk_typepaiement; $this->num_payment = $obj->num_payment; + $this->num_paiement = $obj->num_payment; $this->note_private = $obj->note; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; @@ -577,7 +587,7 @@ class PaymentSocialContribution extends CommonObject $acc = new Account($this->db); $acc->fetch($accountid); - $total = $this->total; + $total = $this->amount; if ($mode == 'payment_sc') { $total = -$total; } diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index f45cc80e909..c5fbf396667 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,12 +59,20 @@ class PaymentVAT extends CommonObject public $datep = ''; /** - * @deprecated + * @deprecated Use $amount instead * @see $amount + * @var float|int */ public $total; + /** + * @var float|int + */ public $amount; // Total amount of payment + + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -73,7 +82,7 @@ class PaymentVAT extends CommonObject /** * @var string - * @deprecated + * @deprecated Use $num_payment instead * @see $num_payment */ public $num_paiement; @@ -578,7 +587,7 @@ class PaymentVAT extends CommonObject $acc = new Account($this->db); $acc->fetch($accountid); - $total = $this->total; + $total = $this->amount; if ($mode == 'payment_vat') { $total = -$total; } diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index f480854dad8..8763f965a90 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,7 +66,13 @@ class PaymentExpenseReport extends CommonObject * @var int|string */ public $datep = ''; + /** + * @var float|int + */ public $amount; // Total amount of payment + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -94,7 +101,14 @@ class PaymentExpenseReport extends CommonObject */ public $fk_user_modif; + /** + * @var string + */ public $type_code; + + /** + * @var string + */ public $type_label; /** @@ -693,7 +707,7 @@ class PaymentExpenseReport extends CommonObject } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index f095f480a04..28a1d9f4060 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2014-2018 Alexandre Spangaro * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2020 Maxime DEMAREST + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,14 +63,23 @@ class PaymentLoan extends CommonObject public $datep = ''; /** - * @var array Array of amounts + * @var array Array of amounts */ public $amounts = array(); - public $amount_capital; // Total amount of payment + /** + * @var float|int Total amount of payment + */ + public $amount_capital; + /** + * @var float|int + */ public $amount_insurance; + /** + * @var float|int + */ public $amount_interest; /** @@ -98,10 +108,22 @@ class PaymentLoan extends CommonObject */ public $fk_user_modif; + /** + * @var string + */ public $type_code; + /** + * @var string + */ public $type_label; public $chid; + /** + * @var string + */ public $label; + /** + * @var string + */ public $paymenttype; public $bank_account; public $bank_line; @@ -666,7 +688,7 @@ class PaymentLoan extends CommonObject global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index e0630108c1a..e6515fa6c7d 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2023 anthony Berton + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,7 +95,7 @@ $next_month = $next['month']; $max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) -$tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday +$tmpday = - (int) date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1); if ($tmpday >= 1) { $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. @@ -398,13 +399,13 @@ if ($action == 'afteradd') { $numdayinweek = (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7); if (!empty($conf->dol_optimize_smallscreen)) { print ' '; - $labelshort = array(0=>'SundayMin', 1=>'MondayMin', 2=>'TuesdayMin', 3=>'WednesdayMin', 4=>'ThursdayMin', 5=>'FridayMin', 6=>'SaturdayMin'); + $labelshort = array(0 => 'SundayMin', 1 => 'MondayMin', 2 => 'TuesdayMin', 3 => 'WednesdayMin', 4 => 'ThursdayMin', 5 => 'FridayMin', 6 => 'SaturdayMin'); print $langs->trans($labelshort[$numdayinweek]); print ' '."\n"; } else { print ' '; //$labelshort = array(0=>'SundayMin', 1=>'MondayMin', 2=>'TuesdayMin', 3=>'WednesdayMin', 4=>'ThursdayMin', 5=>'FridayMin', 6=>'SaturdayMin'); - $labelshort = array(0=>'Sunday', 1=>'Monday', 2=>'Tuesday', 3=>'Wednesday', 4=>'Thursday', 5=>'Friday', 6=>'Saturday'); + $labelshort = array(0 => 'Sunday', 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday'); print $langs->trans($labelshort[$numdayinweek]); print ' '."\n"; } From 0f8b9e73f0eb8abeaae1164a110cf6ab6aa8251d Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 16:24:06 +0100 Subject: [PATCH 085/862] Fix: Enable/fix PhanPluginPrintfIncompatibleArgumentTypeWeak occurences # Fix: Enable/fix PhanPluginPrintfIncompatibleArgumentTypeWeak occurences Fix the PhanPluginPrintfIncompatibleArgumentTypeWeak occurences and fix the rule --- dev/tools/phan/config.php | 2 +- htdocs/compta/bank/annuel.php | 3 ++- htdocs/compta/resultat/result.php | 5 +++-- htdocs/core/modules/asset/mod_asset_standard.php | 4 +++- htdocs/core/modules/bom/mod_bom_standard.php | 3 ++- htdocs/core/modules/cheque/mod_chequereceipt_mint.php | 3 ++- htdocs/core/modules/commande/mod_commande_marbre.php | 3 ++- htdocs/core/modules/contract/mod_contract_serpis.php | 4 ++-- htdocs/core/modules/delivery/mod_delivery_jade.php | 3 ++- htdocs/core/modules/expedition/mod_expedition_safor.php | 3 ++- htdocs/core/modules/expensereport/mod_expensereport_jade.php | 3 ++- htdocs/core/modules/facture/mod_facture_mars.php | 5 +++-- htdocs/core/modules/facture/mod_facture_terre.php | 5 +++-- htdocs/core/modules/fichinter/mod_pacific.php | 3 ++- htdocs/core/modules/holiday/mod_holiday_madonna.php | 4 ++-- htdocs/core/modules/hrm/mod_evaluation_standard.php | 3 ++- htdocs/core/modules/member/mod_member_advanced.php | 4 ++-- htdocs/core/modules/mrp/mod_mo_standard.php | 3 ++- htdocs/core/modules/payment/mod_payment_cicada.php | 3 ++- htdocs/core/modules/product_batch/mod_lot_standard.php | 3 ++- htdocs/core/modules/product_batch/mod_sn_standard.php | 3 ++- htdocs/core/modules/project/mod_project_simple.php | 3 ++- htdocs/core/modules/project/task/mod_task_simple.php | 3 ++- htdocs/core/modules/propale/mod_propale_marbre.php | 3 ++- htdocs/core/modules/reception/mod_reception_beryl.php | 3 ++- htdocs/core/modules/societe/mod_codeclient_monkey.php | 2 +- .../modules/stocktransfer/mod_stocktransfer_standard.php | 3 ++- .../supplier_invoice/mod_facture_fournisseur_cactus.php | 5 +++-- .../supplier_order/mod_commande_fournisseur_muguet.php | 3 ++- .../modules/supplier_payment/mod_supplier_payment_bronan.php | 3 ++- .../supplier_proposal/mod_supplier_proposal_marbre.php | 3 ++- htdocs/core/modules/takepos/mod_takepos_ref_simple.php | 5 +++-- htdocs/core/modules/ticket/mod_ticket_simple.php | 3 ++- htdocs/core/modules/workstation/mod_workstation_standard.php | 3 ++- .../knowledgemanagement/mod_knowledgerecord_standard.php | 3 ++- .../core/modules/partnership/mod_partnership_standard.php | 3 ++- htdocs/product/list.php | 3 ++- .../recruitment/mod_recruitmentcandidature_standard.php | 3 ++- .../recruitment/mod_recruitmentjobposition_standard.php | 3 ++- 39 files changed, 82 insertions(+), 47 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 4771e953a36..4254d0c0585 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -495,7 +495,7 @@ return [ 'PhanTypeInvalidLeftOperandOfBitwiseOp', // 'PhanTypeMismatchDimAssignment', // 'PhanPluginDescriptionlessCommentOnProtectedMethod', - 'PhanPluginPrintfIncompatibleArgumentTypeWeak', + // 'PhanPluginPrintfIncompatibleArgumentTypeWeak', 'PhanUndeclaredVariableAssignOp', 'PhanTypeExpectedObjectOrClassName', 'PhanEmptyFQSENInClasslike', diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 5978fcc75b8..ff8260fce9d 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013-2023 Charlene BENKE + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -205,7 +206,7 @@ for ($mois = 1; $mois < 13; $mois++) { print "".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B").""; for ($annee = $year_start; $annee <= $year_end; $annee++) { - $case = sprintf("%04s-%02s", $annee, $mois); + $case = sprintf("%04d-%02d", $annee, $mois); print ' '; if (isset($decaiss[$case]) && $decaiss[$case] > 0) { diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 21fa04cc931..daa017a0130 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -3,6 +3,7 @@ * Copyright (C) 2016-2022 Alexandre Spangaro * Copyright (C) 2018-2020 Laurent Destailleur * Copyright (C) 2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -260,12 +261,12 @@ print ''.$langs->trans("PreviousPeriod").''; print ''.$langs->trans("SelectedPeriod").''; foreach ($months as $k => $v) { if (($k + 1) >= $date_startmonth && $k < $date_endmonth) { - print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k + 1))).''; + print ''.$langs->trans('MonthShort'.sprintf("%02d", ($k + 1))).''; } } foreach ($months as $k => $v) { if (($k + 1) < $date_startmonth) { - print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k + 1))).''; + print ''.$langs->trans('MonthShort'.sprintf("%02d", ($k + 1))).''; } } print ''; diff --git a/htdocs/core/modules/asset/mod_asset_standard.php b/htdocs/core/modules/asset/mod_asset_standard.php index bc0705840d3..d09748f158c 100644 --- a/htdocs/core/modules/asset/mod_asset_standard.php +++ b/htdocs/core/modules/asset/mod_asset_standard.php @@ -2,6 +2,8 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2022-2024 Frédéric France + * Copyright (C) 2022 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +158,7 @@ class mod_asset_standard extends ModeleNumRefAsset if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_asset_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php index 1e4c22fb754..69656164461 100644 --- a/htdocs/core/modules/bom/mod_bom_standard.php +++ b/htdocs/core/modules/bom/mod_bom_standard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -148,7 +149,7 @@ class mod_bom_standard extends ModeleNumRefBoms if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_bom_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 8cf6c383e65..3f760794750 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -145,7 +146,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 4bd0c9a9c33..71ccfb8915e 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -160,7 +161,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index 4c7979728e4..e0ffb17003c 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php'; */ class mod_contract_serpis extends ModelNumRefContracts { - // variables inherited from ModelNumRefContracts class public $name = 'Serpis'; public $version = 'dolibarr'; @@ -145,7 +145,7 @@ class mod_contract_serpis extends ModelNumRefContracts if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_contract_serpis::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/delivery/mod_delivery_jade.php b/htdocs/core/modules/delivery/mod_delivery_jade.php index df68b875e72..8cc8ec7f234 100644 --- a/htdocs/core/modules/delivery/mod_delivery_jade.php +++ b/htdocs/core/modules/delivery/mod_delivery_jade.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -163,7 +164,7 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_delivery_jade::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index af10ae43e45..a96b405e694 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -151,7 +152,7 @@ class mod_expedition_safor extends ModelNumRefExpedition if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_expedition_safor::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index e88aa5f6bf9..afbd1664e96 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -208,7 +209,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_expensereport_jade::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 2993ed9f37e..651181c8cfb 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -200,7 +201,7 @@ class mod_facture_mars extends ModeleNumRefFactures if ($max >= (pow(10, 4) - 1)) { $num = $max; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max); + $num = sprintf("%04d", $max); } $ref = ''; @@ -229,7 +230,7 @@ class mod_facture_mars extends ModeleNumRefFactures if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index f29607e5cd1..eef74993761 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -240,7 +241,7 @@ class mod_facture_terre extends ModeleNumRefFactures if ($max >= (pow(10, 4) - 1)) { $num = $max; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max); + $num = sprintf("%04d", $max); } $ref = ''; @@ -268,7 +269,7 @@ class mod_facture_terre extends ModeleNumRefFactures if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index 0f780ee2bb6..f721029b132 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +157,7 @@ class mod_pacific extends ModeleNumRefFicheinter if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } return $this->prefix.$yymm."-".$num; diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php index 06e63f42af8..c084f48e46d 100644 --- a/htdocs/core/modules/holiday/mod_holiday_madonna.php +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -2,6 +2,7 @@ /* Copyright (C) 2011 Juanjo Menent * Copyright (C) 2018-2023 Charlene Benke * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/holiday/modules_holiday.php'; */ class mod_holiday_madonna extends ModelNumRefHolidays { - // variables inherited from ModelNumRefHolidays class public $name = 'Madonna'; public $version = 'dolibarr'; @@ -146,7 +146,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/hrm/mod_evaluation_standard.php b/htdocs/core/modules/hrm/mod_evaluation_standard.php index 9a568923e44..9096edcd050 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_standard.php +++ b/htdocs/core/modules/hrm/mod_evaluation_standard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +157,7 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_evaluation_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/member/mod_member_advanced.php b/htdocs/core/modules/member/mod_member_advanced.php index 0547350208e..2e1de7e6b1e 100644 --- a/htdocs/core/modules/member/mod_member_advanced.php +++ b/htdocs/core/modules/member/mod_member_advanced.php @@ -1,6 +1,7 @@ * Copyright (C) 2022-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_member.class.php'; */ class mod_member_advanced extends ModeleNumRefMembers { - // variables inherited from ModeleNumRefMembers class public $name = 'Advanced'; public $version = 'dolibarr'; @@ -150,7 +150,7 @@ class mod_member_advanced extends ModeleNumRefMembers if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_member_advanced::getNextValue return ".$this->prefix.$yymm."-".$num, LOG_INFO); diff --git a/htdocs/core/modules/mrp/mod_mo_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php index 333491281cc..b835a07614f 100644 --- a/htdocs/core/modules/mrp/mod_mo_standard.php +++ b/htdocs/core/modules/mrp/mod_mo_standard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -148,7 +149,7 @@ class mod_mo_standard extends ModeleNumRefMos if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_mo_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index 6c90fec350a..5991cc2be93 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,7 +155,7 @@ class mod_payment_cicada extends ModeleNumRefPayments if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php index d3feb2e88c1..b09f6bc3ff5 100644 --- a/htdocs/core/modules/product_batch/mod_lot_standard.php +++ b/htdocs/core/modules/product_batch/mod_lot_standard.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2021 Christophe Battarel * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -150,7 +151,7 @@ class mod_lot_standard extends ModeleNumRefBatch if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; } else { // If counter > 9999, we do not format on 4 chars, we take number as it is - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_lot_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php index ae4d4efa965..6f5f673562e 100644 --- a/htdocs/core/modules/product_batch/mod_sn_standard.php +++ b/htdocs/core/modules/product_batch/mod_sn_standard.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2021 Christophe Battarel * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -150,7 +151,7 @@ class mod_sn_standard extends ModeleNumRefBatch if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; } else { // If counter > 9999, we do not format on 4 chars, we take number as it is - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_sn_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 1ef51d36c95..a411154425c 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -159,7 +160,7 @@ class mod_project_simple extends ModeleNumRefProjects if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_project_simple::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index e75fd1b5e8a..b523fefad8c 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +157,7 @@ class mod_task_simple extends ModeleNumRefTask if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_task_simple::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index 0da17182404..b601a7b1217 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -157,7 +158,7 @@ class mod_propale_marbre extends ModeleNumRefPropales if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog(get_class($this)."::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php index 1482d96f935..10b12439776 100644 --- a/htdocs/core/modules/reception/mod_reception_beryl.php +++ b/htdocs/core/modules/reception/mod_reception_beryl.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -131,7 +132,7 @@ class mod_reception_beryl extends ModelNumRefReception if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_reception_beryl::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index e46b5dc3f7a..9ddae66f284 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -137,7 +137,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode if ($max >= (pow(10, 5) - 1)) { $num = $max + 1; // If counter > 99999, we do not format on 5 chars, we take number as it is } else { - $num = sprintf("%05s", $max + 1); + $num = sprintf("%05d", $max + 1); } dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php index a270b7d8842..57e7f238fc2 100644 --- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php +++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -157,7 +158,7 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; } else { // If counter > 9999, we do not format on 4 chars, we take number as it is - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_stocktransfer_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 9a197b31aad..68b728b839c 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -4,6 +4,7 @@ * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2016 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -214,7 +215,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices if ($max >= (pow(10, 4) - 1)) { $num = $max; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max); + $num = sprintf("%04d", $max); } $ref = ''; @@ -242,7 +243,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index cd6d9f78d0e..bb9441afc34 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -166,7 +167,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } return $this->prefix.$yymm."-".$num; diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php index dba6eefb6b4..30f323ecc81 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,7 +156,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php index b71d9581a53..ad61e3a55b2 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -157,7 +158,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog(get_class($this)."::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php index 1629d0e779d..7ac31b4929e 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php @@ -4,6 +4,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2020 Open-DSI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -166,7 +167,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos if ($max >= (pow(10, 4) - 1)) { $num = $max; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max); + $num = sprintf("%04d", $max); } $ref = ''; @@ -194,7 +195,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog(get_class($this)."::getNextValue return ".$this->prefix.$pos_source.'-'.$yymm.'-'.$num); diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php index 3d0c057870d..8c476eb91a7 100644 --- a/htdocs/core/modules/ticket/mod_ticket_simple.php +++ b/htdocs/core/modules/ticket/mod_ticket_simple.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +157,7 @@ class mod_ticket_simple extends ModeleNumRefTicket $num = $max + 1; } else { // If counter > 9999, we do not format on 4 chars, we take number as it is - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_ticket_simple::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/core/modules/workstation/mod_workstation_standard.php b/htdocs/core/modules/workstation/mod_workstation_standard.php index d5d6c40e459..c68952f36a6 100644 --- a/htdocs/core/modules/workstation/mod_workstation_standard.php +++ b/htdocs/core/modules/workstation/mod_workstation_standard.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2020 Gauthier VERDOL * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -146,7 +147,7 @@ class mod_workstation_standard extends ModeleNumRefWorkstation if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_workstation_standard::getNextValue return ".$this->prefix."-".$num); diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php index 3d509d7d25c..c4652df83b1 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,7 +155,7 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_knowledgerecord_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php index 92c39356a7f..9dd883cd2fb 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,7 +155,7 @@ class mod_partnership_standard extends ModeleNumRefPartnership if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_partnership_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 1fe8ae87fa5..7d387457b23 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -14,6 +14,7 @@ * Copyright (C) 2020-2021 Open-DSI * Copyright (C) 2022 Charlene Benke * Copyright (C) 2020-2023 Alexandre Spangaro + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -296,7 +297,7 @@ if (getDolGlobalString('PRODUIT_MULTIPRICES')) { } else { $labelp = $langs->transnoentitiesnoconv("SellingPrice")." ".$i; } - $arrayfields['p.sellprice'.$i] = array('label' => $labelp, 'checked' => ($i == 1 ? 1 : 0), 'enabled' => getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => (float) ('40.'.sprintf('%03s', $i))); + $arrayfields['p.sellprice'.$i] = array('label' => $labelp, 'checked' => ($i == 1 ? 1 : 0), 'enabled' => getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => (float) ('40.'.sprintf('%03d', $i))); $arraypricelevel[$i] = array($i); } } diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php index 6a7b4d8c510..cb46d8323df 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,7 +156,7 @@ class mod_recruitmentcandidature_standard extends ModeleNumRefRecruitmentCandida if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_recruitmentcandidature_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php index 50c2ab775e7..e95cfbb2ee8 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,7 +156,7 @@ class mod_recruitmentjobposition_standard extends ModeleNumRefRecruitmentJobPosi if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_recruitmentjobposition_standard::getNextValue return ".$this->prefix.$yymm."-".$num); From 0872f825eca2e55ec866fb03bf0a12a9b0407b1a Mon Sep 17 00:00:00 2001 From: jyhere Date: Fri, 15 Mar 2024 09:10:17 +0100 Subject: [PATCH 086/862] FIX: use getDolGlobalInt --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 7b8092ef81d..b06415364a6 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -137,7 +137,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con }); /* Autofill the code with label */ - global->MAIN_EXTRAFIELDS_CODE_AUTOFILL_DISABLED)) : ?> + jQuery("#label").keyup(function() { console.log("Update new field"); $("#attrname").val( $(this).val().normalize('NFD').replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, '').toLowerCase() ); From 5cdf7c73b1ee38c836a30e6ec12be06ce7b95b1d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 15 Mar 2024 09:22:46 +0100 Subject: [PATCH 087/862] NEW: Label on Price fix:#28544 --- htdocs/product/price.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 8c0acb88b58..40bbfdecd51 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1760,6 +1760,7 @@ if ((!getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || $action == 'showlog_defau } print ''.$langs->trans("MinPrice").' '.$langs->trans("HT").''; print ''.$langs->trans("MinPrice").' '.$langs->trans("TTC").''; + print ''.$langs->trans("Label").''; print ''.$langs->trans("ChangedBy").''; if ($user->hasRight('produit', 'supprimer')) { print ' '; @@ -2318,7 +2319,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { print ''."\n"; if (count($prodcustprice->lines) > 0 || $search_soc) { - $colspan = 9; + $colspan = 10; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { $colspan++; } From 09e75b6c901608dd5bf93848e654fdb39d194524 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 15 Mar 2024 09:24:45 +0100 Subject: [PATCH 088/862] NEW: Label on Price fix:#28544 --- htdocs/langs/en_US/products.lang | 1 + htdocs/langs/fr_FR/products.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 93bf150de17..dbdc58acdcb 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -437,3 +437,4 @@ AllowStockMovementVariantParent=Also records stock movements on parent products AllowStockMovementVariantParentHelp=By default, a parent of a variant is a virtual product, so no stock is managed for it. By enabling this option, a stock will be managed for parent products and each time a stock quantity is modified for a variant product, the same quantity will be modified for the parent product. You should not need this option, except if you are using variant to manage the same product than parent (but with different descriptions, prices...) ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?
The quantities currently set in the inventory will be reset. WarningLineProductNotToSell=Product or service "%s" is not to sell and was cloned +PriceLabel=Price label diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index b794cbde418..a939cc392ba 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -436,3 +436,4 @@ WarningConvertFromBatchToSerial=Si vous disposez actuellement d'une quantité su AllowStockMovementVariantParent=Enregistre également les mouvements de stock sur les produits parent des produits variants AllowStockMovementVariantParentHelp=Par défaut, un parent d'une variante est un produit virtuel, donc aucun stock n'est géré pour celui-ci. En activant cette option, un stock sera géré pour les produits parents et à chaque fois qu'une quantité de stock est modifiée pour une variante de produit, la même quantité sera modifiée pour le produit parent. Vous ne devriez pas avoir besoin de cette option, sauf si vous utilisez une variante pour gérer le même produit que le parent (mais avec des descriptions, des prix différents...) ConfirmSetToDraftInventory=Êtes-vous sûr de vouloir revenir à l'état de brouillon ?
Les quantités actuellement définies dans l'inventaire seront réinitialisées. +PriceLabel=Libellé du prix From 3384a0b84760aeff1a6d8f7e3307eff170efee6e Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 04:22:49 +0100 Subject: [PATCH 089/862] Fix & enable PhanUndeclaredTypeReturnType # Fix & enable PhanUndeclaredTypeReturnType One typo, and replace 'number' with int or int|float --- dev/tools/phan/config.php | 2 +- .../accountancy/class/bookkeeping.class.php | 2 +- .../sociales/class/chargesociales.class.php | 2 +- htdocs/core/class/evalmath.class.php | 17 ++++--- htdocs/core/lib/pdf.lib.php | 51 ++++++++++--------- htdocs/install/inc.php | 2 +- 6 files changed, 40 insertions(+), 36 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 4232427191a..9e5069ba4b4 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -604,7 +604,7 @@ return [ // 'PhanTypeMismatchPropertyDefault', // 'PhanPluginAlwaysReturnMethod', // 'PhanPluginMissingReturnMethod', - 'PhanUndeclaredTypeReturnType', + // 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredClassProperty', 'PhanTypeArraySuspiciousNullable', // 'PhanPluginInconsistentReturnMethod', diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6d47b7fe700..6a261a146cd 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1514,7 +1514,7 @@ class BookKeeping extends CommonObject * @param string $field Field * @param string $value Value * @param string $mode Mode ('' or _tmp') - * @return number Return integer <0 if KO, >0 if OK + * @return int Return integer <0 if KO, >0 if OK */ public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '') { diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index b08bcacfc9a..153cb7d53ff 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -407,7 +407,7 @@ class ChargeSociales extends CommonObject * Calculate amount remaining to pay by year * * @param int $year Year - * @return number + * @return int|float */ public function solde($year = 0) { diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index e47e7e7acd1..84fc25781a7 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -57,6 +57,9 @@ * * AUTHOR INFORMATION * Copyright 2005, Miles Kaufmann. + * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * LICENSE * Redistribution and use in source and binary forms, with or without @@ -129,7 +132,7 @@ class EvalMath * Evaluate * * @param string $expr String - * @return boolean|number|NULL|mixed Result + * @return boolean|int|float|NULL|mixed Result */ public function e($expr) { @@ -140,7 +143,7 @@ class EvalMath * Evaluate * * @param string $expr String - * @return boolean|number|NULL|mixed Result + * @return boolean|int|float|NULL|mixed Result */ public function evaluate($expr) { @@ -166,8 +169,8 @@ class EvalMath } $this->v[$matches[1]] = $tmp; // if so, stick it in the variable array return $this->v[$matches[1]]; // and return the resulting value - // =============== - // is it a function assignment? + // =============== + // is it a function assignment? } elseif (preg_match('/^\s*([a-z]\w*)\s*\(\s*([a-z]\w*(?:\s*,\s*[a-z]\w*)*)\s*\)\s*=\s*(.+)$/', $expr, $matches)) { $fnn = $matches[1]; // get the function name if (in_array($matches[1], $this->fb)) { // make sure it isn't built in @@ -252,7 +255,7 @@ class EvalMath while (1) { // 1 Infinite Loop ;) $op = substr($expr, $index, 1); // get the first character at the current index - // find out if we're currently at the beginning of a number/variable/function/parenthesis/operand + // find out if we're currently at the beginning of a number/variable/function/parenthesis/operand $match = array(); $ex = preg_match('/^([a-z]\w*\(?|\d+(?:\.\d*)?|\.\d+|\()/', substr($expr, $index), $match); // =============== @@ -261,7 +264,7 @@ class EvalMath $index++; } elseif ($op == '_') { // we have to explicitly deny this, because it's legal on the stack return $this->trigger(4, "illegal character '_'", "_"); // but not in the input expression - // =============== + // =============== } elseif ((in_array($op, $ops) or $ex) and $expecting_op) { // are we putting an operator on the stack? if ($ex) { // are we expecting an operator but have a number/variable/function/opening parenthesis? $op = '*'; @@ -427,7 +430,7 @@ class EvalMath } eval('$stack->push('.$fnn.'($op1));'); // perfectly safe eval() } elseif (array_key_exists($fnn, $this->f)) { // user function - // get args + // get args $args = array(); for ($i = count($this->f[$fnn]['args']) - 1; $i >= 0; $i--) { if (is_null($args[$this->f[$fnn]['args'][$i]] = $stack->pop())) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ed3f5f8ef05..d7bc551cd5c 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -14,6 +14,7 @@ * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2021-2022 Anthony Berton * Copyright (C) 2023 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -113,7 +114,7 @@ function pdf_getFormat(Translate $outputlangs = null, $mode = 'setup') } //print "pdfformat=".$pdfformat." width=".$width." height=".$height." unit=".$unit; - return array('width'=>$width, 'height'=>$height, 'unit'=>$unit); + return array('width' => $width, 'height' => $height, 'unit' => $unit); } /** @@ -309,7 +310,7 @@ function pdf_getPDFFontSize($outputlangs) * * @param string $logo Full path to logo file to use * @param bool $url Image with url (true or false) - * @return number + * @return int|float */ function pdf_getHeightForLogo($logo, $url = false) { @@ -1219,7 +1220,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // For customize footer if (is_object($hookmanager)) { - $parameters = array('line1' => $line1, 'line2' => $line2, 'line3' => $line3, 'line4' => $line4, 'outputlangs'=>$outputlangs); + $parameters = array('line1' => $line1, 'line2' => $line2, 'line3' => $line3, 'line4' => $line4, 'outputlangs' => $outputlangs); $action = ''; $hookmanager->executeHooks('pdf_pagefoot', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (!empty($hookmanager->resPrint) && $hidefreetext == 0) { @@ -1433,7 +1434,7 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('pdf'=>$pdf, 'i'=>$i, 'outputlangs'=>$outputlangs, 'w'=>$w, 'h'=>$h, 'posx'=>$posx, 'posy'=>$posy, 'hideref'=>$hideref, 'hidedesc'=>$hidedesc, 'issupplierline'=>$issupplierline, 'special_code'=>$special_code); + $parameters = array('pdf' => $pdf, 'i' => $i, 'outputlangs' => $outputlangs, 'w' => $w, 'h' => $h, 'posx' => $posx, 'posy' => $posy, 'hideref' => $hideref, 'hidedesc' => $hidedesc, 'issupplierline' => $issupplierline, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_writelinedesc', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -1572,7 +1573,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $libelleproduitservice = dol_concatdesc( dol_concatdesc($libelleproduitservice, " * ".$subprodval[3]), (!empty($qtyText) ? - $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText : + $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText : $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1]) ); } @@ -1581,7 +1582,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $libelleproduitservice = dol_concatdesc( dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]), (!empty($qtyText) ? - $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText : + $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText : $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1]) ); } @@ -1826,7 +1827,7 @@ function pdf_getlinenum($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlinenum', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $result .= $hookmanager->resPrint; @@ -1859,7 +1860,7 @@ function pdf_getlineref($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlineref', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $result .= $hookmanager->resPrint; @@ -1891,7 +1892,7 @@ function pdf_getlineref_supplier($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlineref_supplier', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $result .= $hookmanager->resPrint; @@ -1923,7 +1924,7 @@ function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlinevatrate', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -1990,7 +1991,7 @@ function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlineupexcltax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -2033,7 +2034,7 @@ function pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlineupwithtax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -2070,7 +2071,7 @@ function pdf_getlineqty($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlineqty', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -2110,7 +2111,7 @@ function pdf_getlineqty_asked($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlineqty_asked', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -2150,7 +2151,7 @@ function pdf_getlineqty_shipped($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -2190,7 +2191,7 @@ function pdf_getlineqty_keeptoship($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -2275,7 +2276,7 @@ function pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlineremisepercent', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -2372,7 +2373,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code, 'sign'=>$sign); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code, 'sign' => $sign); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -2428,7 +2429,7 @@ function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 0) if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } - $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); + $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -2588,7 +2589,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs) // For add external linked objects if (is_object($hookmanager)) { - $parameters = array('linkedobjects' => $linkedobjects, 'outputlangs'=>$outputlangs); + $parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs); $action = ''; $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (!empty($hookmanager->resArray)) { @@ -2625,7 +2626,7 @@ function pdf_getSizeForImage($realpath) $height = $maxheight; } } - return array('width'=>$width, 'height'=>$height); + return array('width' => $width, 'height' => $height); } /** @@ -2655,10 +2656,10 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = } $parameters = array( - 'i'=>$i, - 'outputlangs'=>$outputlangs, - 'hidedetails'=>$hidedetails, - 'special_code'=>$special_code + 'i' => $i, + 'outputlangs' => $outputlangs, + 'hidedetails' => $hidedetails, + 'special_code' => $special_code ); $action = ''; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index d896cae320c..871030cb774 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -164,7 +164,7 @@ if (php_sapi_name() === "cli" && (float) PHP_VERSION > 7.0) { /** * Previx option with '-' for single characters and -- for more than single characters * @param string $arg - * @return straing + * @return string */ static function ($arg) { if (strlen($arg) > 1) { From 74ab4b5a54b0afce87d0d0455dc3e07b8629ba9e Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 04:10:57 +0100 Subject: [PATCH 090/862] Fix typo in typing # Fix typo in typing Fix typo in typing straing->string. --- htdocs/install/inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index d896cae320c..871030cb774 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -164,7 +164,7 @@ if (php_sapi_name() === "cli" && (float) PHP_VERSION > 7.0) { /** * Previx option with '-' for single characters and -- for more than single characters * @param string $arg - * @return straing + * @return string */ static function ($arg) { if (strlen($arg) > 1) { From 23fecf4524f3424bc5b79bd7bc9540fd73e925a3 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 19:25:55 +0100 Subject: [PATCH 091/862] Fix Add to errors, not error which is not an array --- htdocs/contrat/class/contrat.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 232084addce..53102bc5a07 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1657,7 +1657,7 @@ class Contrat extends CommonObject $contractline->id = $contractlineid; $result = $contractline->insertExtraFields(); if ($result < 0) { - $this->error[] = $contractline->error; + $this->errors[] = $contractline->error; $error++; } } @@ -1851,7 +1851,7 @@ class Contrat extends CommonObject $result = $contractline->insertExtraFields(); if ($result < 0) { - $this->error[] = $contractline->error; + $this->errors[] = $contractline->error; $error++; } } From b28a17ee5195c2290a81a9424f75859d1f9fcc25 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 19:28:10 +0100 Subject: [PATCH 092/862] Fix Assign to error as string, not to error as array --- htdocs/variants/class/ProductCombination.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index ef23ce4857d..7e183f75362 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -884,7 +884,7 @@ class ProductCombination if ($result < 0) { //In case the error is not related with an already existing product if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->error[] = $newproduct->error; + $this->error = $newproduct->error; $this->errors = $newproduct->errors; $this->db->rollback(); return -1; From b57b4c8f1733fd578350862965417d1a1e05cd14 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 19:42:07 +0100 Subject: [PATCH 093/862] Qual: Improve typing hints, in particular sendtoid --- htdocs/core/class/commonobject.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 44de1d12109..9b4c10a21fd 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -226,13 +226,13 @@ abstract class CommonObject /** * @var Project The related project object - * @deprecated - * @see project + * @deprecated Use $project instead + * @see $project */ public $projet; /** - * @deprecated + * @deprecated Use $fk_project instead * @see $fk_project */ public $fk_projet; @@ -322,7 +322,7 @@ abstract class CommonObject /** * @var int The object's status. Use status instead. - * @deprecated + * @deprecated Use $status instead * @see setStatut() */ public $statut; @@ -369,7 +369,7 @@ abstract class CommonObject /** * var int State ID - * @deprecated Use state_id. We can remove this property when the field 'fk_departement' have been renamed into 'state_id' in all tables + * @deprecated Use $state_id. We can remove this property when the field 'fk_departement' have been renamed into 'state_id' in all tables */ public $fk_departement; @@ -447,7 +447,7 @@ abstract class CommonObject /** * @var int Payment terms ID - * @deprecated Kept for compatibility + * @deprecated Use $cond_reglement_id instead - Kept for compatibility * @see cond_reglement_id; */ public $cond_reglement; @@ -730,13 +730,13 @@ abstract class CommonObject public $specimen = 0; /** - * @var int Id of contact to send object (used by the trigger of module Agenda) + * @var int[] Id of contacts to send objects (mails, etc.) */ public $sendtoid; /** * @var float Amount already paid from getSommePaiement() (used to show correct status) - * @deprecated Duplicate of $totalpaid + * @deprecated Use $totalpaid instead */ public $alreadypaid; /** From 6ab1e6e7d91d10f919d2bf818a262c2f8e247596 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 19:43:34 +0100 Subject: [PATCH 094/862] Qual: Add typing information --- htdocs/core/actions_sendmails.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 2a5dc287f2b..58a877cca75 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * Copyright (C) 2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -29,6 +30,10 @@ // $triggersendname must be set (can be '') // $actiontypecode can be set // $object and $uobject may be defined +' +@phan-var-force Societe $mysoc +@phan-var-force CommonObject $object +'; /* * Add file in email form @@ -357,7 +362,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $substitutionarray['__EMAIL__'] = $sendto; $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; - $parameters = array('mode'=>'formemail'); + $parameters = array('mode' => 'formemail'); complete_substitutions_array($substitutionarray, $langs, $object, $parameters); $subject = make_substitutions($subject, $substitutionarray); From db0134183de93f8263f25e811578bd947d7c633c Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 19:57:49 +0100 Subject: [PATCH 095/862] Qual: improve hist typing --- htdocs/core/lib/company.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 0e9927aad5d..2c82eec316b 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2043,6 +2043,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr } } + '@phan-var-force array,datestart:int,dateend:int,fk_element:string,elementtype:string,contact_id:string,lastname:string,firstname:string,contact_photo:string,socpeaopleassigned:int[],login:string,userfirstname:string,userlastname:string,userphoto:string}> $histo'; + if (isModEnabled('agenda') || (isModEnabled('mailing') && !empty($objcon->email))) { $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60; From 07d63e5bf376b4c3f01918ee2ef04ae7ead3df3f Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 20:02:25 +0100 Subject: [PATCH 096/862] Fix Add to errors, not error which is not an array --- htdocs/delivery/class/delivery.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index b4d139a0120..d57a25e96ba 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -615,7 +616,7 @@ class Delivery extends CommonObject $result = $line->insertExtraFields(); if ($result < 0) { - $this->error[] = $line->error; + $this->errors[] = $line->error; $error++; } } @@ -826,7 +827,7 @@ class Delivery extends CommonObject global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From 29644f2ae869c353ee59e0a64df6871d0ec1d5d9 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 20:05:00 +0100 Subject: [PATCH 097/862] Fix Add to errors, not error which is not an array --- htdocs/partnership/class/partnership.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 51e44645703..b03747a8129 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -205,7 +205,7 @@ class Partnership extends CommonObject public function create(User $user, $notrigger = 0) { if ($this->fk_soc <= 0 && $this->fk_member <= 0) { - $this->error[] = "ErrorThirpdartyOrMemberidIsMandatory"; + $this->errors[] = "ErrorThirpdartyOrMemberidIsMandatory"; return -1; } @@ -522,7 +522,7 @@ class Partnership extends CommonObject public function update(User $user, $notrigger = 0) { if ($this->fk_soc <= 0 && $this->fk_member <= 0) { - $this->error[] = "ErrorThirpdartyOrMemberidIsMandatory"; + $this->errors[] = "ErrorThirpdartyOrMemberidIsMandatory"; // Mistyping in key is in translations return -1; } if (empty($this->fk_user_creat)) { // For the case the object was created with empty user (from public page). From 18c4bfd808d03afc4347c9db8e4bbfb89002ea9e Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 20:08:10 +0100 Subject: [PATCH 098/862] Fix Initialise ->error as '' --- .../dynamic_price/class/price_global_variable_updater.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index c0ec8226e3d..11b8b1db214 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ion Agorria * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 59abbda92ff3604af9877b137b2f3e5a8210e882 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 20:16:45 +0100 Subject: [PATCH 099/862] Fix Assign 0 to fk_bank not null (dolibarr's way) --- htdocs/expensereport/payment/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index bd3ba374d76..c1f474af0db 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -12,6 +12,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 575e620300ef502c790d645375bdc6a9f10e299c Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 20:19:01 +0100 Subject: [PATCH 100/862] Fix Assign 0 to fk_project, not null (dolibarr's way) --- htdocs/fourn/class/fournisseur.facture.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index cd90cf86179..8084c99c40b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1196,9 +1197,9 @@ class FactureFournisseur extends CommonInvoice } if (isset($this->fk_project)) { if (empty($this->fk_project)) { - $this->fk_project = null; + $this->fk_project = 0; } else { - $this->fk_project = intval($this->fk_project); + $this->fk_project = (int) $this->fk_project; } } if (isset($this->cond_reglement_id)) { From cc5207a5316e42d4ce0ec2a7b6f5f2fe5cea114a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 20:20:38 +0100 Subject: [PATCH 101/862] Fix rate can be null --- htdocs/multicurrency/class/multicurrency.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index f2ff645052c..ed4affb4e1a 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -90,7 +91,7 @@ class MultiCurrency extends CommonObject public $fk_user; /** - * @var CurrencyRate|null The currency rate + * @var ?CurrencyRate The currency rate */ public $rate; From 3e49424f2fc04e76d3f83310512432ae4630df4c Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 20:29:05 +0100 Subject: [PATCH 102/862] Fix finished can be null && defautl fk is 0 --- htdocs/product/card.php | 2 +- htdocs/product/class/product.class.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 086163975a3..0f37edaf398 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -807,7 +807,7 @@ if (empty($reshook)) { if ($fk_default_bom >= 0) { $object->fk_default_bom = $fk_default_bom; } else { - $object->fk_default_bom = null; + $object->fk_default_bom = 0; } $units = GETPOSTINT('units'); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5c59e925394..dc69488ce8b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -310,7 +310,7 @@ class Product extends CommonObject /** * Status indicates whether the product is on sale '1' or not '0' * @var int - * @deprecated + * @deprecated Use $status instead * @see $status */ public $tosell; @@ -325,7 +325,7 @@ class Product extends CommonObject /** * Status indicate whether the product is available for purchase '1' or not '0' * @var int - * @deprecated + * @deprecated Use $status_buy instead * @see $status_buy */ public $tobuy; @@ -333,7 +333,7 @@ class Product extends CommonObject /** * Status indicates whether the product is a finished product '1' or a raw material '0' * - * @var int + * @var ?int */ public $finished; From 8cc6b3133778c7495f6e77c2e07a7f5b8975dec1 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 21:25:44 +0100 Subject: [PATCH 103/862] Fix empty label is '', not null --- htdocs/public/stripe/ipn.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 1cbedcc9342..0b78780cfe4 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -2,6 +2,7 @@ /* Copyright (C) 2018-2020 Thibault FOUCART * Copyright (C) 2018 Fédéric France * Copyright (C) 2023 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -689,7 +690,7 @@ if ($event->type == 'payout.created') { $companypaymentmode->stripe_card_ref = $db->escape($event->data->object->id); $companypaymentmode->fk_soc = $idthirdparty; $companypaymentmode->bank = null; - $companypaymentmode->label = null; + $companypaymentmode->label = ''; $companypaymentmode->number = $db->escape($event->data->object->id); $companypaymentmode->last_four = $db->escape($event->data->object->card->last4); $companypaymentmode->card_type = $db->escape($event->data->object->card->branding); @@ -725,7 +726,7 @@ if ($event->type == 'payout.created') { if ($companypaymentmode->id > 0) { // If we found a payment mode with the ID $companypaymentmode->bank = null; - $companypaymentmode->label = null; + $companypaymentmode->label = ''; $companypaymentmode->number = $db->escape($event->data->object->id); $companypaymentmode->last_four = $db->escape($event->data->object->card->last4); $companypaymentmode->proprio = $db->escape($event->data->object->billing_details->name); From 6a606bf7c11f033059a2663d761411d5ae2a0a20 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 21:34:07 +0100 Subject: [PATCH 104/862] Adjust typing for 'origin' & 'origin_object' --- htdocs/core/class/commonobject.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9b4c10a21fd..ea197a8d0d0 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -274,13 +274,13 @@ abstract class CommonObject public $origin_id; /** - * @var Object Origin object. This is set by fetch_origin() from this->origin and this->origin_id. + * @var ?CommonObject Origin object. This is set by fetch_origin() from this->origin and this->origin_id. */ public $origin_object; /** - * @var string|CommonObject Sometime the type of the originating object ('commande', 'facture', ...), sometime the object (like onh MouvementStock) - * @deprecated Use now $origin_type and $origin_id; + * @var CommonObject|string|null Sometimes the type of the originating object ('commande', 'facture', ...), sometimes the object (as with MouvementStock) + * @deprecated Use now $origin_type and $origin_id; * @see fetch_origin() */ public $origin; From c31c883a9175e057d6ef7432fdd5d8b2bb6f3f02 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 21:37:09 +0100 Subject: [PATCH 105/862] Ensure typing for commandeFournisseur matches --- htdocs/reception/class/reception.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 5d7b262f22e..67e29c85fc1 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Quentin Vial-Gouteyron * Copyright (C) 2022-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -125,7 +126,7 @@ class Reception extends CommonObject public $listmeths; // List of carriers /** - * @var CommandeFournisseur + * @var ?CommandeFournisseur */ public $commandeFournisseur; @@ -731,7 +732,11 @@ class Reception extends CommonObject $this->fetch_origin(); if (empty($this->origin_object->lines)) { $res = $this->origin_object->fetch_lines(); - $this->commandeFournisseur = $this->origin_object; // deprecated + if ($this->origin_object instanceof CommandeFournisseur) { + $this->commandeFournisseur = $this->origin_object; // deprecated + } else { + $this->commandeFournisseur = null; // deprecated + } if ($res < 0) { return $res; } @@ -742,7 +747,7 @@ class Reception extends CommonObject $qty_wished = array(); $supplierorderdispatch = new CommandeFournisseurDispatch($this->db); - $filter = array('t.fk_commande'=>$this->origin_id); + $filter = array('t.fk_commande' => $this->origin_id); if (getDolGlobalInt('SUPPLIER_ORDER_USE_DISPATCH_STATUS')) { $filter['t.status'] = 1; // Restrict to lines with status validated } @@ -1305,7 +1310,7 @@ class Reception extends CommonObject global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From b072966cc8cd8e787c91d08cabb38b7c4eaf091c Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 21:40:27 +0100 Subject: [PATCH 106/862] Fix Initialise id to 0 and ref to '' --- htdocs/salaries/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 0159b9b93a9..4e7024d83c2 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -402,7 +402,8 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) { if ($object->id > 0) { $object->paye = 0; - $object->id = $object->ref = null; + $object->id = 0; + $object->ref = ''; if (GETPOST('amount', 'alphanohtml')) { $object->amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT', 2); From e36dccff599fd722c507068d5aef91186efc77d9 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 21:46:14 +0100 Subject: [PATCH 107/862] Qual: better typing for getCountry() --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2c82eec316b..bae98beff93 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -524,7 +524,7 @@ function societe_admin_prepare_head() * @param Translate $outputlangs Langs object for output translation * @param int $entconv 0=Return value without entities and not converted to output charset, 1=Ready for html output * @param string $searchlabel Label of country to search (warning: searching on label is not reliable) - * @return mixed Integer with country id or String with country code or translated country name or Array('id','code','label') or 'NotDefined' + * @return int|string|array{id:int,code:string,label:string} Integer with country id or String with country code or translated country name or Array('id','code','label') or 'NotDefined' */ function getCountry($searchkey, $withcode = '', $dbtouse = null, $outputlangs = null, $entconv = 1, $searchlabel = '') { From 4e05ac84f147b878e80f890646ec71f08f85af11 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 21:55:43 +0100 Subject: [PATCH 108/862] Init code_client and code_fournisseur to '', not null --- htdocs/societe/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8eda5988f80..52921b28c80 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -562,12 +562,12 @@ if (empty($reshook)) { } else { if ($result == -3 && in_array('ErrorCustomerCodeAlreadyUsed', $object->errors)) { $duplicate_code_error = true; - $object->code_client = null; + $object->code_client = ''; } if ($result == -3 && in_array('ErrorSupplierCodeAlreadyUsed', $object->errors)) { $duplicate_code_error = true; - $object->code_fournisseur = null; + $object->code_fournisseur = ''; } if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { // TODO Sometime errors on duplicate on profid and not on code, so we must manage this case From 7025738db859466d284810e16ca4e82b4ef14b35 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 22:00:55 +0100 Subject: [PATCH 109/862] Fix fields initialisation --- .../class/companybankaccount.class.php | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 86bbab8910c..a30927fafb3 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -94,43 +94,43 @@ class CompanyBankAccount extends Account 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'picto' => 'company', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 25, 'notnull' => 0, 'visible' => -1,), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => -1,), - 'label' => array('type' => 'varchar(200)', 'label' => 'Label', 'enabled' => 1, 'position' => 35, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1', 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist' => 'tdoverflowmax150',), - 'bank' => array('type' => 'varchar(255)', 'label' => 'Bank', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'code_banque' => array('type' => 'varchar(128)', 'label' => 'Codebanque', 'enabled' => 1, 'position' => 45, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'code_guichet' => array('type' => 'varchar(6)', 'label' => 'Codeguichet', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'number' => array('type' => 'varchar(255)', 'label' => 'Number', 'enabled' => 1, 'position' => 55, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'cle_rib' => array('type' => 'varchar(5)', 'label' => 'Clerib', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'bic' => array('type' => 'varchar(20)', 'label' => 'Bic', 'enabled' => 1, 'position' => 65, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'iban_prefix' => array('type' => 'varchar(34)', 'label' => 'Ibanprefix', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'domiciliation' => array('type' => 'varchar(255)', 'label' => 'Domiciliation', 'enabled' => 1, 'position' => 75, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'proprio' => array('type' => 'varchar(60)', 'label' => 'Proprio', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'owner_address' => array('type' => 'varchar(255)', 'label' => 'Owneraddress', 'enabled' => 1, 'position' => 85, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'default_rib' => array('type' => 'smallint(6)', 'label' => 'Defaultrib', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => -1, 'alwayseditable' => '1',), - 'state_id' => array('type' => 'integer', 'label' => 'Stateid', 'enabled' => 1, 'position' => 95, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'fk_country' => array('type' => 'integer', 'label' => 'Fkcountry', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1', 'css' => 'maxwidth500 widthcentpercentminusxx',), - 'currency_code' => array('type' => 'varchar(3)', 'label' => 'Currencycode', 'enabled' => 1, 'position' => 105, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'rum' => array('type' => 'varchar(32)', 'label' => 'Rum', 'enabled' => 1, 'position' => 110, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'date_rum' => array('type' => 'date', 'label' => 'Daterum', 'enabled' => 1, 'position' => 115, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'frstrecur' => array('type' => 'varchar(16)', 'label' => 'Frstrecur', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 900, 'notnull' => 0, 'visible' => -2, 'alwayseditable' => '1',), - 'last_four' => array('type' => 'varchar(4)', 'label' => 'Lastfour', 'enabled' => 1, 'position' => 130, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'card_type' => array('type' => 'varchar(255)', 'label' => 'Cardtype', 'enabled' => 1, 'position' => 135, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'cvn' => array('type' => 'varchar(255)', 'label' => 'Cvn', 'enabled' => 1, 'position' => 140, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'exp_date_month' => array('type' => 'integer', 'label' => 'Expdatemonth', 'enabled' => 1, 'position' => 145, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'exp_date_year' => array('type' => 'integer', 'label' => 'Expdateyear', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'country_code' => array('type' => 'varchar(10)', 'label' => 'Countrycode', 'enabled' => 1, 'position' => 155, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'approved' => array('type' => 'integer', 'label' => 'Approved', 'enabled' => 1, 'position' => 160, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'position' => 165, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'ending_date' => array('type' => 'date', 'label' => 'Endingdate', 'enabled' => 1, 'position' => 170, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'max_total_amount_of_all_payments' => array('type' => 'double(24,8)', 'label' => 'Maxtotalamountofallpayments', 'enabled' => 1, 'position' => 175, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'preapproval_key' => array('type' => 'varchar(255)', 'label' => 'Preapprovalkey', 'enabled' => 1, 'position' => 180, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'starting_date' => array('type' => 'date', 'label' => 'Startingdate', 'enabled' => 1, 'position' => 185, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'total_amount_of_all_payments' => array('type' => 'double(24,8)', 'label' => 'Totalamountofallpayments', 'enabled' => 1, 'position' => 190, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'stripe_card_ref' => array('type' => 'varchar(128)', 'label' => 'Stripecardref', 'enabled' => 1, 'position' => 195, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -1, 'alwayseditable' => '1',), - 'comment' => array('type' => 'varchar(255)', 'label' => 'Comment', 'enabled' => 1, 'position' => 205, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'ipaddress' => array('type' => 'varchar(68)', 'label' => 'Ipaddress', 'enabled' => 1, 'position' => 210, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), - 'stripe_account' => array('type' => 'varchar(128)', 'label' => 'Stripeaccount', 'enabled' => 1, 'position' => 215, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => '1',), + 'label' => array('type' => 'varchar(200)', 'label' => 'Label', 'enabled' => 1, 'position' => 35, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist' => 'tdoverflowmax150',), + 'bank' => array('type' => 'varchar(255)', 'label' => 'Bank', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'code_banque' => array('type' => 'varchar(128)', 'label' => 'Codebanque', 'enabled' => 1, 'position' => 45, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'code_guichet' => array('type' => 'varchar(6)', 'label' => 'Codeguichet', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'number' => array('type' => 'varchar(255)', 'label' => 'Number', 'enabled' => 1, 'position' => 55, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'cle_rib' => array('type' => 'varchar(5)', 'label' => 'Clerib', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'bic' => array('type' => 'varchar(20)', 'label' => 'Bic', 'enabled' => 1, 'position' => 65, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'iban_prefix' => array('type' => 'varchar(34)', 'label' => 'Ibanprefix', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'domiciliation' => array('type' => 'varchar(255)', 'label' => 'Domiciliation', 'enabled' => 1, 'position' => 75, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'proprio' => array('type' => 'varchar(60)', 'label' => 'Proprio', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'owner_address' => array('type' => 'varchar(255)', 'label' => 'Owneraddress', 'enabled' => 1, 'position' => 85, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'default_rib' => array('type' => 'smallint(6)', 'label' => 'Defaultrib', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => -1, 'alwayseditable' => 1,), + 'state_id' => array('type' => 'integer', 'label' => 'Stateid', 'enabled' => 1, 'position' => 95, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'fk_country' => array('type' => 'integer', 'label' => 'Fkcountry', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx',), + 'currency_code' => array('type' => 'varchar(3)', 'label' => 'Currencycode', 'enabled' => 1, 'position' => 105, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'rum' => array('type' => 'varchar(32)', 'label' => 'Rum', 'enabled' => 1, 'position' => 110, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'date_rum' => array('type' => 'date', 'label' => 'Daterum', 'enabled' => 1, 'position' => 115, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'frstrecur' => array('type' => 'varchar(16)', 'label' => 'Frstrecur', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 900, 'notnull' => 0, 'visible' => -2, 'alwayseditable' => 1,), + 'last_four' => array('type' => 'varchar(4)', 'label' => 'Lastfour', 'enabled' => 1, 'position' => 130, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'card_type' => array('type' => 'varchar(255)', 'label' => 'Cardtype', 'enabled' => 1, 'position' => 135, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'cvn' => array('type' => 'varchar(255)', 'label' => 'Cvn', 'enabled' => 1, 'position' => 140, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'exp_date_month' => array('type' => 'integer', 'label' => 'Expdatemonth', 'enabled' => 1, 'position' => 145, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'exp_date_year' => array('type' => 'integer', 'label' => 'Expdateyear', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'country_code' => array('type' => 'varchar(10)', 'label' => 'Countrycode', 'enabled' => 1, 'position' => 155, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'approved' => array('type' => 'integer', 'label' => 'Approved', 'enabled' => 1, 'position' => 160, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'position' => 165, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'ending_date' => array('type' => 'date', 'label' => 'Endingdate', 'enabled' => 1, 'position' => 170, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'max_total_amount_of_all_payments' => array('type' => 'double(24,8)', 'label' => 'Maxtotalamountofallpayments', 'enabled' => 1, 'position' => 175, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'preapproval_key' => array('type' => 'varchar(255)', 'label' => 'Preapprovalkey', 'enabled' => 1, 'position' => 180, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'starting_date' => array('type' => 'date', 'label' => 'Startingdate', 'enabled' => 1, 'position' => 185, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'total_amount_of_all_payments' => array('type' => 'double(24,8)', 'label' => 'Totalamountofallpayments', 'enabled' => 1, 'position' => 190, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'stripe_card_ref' => array('type' => 'varchar(128)', 'label' => 'Stripecardref', 'enabled' => 1, 'position' => 195, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -1, 'alwayseditable' => 1,), + 'comment' => array('type' => 'varchar(255)', 'label' => 'Comment', 'enabled' => 1, 'position' => 205, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'ipaddress' => array('type' => 'varchar(68)', 'label' => 'Ipaddress', 'enabled' => 1, 'position' => 210, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), + 'stripe_account' => array('type' => 'varchar(128)', 'label' => 'Stripeaccount', 'enabled' => 1, 'position' => 215, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'visible' => 0, 'position' => 230), ); From a5acb448902189ba19839d467b5950501ba79a95 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 22:18:13 +0100 Subject: [PATCH 110/862] Fix origin_email and track_id can be null --- htdocs/ticket/class/ticket.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 778bd6ef730..cdfb8beef07 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -76,7 +76,7 @@ class Ticket extends CommonObject /** - * @var string Hash to identify ticket publicly + * @var ?string Hash to identify ticket publicly */ public $track_id; @@ -97,17 +97,17 @@ class Ticket extends CommonObject public $fk_contract; /** - * @var string Person email who have create ticket + * @var ?string Email of person who created the ticket */ public $origin_email; /** - * @var int User id who have create ticket + * @var int User id who created the ticket */ public $fk_user_create; /** - * @var int User id who have ticket assigned + * @var int User id who the ticket is assigned to */ public $fk_user_assign; From ec6786ece323eb168c8a6fb1f4201b5046b5f0de Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 19:56:19 +0100 Subject: [PATCH 111/862] Detect PhanTypeMismatchPropertyProbablyReal --- dev/tools/phan/baseline.txt | 2 ++ dev/tools/phan/config.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index c56fd81b5d6..0fa37276d34 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -70,6 +70,7 @@ return [ 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'], 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'], 'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'], + 'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanTypeMismatchPropertyProbablyReal'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginSuspiciousParamOrder'], @@ -82,6 +83,7 @@ return [ 'htdocs/public/opensurvey/index.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/public/recruitment/index.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/societe/paymentmodes.php' => ['PhanTypeMismatchPropertyProbablyReal'], 'htdocs/societe/class/companybankaccount.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/takepos/invoice.php' => ['PhanPluginSuspiciousParamPosition'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 4232427191a..c698f693e59 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -457,7 +457,7 @@ return [ 'PhanPluginUnknownClosureReturnType', // 'PhanPluginNoCommentOnProtectedMethod', // 'PhanTypeArraySuspicious', - 'PhanTypeMismatchPropertyProbablyReal', + // 'PhanTypeMismatchPropertyProbablyReal', // 'PhanPluginNoCommentOnPrivateMethod', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeInvalidLeftOperandOfAdd', From 651b5a22eb4fa52a79a420c02b29659268e6418d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 15:06:34 +0100 Subject: [PATCH 112/862] Fix & enable PhanTypeSuspiciousEcho # Fix & enable PhanTypeSuspiciousEcho Fix occurences by improving typing - array key was not found and supposed null in a print statement. Example: PhanTypeSuspiciousEcho Suspicious argument $menu_array[$i]['prefix'] of type null for an echo/print statement Enabled detection because all cases are fixed --- dev/tools/phan/config.php | 2 +- htdocs/core/class/menu.class.php | 3 +- htdocs/core/class/menubase.class.php | 10 +-- htdocs/core/menus/standard/auguria.lib.php | 14 +-- htdocs/core/menus/standard/eldy.lib.php | 99 ++++++++++++---------- 5 files changed, 69 insertions(+), 59 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 4232427191a..201f4399965 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -526,7 +526,7 @@ return [ // 'PhanTypeMismatchArgumentInternalProbablyReal', 'PhanTypeMismatchBitwiseBinaryOperands', 'PhanTypeMismatchDimEmpty', - 'PhanTypeSuspiciousEcho', + // 'PhanTypeSuspiciousEcho', // 'PhanNoopBinaryOperator', // 'PhanTypeInvalidBitwiseBinaryOperator', // 'PhanPluginDescriptionlessCommentOnFunction', diff --git a/htdocs/core/class/menu.class.php b/htdocs/core/class/menu.class.php index f87766fff94..90299401453 100644 --- a/htdocs/core/class/menu.class.php +++ b/htdocs/core/class/menu.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,7 +32,7 @@ class Menu /** * List of menu items * - * @var array,target:string,mainmenu:string,leftmenu:string,position:int,id:string,idsel:string,classname:string,prefix:string}> + * @var array,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,id:string,idsel:string,classname:string,prefix:string}> */ public $liste; diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 85b6ca80901..d6b60144dfa 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -512,8 +512,8 @@ class Menubase * @param string $myleftmenu Value for leftmenu to filter menu to load (always '') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...) - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> Return array with menu entries for top menu + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> Return array with menu entries for top menu */ public function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) { @@ -542,7 +542,7 @@ class Menubase * @param string $myleftmenu Value for leftmenu to filter menu to load (always '') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...) - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu Array with menu entries already loaded + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $tabMenu Array with menu entries already loaded * @return Menu Menu array for particular mainmenu value or full tabArray */ public function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) @@ -624,7 +624,7 @@ class Menubase * @param string $myleftmenu Value for left that defined leftmenu * @param int $type_user Looks for menu entry for 0=Internal users, 1=External users * @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...) - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu Array to store new entries found (in most cases, it's empty, but may be already filled) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $tabMenu Array to store new entries found (in most cases, it's empty, but may be already filled) * @return int >0 if OK, <0 if KO */ public function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) @@ -757,7 +757,7 @@ class Menubase /** * Complete this->newmenu with menu entry found in $tab * - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tab Tab array with all menu entries + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $tab Tab array with all menu entries * @param int $pere Id of parent * @param int $level Level * @return void diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 8509416d4fc..ddbd7fab4b9 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * @param DoliDB $db Database handler * @param string $atarget Target (Example: '' or '_top') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout 1=Disable output (Initialise &$menu only). * @param string $mode 'top', 'topnb', 'left', 'jmobile' @@ -309,9 +309,9 @@ function print_end_menu_array_auguria() * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) * * @param DoliDB $db Database handler - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' @@ -514,6 +514,10 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t // array_multisort($position, $array1_sort_order, $menu_array); } + // Phan has a hard time tracking the type, for instance because it get hookmanager->results + // Force the typing at this point to get useful analysis below: + '@phan-var-force array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string,level:int}> $menu_array'; + // Show menu $invert = !getDolGlobalString('MAIN_MENU_INVERT') ? "" : "invert"; if (empty($noout)) { @@ -521,7 +525,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t $blockvmenuopened = false; $lastlevel0 = ''; $num = count($menu_array); - for ($i = 0; $i < $num; $i++) { // Loop on each menu entry + foreach (array_keys($menu_array) as $i) { // Loop on each menu entry (foreach better for static analysis) $showmenu = true; if (getDolGlobalString('MAIN_MENU_HIDE_UNAUTHORIZED') && empty($menu_array[$i]['enabled'])) { $showmenu = false; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a18a773f390..7fcb1c8f0d1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -7,6 +7,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * @param DoliDB $db Database handler * @param string $atarget Target (Example: '' or '_top') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty). For eldy menu, it contains menu entries loaded from database. + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty). For eldy menu, it contains menu entries loaded from database. * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout 1=Disable output (Initialise &$menu only). * @param string $mode 'top', 'topnb', 'left', 'jmobile' @@ -120,15 +121,15 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Third parties $tmpentry = array( - 'enabled'=> ( + 'enabled' => ( ( - isModEnabled('societe') && + isModEnabled('societe') && (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') || !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) - ) + ) || (isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) ), - 'perms'=> ($user->hasRight('societe', 'lire') || $user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire')), - 'module'=>'societe|fournisseur' + 'perms' => ($user->hasRight('societe', 'lire') || $user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire')), + 'module' => 'societe|fournisseur' ); $menu_arr[] = array( 'name' => 'Companies', @@ -151,9 +152,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Products-Services $tmpentry = array( - 'enabled'=> (isModEnabled('product') || isModEnabled('service') || isModEnabled('shipping')), - 'perms'=> ($user->hasRight('product', 'read') || $user->hasRight('service', 'read') || $user->hasRight('expedition', 'lire')), - 'module'=>'product|service' + 'enabled' => (isModEnabled('product') || isModEnabled('service') || isModEnabled('shipping')), + 'perms' => ($user->hasRight('product', 'read') || $user->hasRight('service', 'read') || $user->hasRight('expedition', 'lire')), + 'module' => 'product|service' ); $menu_arr[] = array( 'name' => 'Products', @@ -178,9 +179,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // MRP - GPAO $tmpentry = array( - 'enabled'=>(isModEnabled('bom') || isModEnabled('mrp')), - 'perms'=>($user->hasRight('bom', 'read') || $user->hasRight('mrp', 'read')), - 'module'=>'bom|mrp' + 'enabled' => (isModEnabled('bom') || isModEnabled('mrp')), + 'perms' => ($user->hasRight('bom', 'read') || $user->hasRight('mrp', 'read')), + 'module' => 'bom|mrp' ); $menu_arr[] = array( 'name' => 'TMenuMRP', @@ -203,9 +204,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Projects $tmpentry = array( - 'enabled'=> (isModEnabled('project') ? 1 : 0), - 'perms'=> ($user->hasRight('projet', 'lire') ? 1 : 0), - 'module'=>'projet' + 'enabled' => (isModEnabled('project') ? 1 : 0), + 'perms' => ($user->hasRight('projet', 'lire') ? 1 : 0), + 'module' => 'projet' ); if ($mode == 'jmobile') { @@ -241,7 +242,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Commercial (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) $tmpentry = array( - 'enabled'=>( + 'enabled' => ( isModEnabled('propal') || isModEnabled('order') || isModEnabled('fournisseur') @@ -250,7 +251,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = || isModEnabled('contract') || isModEnabled('intervention') ) ? 1 : 0, - 'perms'=>( + 'perms' => ( $user->hasRight('propal', 'read') || $user->hasRight('commande', 'lire') || $user->hasRight('supplier_proposal', 'lire') @@ -260,7 +261,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = || $user->hasRight('contrat', 'lire') || $user->hasRight('ficheinter', 'lire') ), - 'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' + 'module' => 'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' ); $onlysupplierorder = $user->hasRight('fournisseur', 'commande', 'lire') && @@ -292,7 +293,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Billing - Financial $tmpentry = array( - 'enabled'=>( + 'enabled' => ( isModEnabled('invoice') || isModEnabled('don') || isModEnabled('tax') || @@ -301,10 +302,10 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = isModEnabled('loan') || isModEnabled('margin') ) ? 1 : 0, - 'perms'=>($user->hasRight('facture', 'lire') || $user->hasRight('don', 'contact', 'lire') + 'perms' => ($user->hasRight('facture', 'lire') || $user->hasRight('don', 'contact', 'lire') || $user->hasRight('tax', 'charges', 'lire') || $user->hasRight('salaries', 'read') || $user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('loan', 'read') || $user->hasRight('margins', 'liretous')), - 'module'=>'facture|supplier_invoice|don|tax|salaries|loan' + 'module' => 'facture|supplier_invoice|don|tax|salaries|loan' ); $menu_arr[] = array( 'name' => 'Compta', @@ -327,9 +328,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Bank $tmpentry = array( - 'enabled'=>(isModEnabled('bank') || isModEnabled('prelevement')), - 'perms'=>($user->hasRight('banque', 'lire') || $user->hasRight('prelevement', 'lire') || $user->hasRight('paymentbybanktransfer', 'read')), - 'module'=>'banque|prelevement|paymentbybanktransfer' + 'enabled' => (isModEnabled('bank') || isModEnabled('prelevement')), + 'perms' => ($user->hasRight('banque', 'lire') || $user->hasRight('prelevement', 'lire') || $user->hasRight('paymentbybanktransfer', 'read')), + 'module' => 'banque|prelevement|paymentbybanktransfer' ); $menu_arr[] = array( 'name' => 'Bank', @@ -352,9 +353,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Accounting $tmpentry = array( - 'enabled'=>(isModEnabled('comptabilite') || isModEnabled('accounting') || isModEnabled('asset') || isModEnabled('intracommreport')), - 'perms'=>($user->hasRight('compta', 'resultat', 'lire') || $user->hasRight('accounting', 'comptarapport', 'lire') || $user->hasRight('accounting', 'mouvements', 'lire') || $user->hasRight('asset', 'read') || $user->hasRight('intracommreport', 'read')), - 'module'=>'comptabilite|accounting|asset|intracommreport' + 'enabled' => (isModEnabled('comptabilite') || isModEnabled('accounting') || isModEnabled('asset') || isModEnabled('intracommreport')), + 'perms' => ($user->hasRight('compta', 'resultat', 'lire') || $user->hasRight('accounting', 'comptarapport', 'lire') || $user->hasRight('accounting', 'mouvements', 'lire') || $user->hasRight('asset', 'read') || $user->hasRight('intracommreport', 'read')), + 'module' => 'comptabilite|accounting|asset|intracommreport' ); $menu_arr[] = array( 'name' => 'Accounting', @@ -377,9 +378,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // HRM $tmpentry = array( - 'enabled'=>(isModEnabled('hrm') || (isModEnabled('holiday')) || isModEnabled('deplacement') || isModEnabled('expensereport') || isModEnabled('recruitment')), - 'perms'=>($user->hasRight('user', 'user', 'lire') || $user->hasRight('holiday', 'read') || $user->hasRight('deplacement', 'lire') || $user->hasRight('expensereport', 'lire') || $user->hasRight('recruitment', 'recruitmentjobposition', 'read')), - 'module'=>'hrm|holiday|deplacement|expensereport|recruitment' + 'enabled' => (isModEnabled('hrm') || (isModEnabled('holiday')) || isModEnabled('deplacement') || isModEnabled('expensereport') || isModEnabled('recruitment')), + 'perms' => ($user->hasRight('user', 'user', 'lire') || $user->hasRight('holiday', 'read') || $user->hasRight('deplacement', 'lire') || $user->hasRight('expensereport', 'lire') || $user->hasRight('recruitment', 'recruitmentjobposition', 'read')), + 'module' => 'hrm|holiday|deplacement|expensereport|recruitment' ); $menu_arr[] = array( @@ -403,9 +404,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Tickets and Knowledge base $tmpentry = array( - 'enabled'=>(isModEnabled('ticket') || isModEnabled('knowledgemanagement')), - 'perms'=>($user->hasRight('ticket', 'read') || $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')), - 'module'=>'ticket|knowledgemanagement' + 'enabled' => (isModEnabled('ticket') || isModEnabled('knowledgemanagement')), + 'perms' => ($user->hasRight('ticket', 'read') || $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')), + 'module' => 'ticket|knowledgemanagement' ); $link = ''; if (isModEnabled('ticket')) { @@ -434,9 +435,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Tools $tmpentry = array( - 'enabled'=>1, - 'perms'=>1, - 'module'=>'' + 'enabled' => 1, + 'perms' => 1, + 'module' => '' ); $menu_arr[] = array( 'name' => 'Tools', @@ -638,7 +639,7 @@ function print_start_menu_entry($idsel, $classname, $showmode) * @param string $idsel Id sel * @param string $classname Class name * @param string $atarget Target - * @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string} $menuval All the $menuval array + * @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string} $menuval All the $menuval array * @return void */ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array()) @@ -719,9 +720,9 @@ function print_end_menu_array() * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) * * @param DoliDB $db Database handler - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' @@ -738,8 +739,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu = $menu; - $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]??''); - $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"]??'')); + $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"] ?? ''); + $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"] ?? '')); if (is_null($mainmenu)) { $mainmenu = 'home'; @@ -931,6 +932,10 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $cursor++; }*/ + // Force the typing at this point to get useful analysis below: + '@phan-var-force array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $menu_array'; + + // Show menu $invert = !getDolGlobalString('MAIN_MENU_INVERT') ? "" : "invert"; if (empty($noout)) { @@ -938,7 +943,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $blockvmenuopened = false; $lastlevel0 = ''; $num = count($menu_array); - for ($i = 0; $i < $num; $i++) { // Loop on each menu entry + foreach (array_keys($menu_array) as $i) { // Loop on each menu entry (got better static analysis) $showmenu = true; if (getDolGlobalString('MAIN_MENU_HIDE_UNAUTHORIZED') && empty($menu_array[$i]['enabled'])) { $showmenu = false; @@ -2038,7 +2043,7 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = // Cash Control if (isModEnabled('takepos') || isModEnabled('cashdesk')) { - $permtomakecashfence = ($user->hasRight('cashdesk', 'run')|| $user->hasRight('takepos', 'run')); + $permtomakecashfence = ($user->hasRight('cashdesk', 'run') || $user->hasRight('takepos', 'run')); $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("CashControl"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="paddingright pictofixedwidth"')); $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence); $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence); @@ -2245,9 +2250,9 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme $search_project_user = GETPOSTINT('search_project_user'); $tmpentry = array( - 'enabled'=>isModEnabled('project'), - 'perms'=>$user->hasRight('projet', 'lire'), - 'module'=>'projet' + 'enabled' => isModEnabled('project'), + 'perms' => $user->hasRight('projet', 'lire'), + 'module' => 'projet' ); $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); From 778f7b0fbf3a2d5698407e282b6c5086c4efe24c Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 15 Mar 2024 10:21:17 +0100 Subject: [PATCH 113/862] NEW: add column for barcode in ticket --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_ticket-ticket.sql | 2 ++ 2 files changed, 5 insertions(+) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 1a109507a36..6b0714022c4 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -270,3 +270,6 @@ ALTER TABLE llx_element_element MODIFY COLUMN targettype VARCHAR(64) NOT NULL; ALTER TABLE llx_c_type_contact MODIFY COLUMN element VARCHAR(64) NOT NULL; ALTER TABLE llx_product_association ADD COLUMN import_key varchar(14) DEFAULT NULL; + +ALTER TABLE llx_ticket ADD COLUMN barcode varchar(255) DEFAULT NULL after extraparams; +ALTER TABLE llx_ticket ADD COLUMN fk_barcode_type integer DEFAULT NULL after barcode; diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql index 67e7ca419dd..cda890c6f69 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.sql @@ -49,5 +49,7 @@ CREATE TABLE llx_ticket model_pdf varchar(255), last_main_doc varchar(255), -- relative filepath+filename of last main generated document extraparams varchar(255), -- to save other parameters with json format + barcode varchar(255) DEFAULT NULL, -- barcode + fk_barcode_type integer DEFAULT NULL, -- barcode type import_key varchar(14) )ENGINE=innodb; From ee02be99e38a1b851c1fa892fae86e80e8747c29 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 15 Mar 2024 10:36:22 +0100 Subject: [PATCH 114/862] add BDD contraint on bar code --- htdocs/install/mysql/tables/llx_ticket-ticket.key.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql index 858f7c7eec5..7517538baac 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql @@ -22,7 +22,10 @@ ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_user_assign (fk_user_assign); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_project (fk_project); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_statut (fk_statut); +ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_product_barcode (barcode, fk_barcode_type, entity); +ALTER TABLE llx_ticket ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); + -- Idea for better perf to get last num of ticket on large databases ---ALTER TABLE llx_ticket ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'TS' THEN CAST(SUBSTRING(ref FROM 8) AS SIGNED) ELSE 0 END) PERSISTENT; ---ALTER TABLE llx_ticket ADD INDEX idx_calculated_numrefonly (calculated_numrefonly); ---Then, the numering module can use the column calculated_numrefonly to get the max with SELECT MAX(calculated_numrefonly) FROM llx_ticket +-- ALTER TABLE llx_ticket ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'TS' THEN CAST(SUBSTRING(ref FROM 8) AS SIGNED) ELSE 0 END) PERSISTENT; +-- ALTER TABLE llx_ticket ADD INDEX idx_calculated_numrefonly (calculated_numrefonly); +-- Then, the numering module can use the column calculated_numrefonly to get the max with SELECT MAX(calculated_numrefonly) FROM llx_ticket From 2d051d2fd550341235a7733acb2e90640c245d9d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 15 Mar 2024 10:38:07 +0100 Subject: [PATCH 115/862] add BDD contraint on bar code --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_ticket-ticket.key.sql | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 6b0714022c4..7d23c0a4554 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -273,3 +273,6 @@ ALTER TABLE llx_product_association ADD COLUMN import_key varchar(14) DEFAULT NU ALTER TABLE llx_ticket ADD COLUMN barcode varchar(255) DEFAULT NULL after extraparams; ALTER TABLE llx_ticket ADD COLUMN fk_barcode_type integer DEFAULT NULL after barcode; + +ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_ticket_barcode_barcode_type (barcode, fk_barcode_type, entity); +ALTER TABLE llx_ticket ADD CONSTRAINT llx_ticket_fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql index 7517538baac..e7bd5174263 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql @@ -22,8 +22,8 @@ ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_user_assign (fk_user_assign); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_project (fk_project); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_statut (fk_statut); -ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_product_barcode (barcode, fk_barcode_type, entity); -ALTER TABLE llx_ticket ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); +ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_ticket_barcode_barcode_type (barcode, fk_barcode_type, entity); +ALTER TABLE llx_ticket ADD CONSTRAINT llx_ticket_fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); -- Idea for better perf to get last num of ticket on large databases -- ALTER TABLE llx_ticket ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'TS' THEN CAST(SUBSTRING(ref FROM 8) AS SIGNED) ELSE 0 END) PERSISTENT; From f91d32de86b3b4d76561da2914f97745200da267 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 10:46:20 +0100 Subject: [PATCH 116/862] Qual: Fix typing - module_parts['hooks'] may be empty # Qual: Fix typing - moduleparts['hooks'] may be empty PHPstan reported on initialisation mismatch when module_parts['hooks'] is initialised to empty array. This change makes the fields optional. --- htdocs/core/modules/DolibarrModules.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 04081ba6a02..e0603034fbe 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -141,7 +141,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it public $menu = array(); /** - * @var array{triggers?:int<0,1>,login?:int<0,1>,substitutions?:int<0,1>,menus?:int<0,1>,theme?:int<0,1>,tpl?:int<0,1>,barcode?:int<0,1>,models?:int<0,1>,printing?:int<0,1>,css?:string[],js?:string[],hooks?:array{data:string[],entity:string},moduleforexternal?:int<0,1>,websitetemplates?:int<0,1>,contactelement?:int<0,1>} Module parts + * @var array{triggers?:int<0,1>,login?:int<0,1>,substitutions?:int<0,1>,menus?:int<0,1>,theme?:int<0,1>,tpl?:int<0,1>,barcode?:int<0,1>,models?:int<0,1>,printing?:int<0,1>,css?:string[],js?:string[],hooks?:array{data?:string[],entity?:string},moduleforexternal?:int<0,1>,websitetemplates?:int<0,1>,contactelement?:int<0,1>} Module parts * array( * // Set this to 1 if module has its own trigger directory (/mymodule/core/triggers) * 'triggers' => 0, From 2bf7c6f806ed174c1ee6aa9fe9bdef865e779cc3 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 11:06:29 +0100 Subject: [PATCH 117/862] add permission --- htdocs/societe/contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index c56ca5ccfb4..ffd695e83e5 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -133,7 +133,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; } -if ($action == 'confirm_delete') { +if ($action == 'confirm_delete' && $user->hasRight('societe', 'contact', 'delete')) { $id = GETPOST('id', 'int'); if (!empty($id) && $socid > 0) { $sql = "DELETE t, et FROM llx_socpeople AS t"; From 3ec61160378623108551d30e10650fb22c117580 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 9 Mar 2024 18:01:48 +0100 Subject: [PATCH 118/862] Qual: Fix PhanTypeMismatchReturnProbablyReal with typing update --- htdocs/compta/sociales/class/chargesociales.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 153cb7d53ff..d91ce98999e 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -406,8 +406,8 @@ class ChargeSociales extends CommonObject /** * Calculate amount remaining to pay by year * - * @param int $year Year - * @return int|float + * @param int $year Year + * @return int|float Returns -1 when error (Note: could be mistaken with an amount) */ public function solde($year = 0) { From a9220b6f68ce9c0af7ca3f60abf869fe54aa4ff7 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 12:02:12 +0100 Subject: [PATCH 119/862] add begin and rollback for db --- htdocs/societe/contact.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index ffd695e83e5..fd0109db515 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -136,6 +136,8 @@ if (empty($reshook)) { if ($action == 'confirm_delete' && $user->hasRight('societe', 'contact', 'delete')) { $id = GETPOST('id', 'int'); if (!empty($id) && $socid > 0) { + $db->begin(); + $sql = "DELETE t, et FROM llx_socpeople AS t"; $sql .= " LEFT JOIN llx_socpeople_extrafields AS et ON t.rowid = et.fk_object"; $sql .= " WHERE t.fk_soc = ".((int) $socid); @@ -144,8 +146,8 @@ if ($action == 'confirm_delete' && $user->hasRight('societe', 'contact', 'delete $result = $db->query($sql); if (!$result) { - $error++; setEventMessages($db->lasterror(), null, 'errors'); + $db->rollback(); } else { $db->commit(); setEventMessages('ContactDeleted', null, 'mesgs'); From d43c3227dbe82e7f96f8ac5f59b54edc1a5f84bb Mon Sep 17 00:00:00 2001 From: evarisk-micka Date: Fri, 15 Mar 2024 12:11:01 +0100 Subject: [PATCH 120/862] Add signed status CRUD to contract and fichinter --- htdocs/contrat/class/contrat.class.php | 42 ++++++++++++++++ htdocs/core/class/commonobject.class.php | 49 +++++++++++++++++++ htdocs/fichinter/class/fichinter.class.php | 41 ++++++++++++++++ .../install/mysql/migration/19.0.0-20.0.0.sql | 4 +- htdocs/install/mysql/tables/llx_contrat.sql | 2 +- htdocs/install/mysql/tables/llx_fichinter.sql | 2 +- 6 files changed, 136 insertions(+), 4 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 232084addce..06644ff5a17 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -184,6 +184,12 @@ class Contrat extends CommonObject */ public $date_contrat; + /** + * Status of the contract (0=NoSignature, 1=SignedBySender, 2=SignedByReceiver, 9=SignedByAll) + * @var int + */ + public $signed_status = 0; + public $commercial_signature_id; public $fk_commercial_signature; public $commercial_suivi_id; @@ -255,6 +261,7 @@ class Contrat extends CommonObject 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 40), 'date_contrat' => array('type' => 'datetime', 'label' => 'Date contrat', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 50, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 9 => 'SignedAll')), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 70), 'fk_projet' => array('type' => 'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'visible' => -1, 'position' => 75), 'fk_commercial_signature' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'SaleRepresentative Signature', 'enabled' => 1, 'visible' => -1, 'position' => 80), @@ -275,6 +282,25 @@ class Contrat extends CommonObject const STATUS_VALIDATED = 1; const STATUS_CLOSED = 2; + /* + * No signature + */ + const STATUS_NO_SIGNATURE = 0; + + /* + * Signed by sender + */ + CONST STATUS_SIGNED_SENDER = 1; + + /* + * Signed by receiver + */ + CONST STATUS_SIGNED_RECEIVER = 2; + + /* + * Signed by all + */ + CONST STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) /** @@ -2953,6 +2979,22 @@ class Contrat extends CommonObject $return .= ''; return $return; } + + // @Todo getLibSignedStatus, LibSignedStatus + + /** + * Set signed status + * + * @param User $user Object user that modify + * @param int $status Newsigned status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers + * @param string $triggercode Trigger code to use + * @return int 0 < if KO, > 0 if OK + */ + public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, $triggercode = ''): int + { + return $this->setSignedStatusCommon($user, $status, $notrigger, $triggercode); + } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 44de1d12109..985f23625e8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -10467,6 +10467,55 @@ abstract class CommonObject } } + /** + * Set to a signed status + * + * @param User $user Object user that modify + * @param int $status New status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @param string $triggercode Trigger code to use + * @return int Return integer <0 if KO, >0 if OK + */ + public function setSignedStatusCommon($user, $status, $notrigger = 0, $triggercode = '') + { + $error = 0; + + $this->db->begin(); + + $statusfield = 'signed_status'; + + $sql = "UPDATE ".$this->db->prefix().$this->table_element; + $sql .= " SET ".$statusfield." = ".((int) $status); + $sql .= " WHERE rowid = ".((int) $this->id); + + if ($this->db->query($sql)) { + if (!$error) { + $this->oldcopy = clone $this; + } + + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger($triggercode, $user); + if ($result < 0) { + $error++; + } + } + + if (!$error) { + $this->status = $status; + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + return -1; + } + } else { + $this->error = $this->db->error(); + $this->db->rollback(); + return -1; + } + } + /** * Initialise object with example values diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 010427ab2a4..f5b57037c0d 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -58,6 +58,7 @@ class Fichinter extends CommonObject 'datee' => array('type' => 'date', 'label' => 'Datee', 'enabled' => 1, 'visible' => -1, 'position' => 90), 'datet' => array('type' => 'date', 'label' => 'Datet', 'enabled' => 1, 'visible' => -1, 'position' => 95), 'duree' => array('type' => 'double', 'label' => 'Duree', 'enabled' => 1, 'visible' => -1, 'position' => 100), + 'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 101, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 9 => 'SignedAll')), 'description' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 105, 'showoncombobox' => 2), 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110), 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 115), @@ -134,6 +135,12 @@ class Fichinter extends CommonObject */ public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate + /** + * Signed Status of the intervention (0=NoSignature, 1=SignedBySender, 2=SignedByReceiver, 9=SignedByAll) + * @var int + */ + public $signed_status = 0; + /** * @var string description */ @@ -185,6 +192,26 @@ class Fichinter extends CommonObject */ const STATUS_CLOSED = 3; + /* + * No signature + */ + const STATUS_NO_SIGNATURE = 0; + + /* + * Signed by sender + */ + CONST STATUS_SIGNED_SENDER = 1; + + /* + * Signed by receiver + */ + CONST STATUS_SIGNED_RECEIVER = 2; + + /* + * Signed by all + */ + CONST STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) + /** * Date delivery * @var string|int Delivery int @@ -1600,6 +1627,20 @@ class Fichinter extends CommonObject $return .= ''; return $return; } + + /** + * Set signed status + * + * @param User $user Object user that modify + * @param int $status Newsigned status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers + * @param string $triggercode Trigger code to use + * @return int 0 < if KO, > 0 if OK + */ + public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, $triggercode = ''): int + { + return $this->setSignedStatusCommon($user, $status, $notrigger, $triggercode); + } } /** diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 7d23c0a4554..9c9f6dd01ee 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -232,8 +232,8 @@ ALTER TABLE llx_knowledgemanagement_knowledgerecord MODIFY COLUMN answer longtex -- Rename const to add customer categories on not customer/prospect third-party if enabled UPDATE llx_const SET name = 'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT' WHERE name = 'THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER'; -ALTER TABLE llx_fichinter ADD COLUMN signed_status integer DEFAULT NULL AFTER duree; -ALTER TABLE llx_contrat ADD COLUMN signed_status integer DEFAULT NULL AFTER date_contrat; +ALTER TABLE llx_fichinter ADD COLUMN signed_status smallint DEFAULT NULL AFTER duree; +ALTER TABLE llx_contrat ADD COLUMN signed_status smallint DEFAULT NULL AFTER date_contrat; ALTER TABLE llx_mailing ADD COLUMN messtype varchar(16) DEFAULT 'email' after rowid; diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index 2e01e909127..53c97061102 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -29,7 +29,7 @@ create table llx_contrat tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- creation date date_contrat datetime, - signed_status integer DEFAULT NULL, -- signed status + signed_status smallint DEFAULT NULL, -- signed status statut smallint DEFAULT 0, -- not used. deprecated fin_validite datetime, date_cloture datetime, diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 4065f3c64b8..5832ce07e9f 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -39,7 +39,7 @@ create table llx_fichinter datee date, -- date de fin d'intervention datet date, -- date de terminaison de l'intervention duree real, -- duree totale de l'intervention - signed_status integer DEFAULT NULL, -- signed status + signed_status smallint DEFAULT NULL, -- signed status description text, note_private text, note_public text, From 6d7ce609ca1daf23404717d18a00e69f968460b5 Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 15 Mar 2024 12:30:00 +0100 Subject: [PATCH 121/862] Updated add button to use minutes and local user time --- htdocs/comm/action/list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index eff2e4b3708..dc81eff94b2 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -724,8 +724,7 @@ $tmpforcreatebutton = dol_getdate(dol_now(), true); $newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; -//$param='month='.$monthshown.'&year='.$year; -$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation +$hourminsec = dol_print_date(dol_now(), '%H%M', 'tzserver').'00'; $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; From 28f74e994ae0e8fb5b6b9e82840ae567ffdee4f3 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 12:50:06 +0100 Subject: [PATCH 122/862] FIX number of properties for each object in modulebuilder --- htdocs/modulebuilder/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 6eb2db3db15..3c0d1e41776 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -4353,8 +4353,9 @@ if ($module == 'initmodule') { $mod = strtolower($module); $obj = strtolower($tabobj); $newproperty = dolGetButtonTitle($langs->trans('NewProperty'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.urlencode($module).'&tabobj=createproperty&obj='.urlencode($tabobj)); + $nbOfProperties = count($reflectorpropdefault['fields']); - print_barre_liste($langs->trans("ObjectProperties"), 0, $_SERVER["PHP_SELF"], '', '', '', '', '', 0, '', 0, $newproperty, '', '', 0, 0, 1); + print_barre_liste($langs->trans("ObjectProperties"), 0, $_SERVER["PHP_SELF"], '', '', '', '', '', $nbOfProperties, '', 0, $newproperty, '', '', 0, 0, 1); //var_dump($reflectorpropdefault);exit; print ''."\n"; From 65ee1f17760904e3f140ea4e90ec064986258170 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 12:55:30 +0100 Subject: [PATCH 123/862] initialise the variable as an empty string --- htdocs/projet/class/project.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index e8911500494..ca071434835 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2607,7 +2607,7 @@ class Project extends CommonObject $to = ''; $nbMailSend = 0; $error = 0; - $errors_to = 0; + $errors_to = ''; while ($obj = $this->db->fetch_object($resql)) { $to = $obj->email; $numHolidays = num_public_holiday($lastWeekStartTS, $lastWeekEndTS, $mysoc->country_code, 1); @@ -2670,7 +2670,7 @@ class Project extends CommonObject $actioncomm->email_sender = ''; $actioncomm->email_to = $to; - $actioncomm->errors_to = (string) $errors_to; + $actioncomm->errors_to = $errors_to; $actioncomm->elementtype = 'project_task'; $actioncomm->fk_element = (int) $this->element; @@ -2704,7 +2704,7 @@ class Project extends CommonObject $actioncomm->email_sender = ''; $actioncomm->email_to = $to; - $actioncomm->errors_to = (string) $errors_to; + $actioncomm->errors_to = $errors_to; $actioncomm->elementtype = 'project_task'; $actioncomm->fk_element = (int) $this->element; From b2804f09825f4e6a3714e906dec79cb5ef1a3f6a Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 12:58:03 +0100 Subject: [PATCH 124/862] add brackets in cast variable --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 30b9502a78a..3f7a58760ca 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -292,7 +292,7 @@ if (empty($reshook)) { $newlocaltax2_type = GETPOST('localtax2_type', 'array'); //Shall we generate prices using price rules? - $object->price_autogen = (int) GETPOST('usePriceRules') == 'on'; + $object->price_autogen = (int) (GETPOST('usePriceRules') == 'on'); for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { if (!isset($newprice[$i])) { From c9e0bc86dcc1e28f91e06896684782012c63c94f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Mar 2024 13:02:58 +0100 Subject: [PATCH 125/862] Fix look and feel --- htdocs/compta/prelevement/demandes.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 4422ff3da33..0829b4cc8ec 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -356,6 +356,11 @@ while ($i < min($num, $limit)) { $i++; } +// If no record found +if ($num == 0) { + print '
'; +} + print "
'.$langs->trans("NoRecordFound").'
"; print ""; print "
"; From 9a79e6b6d00056654c3473aa443e10a1ec5bf011 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:26:23 +0100 Subject: [PATCH 126/862] Fix PhanTypeMismatchDefault with typing hints --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index da57c3863a8..98d06e8a72f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -13866,9 +13866,9 @@ function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto') * request. * * @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate) - * @param int $timestamp If null, the timestamp will be created from request data - * @param bool $hourTime If timestamp is null, will be passed to GETPOSTDATE to construct the timestamp - * @param bool $gm If timestamp is null, will be passed to GETPOSTDATE to construct the timestamp + * @param ?int $timestamp If null, the timestamp will be created from request data + * @param string $hourTime If timestamp is null, will be passed to GETPOSTDATE to construct the timestamp + * @param string $gm If timestamp is null, will be passed to GETPOSTDATE to construct the timestamp * @return string Portion of URL with query parameters for the specified date */ function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto') From f0821a6b427692912ea79080fdd8b6929fad7db1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Mar 2024 13:34:49 +0100 Subject: [PATCH 127/862] Fix date param must use the day/hour/year instead of one string date. --- htdocs/comm/action/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index dc81eff94b2..217fca02d35 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -724,10 +724,8 @@ $tmpforcreatebutton = dol_getdate(dol_now(), true); $newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; -$hourminsec = dol_print_date(dol_now(), '%H%M', 'tzserver').'00'; - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; -$url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; +$url .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->hasRight('agenda', 'allactions', 'create')); From c5c79a9fc5195992b8bfacf4921fc1763322f195 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 12:13:55 +0100 Subject: [PATCH 128/862] Fix PhanTypeMismatchReturnProbablyReal --- htdocs/core/lib/files.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 5b18aee94af..3d9117894a2 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -57,7 +57,7 @@ function dol_basename($pathfile) * @param string $relativename For recursive purpose only. Must be "" at first call. * @param int $donotfollowsymlinks Do not follow symbolic links * @param int $nbsecondsold Only files older than $nbsecondsold - * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...) + * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)> * @see dol_dir_list_in_database() */ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "", $excludefilter = null, $sortcriteria = "name", $sortorder = SORT_ASC, $mode = 0, $nohook = 0, $relativename = "", $donotfollowsymlinks = 0, $nbsecondsold = 0) @@ -2621,10 +2621,10 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = * * @param string $dir Directory to scan * @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function - * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function - * @param int $nohook Disable all hooks - * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only - * @return array Array with properties (full path, date, ...) of to most recent file + * @param string[] $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function + * @param int<0,1> $nohook Disable all hooks + * @param int<0,3> $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only + * @return null|array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string} null if none or Array with properties (full path, date, ...) of the most recent file */ function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(\.meta|_preview.*\.png)$', '^\.'), $nohook = 0, $mode = 0) { From 3a6144dc9056af8609fc5ccabde57caa6cd9481d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:02:35 +0100 Subject: [PATCH 129/862] Fix PhanTypeMismatchReturnProbablyReal --- htdocs/societe/class/api_contacts.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 7fd087024c3..db6e2158e1f 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2019 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -167,7 +168,7 @@ class Contacts extends DolibarrApi * @param int $includecount Count and return also number of elements the contact is used as a link for * @param int $includeroles Includes roles of the contact * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names - * @return array Array of contact objects + * @return Contact[] Array of contact objects * * @throws RestException */ @@ -273,6 +274,8 @@ class Contacts extends DolibarrApi * * @param array $request_data Request datas * @return int ID of contact + * + * @suppress PhanPluginUnknownArrayMethodParamType Luracast limitation */ public function post($request_data = null) { @@ -311,7 +314,7 @@ class Contacts extends DolibarrApi * * @param int $id Id of contact to update * @param array $request_data Datas - * @return Object Updated object + * @return Object|false Updated object, false when issue toupdate */ public function put($id, $request_data = null) { @@ -389,6 +392,7 @@ class Contacts extends DolibarrApi * @return int ID of user * * @url POST {id}/createUser + * @suppress PhanPluginUnknownArrayMethodParamType Luracast limitation */ public function createUser($id, $request_data = null) { @@ -573,8 +577,8 @@ class Contacts extends DolibarrApi /** * Validate fields before create or update object * - * @param array|null $data Data to validate - * @return array + * @param string[]|null $data Data to validate + * @return string[] * @throws RestException */ private function _validate($data) From 3b0e83c53346888184822eb77c457f7f1f94af3f Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:06:00 +0100 Subject: [PATCH 130/862] Fix PhanTypeMismatchReturnProbablyReal --- 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 44de1d12109..725af336c9a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8955,7 +8955,7 @@ abstract class CommonObject /** * Returns the rights used for this class * - * @return int|stdClass Object of permission for the module + * @return null|int|stdClass Object of permission for the module */ public function getRights() { From c7ad91cfc0851937fba82817368b41b08c984b18 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 12:12:51 +0100 Subject: [PATCH 131/862] Qual: Enable PhanTypeMismatchReturnProbablyReal --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 650f4fbf9e2..7edfd7a8d1b 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -591,7 +591,7 @@ return [ // 'PhanPluginPossiblyStaticProtectedMethod', 'PhanTypeMismatchReturn', // 'PhanPluginMoreSpecificActualReturnType', - 'PhanTypeMismatchReturnProbablyReal', + // 'PhanTypeMismatchReturnProbablyReal', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', // 'PhanPluginUnreachableCode', From e5cf5475a10b8c3d47f25a61f4b2ba6dd6699d39 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:04:43 +0100 Subject: [PATCH 132/862] Qual: Improve test message on failure --- test/phpunit/RestAPIContactTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/phpunit/RestAPIContactTest.php b/test/phpunit/RestAPIContactTest.php index 4af37c718e0..dd4173ab6ff 100644 --- a/test/phpunit/RestAPIContactTest.php +++ b/test/phpunit/RestAPIContactTest.php @@ -1,6 +1,7 @@ * Copyright (C) 2023 Alexandre Janniaux + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -229,7 +230,7 @@ class RestAPIContactTest extends CommonClassTest print_r($updateResponse); // Check if the updated fields match the changes you made - $this->assertTrue($updateResponse['firstname'] === $updateBody['firstname'], 'Update might have failed'); + $this->assertEquals($updateBody['firstname'], $updateResponse['firstname'], 'Update failed for request body: '.$updateRequestBody); // Deleting the Contact /* From 972028bb9523aaad0ee58ed94cf450d6de76fd96 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:34:27 +0100 Subject: [PATCH 133/862] Fix PhanTypeMismatchDefault by removing defaults ($object is required) --- .../modules/supplier_order/mod_commande_fournisseur_muguet.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index cd6d9f78d0e..ff0ac8142aa 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -135,7 +136,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders * @param CommandeFournisseur $object Object * @return string Value if OK, 0 if KO */ - public function getNextValue($objsoc = '', $object = '') + public function getNextValue($objsoc, $object) { global $db, $conf; From 920e1fbe770b7f4ec3af0086fde8545ad57b4cb4 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:35:41 +0100 Subject: [PATCH 134/862] Fix PhanTypeMismatchDefault by removing defaults ($object is required) --- .../supplier_order/mod_commande_fournisseur_orchidee.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 03f948de1c1..025ee320d36 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -126,7 +127,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders * @param CommandeFournisseur $object Object * @return string|0 Value if OK, 0 if KO */ - public function getNextValue($objsoc = '', $object = '') + public function getNextValue($objsoc, $object) { global $db, $conf; From 4a53b3dd1770b50f786dbc35f602bad60248b811 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 14:37:35 +0100 Subject: [PATCH 135/862] fix type by adding both to doc function --- htdocs/core/modules/member/doc/pdf_standard.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 5ce0565f4eb..db1b90f1118 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -263,7 +263,7 @@ class pdf_standard extends CommonStickerGenerator /** * Function to build PDF on disk, then output on HTTP stream. * - * @param mixed $object Member object. Old usage: Array of record information (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>) + * @param Adherent|array $object Member object. Old usage: Array of record information (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>) * @param Translate $outputlangs Lang object for output language * @param string $srctemplatepath Full path of source filename for generator using a template file. Example: '5161', 'AVERYC32010', 'CARD', ... * @param string $mode Tell if doc module is called for 'member', ... From d9694bec3dca878ab23d0d5a2b29a1b0df39eb21 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 14:38:22 +0100 Subject: [PATCH 136/862] fix type by adding both to doc function --- htdocs/core/modules/member/doc/pdf_standard.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index db1b90f1118..b8b8acbbec1 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -264,11 +264,11 @@ class pdf_standard extends CommonStickerGenerator * Function to build PDF on disk, then output on HTTP stream. * * @param Adherent|array $object Member object. Old usage: Array of record information (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>) - * @param Translate $outputlangs Lang object for output language - * @param string $srctemplatepath Full path of source filename for generator using a template file. Example: '5161', 'AVERYC32010', 'CARD', ... - * @param string $mode Tell if doc module is called for 'member', ... - * @param int $nooutput 1=Generate only file on disk and do not return it on response - * @param string $filename Name of output file (without extension) + * @param Translate $outputlangs Lang object for output language + * @param string $srctemplatepath Full path of source filename for generator using a template file. Example: '5161', 'AVERYC32010', 'CARD', ... + * @param string $mode Tell if doc module is called for 'member', ... + * @param int $nooutput 1=Generate only file on disk and do not return it on response + * @param string $filename Name of output file (without extension) * @return int 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = 0, $filename = 'tmp_cards') From 0617d4346046b5ec659f474decfc4b1719642268 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Mar 2024 14:39:40 +0100 Subject: [PATCH 137/862] Fix link to create an event --- htdocs/comm/action/index.php | 6 +++++- htdocs/comm/action/list.php | 2 +- htdocs/comm/action/pertype.php | 8 +++++--- htdocs/comm/action/peruser.php | 16 +++++++++------- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index c995908532f..78c5449ccca 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -550,7 +550,11 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' //$param='month='.$monthshown.'&year='.$year; $hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); + $urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; + $urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction); } // Define the legend/list of calendard to show diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 217fca02d35..408b64c6fc9 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -730,7 +730,7 @@ $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->hasRight('agenda', 'allactions', 'create')); -$param .= '&mode='.$mode; +$param .= '&mode='.urlencode($mode); print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, is_numeric($nbtotalofrecords) ? -1 * $nbtotalofrecords : $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode); diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 7bb071f036c..990c9af705f 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -480,9 +480,11 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; - //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); + $urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; + $urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction); } print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.''.$newcardbutton, '', $limit, 1, 0, 1, $viewmode); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index c191a6c35be..97098383652 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -129,8 +129,8 @@ if ($dateselect > 0) { $tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS') ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); -$begin_h = GETPOSTINT('begin_h') != '' ? GETPOSTINT('begin_h') : ($tmparray[0] != '' ? $tmparray[0] : 9); -$end_h = GETPOSTINT('end_h') ? GETPOSTINT('end_h') : ($tmparray[1] != '' ? $tmparray[1] : 18); +$begin_h = GETPOSTISSET('begin_h') ? GETPOSTINT('begin_h') : ($tmparray[0] != '' ? $tmparray[0] : 9); +$end_h = GETPOSTISSET('end_h') ? GETPOSTINT('end_h') : ($tmparray[1] != '' ? $tmparray[1] : 18); if ($begin_h < 0 || $begin_h > 23) { $begin_h = 9; } @@ -144,8 +144,8 @@ if ($end_h <= $begin_h) { $tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS') ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); -$begin_d = GETPOSTINT('begin_d') ? GETPOSTINT('begin_d') : ($tmparray[0] != '' ? $tmparray[0] : 1); -$end_d = GETPOSTINT('end_d') ? GETPOSTINT('end_d') : ($tmparray[1] != '' ? $tmparray[1] : 5); +$begin_d = GETPOSTISSET('begin_d') ? GETPOSTINT('begin_d') : ($tmparray[0] != '' ? $tmparray[0] : 1); +$end_d = GETPOSTISSET('end_d') ? GETPOSTINT('end_d') : ($tmparray[1] != '' ? $tmparray[1] : 5); if ($begin_d < 1 || $begin_d > 7) { $begin_d = 1; } @@ -496,9 +496,11 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' $newparam .= '&end_d='.urlencode($end_d); } - //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); + $urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; + $urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction); } $num = ''; From 8495a75f43970c924c6e0e6352852d42d6cddac1 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:50:23 +0100 Subject: [PATCH 138/862] Fix PhanTypeMismatchDefault by removing defaults, update typing Also remove some unused references to globals --- .../class/expensereport.class.php | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 54c4a8b469a..a602edc810d 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -656,8 +656,6 @@ class ExpenseReport extends CommonObject */ public function fetch($id, $ref = '') { - global $conf; - $sql = "SELECT d.rowid, d.entity, d.ref, d.note_public, d.note_private,"; // DEFAULT $sql .= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS $sql .= " d.date_refuse, d.date_cancel,"; // ACTIONS @@ -885,6 +883,8 @@ class ExpenseReport extends CommonObject $sql .= " WHERE f.rowid = ".((int) $id); $sql .= " AND f.entity = ".$conf->entity; + + $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql)) { @@ -920,7 +920,7 @@ class ExpenseReport extends CommonObject */ public function initAsSpecimen() { - global $user, $langs, $conf; + global $user, $langs; $now = dol_now(); @@ -983,10 +983,10 @@ class ExpenseReport extends CommonObject * @param User $user User * @return int Return integer <0 if KO, >0 if OK */ - public function fetch_line_by_project($projectid, $user = '') + public function fetch_line_by_project($projectid, $user) { // phpcs:enable - global $conf, $db, $langs; + global $langs; $langs->load('trips'); @@ -1086,8 +1086,6 @@ class ExpenseReport extends CommonObject public function fetch_lines() { // phpcs:enable - global $conf; - $this->lines = array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; @@ -1792,7 +1790,7 @@ class ExpenseReport extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) { - global $langs, $conf, $hookmanager; + global $langs, $hookmanager; $result = ''; @@ -1906,7 +1904,7 @@ class ExpenseReport extends CommonObject * @param float $qty Qty * @param double $up Unit price (price with tax) * @param int $fk_c_type_fees Type payment - * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)') + * @param int<-1,0>|string $vatrate Vat rate (Can be '10' or '10 (ABC)') * @param string $date Date * @param string $comments Description * @param int $fk_project Project id @@ -1917,7 +1915,7 @@ class ExpenseReport extends CommonObject */ public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0, $fk_ecm_files = 0) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG); @@ -2029,7 +2027,7 @@ class ExpenseReport extends CommonObject */ public function checkRules($type = 0, $seller = '') { - global $user, $conf, $db, $langs, $mysoc; + global $conf, $db, $langs, $mysoc; $langs->load('trips'); @@ -2105,7 +2103,7 @@ class ExpenseReport extends CommonObject */ public function applyOffset($type = 0, $seller = '') { - global $conf, $mysoc; + global $mysoc; if (!getDolGlobalString('MAIN_USE_EXPENSE_IK')) { return false; @@ -2327,10 +2325,10 @@ class ExpenseReport extends CommonObject /** * deleteline * - * @param int $rowid Row id - * @param User $fuser User - * @param int $notrigger 1=No trigger - * @return int Return integer <0 if KO, >0 if OK + * @param int $rowid Row id + * @param User|string $fuser User + * @param int<0,1> $notrigger 1=No trigger + * @return int<0,1> Return integer <0 if KO, >0 if OK */ public function deleteLine($rowid, $fuser = '', $notrigger = 0) { @@ -2473,8 +2471,6 @@ class ExpenseReport extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf; - $outputlangs->load("trips"); if (!dol_strlen($modele)) { @@ -2530,7 +2526,7 @@ class ExpenseReport extends CommonObject */ public function loadStateBoard() { - global $conf, $user; + global $user; $this->nb = array(); @@ -3040,7 +3036,7 @@ class ExpenseReportLine extends CommonObjectLine */ public function insert($notrigger = 0, $fromaddline = false) { - global $user, $conf; + global $user; $error = 0; @@ -3182,7 +3178,7 @@ class ExpenseReportLine extends CommonObjectLine */ public function update(User $user) { - global $langs, $conf; + global $langs; $error = 0; From 61b55f21abd6a2bc66979fc5a16a720d1b1c8cbd Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:56:36 +0100 Subject: [PATCH 139/862] Fix PhanTypeMismatchDefault with typing hint --- .../class/fournisseur.commande.class.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7f7511db38f..5c7fba47e8e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1929,7 +1929,7 @@ class CommandeFournisseur extends CommonOrder * @param int $date_end Date end of service * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param string $pu_ht_devise Amount in currency + * @param int|string $pu_ht_devise Amount in currency * @param string $origin 'order', ... * @param int $origin_id Id of origin object * @param int $rang Rank @@ -2880,13 +2880,13 @@ class CommandeFournisseur extends CommonOrder * * @param int $rowid ID de la ligne de facture * @param string $desc Line description - * @param float $pu Unit price - * @param float $qty Quantity - * @param float $remise_percent Percent discount on line - * @param float $txtva VAT rate - * @param float $txlocaltax1 Localtax1 tax - * @param float $txlocaltax2 Localtax2 tax - * @param float $price_base_type Type of price base + * @param int|float $pu Unit price + * @param int|float $qty Quantity + * @param int|float $remise_percent Percent discount on line + * @param int|float $txtva VAT rate + * @param int|float $txlocaltax1 Localtax1 tax + * @param int|float $txlocaltax2 Localtax2 tax + * @param string $price_base_type Type of price base * @param int $info_bits Miscellaneous information * @param int $type Type of line (0=product, 1=service) * @param int $notrigger Disable triggers @@ -2894,11 +2894,11 @@ class CommandeFournisseur extends CommonOrder * @param integer $date_end Date end of service * @param array $array_options Extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param float $pu_ht_devise Unit price in currency + * @param int|float $pu_ht_devise Unit price in currency * @param string $ref_supplier Supplier ref * @return int Return integer < 0 if error, > 0 if ok */ - public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') + public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = 0, $date_end = 0, $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') { global $mysoc, $conf, $langs; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit"); @@ -3243,8 +3243,8 @@ class CommandeFournisseur extends CommonOrder /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * - * @param User $user Object user - * @param int $mode "opened", "awaiting" for orders awaiting reception + * @param User $user Object user + * @param string $mode "opened", "awaiting" for orders awaiting reception * @return WorkboardResponse|int Return integer <0 if KO, WorkboardResponse if OK */ public function load_board($user, $mode = 'opened') From 82157757f012e2b8f4f0f574c991b8164d74ad6d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:59:15 +0100 Subject: [PATCH 140/862] Fix PhanTypeMismatchDefault by updating defaults --- htdocs/fourn/class/fournisseur.facture.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index cd90cf86179..146bc872c3b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2064,7 +2065,7 @@ class FactureFournisseur extends CommonInvoice * @param int $fk_remise_except Id discount used * @return int >0 if OK, <0 if KO */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $fk_code_ventilation = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = 0, $array_options = [], $fk_unit = null, $origin_id = 0, $pu_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0, $fk_remise_except = 0) + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = 0, $date_end = 0, $fk_code_ventilation = 0, $info_bits = 0, $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = 0, $array_options = [], $fk_unit = null, $origin_id = 0, $pu_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0, $fk_remise_except = 0) { global $langs, $mysoc, $conf; From 5c9a063160b83a5ffa565c2f50efacb19326f885 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 14:02:33 +0100 Subject: [PATCH 141/862] Fix PhanTypeMismatchDefault by updating default to null --- htdocs/product/class/product.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c4b70c7a1f8..274e586340b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1971,7 +1971,7 @@ class Product extends CommonObject // Add new price $sql = "INSERT INTO ".$this->db->prefix()."product_price(price_level,date_price, fk_product, fk_user_author, price_label, price, price_ttc, price_base_type,tosell, tva_tx, default_vat_code, recuperableonly,"; $sql .= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, price_min,price_min_ttc,price_by_qty,entity,fk_price_expression) "; - $sql .= " VALUES(".($level ? ((int) $level) : 1).", '".$this->db->idate($now)."', ".((int) $this->id).", ".((int) $user->id).", ".(empty($this->price_label)?"null":"'".$this->db->escape($this->price_label)."'").", ".((float) price2num($this->price)).", ".((float) price2num($this->price_ttc)).",'".$this->db->escape($this->price_base_type)."',".((int) $this->status).", ".((float) price2num($this->tva_tx)).", ".($this->default_vat_code ? ("'".$this->db->escape($this->default_vat_code)."'") : "null").", ".((int) $this->tva_npr).","; + $sql .= " VALUES(".($level ? ((int) $level) : 1).", '".$this->db->idate($now)."', ".((int) $this->id).", ".((int) $user->id).", ".(empty($this->price_label) ? "null" : "'".$this->db->escape($this->price_label)."'").", ".((float) price2num($this->price)).", ".((float) price2num($this->price_ttc)).",'".$this->db->escape($this->price_base_type)."',".((int) $this->status).", ".((float) price2num($this->tva_tx)).", ".($this->default_vat_code ? ("'".$this->db->escape($this->default_vat_code)."'") : "null").", ".((int) $this->tva_npr).","; $sql .= " ".price2num($this->localtax1_tx).", ".price2num($this->localtax2_tx).", '".$this->db->escape($this->localtax1_type)."', '".$this->db->escape($this->localtax2_type)."', ".price2num($this->price_min).", ".price2num($this->price_min_ttc).", ".price2num($this->price_by_qty).", ".((int) $conf->entity).",".($this->fk_price_expression > 0 ? ((int) $this->fk_price_expression) : 'null'); $sql .= ")"; @@ -2308,7 +2308,7 @@ class Product extends CommonObject * @param double $newprice New price * @param string $newpricebase HT or TTC * @param User $user Object user that make change - * @param double $newvat New VAT Rate (For example 8.5. Should not be a string) + * @param ?double $newvat New VAT Rate (For example 8.5. Should not be a string) * @param double $newminprice New price min * @param int $level 0=standard, >0 = level if multilevel prices * @param int $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT @@ -2320,7 +2320,7 @@ class Product extends CommonObject * @param int $notrigger Disable triggers * @return int Return integer <0 if KO, >0 if OK */ - public function updatePrice($newprice, $newpricebase, $user, $newvat = '', $newminprice = 0, $level = 0, $newnpr = 0, $newpbq = 0, $ignore_autogen = 0, $localtaxes_array = array(), $newdefaultvatcode = '', $price_label = '', $notrigger = 0) + public function updatePrice($newprice, $newpricebase, $user, $newvat = null, $newminprice = 0, $level = 0, $newnpr = 0, $newpbq = 0, $ignore_autogen = 0, $localtaxes_array = array(), $newdefaultvatcode = '', $price_label = '', $notrigger = 0) { global $conf, $langs; @@ -2342,7 +2342,7 @@ class Product extends CommonObject } // Check parameters - if ($newvat == '') { + if ($newvat === null || $newvat == '') { // Maintain '' for backwards compatibility $newvat = $this->tva_tx; } From 38e7d389a92bcc8be948a6d184375260f2c70de4 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 14:13:38 +0100 Subject: [PATCH 142/862] Fix PhanTypeMismatchDefault by updating default to null --- htdocs/projet/class/task.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 754f465e574..260b922d5de 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -934,9 +934,9 @@ class Task extends CommonObjectLine * @param string $filteronproj Filter on project ref or label * @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated only) * @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...') - * @param string $filteronprojuser Filter on user that is a contact of project - * @param string $filterontaskuser Filter on user assigned to task - * @param Extrafields $extrafields Show additional column from project or task + * @param int $filteronprojuser Filter on user that is a contact of project + * @param int $filterontaskuser Filter on user assigned to task + * @param ?Extrafields $extrafields Show additional column from project or task * @param int $includebilltime Calculate also the time to bill and billed * @param array $search_array_options Array of search filters. Not Used yet. * @param int $loadextras Fetch all Extrafields on each project and task @@ -945,9 +945,9 @@ class Task extends CommonObjectLine * @param string $sortorder Sort order * @return array|string Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = null, $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') { - global $conf, $hookmanager; + global $hookmanager; $tasks = array(); @@ -1054,7 +1054,7 @@ class Task extends CommonObjectLine if ($filteronproj) { $sql .= natural_search(array("p.ref", "p.title"), $filteronproj); } - if ($filteronprojstatus && $filteronprojstatus != '-1') { + if ($filteronprojstatus && (int) $filteronprojstatus != '-1') { $sql .= " AND p.fk_statut IN (".$this->db->sanitize($filteronprojstatus).")"; } if ($morewherefilter) { From ca06a0ee7fdf159621d610298f96f69c2c86e11b Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 13:30:01 +0100 Subject: [PATCH 143/862] Fix PhanTypeMismatchDefault with typing hint --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7fcb1c8f0d1..9c5d138dfc6 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -639,7 +639,7 @@ function print_start_menu_entry($idsel, $classname, $showmode) * @param string $idsel Id sel * @param string $classname Class name * @param string $atarget Target - * @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string} $menuval All the $menuval array + * @param array{}|array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string} $menuval All the $menuval array * @return void */ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array()) From 1af4e9002700acddbe618aa078a392313b268f0a Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 14:14:42 +0100 Subject: [PATCH 144/862] Qual: enable PhanTypeMismatchDefault --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 650f4fbf9e2..0c5e261618b 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -446,7 +446,7 @@ return [ 'PhanRedefinedClassReference', // 'PhanPluginNoCommentOnClass', // 'PhanPluginNotFullyQualifiedGlobalConstant', - 'PhanTypeMismatchDefault', + // 'PhanTypeMismatchDefault', // 'PhanPluginPHPDocHashComment', 'PhanPluginShortArrayList', 'PhanPluginUnknownArrayPropertyType', From 29d6c2b76ea73302eabff3d15069d4ab60a517a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Mar 2024 15:07:05 +0100 Subject: [PATCH 145/862] Fix for #28821 ->status is int ->labelStatus is array of label. --- htdocs/compta/bank/class/account.class.php | 60 ++++------------------ 1 file changed, 10 insertions(+), 50 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 94d4b4247b1..67a067854f1 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -93,8 +93,10 @@ class Account extends CommonObject public $bank; /** - * Status + * Status closed + * * @var int + * @deprecated Duplicate field. We already have the field $this->status */ public $clos = self::STATUS_OPEN; @@ -200,13 +202,6 @@ class Account extends CommonObject */ public $type_lib = array(); - /** - * Array listing all the potential status of an account. - * Defined in __construct - * @var array array: int of the status => translated label of the status - */ - public $status = array(); - /** * Accountancy code * @var string @@ -387,17 +382,17 @@ class Account extends CommonObject $this->db = $db; - $this->solde = 0; + $this->balance = 0; $this->type_lib = array( - self::TYPE_SAVINGS => $langs->trans("BankType0"), - self::TYPE_CURRENT => $langs->trans("BankType1"), - self::TYPE_CASH => $langs->trans("BankType2"), + self::TYPE_SAVINGS => $langs->transnoentitiesnoconv("BankType0"), + self::TYPE_CURRENT => $langs->transnoentitiesnoconv("BankType1"), + self::TYPE_CASH => $langs->transnoentitiesnoconv("BankType2"), ); - $this->status = array( - self::STATUS_OPEN => $langs->trans("StatusAccountOpened"), - self::STATUS_CLOSED => $langs->trans("StatusAccountClosed") + $this->labelStatus = array( + self::STATUS_OPEN => $langs->transnoentitiesnoconv("StatusAccountOpened"), + self::STATUS_CLOSED => $langs->transnoentitiesnoconv("StatusAccountClosed") ); } @@ -2744,41 +2739,6 @@ class AccountLine extends CommonObjectLine public function LibStatut($status, $mode = 0) { // phpcs:enable - //global $langs; - - //$langs->load('companies'); - /* - if ($mode == 0) - { - if ($status==0) return $langs->trans("ActivityCeased"); - if ($status==1) return $langs->trans("InActivity"); - } - if ($mode == 1) - { - if ($status==0) return $langs->trans("ActivityCeased"); - if ($status==1) return $langs->trans("InActivity"); - } - if ($mode == 2) - { - if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); - if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); - } - if ($mode == 3) - { - if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); - if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); - } - if ($mode == 4) - { - if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); - if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); - } - if ($mode == 5) - { - if ($status==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); - if ($status==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); - }*/ - return ''; } From e3c4c1aff0b8fb6baf8febda57612f541cb18443 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Mar 2024 15:16:22 +0100 Subject: [PATCH 146/862] Fix warning --- htdocs/compta/tva/class/paymentvat.class.php | 10 ++++----- .../class/paymentexpensereport.class.php | 22 ++++++------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index c5fbf396667..1c72b1ff444 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -548,12 +548,12 @@ class PaymentVAT extends CommonObject $this->fk_tva = 0; $this->datec = dol_now(); $this->tms = dol_now(); - $this->datep = ''; - $this->amount = ''; + $this->datep = dol_now(); + $this->amount = 100; $this->fk_typepaiement = 0; - $this->num_payment = ''; - $this->note_private = ''; - $this->note_public = ''; + $this->num_payment = '123456'; + $this->note_private = 'Private note'; + $this->note_public = 'Public note'; $this->fk_bank = 0; $this->fk_user_creat = 0; $this->fk_user_modif = 0; diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 8763f965a90..5541cdc9ac3 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -307,7 +307,6 @@ class PaymentExpenseReport extends CommonObject public function update($user = null, $notrigger = 0) { // phpcs:enable - global $conf, $langs; $error = 0; // Clean parameters @@ -337,13 +336,8 @@ class PaymentExpenseReport extends CommonObject $this->fk_user_modif = (int) $this->fk_user_modif; } - - // Check parameters - // Put here code to add control on parameters values - // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET"; - $sql .= " fk_expensereport=".(isset($this->fk_expensereport) ? $this->fk_expensereport : "null").","; $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; @@ -355,8 +349,6 @@ class PaymentExpenseReport extends CommonObject $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null"); - - $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -393,7 +385,6 @@ class PaymentExpenseReport extends CommonObject public function delete($user, $notrigger = 0) { // phpcs:enable - global $conf, $langs; $error = 0; $this->db->begin(); @@ -524,13 +515,14 @@ class PaymentExpenseReport extends CommonObject $this->id = 0; $this->fk_expensereport = 0; - $this->datec = ''; + $this->datec = dol_now(); $this->tms = dol_now(); - $this->datep = ''; - $this->amount = ''; + $this->datep = dol_now(); + $this->amount = 100; $this->fk_typepayment = 0; - $this->num_payment = ''; - $this->note = ''; + $this->num_payment = '123456'; + $this->note_public = 'Public note'; + $this->note_private = 'Private note'; $this->fk_bank = 0; $this->fk_user_creat = 0; $this->fk_user_modif = 0; @@ -553,7 +545,7 @@ class PaymentExpenseReport extends CommonObject */ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { - global $langs, $conf; + global $langs; $error = 0; From 8ca778978010698e525882c84df330736e7ec9f7 Mon Sep 17 00:00:00 2001 From: x Date: Fri, 15 Mar 2024 15:36:05 +0100 Subject: [PATCH 147/862] FIX function load_stats_inproduction() --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5812a120489..5e5e8f8d119 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3605,13 +3605,13 @@ class Product extends CommonObject $result = $this->db->query($sql); if ($result) { while ($obj = $this->db->fetch_object($result)) { - if ($obj->role == 'toconsume') { + if ($obj->role == 'toconsume' && empty($warehouseid)) { $this->stats_mrptoconsume['customers'] += $obj->nb_customers; $this->stats_mrptoconsume['nb'] += $obj->nb; $this->stats_mrptoconsume['rows'] += $obj->nb_rows; $this->stats_mrptoconsume['qty'] += ($obj->qty ? $obj->qty : 0); } - if ($obj->role == 'consumed') { + if ($obj->role == 'consumed' && empty($warehouseid)) { //$this->stats_mrptoconsume['customers'] += $obj->nb_customers; //$this->stats_mrptoconsume['nb'] += $obj->nb; //$this->stats_mrptoconsume['rows'] += $obj->nb_rows; From b4ffcf400f1807db8d25f748a23ddd74b803fea3 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 15:47:48 +0100 Subject: [PATCH 148/862] Fix assignment with moLine to BomLine --- htdocs/mrp/class/mo.class.php | 2 +- htdocs/mrp/mo_card.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index da5b1caf030..2a1c580a03b 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -231,7 +231,7 @@ class Mo extends CommonObject protected $childtablesoncascade = array('mrp_production'); /** - * @var MoLine[]|BOMLine[] Array of subtable lines + * @var MoLine[] Array of subtable lines */ public $lines = array(); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index d88c5755d45..2e0bd589fd0 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -432,7 +432,20 @@ if ($action == 'create') { print '
'; print ''; - $object->lines = $objectbom->lines; + $arrayOfObjBom = array(); + foreach ($objectbom->lines as $key => $val) { + $moLine = new MoLine($db); + $moLine->id = $objectbom->lines[$key]->id; + $moLine->position = $objectbom->lines[$key]->position; + $moLine->fk_product = $objectbom->lines[$key]->fk_product; + $moLine->fk_unit = $objectbom->lines[$key]->fk_unit; + $moLine->qty = $objectbom->lines[$key]->qty; + $moLine->qty_frozen = $objectbom->lines[$key]->qty_frozen; + $moLine->disable_stock_change = $objectbom->lines[$key]->disable_stock_change; + + $arrayOfObjBom[] = $moLine; + } + $object->lines = $arrayOfObjBom; $object->mrptype = $objectbom->bomtype; $object->bom = $objectbom; From 61e05a9fdea253ce3d7643a8b94462907879593d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 15 Mar 2024 17:10:30 +0100 Subject: [PATCH 149/862] Fix Typing on $fields for 2nd class in file # Fix Typing on $fields for 2nd class in file This fixes the PHPstan notification for the $fields property of the second CommonObject subclass in the files. Example: 'PHPDoc type array of property BOMLine::$fields is not covariant with PHPDoc type array of overridden property CommonObject::$fields.' --- htdocs/bom/class/bom.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 1aa3f31ddae..1ed600f2433 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1714,7 +1714,7 @@ class BOMLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'LineID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 6c9fc066666..6110150e731 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -290,17 +290,17 @@ class Contrat extends CommonObject /* * Signed by sender */ - CONST STATUS_SIGNED_SENDER = 1; + const STATUS_SIGNED_SENDER = 1; /* * Signed by receiver */ - CONST STATUS_SIGNED_RECEIVER = 2; + const STATUS_SIGNED_RECEIVER = 2; /* * Signed by all */ - CONST STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) + const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) /** @@ -3148,7 +3148,7 @@ class ContratLigne extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), From 13e1209c01c4c2b169442b47c9d4b6901bf7cb6f Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 17:15:24 +0100 Subject: [PATCH 150/862] FIX problem for display content in editor --- htdocs/comm/mailing/card.php | 4 ++-- htdocs/core/class/html.formmail.class.php | 25 +++++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 216ec9bbdd8..d0efa85599e 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -895,10 +895,10 @@ if ($action == 'create') { '; } if ($formmail->withfckeditor) { - $out .= $formmail->getModelEmailTemplate(); + $out .= $formmail->getModelEmailTemplate('bodyemail'); } if ($formmail->withaiprompt && isModEnabled('ai')) { - $out .= $formmail->getSectionForAIPrompt(); + $out .= $formmail->getSectionForAIPrompt('', 'bodyemail'); } print $out; print ''; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 7557a9d89ce..f9cde0e1d1a 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1004,6 +1004,8 @@ class FormMail extends Form $out .= ''; $out .= '\n"; $out .= ""; if ($nbofsuggested > 0) { + $quantityToBeDelivered = 0; echo "
".$langs->trans("SearchIntoBatch").": $nbofsuggested

'; + $this->withaiprompt = 'html'; + $this->withlayout = 1; // Add link to add layout if ($this->withlayout && $this->withfckeditor) { $out .= ''; @@ -1440,9 +1442,10 @@ class FormMail extends Form * Return Html code for AI instruction of message and autofill result * * @param string $format Format for output ('', 'html', ...) + * @param string $htmlContent HTML name of WYSIWIG field * @return string HTML code to ask AI instruction and autofill result */ - public function getSectionForAIPrompt($format = '') + public function getSectionForAIPrompt($format = '', $htmlContent = 'message') { global $langs; @@ -1473,8 +1476,8 @@ class FormMail extends Form $('#ai_status_message').show(); //editor on readonly - if (CKEDITOR.instances.message) { - CKEDITOR.instances.message.setReadOnly(1); + if (CKEDITOR.instances.".$htmlContent.") { + CKEDITOR.instances.".$htmlContent.".setReadOnly(1); } $.ajax({ @@ -1486,13 +1489,13 @@ class FormMail extends Form 'instructions': instructions, }), success: function(response) { - console.log('Add response into field message: '+response); + console.log('Add response into field ".$htmlContent.": '+response); - jQuery('#message').val(response); + jQuery('#".$htmlContent."').val(response); - if (CKEDITOR.instances && CKEDITOR.instances.message && ".getDolGlobalInt('FCKEDITOR_ENABLE_MAIL', 0).") { - CKEDITOR.instances.message.setReadOnly(0); - CKEDITOR.instances.message.setData(response); + if (CKEDITOR.instances && CKEDITOR.instances.".$htmlContent." && ".getDolGlobalInt('FCKEDITOR_ENABLE_MAIL', 0).") { + CKEDITOR.instances.".$htmlContent.".setReadOnly(0); + CKEDITOR.instances.".$htmlContent.".setData(response); } // remove readonly @@ -1516,10 +1519,10 @@ class FormMail extends Form /** * Return HTML code for selection of email layout - * + * @param string $htmlContent HTML name of WYSIWIG field * @return string HTML for model email boxes */ - public function getModelEmailTemplate() + public function getModelEmailTemplate($htmlContent = 'message') { require_once DOL_DOCUMENT_ROOT.'/core/lib/emaillayout.lib.php'; @@ -1551,7 +1554,7 @@ class FormMail extends Form var template = $(this).data('template'); var contentHtml = $(this).data('content'); - var editorInstance = CKEDITOR.instances.message; + var editorInstance = CKEDITOR.instances.".$htmlContent."; if (editorInstance) { editorInstance.setData(contentHtml); } From 7d49d0e20b4fcb976ea8884389b5c5bb76684992 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 15 Mar 2024 18:05:32 +0100 Subject: [PATCH 151/862] NEW annimation for display spinner when waiting response --- htdocs/core/class/html.formmail.class.php | 8 +++- htdocs/theme/eldy/global.inc.php | 46 +++++++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 7557a9d89ce..290c4ffec6d 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1454,7 +1454,8 @@ class FormMail extends Form $out .= ''; $out .= ''; $out .= ''; - $out .= '
'.$langs->trans("AIProcessingPleaseWait").'
'; + $out .= '
'; + $out .= ''.$langs->trans("AIProcessingPleaseWait").'
'; $out .= "
"; foreach ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch as $dbatch) { // $dbatch is instance of Productbatch $batchStock = + $dbatch->qty; // To get a numeric @@ -1604,6 +1605,7 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categorie = new Categorie($db); $categories = $categorie->get_full_arbo('product'); + $htmlforlines = ''; foreach ($categories as $row) { if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { $htmlforlines .= '
Date: Mon, 18 Mar 2024 13:54:05 +0100 Subject: [PATCH 420/862] Fix PhanPossiblyUndeclaredGlobalVariable and PhanPossiblyUndeclaredGlobalVariable --- htdocs/compta/prelevement/factures.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 1fe40efa05e..d100cf59961 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -274,10 +274,10 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; + $param = "&id=".$id; if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } - $param = "&id=".urlencode((string) ($id)); // Lines of title fields print '
'; @@ -325,10 +325,14 @@ if ($resql) { while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); - if ($salaryBonPl) { + $itemurl = ''; + $partyurl = ''; + if ($salaryBonPl && ($salarytmp instanceof Salary) && ($user instanceof User)) { $salarytmp->fetch($obj->salaryid); $usertmp->fetch($obj->userid); - } else { + $itemurl = $salarytmp->getNomUrl(1); + $partyurl = $usertmp->getNomUrl(1); + } elseif ($invoicetmp instanceof Facture && $invoicetmpsupplier instanceof FactureFournisseur) { if ($obj->type == 'bank-transfer') { $invoicetmp = $invoicetmpsupplier; } else { @@ -337,22 +341,24 @@ if ($resql) { $invoicetmp->fetch($obj->facid); $thirdpartytmp->fetch($obj->socid); + $itemurl = $invoicetmp->getNomUrl(1); + $partyurl = $thirdpartytmp->getNomUrl(1); } print '
'; print '\n"; - if ($object->type == 'bank-transfer' && !$salaryBonPl) { + if ($object->type == 'bank-transfer' && !$salaryBonPl && $invoicetmp instanceof Facture) { print '\n"; } print '\n"; // Amount of invoice From c5b62a4a73631999e7183273266aa43345861815 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:55:03 +0100 Subject: [PATCH 421/862] Add typing to fix PhanTypeMismatchDimFetch --- htdocs/compta/prelevement/class/bonprelevement.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 2cc21fb215d..e3a3eb07439 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -83,6 +83,9 @@ class BonPrelevement extends CommonObject public $factures = array(); + /** + * @var array + */ public $methodes_trans = array(); public $invoice_in_error = array(); @@ -171,6 +174,9 @@ class BonPrelevement extends CommonObject public $credite; public $note; public $date_trans; + /** + * @var int Current transport method, index to $methodes_trans + */ public $method_trans; public $fk_user_trans; public $date_credit; From 33680415871f97af621095c1503ef7af131c24c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 14:04:10 +0100 Subject: [PATCH 422/862] Fix filter --- htdocs/compta/facture/invoicetemplate_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 13a119e35b5..63e01dac397 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -91,7 +91,7 @@ $search_date_when_endmonth = GETPOSTINT('search_date_when_endmonth'); $search_date_when_endyear = GETPOSTINT('search_date_when_endyear'); $search_date_when_start = dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear); // Use tzserver $search_date_when_end = dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear); -$search_recurring = GETPOSTINT('search_recurring'); +$search_recurring = GETPOST('search_recurring', 'intcomma'); $search_frequency = GETPOST('search_frequency', 'alpha'); $search_unit_frequency = GETPOST('search_unit_frequency', 'alpha'); $search_nb_gen_done = GETPOST('search_nb_gen_done', 'alpha'); From 9913778da0cd573c2f95718c4cb7a8370503918a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 18 Mar 2024 14:04:51 +0100 Subject: [PATCH 423/862] fix migration for postgresql 19.0.0 -> 20.0.0 --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index cbbb6d34cdc..170f02a9ec1 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -227,8 +227,10 @@ ALTER TABLE llx_product ADD COLUMN last_main_doc varchar(255); ALTER TABLE llx_knowledgemanagement_knowledgerecord MODIFY COLUMN answer longtext; -ALTER TABLE llx_commande_fournisseur_dispatch_extrafields RENAME llx_receptiondet_batch_extrafields; -ALTER TABLE llx_commande_fournisseur_dispatch RENAME llx_receptiondet_batch; +-- VMYSQL4.3 ALTER TABLE llx_commande_fournisseur_dispatch_extrafields RENAME llx_receptiondet_batch_extrafields; +-- VMYSQL4.3 ALTER TABLE llx_commande_fournisseur_dispatch RENAME llx_receptiondet_batch; +-- VPGSQL8.2 ALTER TABLE llx_commande_fournisseur_dispatch_extrafields RENAME TO llx_receptiondet_batch_extrafields; +-- VPGSQL8.2 ALTER TABLE llx_commande_fournisseur_dispatch RENAME TO llx_receptiondet_batch; -- Rename const to add customer categories on not customer/prospect third-party if enabled UPDATE llx_const SET name = 'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT' WHERE name = 'THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER'; From 1783d68fd4aa9542a4a58006c642287d2021e23d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 18 Mar 2024 14:10:55 +0100 Subject: [PATCH 424/862] Update pgsql.class.php --- htdocs/core/db/pgsql.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index a76fbfb6857..ecb9b0f0df9 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -724,7 +724,7 @@ class DoliDBPgsql extends DoliDB */ public function escape($stringtoencode) { - return pg_escape_string($stringtoencode); + return pg_escape_string($this->db, $stringtoencode); } /** From 6640354e79ad6b2b3abed9f16daa50136b1ee84b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 14:32:59 +0100 Subject: [PATCH 425/862] Move to use the english key name ofmodule --- htdocs/admin/workflow.php | 2 +- htdocs/core/lib/functions.lib.php | 6 ++-- htdocs/core/menus/init_menu_auguria.sql | 38 ++++++++++++------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 648f7706ad9..d68b7c054ef 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -158,7 +158,7 @@ $workflowcodes = array( 'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array( 'family' => 'classify_shipping', 'position' => 90, - 'enabled' => isModEnabled("expedition") && isModEnabled("facture"), + 'enabled' => isModEnabled("shipping") && isModEnabled("invoice"), 'picto' => 'shipment', 'deprecated' => 1 ), diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7554f5e5851..bb5abcf9f4c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11765,9 +11765,9 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * @param string $actionType 'default', 'danger', 'email', 'clone', 'cancel', 'delete', ... * @param string|array $url Url for link or array of subbutton description ('label'=>, 'url'=>, 'lang'=>, 'perm'=> ) * Example when an array is used: $arrayforbutaction = array( - * 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("propal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - * 20 => array('lang'=>'orders', 'enabled'=>isModEnabled("commande"), 'perm'=>$user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - * 30 => array('lang'=>'bills', 'enabled'=>isModEnabled("facture"), 'perm'=>$user->hasRight('facture', 'creer'), 'label' => 'CreateBill', 'url'=>'/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + * 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("proposal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + * 20 => array('lang'=>'orders', 'enabled'=>isModEnabled("order"), 'perm'=>$user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + * 30 => array('lang'=>'bills', 'enabled'=>isModEnabled("invoice"), 'perm'=>$user->hasRight('facture', 'creer'), 'label' => 'CreateBill', 'url'=>'/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), * ); * @param string $id Attribute id of action button. Example 'action-delete'. This can be used for full ajax confirm if this code is reused into the ->formconfirm() method. * @param int|boolean $userRight User action right diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index e661fb3db4c..d177030b841 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -18,7 +18,7 @@ insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, left insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 16__+MAX_llx_menu__, 'bom|mrp', 'isModEnabled("bom") || isModEnabled("mrp")', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'TMenuMRP', -1, 'mrp', '$user->hasRight("bom","read") || $user->hasRight("mrp","read")', '', 0, 31, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 7__+MAX_llx_menu__, 'projet', 'isModEnabled("project")', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->hasRight("projet","lire")', '', 2, 32, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', 'isModEnabled("propal") || isModEnabled("commande") || isModEnabled("supplier_order") || isModEnabled("contrat") || isModEnabled("ficheinter")', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->hasRight("societe","lire") || $user->hasRight("societe","contact","lire")', '', 2, 40, __ENTITY__, ''); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("facture") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->hasRight("facture","lire") || $user->hasRight("don","lire") || $user->hasRight("tax","charges","lire") || $user->hasRight("salaries","read") || $user->hasRight("loan","read") || $user->hasRight("banque","lire") || $user->hasRight("fournisseur","facture","lire") || $user->hasRight("supplier_invoice","read")', '', 2, 50, __ENTITY__, ''); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("invoice") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->hasRight("facture","lire") || $user->hasRight("don","lire") || $user->hasRight("tax","charges","lire") || $user->hasRight("salaries","read") || $user->hasRight("loan","read") || $user->hasRight("banque","lire") || $user->hasRight("fournisseur","facture","lire") || $user->hasRight("supplier_invoice","read")', '', 2, 50, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 14__+MAX_llx_menu__, 'banque|prelevement', 'isModEnabled("banque") || isModEnabled("prelevement")', __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->hasRight("banque","lire") || $user->hasRight("prelevement","bons","lire")', '', 0, 52, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 9__+MAX_llx_menu__, 'comptabilite|accounting|asset', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("asset")', __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->hasRight("compta","resultat","lire") || $user->hasRight("accounting","mouvements","lire") || $user->hasRight("asset","read")', '', 2, 54, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 8__+MAX_llx_menu__, '', '', __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__, ''); @@ -231,23 +231,23 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("supplier_invoice")', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__); -- Billing - Customer invoice -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'billing', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?mainmenu=billing&action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'billing', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?mainmenu=billing&action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_draft&search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_notpaid&search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_paid&search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_canceled&search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_draft&search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_notpaid&search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_paid&search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_canceled&search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/invoicetemplate_list.php?mainmenu=billing&leftmenu=customers_bills', 'ListOfTemplates', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/invoicetemplate_list.php?mainmenu=billing&leftmenu=customers_bills', 'ListOfTemplates', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', 'customers_bills_payment', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?mainmenu=billing&leftmenu=customers_bills_payment', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', 'customers_bills_reports', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?mainmenu=billing&leftmenu=customers_bills_reports', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', 'customers_bills_payment', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?mainmenu=billing&leftmenu=customers_bills_payment', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', 'customers_bills_reports', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?mainmenu=billing&leftmenu=customers_bills_reports', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); -- Billing - Orders to bill -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("commande")', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?mainmenu=billing&leftmenu=orders&search_status=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("order")', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?mainmenu=billing&leftmenu=orders&search_status=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); -- Donations insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("don")', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'billing', 'donations', 6__+MAX_llx_menu__, '/don/index.php?mainmenu=billing&leftmenu=donations', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__); @@ -316,9 +316,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__); -- Binding -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("facture") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("facture") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("facture") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("supplier_invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier', 'SuppliersVentilation', 1, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("supplier_invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("supplier_invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 7, __ENTITY__); @@ -379,9 +379,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("asset") && $leftmenu=="asset"', __HANDLER__, 'left', 3006__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy', 'MenuListTypeAssets', 3, 'assets', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->hasRight("asset","model_advance","read"):$user->hasRight("asset","read"))', '', 0, 25, __ENTITY__); -- Check deposit -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("banque") && (isModEnabled("facture") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->hasRight("banque","lire")', '', 2, 9, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("banque") && (isModEnabled("facture") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?mainmenu=bank&leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->hasRight("banque","lire")', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("banque") && (isModEnabled("facture") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1713__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/list.php?mainmenu=bank&leftmenu=checks', 'List', 1, 'bills', '$user->hasRight("banque","lire")', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("bank") && (isModEnabled("invoice") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->hasRight("banque","lire")', '', 2, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("bank") && (isModEnabled("invoice") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?mainmenu=bank&leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->hasRight("banque","lire")', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("bank") && (isModEnabled("invoice") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1713__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/list.php?mainmenu=bank&leftmenu=checks', 'List', 1, 'bills', '$user->hasRight("banque","lire")', '', 2, 1, __ENTITY__); -- PaymentByDirectDebit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("prelevement")', __HANDLER__, 'left', 2500__+MAX_llx_menu__, 'accountancy', 'withdraw', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?mainmenu=bank&leftmenu=withdraw', 'PaymentByDirectDebit', 0, 'withdrawals', '$user->hasRight("prelevement","bons","lire")', '', 2, 9, __ENTITY__); From 90882d46b2532beff42b1d87add039af46551dc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 14:36:09 +0100 Subject: [PATCH 426/862] Update factures.php --- htdocs/compta/prelevement/factures.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index d100cf59961..1dc1fd3d76d 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -274,7 +274,7 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $param = "&id=".$id; + $param = "&id=".((int) $id); if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } From d73d27466bbd4a8592173d683f95fb861e8e63c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 14:40:47 +0100 Subject: [PATCH 427/862] Update 19.0.0-20.0.0.sql --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 170f02a9ec1..acd230f65cb 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -5,7 +5,7 @@ -- -- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y -- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y --- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; -- Note that "RENAME TO" is both compatible mysql/postgesql, not "RENAME" alone. -- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; -- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); -- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; @@ -227,10 +227,8 @@ ALTER TABLE llx_product ADD COLUMN last_main_doc varchar(255); ALTER TABLE llx_knowledgemanagement_knowledgerecord MODIFY COLUMN answer longtext; --- VMYSQL4.3 ALTER TABLE llx_commande_fournisseur_dispatch_extrafields RENAME llx_receptiondet_batch_extrafields; --- VMYSQL4.3 ALTER TABLE llx_commande_fournisseur_dispatch RENAME llx_receptiondet_batch; --- VPGSQL8.2 ALTER TABLE llx_commande_fournisseur_dispatch_extrafields RENAME TO llx_receptiondet_batch_extrafields; --- VPGSQL8.2 ALTER TABLE llx_commande_fournisseur_dispatch RENAME TO llx_receptiondet_batch; +ALTER TABLE llx_commande_fournisseur_dispatch_extrafields RENAME TO llx_receptiondet_batch_extrafields; +ALTER TABLE llx_commande_fournisseur_dispatch RENAME TO llx_receptiondet_batch; -- Rename const to add customer categories on not customer/prospect third-party if enabled UPDATE llx_const SET name = 'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT' WHERE name = 'THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER'; From 034ce8cb98ac13c01f8fb35eba62c5e37e8626fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 14:44:18 +0100 Subject: [PATCH 428/862] Fix trans key code --- htdocs/core/lib/emaillayout.lib.php | 4 ++-- htdocs/langs/en_US/mails.lang | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/emaillayout.lib.php b/htdocs/core/lib/emaillayout.lib.php index 9ae359f26df..75b7b589c44 100644 --- a/htdocs/core/lib/emaillayout.lib.php +++ b/htdocs/core/lib/emaillayout.lib.php @@ -43,10 +43,10 @@ function getHtmlOfLayout($name) } else { $out .= 'Gray rectangle'; } - $out .= ' + $out .= '

'.$langs->trans('TitleOfMailHolder').'

'; if (!(empty($user->signature))) { $out .= '

'.dol_htmlentities($user->signature).'

'; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 4160930b410..da25fc5a5f9 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -192,4 +192,4 @@ YouCanMakeSomeInstructionForEmail=You can make some instructions for your Email ModelTemplate=Email template YouCanChooseAModelForYouMailContent= You can choose one of template models or generate one with AI TitleOfMailHolder=Title of the e-mail goes here -ContentOfMailHOlder=Content of email goes here... \ No newline at end of file +ContentOfMailHolder=Content of email goes here... From 72d758e05455f94766dd936a4c5e94a29695811b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 14:56:54 +0100 Subject: [PATCH 429/862] Doc --- .../interface_99_modMyModule_MyModuleTriggers.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index db9cb264f7b..c68c6a4f33e 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -139,7 +139,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_DELETE': //case 'ORDER_CANCEL': //case 'ORDER_SENTBYMAIL': - //case 'ORDER_CLASSIFY_BILLED': + //case 'ORDER_CLASSIFY_BILLED': // TODO Replace it with ORDER_MODIFY + //case 'ORDER_CLASSIFY_UNBILLED': // TODO Replace it with ORDER_MODIFY //case 'ORDER_SETDRAFT': //case 'LINEORDER_INSERT': //case 'LINEORDER_UPDATE': @@ -151,6 +152,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_SUPPLIER_VALIDATE': //case 'ORDER_SUPPLIER_DELETE': //case 'ORDER_SUPPLIER_APPROVE': + //case 'ORDER_SUPPLIER_CLASSIFY_BILLED': // TODO Replace with ORDER_SUPPLIER_MODIFY + //case 'ORDER_SUPPLIER_CLASSIFY_UNBILLED': // TODO Replace with ORDER_SUPPLIER_MODIFY //case 'ORDER_SUPPLIER_REFUSE': //case 'ORDER_SUPPLIER_CANCEL': //case 'ORDER_SUPPLIER_SENTBYMAIL': @@ -165,6 +168,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'PROPAL_MODIFY': //case 'PROPAL_VALIDATE': //case 'PROPAL_SENTBYMAIL': + //case 'PROPAL_CLASSIFY_BILLED': // TODO Replace it with PROPAL_MODIFY + //case 'PROPAL_CLASSIFY_UNBILLED': // TODO Replace it with PROPAL_MODIFY //case 'PROPAL_CLOSE_SIGNED': //case 'PROPAL_CLOSE_REFUSED': //case 'PROPAL_DELETE': @@ -240,6 +245,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'FICHINTER_CREATE': //case 'FICHINTER_MODIFY': //case 'FICHINTER_VALIDATE': + //case 'FICHINTER_CLASSIFY_BILLED': // TODO Replace it with FICHINTER_MODIFY + //case 'FICHINTER_CLASSIFY_UNBILLED': // TODO Replace it with FICHINTER_MODIFY //case 'FICHINTER_DELETE': //case 'LINEFICHINTER_CREATE': //case 'LINEFICHINTER_UPDATE': From b72b38f5d1b6fc29552e103aec60d4679f2caa9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 15:03:41 +0100 Subject: [PATCH 430/862] Doc --- ...ace_99_modMyModule_MyModuleTriggers.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index c68c6a4f33e..3ab08016799 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -139,8 +139,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_DELETE': //case 'ORDER_CANCEL': //case 'ORDER_SENTBYMAIL': - //case 'ORDER_CLASSIFY_BILLED': // TODO Replace it with ORDER_MODIFY - //case 'ORDER_CLASSIFY_UNBILLED': // TODO Replace it with ORDER_MODIFY + //case 'ORDER_CLASSIFY_BILLED': // TODO Replace it with ORDER_BILLED + //case 'ORDER_CLASSIFY_UNBILLED': // TODO Replace it with ORDER_UNBILLED //case 'ORDER_SETDRAFT': //case 'LINEORDER_INSERT': //case 'LINEORDER_UPDATE': @@ -152,8 +152,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_SUPPLIER_VALIDATE': //case 'ORDER_SUPPLIER_DELETE': //case 'ORDER_SUPPLIER_APPROVE': - //case 'ORDER_SUPPLIER_CLASSIFY_BILLED': // TODO Replace with ORDER_SUPPLIER_MODIFY - //case 'ORDER_SUPPLIER_CLASSIFY_UNBILLED': // TODO Replace with ORDER_SUPPLIER_MODIFY + //case 'ORDER_SUPPLIER_CLASSIFY_BILLED': // TODO Replace with ORDER_SUPPLIER_BILLED + //case 'ORDER_SUPPLIER_CLASSIFY_UNBILLED': // TODO Replace with ORDER_SUPPLIER_UNBILLED //case 'ORDER_SUPPLIER_REFUSE': //case 'ORDER_SUPPLIER_CANCEL': //case 'ORDER_SUPPLIER_SENTBYMAIL': @@ -168,8 +168,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'PROPAL_MODIFY': //case 'PROPAL_VALIDATE': //case 'PROPAL_SENTBYMAIL': - //case 'PROPAL_CLASSIFY_BILLED': // TODO Replace it with PROPAL_MODIFY - //case 'PROPAL_CLASSIFY_UNBILLED': // TODO Replace it with PROPAL_MODIFY + //case 'PROPAL_CLASSIFY_BILLED': // TODO Replace it with PROPAL_BILLED + //case 'PROPAL_CLASSIFY_UNBILLED': // TODO Replace it with PROPAL_UNBILLED //case 'PROPAL_CLOSE_SIGNED': //case 'PROPAL_CLOSE_REFUSED': //case 'PROPAL_DELETE': @@ -245,8 +245,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'FICHINTER_CREATE': //case 'FICHINTER_MODIFY': //case 'FICHINTER_VALIDATE': - //case 'FICHINTER_CLASSIFY_BILLED': // TODO Replace it with FICHINTER_MODIFY - //case 'FICHINTER_CLASSIFY_UNBILLED': // TODO Replace it with FICHINTER_MODIFY + //case 'FICHINTER_CLASSIFY_BILLED': // TODO Replace it with FICHINTER_BILLED + //case 'FICHINTER_CLASSIFY_UNBILLED': // TODO Replace it with FICHINTER_UNBILLED //case 'FICHINTER_DELETE': //case 'LINEFICHINTER_CREATE': //case 'LINEFICHINTER_UPDATE': From d82729e49d5909cc0f80f87156b87d421acdc70e Mon Sep 17 00:00:00 2001 From: Hystepik Date: Mon, 18 Mar 2024 15:11:50 +0100 Subject: [PATCH 431/862] New data struture for references field in ticket --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 1 + htdocs/install/mysql/tables/llx_ticket-ticket.sql | 1 + htdocs/ticket/class/ticket.class.php | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index acd230f65cb..53502e05197 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -242,6 +242,7 @@ ALTER TABLE llx_ticket ADD COLUMN model_pdf varchar(255); ALTER TABLE llx_ticket ADD COLUMN last_main_doc varchar(255); ALTER TABLE llx_ticket ADD COLUMN extraparams varchar(255); ALTER TABLE llx_ticket ADD COLUMN origin_replyto varchar(128); +ALTER TABLE llx_ticket ADD COLUMN origin_references mediumtext; ALTER TABLE llx_expensereport MODIFY COLUMN model_pdf varchar(255) DEFAULT NULL; ALTER TABLE llx_fichinter_rec MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql index cda890c6f69..305b8a1db87 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.sql @@ -26,6 +26,7 @@ CREATE TABLE llx_ticket fk_contract integer DEFAULT 0, origin_email varchar(128), origin_replyto varchar(128), + origin_references mediumtext, fk_user_create integer, fk_user_assign integer, subject varchar(255), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 3d231680b21..716a75672bb 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -193,6 +193,11 @@ class Ticket extends CommonObject */ public $origin_replyto; + /** + * References from origin email + */ + public $origin_references; + /** * @var int Creation date */ @@ -327,7 +332,8 @@ class Ticket extends CommonObject 'fk_user_create' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Author', 'visible' => 1, 'enabled' => 1, 'position' => 15, 'notnull' => 1, 'csslist' => 'tdoverflowmax100 maxwidth150onsmartphone'), 'origin_email' => array('type' => 'mail', 'label' => 'OriginEmail', 'visible' => -2, 'enabled' => 1, 'position' => 16, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'csslist' => 'tdoverflowmax150'), 'origin_replyto' => array('type' => 'mail', 'label' => 'EmailReplyto', 'visible' => -2, 'enabled' => 1, 'position' => 17, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Email to reply to", 'csslist' => 'tdoverflowmax150'), - 'subject' => array('type' => 'varchar(255)', 'label' => 'Subject', 'visible' => 1, 'enabled' => 1, 'position' => 18, 'notnull' => -1, 'searchall' => 1, 'help' => "", 'css' => 'maxwidth200 tdoverflowmax200', 'autofocusoncreate' => 1), + 'origin_references' => array('type' => 'mediumtext', 'label' => 'EmailReferences', 'visible' => -2, 'enabled' => 1, 'position' => 18, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "References from origin email", 'csslist' => 'tdoverflowmax150'), + 'subject' => array('type' => 'varchar(255)', 'label' => 'Subject', 'visible' => 1, 'enabled' => 1, 'position' => 19, 'notnull' => -1, 'searchall' => 1, 'help' => "", 'css' => 'maxwidth200 tdoverflowmax200', 'autofocusoncreate' => 1), 'type_code' => array('type' => 'varchar(32)', 'label' => 'Type', 'visible' => 1, 'enabled' => 1, 'position' => 20, 'notnull' => -1, 'help' => "", 'csslist' => 'maxwidth125 tdoverflowmax50'), 'category_code' => array('type' => 'varchar(32)', 'label' => 'TicketCategory', 'visible' => -1, 'enabled' => 1, 'position' => 21, 'notnull' => -1, 'help' => "", 'css' => 'maxwidth100 tdoverflowmax200'), 'severity_code' => array('type' => 'varchar(32)', 'label' => 'Severity', 'visible' => 1, 'enabled' => 1, 'position' => 22, 'notnull' => -1, 'help' => "", 'css' => 'maxwidth100'), @@ -518,6 +524,7 @@ class Ticket extends CommonObject $sql .= "fk_contract,"; $sql .= "origin_email,"; $sql .= "origin_replyto,"; + $sql .= "origin_references,"; $sql .= "fk_user_create,"; $sql .= "fk_user_assign,"; $sql .= "email_msgid,"; @@ -546,6 +553,7 @@ class Ticket extends CommonObject $sql .= " ".($this->fk_contract > 0 ? $this->db->escape($this->fk_contract) : "null").","; $sql .= " ".(!isset($this->origin_email) ? 'NULL' : "'".$this->db->escape($this->origin_email)."'").","; $sql .= " ".(!isset($this->origin_replyto) ? 'NULL' : "'".$this->db->escape($this->origin_replyto)."'").","; + $sql .= " ".(!isset($this->origin_references) ? 'NULL' : "'".$this->db->escape($this->origin_references)."'").","; $sql .= " ".(!isset($this->fk_user_create) ? ($user->id > 0 ? $user->id : 'NULL') : ($this->fk_user_create > 0 ? $this->fk_user_create : 'NULL')).","; $sql .= " ".($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL').","; $sql .= " ".(empty($this->email_msgid) ? 'NULL' : "'".$this->db->escape($this->email_msgid)."'").","; @@ -672,6 +680,7 @@ class Ticket extends CommonObject $sql .= " t.fk_contract,"; $sql .= " t.origin_email,"; $sql .= " t.origin_replyto,"; + $sql .= " t.origin_references,"; $sql .= " t.fk_user_create,"; $sql .= " t.fk_user_assign,"; $sql .= " t.email_msgid,"; @@ -728,6 +737,7 @@ class Ticket extends CommonObject $this->fk_contract = $obj->fk_contract; $this->origin_email = $obj->origin_email; $this->origin_replyto = $obj->origin_replyto; + $this->origin_references = $obj->origin_references; $this->fk_user_create = $obj->fk_user_create; $this->fk_user_assign = $obj->fk_user_assign; $this->email_msgid = $obj->email_msgid; @@ -808,6 +818,7 @@ class Ticket extends CommonObject $sql .= " t.fk_contract,"; $sql .= " t.origin_email,"; $sql .= " t.origin_replyto,"; + $sql .= " t.origin_references,"; $sql .= " t.fk_user_create, uc.lastname as user_create_lastname, uc.firstname as user_create_firstname,"; $sql .= " t.fk_user_assign, ua.lastname as user_assign_lastname, ua.firstname as user_assign_firstname,"; $sql .= " t.subject,"; @@ -926,6 +937,7 @@ class Ticket extends CommonObject $line->fk_contract = $obj->fk_contract; $line->origin_email = $obj->origin_email; $line->origin_replyto = $obj->origin_replyto; + $line->origin_references = $obj->origin_references; $line->fk_user_create = $obj->fk_user_create; $line->fk_user_assign = $obj->fk_user_assign; @@ -1079,6 +1091,7 @@ class Ticket extends CommonObject $sql .= " fk_contract=".(isset($this->fk_contract) ? (int) $this->fk_contract : "null").","; $sql .= " origin_email=".(isset($this->origin_email) ? "'".$this->db->escape($this->origin_email)."'" : "null").","; $sql .= " origin_replyto=".(isset($this->origin_replyto) ? "'".$this->db->escape($this->origin_replyto)."'" : "null").","; + $sql .= " origin_references=".(isset($this->origin_references) ? "'".$this->db->escape($this->origin_references)."'" : "null").","; $sql .= " fk_user_create=".(isset($this->fk_user_create) ? (int) $this->fk_user_create : "null").","; $sql .= " fk_user_assign=".(isset($this->fk_user_assign) ? (int) $this->fk_user_assign : "null").","; $sql .= " subject=".(isset($this->subject) ? "'".$this->db->escape($this->subject)."'" : "null").","; From 20018163e29a67ccdad87c92171a11d23d872539 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 15:13:43 +0100 Subject: [PATCH 432/862] Fix restore declaration to avoid to many uncompatibility problems. --- htdocs/core/triggers/dolibarrtriggers.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index e1eb9be0c0c..fd3004a9c9d 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -186,5 +186,5 @@ abstract class DolibarrTriggers * @param conf $conf Object conf * @return int if KO: <0 || if no trigger ran: 0 || if OK: >0 */ - abstract public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf); + abstract public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf); } From f9346a8022c895900ad2a8784b17dce308a65aaf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 15:13:43 +0100 Subject: [PATCH 433/862] Fix restore declaration to avoid to many uncompatibility problems. --- htdocs/core/triggers/dolibarrtriggers.class.php | 2 +- htdocs/core/triggers/interface_20_all_Logevents.class.php | 2 +- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 2 +- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- .../interface_50_modBlockedlog_ActionsBlockedLog.class.php | 2 +- ...nterface_50_modEventOrganization_EventOrganization.class.php | 2 +- htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php | 2 +- .../interface_50_modMailmanspip_Mailmanspipsynchro.class.php | 2 +- .../interface_50_modNotification_Notification.class.php | 2 +- .../core/triggers/interface_50_modTicket_TicketEmail.class.php | 2 +- htdocs/core/triggers/interface_80_modStripe_Stripe.class.php | 2 +- .../triggers/interface_90_modSociete_ContactRoles.class.php | 2 +- .../triggers/interface_95_modWebhook_WebhookTriggers.class.php | 2 +- .../triggers/interface_95_modZapier_ZapierTriggers.class.php | 2 +- .../interface_99_modMyModule_MyModuleTriggers.class.php | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index e1eb9be0c0c..fd3004a9c9d 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -186,5 +186,5 @@ abstract class DolibarrTriggers * @param conf $conf Object conf * @return int if KO: <0 || if no trigger ran: 0 || if OK: >0 */ - abstract public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf); + abstract public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf); } diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 47432eeb75c..adc63815e33 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -88,7 +88,7 @@ class InterfaceLogevents extends DolibarrTriggers * @return int if KO: <0, if no trigger ran: 0, if OK: >0 * @throws Exception dol_syslog can throw Exceptions */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (getDolGlobalString('MAIN_LOGEVENTS_DISABLE_ALL')) { return 0; // Log events is disabled (hidden features) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 96da2886c32..1edea428b6f 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -62,7 +62,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->workflow) || empty($conf->workflow->enabled)) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 034a052ce0c..4d6a062e38b 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -77,7 +77,7 @@ class InterfaceActionsAuto extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (!isModEnabled('agenda')) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 68cfccb49d5..a27ee6b7d66 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -56,7 +56,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->blockedlog) || empty($conf->blockedlog->enabled)) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php index f54615a2aaf..445bbf4ac3c 100644 --- a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php +++ b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php @@ -69,7 +69,7 @@ class InterfaceEventOrganization extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->eventorganization) || empty($conf->eventorganization->enabled)) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 105739fa5de..1a92bca5b66 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -59,7 +59,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->ldap) || empty($conf->ldap->enabled)) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php index a73a0eb2eb4..5b746b971cb 100644 --- a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php @@ -57,7 +57,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->mailmanspip) || empty($conf->mailmanspip->enabled)) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 602c3798c97..b9a009f7c0a 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -64,7 +64,7 @@ class InterfaceNotification extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { global $hookmanager; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index b37bd6ced34..08a24e1fc63 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -59,7 +59,7 @@ class InterfaceTicketEmail extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { global $mysoc; diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index 2d2b6db94c9..7178f29654c 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -64,7 +64,7 @@ class InterfaceStripe extends DolibarrTriggers * @param Conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { // Put here code you want to execute when a Dolibarr business event occurs. // Data and type of action are stored into $object and $action diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index 7c3047b03d3..6906157f6ef 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -65,7 +65,7 @@ class InterfaceContactRoles extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE' || $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' || $action === 'PROPOSAL_SUPPLIER_CREATE' diff --git a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php index 70777a03ed4..c78c99fc304 100644 --- a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php @@ -65,7 +65,7 @@ class InterfaceWebhookTriggers extends DolibarrTriggers * @param Conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->webhook) || empty($conf->webhook->enabled)) { return 0; // If module is not enabled, we do nothing diff --git a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php index 701cfeec3fd..bfb4cf8ada3 100644 --- a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php @@ -58,7 +58,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers * @param Conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->zapier) || empty($conf->zapier->enabled)) { // Module not active, we do nothing diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 3ab08016799..32a980784e1 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -65,7 +65,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers * @param Conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (!isModEnabled('mymodule')) { return 0; // If module is not enabled, we do nothing From 57181e64070233881536f8a8ee2f0c72852a9d81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 15:28:19 +0100 Subject: [PATCH 434/862] Typo --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bb5abcf9f4c..9b0d6cfaab4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11765,7 +11765,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * @param string $actionType 'default', 'danger', 'email', 'clone', 'cancel', 'delete', ... * @param string|array $url Url for link or array of subbutton description ('label'=>, 'url'=>, 'lang'=>, 'perm'=> ) * Example when an array is used: $arrayforbutaction = array( - * 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("proposal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + * 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("propal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), * 20 => array('lang'=>'orders', 'enabled'=>isModEnabled("order"), 'perm'=>$user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), * 30 => array('lang'=>'bills', 'enabled'=>isModEnabled("invoice"), 'perm'=>$user->hasRight('facture', 'creer'), 'label' => 'CreateBill', 'url'=>'/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), * ); From 49bd37a72d37448602566dec1c206a792553f2d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 16:02:33 +0100 Subject: [PATCH 435/862] Doc --- htdocs/admin/system/database-tables.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index e122150571b..defb52235b7 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -168,7 +168,8 @@ if (!$base) { print '
'; print ''; print ''; From fcff03c66d68d0486a80abc0d032b2eff4f75bc9 Mon Sep 17 00:00:00 2001 From: mrozniecki Date: Mon, 18 Mar 2024 16:10:39 +0100 Subject: [PATCH 436/862] Add substitution for mail intro and signature on ticket mail --- htdocs/core/class/html.formticket.class.php | 8 ++++++-- htdocs/ticket/card.php | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 4fa8ee3eac6..471cffd2a84 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1661,10 +1661,14 @@ class FormTicket $texttooltip .= '

'.$langs->trans("ForEmailMessageWillBeCompletedWith").'...'; } if (getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO')) { - $texttooltip .= '
'.$langs->trans("TicketMessageMailIntro").'
'.getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO'); + $mail_intro = make_substitutions(getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO'), $this->substit); + print ''; + $texttooltip .= '
'.$langs->trans("TicketMessageMailIntro").'
'.$mail_intro; } if (getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE')) { - $texttooltip .= '

'.$langs->trans("TicketMessageMailFooter").'
'.getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE'); + $mail_signature = make_substitutions(getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE'), $this->substit); + print ''; + $texttooltip .= '

'.$langs->trans("TicketMessageMailFooter").'
'.$mail_signature; } print $form->textwithpicto('', $texttooltip, 1, 'help'); } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 037ec5c57c4..db416fb7742 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1536,6 +1536,7 @@ if ($action == 'create' || $action == 'presend') { $morehtmlright = ''; $help = ""; $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); $morehtmlright .= $form->textwithpicto(''.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution'); print '
'; From a9cabe6fe4c5f89b78180b238a8b430199be6519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 18 Mar 2024 16:39:49 +0100 Subject: [PATCH 437/862] Update codespell-dict.txt --- dev/tools/codespell/codespell-dict.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tools/codespell/codespell-dict.txt b/dev/tools/codespell/codespell-dict.txt index f6d51c0b68d..047de65a4a8 100644 --- a/dev/tools/codespell/codespell-dict.txt +++ b/dev/tools/codespell/codespell-dict.txt @@ -9,6 +9,7 @@ aploha->alpha aplohanothtml->alphanohtml aplphanothtml->alphanohtml choosed->chosen +cumuled->cumulative dokument->document dolibar->dolibarr dolibarrr->dolibarr From 06ae1deb1b81147fb0f76acb9833ec1cb410d183 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 17:27:06 +0100 Subject: [PATCH 438/862] Fix better error message when using bad character_set_client --- htdocs/conf/conf.php.example | 7 +++---- htdocs/core/db/mysqli.class.php | 8 ++++++-- htdocs/website/index.php | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index d0ca5f7142e..4d8c4f8fadd 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -130,8 +130,8 @@ $dolibarr_main_db_user=''; // dolibarr_main_db_pass // ===================== // This parameter contains password used to read and write into Dolibarr database. -// If content is 'crypted:...', the password is encrypted/decrypted with dol_encode/dol_decode. -// If content is 'dolcrypt:...', the password is encrypted/decrypted with dolEncrypt/dolDecrypt. +// If content is 'crypted:...', the password is encrypted/decrypted with dol_encode/dol_decode. +// If content is 'dolcrypt:...', the password is encrypted/decrypted with dolEncrypt/dolDecrypt. // // Examples: // $dolibarr_main_db_pass='myadminpass'; @@ -160,6 +160,7 @@ $dolibarr_main_db_type=''; // Default value: depends on database driver // Examples: // dolibarr_main_db_character_set='utf8'; +// dolibarr_main_db_character_set='utf8mb4'; // $dolibarr_main_db_character_set='utf8'; @@ -455,5 +456,3 @@ $dolibarr_cron_allow_cli='0'; //############################## // External modules //############################## - - diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 8024bb4aa5b..ff63113e47b 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -125,11 +125,15 @@ class DoliDBMysqli extends DoliDB dol_syslog(get_class($this)."::DoliDBMysqli You should set the \$dolibarr_main_db_character_set and \$dolibarr_main_db_collation for the PHP to the one of the database ".$this->db->character_set_name(), LOG_WARNING); $this->db->set_charset($clientmustbe); // This set charset, but with a bad collation } catch (Exception $e) { - print 'Failed to force character set to '.$clientmustbe." according to setup to match the one of the server database.
\n"; + print 'Failed to force character_set_client to '.$clientmustbe." (according to setup) to match the one of the server database.
\n"; print $e->getMessage(); print "
\n"; if ($clientmustbe != 'utf8') { - print 'Edit conf/conf.php file to set a charset "utf8" instead of "'.$clientmustbe.'".'."\n"; + print 'Edit conf/conf.php file to set a charset "utf8"'; + if ($clientmustbe != 'utf8mb4') { + print ' or "utf8mb4"'; + } + print ' instead of "'.$clientmustbe.'".'."\n"; } exit; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 2b622531dac..d64888743cb 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -683,7 +683,7 @@ if ($action == 'adddir' && $permtouploadfile) } */ -// Add site +// Add a website if ($action == 'addsite' && $usercanedit) { $db->begin(); From 13f7012d401525d80317d484bdca362e402af6c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 18:17:53 +0100 Subject: [PATCH 439/862] NEW Add maintenance tool to switch utf8 -> utf8mb4 --- htdocs/admin/system/database-tables.php | 42 +++++++---- htdocs/admin/system/dbtable.php | 94 +++++++++++++++++++++++-- htdocs/core/lib/functions.lib.php | 8 +-- 3 files changed, 120 insertions(+), 24 deletions(-) diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index defb52235b7..14121aebab8 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -39,6 +39,7 @@ if (!$user->admin) { accessforbidden(); } +$table = GETPOST('table', 'aZ09'); $action = GETPOST('action', 'aZ09'); @@ -46,16 +47,20 @@ $action = GETPOST('action', 'aZ09'); * Actions */ -if ($action == 'convert') { - $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB"; +if ($action == 'convert') { // Convert engine into innodb + $sql = "ALTER TABLE ".$db->sanitize($table)." ENGINE=INNODB"; $db->query($sql); } if ($action == 'convertutf8') { - $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + $sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + $db->query($sql); +} +if ($action == 'convertutf8mb4') { + $sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"; $db->query($sql); } if ($action == 'convertdynamic') { - $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ROW_FORMAT=DYNAMIC;"; + $sql = "ALTER TABLE ".$db->sanitize($table)." ROW_FORMAT=DYNAMIC;"; $db->query($sql); } @@ -160,17 +165,24 @@ if (!$base) { print '
'.$langs->trans("Convert").' Dynamic'; } print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index c7e7c5baa5e..a47be52e386 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -33,7 +33,57 @@ if (!$user->admin) { accessforbidden(); } -$table = GETPOST('table', 'alpha'); +$table = GETPOST('table', 'aZ09'); +$field = GETPOST('field', 'aZ09'); +$action = GETPOST('action', 'aZ09'); + + +/* + * Actions + */ + +if ($action == 'convertutf8') { + $sql = "SHOW FULL COLUMNS IN ".$db->sanitize($table); + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $db->fetch_row($resql); + if ($row[0] == $field) { + $sql = 'ALTER TABLE '.$db->sanitize($table).' MODIFY '.$db->sanitize($row[0]).' '.$row[1].' CHARACTER SET utf8'; // We must not sanitize the $row[1] + $db->query($sql); + + $sql = 'ALTER TABLE '.$db->sanitize($table).' MODIFY '.$db->sanitize($row[0]).' '.$row[1].' COLLATE utf8_unicode_ci'; // We must not sanitize the $row[1] + $db->query($sql); + + break; + } + } + } +} +if ($action == 'convertutf8mb4') { + $sql = "SHOW FULL COLUMNS IN ".$db->sanitize($table); + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $db->fetch_row($resql); + if ($row[0] == $field) { + $sql = 'ALTER TABLE '.$db->sanitize($table).' MODIFY '.$db->sanitize($row[0]).' '.$row[1].' CHARACTER SET utf8mb4'; // We must not sanitize the $row[1] + $db->query($sql); + + $sql = 'ALTER TABLE '.$db->sanitize($table).' MODIFY '.$db->sanitize($row[0]).' '.$row[1].' COLLATE utf8mb4_unicode_ci'; // We must not sanitize the $row[1] + $db->query($sql); + + break; + } + } + } +} /* @@ -48,7 +98,7 @@ print load_fiche_titre($langs->trans("Table")." ".$table, '', 'title_setup'); // Define request to get table description $base = 0; if (preg_match('/mysql/i', $conf->db->type)) { - $sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'"; + $sql = "SHOW TABLE STATUS LIKE '".$db->escape($db->escapeforlike($table))."'"; $base = 1; } elseif ($conf->db->type == 'pgsql') { $sql = "SELECT conname,contype FROM pg_constraint"; @@ -99,7 +149,7 @@ if (!$base) { print ''; // $sql = "DESCRIBE ".$table; - $sql = "SHOW FULL COLUMNS IN ".$db->escape($table); + $sql = "SHOW FULL COLUMNS IN ".$db->sanitize($table); $resql = $db->query($sql); if ($resql) { @@ -109,12 +159,46 @@ if (!$base) { $row = $db->fetch_row($resql); print ''; + // field print ""; + // type - print ""; + print ""; + // collation - print ""; + print ""; + // null print ""; // key diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9b0d6cfaab4..4a1beee4bcf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5437,7 +5437,7 @@ function img_mime($file, $titlealt = '', $morecss = '') */ function img_search($titlealt = 'default', $other = '') { - global $conf, $langs; + global $langs; if ($titlealt == 'default') { $titlealt = $langs->trans('Search'); @@ -5460,7 +5460,7 @@ function img_search($titlealt = 'default', $other = '') */ function img_searchclear($titlealt = 'default', $other = '') { - global $conf, $langs; + global $langs; if ($titlealt == 'default') { $titlealt = $langs->trans('Search'); @@ -5682,7 +5682,7 @@ function dol_print_error($db = null, $error = '', $errors = null) */ function dol_print_error_email($prefixcode, $errormessage = '', $errormessages = array(), $morecss = 'error', $email = '') { - global $langs, $conf; + global $langs; if (empty($email)) { $email = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'); @@ -5745,7 +5745,7 @@ function print_liste_field_titre($name, $file = "", $field = "", $begin = "", $m */ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin = "", $moreparam = "", $moreattrib = "", $sortfield = "", $sortorder = "", $prefix = "", $disablesortlink = 0, $tooltip = '', $forcenowrapcolumntitle = 0) { - global $conf, $langs, $form; + global $langs, $form; //print "$name, $file, $field, $begin, $options, $moreattrib, $sortfield, $sortorder
\n"; if ($moreattrib == 'class="right"') { From 244da63a1cb2e75caa180b1a0ce2722ecb77bead Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 18 Mar 2024 18:22:19 +0100 Subject: [PATCH 440/862] NEW functionality for salaries with massactions --- htdocs/salaries/class/salary.class.php | 1 + htdocs/salaries/list.php | 91 ++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 0e242e38b39..b8cac236746 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -128,6 +128,7 @@ class Salary extends CommonObject const STATUS_UNPAID = 0; const STATUS_PAID = 1; + public $resteapayer; /** * Constructor diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 7af81d47d6e..f88783a1f49 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -166,6 +166,93 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } +//credit transfer request +if ($massaction == 'withdrawrequest') { + $langs->load("withdrawals"); + + if (!$user->hasRight('paymentbybanktransfer', 'create')) { + $error++; + setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); + } else { + //Checking error + $error = 0; + $listofSalries = array(); + $arrayofselected = is_array($toselect) ? $toselect : array(); + foreach ($arrayofselected as $toselectid) { + $objecttmp = new Salary($db); + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + $totalpaid = $objecttmp->getSommePaiement(); + $objecttmp->resteapayer = price2num($objecttmp->amount - $totalpaid, 'MT'); + + // hook to finalize the remaining amount, considering e.g. cash discount agreements + $parameters = array('remaintopay' => $objecttmp->resteapayer); + $reshook = $hookmanager->executeHooks('finalizeAmountOfInvoice', $parameters, $objecttmp, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + if (!empty($remaintopay = $hookmanager->resArray['remaintopay'])) { + $objecttmp->resteapayer = $remaintopay; + } + } elseif ($reshook < 0) { + $error++; + setEventMessages($objecttmp->ref.' '.$langs->trans("ProcessingError"), $hookmanager->errors, 'errors'); + } + + if ($objecttmp->status == Salary::STATUS_PAID || $objecttmp->resteapayer == 0) { + $error++; + setEventMessages($objecttmp->ref.' '.$langs->trans("AlreadyPaid"), $objecttmp->errors, 'errors'); + } elseif ($resteapayer < 0) { + $error++; + setEventMessages($objecttmp->ref.' '.$langs->trans("AmountMustBePositive"), $objecttmp->errors, 'errors'); + } + + $rsql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande"; + $rsql .= " , pfd.date_traite as date_traite"; + $rsql .= " , pfd.amount"; + $rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login"; + $rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; + $rsql .= " , ".MAIN_DB_PREFIX."user as u"; + $rsql .= " WHERE fk_salary = ".((int) $objecttmp->id); + $rsql .= " AND pfd.fk_user_demande = u.rowid"; + $rsql .= " AND pfd.traite = 0"; + $rsql .= " ORDER BY pfd.date_demande DESC"; + + $result_sql = $db->query($rsql); + if ($result_sql) { + $numprlv = $db->num_rows($result_sql); + } + + if ($numprlv > 0) { + $error++; + setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'warnings'); + } elseif (!empty($objecttmp->type_payment) && $objecttmp->type_payment != '2') { + $error++; + setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors'); + } else { + $listofSalries[] = $objecttmp; + } + } + } + + if (!empty($listofSalries)) { + $nbwithdrawrequestok = 0; + foreach ($listofSalries as $salary) { + $db->begin(); + $result = $salary->demande_prelevement($user, (float) $salary->resteapayer, 'salaire'); + if ($result > 0) { + $db->commit(); + $nbwithdrawrequestok++; + } else { + $db->rollback(); + setEventMessages($aBill->error, $aBill->errors, 'errors'); + } + } + if ($nbwithdrawrequestok > 0) { + setEventMessages($langs->trans("WithdrawRequestsDone", $nbwithdrawrequestok), null, 'mesgs'); + } + } + } +} + $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -413,6 +500,10 @@ $arrayofmassactions = array( if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } +if (isModEnabled('prelevement') && $user->hasRight('prelevement', 'bons', 'creer')) { + $langs->load("withdrawals"); + $arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeBankTransferOrder"); +} if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); } From b1758520ea9f1d98ef38d7a1e689753c2bfa9c40 Mon Sep 17 00:00:00 2001 From: xbloq Date: Mon, 18 Mar 2024 18:28:49 +0100 Subject: [PATCH 441/862] Update card.php #28938 --- htdocs/compta/prelevement/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index c9f2401513b..920aaa36885 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -460,7 +460,7 @@ if ($id > 0 || $ref) { if ($salaryBonPl) { $sql = "SELECT pl.rowid, pl.statut, pl.amount, pl.fk_user,"; $sql .= " u.rowid as socid, u.login as name"; - $sql .= " FROM llx_prelevement_lignes as pl"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb"; $sql .= ", ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id); From d98b7210715351fff0086e3f90da9dc739e04f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 18 Mar 2024 18:42:09 +0100 Subject: [PATCH 442/862] fix phpstan --- htdocs/compta/prelevement/class/bonprelevement.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index e3a3eb07439..6a7d5a774ee 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 JC Prieto * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -672,7 +673,7 @@ class BonPrelevement extends CommonObject * * @param User $user Id of user * @param int $date Date of action - * @param string $method Method of transmission to bank (0=Internet, 1=Api...) + * @param int $method Method of transmission to bank (0=Internet, 1=Api...) * @return int >0 if OK, <0 if KO */ public function set_infotrans($user, $date, $method) From 62cf3ab098682dccfd78ad4aecdbcb5b1573764f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 19:27:52 +0100 Subject: [PATCH 443/862] Enhance error message --- htdocs/core/class/CMailFile.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 2ba41c28f43..11e25c2c741 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -275,8 +275,9 @@ class CMailFile // Search into the body for errors)); // Output errors set by findHtmlImagesInSrcData $this->error = 'ErrorInAddAttachementsImageBaseOnMedia'; return; } @@ -1900,8 +1901,6 @@ class CMailFile */ private function findHtmlImagesIsSrcData($images_dir) { - global $conf; - // Build the array of image extensions $extensions = array_keys($this->image_types); @@ -1927,7 +1926,7 @@ class CMailFile if (!empty($matches) && !empty($matches[1])) { if (empty($images_dir)) { // No temp directory provided, so we are not able to support convertion of data:image into physical images. - $this->error = 'NoTempDirProvidedInCMailConstructorSoCantConvertDataImgOnDisk'; + $this->errors[] = 'NoTempDirProvidedInCMailConstructorSoCantConvertDataImgOnDisk'; return -1; } @@ -1949,7 +1948,7 @@ class CMailFile dolChmod($destfiletmp); } else { $this->errors[] = "Failed to open file '".$destfiletmp."' for write"; - return -1; + return -2; } } From 04ae0f776d4d05b534e70331c9e1dec7157252b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 20:02:08 +0100 Subject: [PATCH 444/862] FIX trackid and temp dir on payment confirmation of event registration --- htdocs/public/payment/paymentok.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ca5db265610..62f9797d833 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1378,7 +1378,10 @@ if ($ispaymentok) { $listofmimes = array(dol_mimetype($file)); } - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc, '', 0, $ishtml); + $trackid = 'inv'.$object->id; + $upload_dir_tmp = $conf->admin->dir_output.'/temp/'.uniqid('cmailfile'); + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc, '', 0, $ishtml, '', '', $trackid, '', 'standard', '', $upload_dir_tmp); $result = $mailfile->sendfile(); if ($result) { From a0b7cb90d86c2f7a740654dd8a7576193929d899 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 20:02:08 +0100 Subject: [PATCH 445/862] FIX trackid and temp dir on payment confirmation of event registration --- htdocs/core/class/CMailFile.class.php | 6 ++++++ htdocs/public/payment/paymentok.php | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 11e25c2c741..3539c62b6cf 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1901,9 +1901,15 @@ class CMailFile */ private function findHtmlImagesIsSrcData($images_dir) { + global $conf; + // Build the array of image extensions $extensions = array_keys($this->image_types); + if (empty($images_dir)) { + $images_dir = $conf->admin->dir_output.'/temp/'.uniqid('cmailfile'); + } + if ($images_dir && !dol_is_dir($images_dir)) { dol_mkdir($images_dir, DOL_DATA_ROOT); } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ca5db265610..3c710691bdd 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1378,7 +1378,9 @@ if ($ispaymentok) { $listofmimes = array(dol_mimetype($file)); } - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc, '', 0, $ishtml); + $trackid = 'inv'.$object->id; + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc, '', 0, $ishtml, '', '', $trackid, '', 'standard'); $result = $mailfile->sendfile(); if ($result) { @@ -1569,8 +1571,9 @@ if ($ispaymentok) { $urlback = $_SERVER["REQUEST_URI"]; $ishtml = dol_textishtml($texttosend); // May contain urls + $trackid = 'inv'.$invoice->id; - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml, '', '', $trackid, '', 'standard'); $result = $mailfile->sendfile(); if ($result) { @@ -1777,10 +1780,7 @@ if ($ispaymentok) { print $conf->global->$key; } - $sendemail = ''; - if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) { - $sendemail = $conf->global->ONLINE_PAYMENT_SENDEMAIL; - } + $sendemail = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL'); $tmptag = dolExplodeIntoArray($fulltag, '.', '='); @@ -1860,9 +1860,10 @@ if ($ispaymentok) { $ishtml = dol_textishtml($content); // May contain urls + $trackid = ''; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml); + $mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml, '', '', $trackid, '', 'standard'); $result = $mailfile->sendfile(); if ($result) { @@ -1941,9 +1942,10 @@ if ($ispaymentok) { $ishtml = dol_textishtml($content); // May contain urls + $trackid = ''; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml); + $mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml, '', '', $trackid, '', 'standard'); $result = $mailfile->sendfile(); if ($result) { From 1a82c5e8ced5270313c6391787490fd891d1d9bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 20:38:51 +0100 Subject: [PATCH 446/862] Fix warnings --- htdocs/admin/mails_templates.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index ae1f8bf67d1..546427463da 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -681,7 +681,7 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu // Confirm deletion of record if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid).'&code='.urlencode($code).'&id='.((int) $id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid).'&id='.((int) $id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); } @@ -1101,7 +1101,7 @@ if ($num) { } print "\n"; - print ''; + print ''; print '\n"; - print ''; + print ''; print '"; // Date start print ''; // Date end print ''; // Status From 7e44ab47ca3ed2a67e49380ab763abf1a8ebc4fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 00:48:51 +0100 Subject: [PATCH 474/862] FIX Manual deletion of a bookkeeping line --- .../accountancy/class/bookkeeping.class.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5c07b8f637f..44f28bae658 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -738,11 +738,10 @@ class BookKeeping extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * @param string $mode Mode - * - * @return int Return integer <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @param string $mode Mode ('' or 'tmp_') + * @return int Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = null, $mode = '') { @@ -1545,15 +1544,16 @@ class BookKeeping extends CommonObject * * @param User $user User that deletes * @param int $notrigger false=launch triggers after, true=disable triggers - * @param string $mode Mode + * @param string $mode Mode ('' or 'tmp_') * @return int Return integer <0 if KO, >0 if OK */ public function delete(User $user, $notrigger = 0, $mode = '') { global $langs; + dol_syslog(__METHOD__, LOG_DEBUG); - $result = $this->canModifyBookkeeping($this->id); + $result = $this->canModifyBookkeeping($this->id, $mode); if ($result < 0) { return -1; } elseif ($result == 0) { @@ -2357,9 +2357,10 @@ class BookKeeping extends CommonObject * Is the bookkeeping can be modified or deleted ? * * @param int $id Bookkeeping ID + * @param string $mode Mode ('' or 'tmp_') * @return int Return integer <0 if KO, == 0 if No, == 1 if Yes */ - public function canModifyBookkeeping($id) + public function canModifyBookkeeping($id, $mode = '') { global $conf; @@ -2371,7 +2372,7 @@ class BookKeeping extends CommonObject } $bookkeeping = new BookKeeping($this->db); - $result = $bookkeeping->fetch($id); + $result = $bookkeeping->fetch($id, null, $mode); if ($result <= 0) { return $result; } @@ -2392,7 +2393,7 @@ class BookKeeping extends CommonObject } $bookkeeping = new BookKeeping($this->db); - $result = $bookkeeping->fetch($id); + $result = $bookkeeping->fetch($id, null, $mode); if ($result <= 0) { return $result; } From 2fce8f1d461d71ff5bf2f0638d822fff9028cd70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 00:49:45 +0100 Subject: [PATCH 475/862] FIX Bad management on error creation of bookkeeping --- htdocs/accountancy/bookkeeping/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 79f7c44cda9..3469e8e994c 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -94,6 +94,7 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { /* * Actions */ + $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) { @@ -229,7 +230,7 @@ if (empty($reshook)) { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - $result = $object->delete($user, false, $mode); + $result = $object->delete($user, 0, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -269,6 +270,8 @@ if (empty($reshook)) { $result = $object->createStd($user, 0, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); + + $action = 'create'; } else { $reshook = $hookmanager->executeHooks('afterCreateBookkeeping', $parameters, $object, $action); @@ -411,6 +414,7 @@ if ($action == 'create') { print ''; } else { $object = new BookKeeping($db); + $result = $object->fetchPerMvt($piece_num, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -811,7 +815,7 @@ if ($action == 'create') { } } - print dol_get_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); From 79334dbbe4178efd0e41b73dd1c285fca3b6cfb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 00:49:55 +0100 Subject: [PATCH 476/862] Fix regression in GETPOST --- htdocs/accountancy/bookkeeping/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 7ac6bc27cea..f776fb43b9e 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -53,7 +53,7 @@ $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bookkeepinglist'; // Search Parameters -$search_mvt_num = GETPOSTINT('search_mvt_num'); +$search_mvt_num = GETPOST('search_mvt_num', 'intcomma'); $search_doc_type = GETPOST("search_doc_type", 'alpha'); $search_doc_ref = GETPOST("search_doc_ref", 'alpha'); $search_date_startyear = GETPOSTINT('search_date_startyear'); From f5259cee654cbfb3d3ca444bd1adab215375950b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 01:02:24 +0100 Subject: [PATCH 477/862] Fix regression of GETPOSTINT --- htdocs/accountancy/bookkeeping/export.php | 62 +++++++++---------- htdocs/accountancy/bookkeeping/list.php | 4 +- .../accountancy/bookkeeping/listbyaccount.php | 38 ++++++------ 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 16923e5ebbd..cb9e8ea09d4 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -50,48 +50,48 @@ $massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bookkeepinglist'; -$search_mvt_num = GETPOSTINT('search_mvt_num'); +$search_mvt_num = GETPOST('search_mvt_num', 'alpha'); $search_doc_type = GETPOST("search_doc_type", 'alpha'); $search_doc_ref = GETPOST("search_doc_ref", 'alpha'); -$search_date_startyear = GETPOSTINT('search_date_startyear'); -$search_date_startmonth = GETPOSTINT('search_date_startmonth'); -$search_date_startday = GETPOSTINT('search_date_startday'); -$search_date_endyear = GETPOSTINT('search_date_endyear'); -$search_date_endmonth = GETPOSTINT('search_date_endmonth'); -$search_date_endday = GETPOSTINT('search_date_endday'); +$search_date_startyear = GETPOSTINT('search_date_startyear'); +$search_date_startmonth = GETPOSTINT('search_date_startmonth'); +$search_date_startday = GETPOSTINT('search_date_startday'); +$search_date_endyear = GETPOSTINT('search_date_endyear'); +$search_date_endmonth = GETPOSTINT('search_date_endmonth'); +$search_date_endday = GETPOSTINT('search_date_endday'); $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_doc_date = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); -$search_date_creation_startyear = GETPOSTINT('search_date_creation_startyear'); -$search_date_creation_startmonth = GETPOSTINT('search_date_creation_startmonth'); -$search_date_creation_startday = GETPOSTINT('search_date_creation_startday'); -$search_date_creation_endyear = GETPOSTINT('search_date_creation_endyear'); -$search_date_creation_endmonth = GETPOSTINT('search_date_creation_endmonth'); -$search_date_creation_endday = GETPOSTINT('search_date_creation_endday'); +$search_date_creation_startyear = GETPOSTINT('search_date_creation_startyear'); +$search_date_creation_startmonth = GETPOSTINT('search_date_creation_startmonth'); +$search_date_creation_startday = GETPOSTINT('search_date_creation_startday'); +$search_date_creation_endyear = GETPOSTINT('search_date_creation_endyear'); +$search_date_creation_endmonth = GETPOSTINT('search_date_creation_endmonth'); +$search_date_creation_endday = GETPOSTINT('search_date_creation_endday'); $search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); $search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear); -$search_date_modification_startyear = GETPOSTINT('search_date_modification_startyear'); -$search_date_modification_startmonth = GETPOSTINT('search_date_modification_startmonth'); -$search_date_modification_startday = GETPOSTINT('search_date_modification_startday'); -$search_date_modification_endyear = GETPOSTINT('search_date_modification_endyear'); -$search_date_modification_endmonth = GETPOSTINT('search_date_modification_endmonth'); -$search_date_modification_endday = GETPOSTINT('search_date_modification_endday'); +$search_date_modification_startyear = GETPOSTINT('search_date_modification_startyear'); +$search_date_modification_startmonth = GETPOSTINT('search_date_modification_startmonth'); +$search_date_modification_startday = GETPOSTINT('search_date_modification_startday'); +$search_date_modification_endyear = GETPOSTINT('search_date_modification_endyear'); +$search_date_modification_endmonth = GETPOSTINT('search_date_modification_endmonth'); +$search_date_modification_endday = GETPOSTINT('search_date_modification_endday'); $search_date_modification_start = dol_mktime(0, 0, 0, $search_date_modification_startmonth, $search_date_modification_startday, $search_date_modification_startyear); $search_date_modification_end = dol_mktime(23, 59, 59, $search_date_modification_endmonth, $search_date_modification_endday, $search_date_modification_endyear); -$search_date_export_startyear = GETPOSTINT('search_date_export_startyear'); -$search_date_export_startmonth = GETPOSTINT('search_date_export_startmonth'); -$search_date_export_startday = GETPOSTINT('search_date_export_startday'); -$search_date_export_endyear = GETPOSTINT('search_date_export_endyear'); -$search_date_export_endmonth = GETPOSTINT('search_date_export_endmonth'); -$search_date_export_endday = GETPOSTINT('search_date_export_endday'); +$search_date_export_startyear = GETPOSTINT('search_date_export_startyear'); +$search_date_export_startmonth = GETPOSTINT('search_date_export_startmonth'); +$search_date_export_startday = GETPOSTINT('search_date_export_startday'); +$search_date_export_endyear = GETPOSTINT('search_date_export_endyear'); +$search_date_export_endmonth = GETPOSTINT('search_date_export_endmonth'); +$search_date_export_endday = GETPOSTINT('search_date_export_endday'); $search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear); $search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear); -$search_date_validation_startyear = GETPOSTINT('search_date_validation_startyear'); -$search_date_validation_startmonth = GETPOSTINT('search_date_validation_startmonth'); -$search_date_validation_startday = GETPOSTINT('search_date_validation_startday'); -$search_date_validation_endyear = GETPOSTINT('search_date_validation_endyear'); -$search_date_validation_endmonth = GETPOSTINT('search_date_validation_endmonth'); -$search_date_validation_endday = GETPOSTINT('search_date_validation_endday'); +$search_date_validation_startyear = GETPOSTINT('search_date_validation_startyear'); +$search_date_validation_startmonth = GETPOSTINT('search_date_validation_startmonth'); +$search_date_validation_startday = GETPOSTINT('search_date_validation_startday'); +$search_date_validation_endyear = GETPOSTINT('search_date_validation_endyear'); +$search_date_validation_endmonth = GETPOSTINT('search_date_validation_endmonth'); +$search_date_validation_endday = GETPOSTINT('search_date_validation_endday'); $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear); $search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear); $search_import_key = GETPOST("search_import_key", 'alpha'); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index f776fb43b9e..a9931ab2ccb 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -53,7 +53,7 @@ $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bookkeepinglist'; // Search Parameters -$search_mvt_num = GETPOST('search_mvt_num', 'intcomma'); +$search_mvt_num = GETPOST('search_mvt_num', 'alpha'); $search_doc_type = GETPOST("search_doc_type", 'alpha'); $search_doc_ref = GETPOST("search_doc_ref", 'alpha'); $search_date_startyear = GETPOSTINT('search_date_startyear'); @@ -154,7 +154,7 @@ $hookmanager->initHooks(array('bookkeepinglist')); $formaccounting = new FormAccounting($db); $form = new Form($db); -if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOSTINT('page') == '' && !GETPOSTINT('noreset') && $user->hasRight('accounting', 'mouvements', 'export')) { +if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'alpha') == '' && !GETPOSTINT('noreset') && $user->hasRight('accounting', 'mouvements', 'export')) { if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) { $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index bb549a3bc6d..338ca12e5f0 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -52,29 +52,29 @@ if ($type == 'sub') { $context_default = 'bookkeepingbyaccountlist'; } $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default; -$search_date_startyear = GETPOSTINT('search_date_startyear'); -$search_date_startmonth = GETPOSTINT('search_date_startmonth'); -$search_date_startday = GETPOSTINT('search_date_startday'); -$search_date_endyear = GETPOSTINT('search_date_endyear'); -$search_date_endmonth = GETPOSTINT('search_date_endmonth'); -$search_date_endday = GETPOSTINT('search_date_endday'); +$search_date_startyear = GETPOSTINT('search_date_startyear'); +$search_date_startmonth = GETPOSTINT('search_date_startmonth'); +$search_date_startday = GETPOSTINT('search_date_startday'); +$search_date_endyear = GETPOSTINT('search_date_endyear'); +$search_date_endmonth = GETPOSTINT('search_date_endmonth'); +$search_date_endday = GETPOSTINT('search_date_endday'); $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_doc_date = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); -$search_date_export_startyear = GETPOSTINT('search_date_export_startyear'); -$search_date_export_startmonth = GETPOSTINT('search_date_export_startmonth'); -$search_date_export_startday = GETPOSTINT('search_date_export_startday'); -$search_date_export_endyear = GETPOSTINT('search_date_export_endyear'); -$search_date_export_endmonth = GETPOSTINT('search_date_export_endmonth'); -$search_date_export_endday = GETPOSTINT('search_date_export_endday'); +$search_date_export_startyear = GETPOSTINT('search_date_export_startyear'); +$search_date_export_startmonth = GETPOSTINT('search_date_export_startmonth'); +$search_date_export_startday = GETPOSTINT('search_date_export_startday'); +$search_date_export_endyear = GETPOSTINT('search_date_export_endyear'); +$search_date_export_endmonth = GETPOSTINT('search_date_export_endmonth'); +$search_date_export_endday = GETPOSTINT('search_date_export_endday'); $search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear); $search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear); -$search_date_validation_startyear = GETPOSTINT('search_date_validation_startyear'); -$search_date_validation_startmonth = GETPOSTINT('search_date_validation_startmonth'); -$search_date_validation_startday = GETPOSTINT('search_date_validation_startday'); -$search_date_validation_endyear = GETPOSTINT('search_date_validation_endyear'); -$search_date_validation_endmonth = GETPOSTINT('search_date_validation_endmonth'); -$search_date_validation_endday = GETPOSTINT('search_date_validation_endday'); +$search_date_validation_startyear = GETPOSTINT('search_date_validation_startyear'); +$search_date_validation_startmonth = GETPOSTINT('search_date_validation_startmonth'); +$search_date_validation_startday = GETPOSTINT('search_date_validation_startday'); +$search_date_validation_endyear = GETPOSTINT('search_date_validation_endyear'); +$search_date_validation_endmonth = GETPOSTINT('search_date_validation_endmonth'); +$search_date_validation_endday = GETPOSTINT('search_date_validation_endday'); $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear); $search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear); $search_import_key = GETPOST("search_import_key", 'alpha'); @@ -91,7 +91,7 @@ if ($search_accountancy_code_end == - 1) { } $search_doc_ref = GETPOST('search_doc_ref', 'alpha'); $search_label_operation = GETPOST('search_label_operation', 'alpha'); -$search_mvt_num = GETPOSTINT('search_mvt_num'); +$search_mvt_num = GETPOST('search_mvt_num', 'alpha'); $search_direction = GETPOST('search_direction', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_debit = GETPOST('search_debit', 'alpha'); From 6506a547341f1edc7e44ff0fdc1d53b9b59b22f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 01:12:35 +0100 Subject: [PATCH 478/862] Fix regression --- htdocs/accountancy/class/bookkeeping.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 44f28bae658..2dc381808fc 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2055,6 +2055,7 @@ class BookKeeping extends CommonObject $error = 0; $sql_filter = $this->getCanModifyBookkeepingSQL(); + if (!isset($sql_filter)) { return -1; } @@ -2344,10 +2345,11 @@ class BookKeeping extends CommonObject $sql_list = array(); if (!empty($conf->cache['active_fiscal_period_cached']) && is_array($conf->cache['active_fiscal_period_cached'])) { foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) { - $sql_list[] = "('" . $this->db->idate($fiscal_period['date_start']) . "' <= {$alias}doc_date AND {$alias}doc_date <= '" . $this->db->idate($fiscal_period['date_end']) . "')"; + $sql_list[] = "('" . $this->db->idate($fiscal_period['date_start']) . "' <= ".$this->db->sanitize($alias)."doc_date AND ".$this->db->sanitize($alias)."doc_date <= '" . $this->db->idate($fiscal_period['date_end']) . "')"; } } - self::$can_modify_bookkeeping_sql_cached[$alias] = !empty($sql_list) ? ' AND (' . $this->db->sanitize(implode(' OR ', $sql_list), 1, 1, 1) . ')' : ''; + $sqlsanitized = implode(' OR ', $sql_list); + self::$can_modify_bookkeeping_sql_cached[$alias] = !empty($sql_list) ? " AND (".$sqlsanitized.")" : ""; } return self::$can_modify_bookkeeping_sql_cached[$alias]; From aadd5376aa7c7a0dbc1c57f814e7d69edcaccb42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 00:47:32 +0100 Subject: [PATCH 479/862] FIX Inline edition not implemented --- htdocs/accountancy/admin/fiscalyear_card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index ee587a31f96..06dc52d3247 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -313,23 +313,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Label print '"; // Date start print ''; // Date end print ''; // Status From ae3847dc38c27c40b6267fe6a430a63bb895656d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 00:48:51 +0100 Subject: [PATCH 480/862] FIX Manual deletion of a bookkeeping line Conflicts: htdocs/accountancy/class/bookkeeping.class.php --- .../accountancy/class/bookkeeping.class.php | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 9075c241e3b..97387198fcd 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -758,11 +758,10 @@ class BookKeeping extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * @param string $mode Mode - * - * @return int Return integer <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @param string $mode Mode ('' or 'tmp_') + * @return int Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = null, $mode = '') { @@ -1491,17 +1490,18 @@ class BookKeeping extends CommonObject /** * Delete object in database * - * @param User $user User that deletes - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @param string $mode Mode - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that deletes + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @param string $mode Mode ('' or 'tmp_') + * @return int Return integer <0 if KO, >0 if OK */ - public function delete(User $user, $notrigger = false, $mode = '') + public function delete(User $user, $notrigger = 0, $mode = '') { global $langs; + dol_syslog(__METHOD__, LOG_DEBUG); - $result = $this->canModifyBookkeeping($this->id); + $result = $this->canModifyBookkeeping($this->id, $mode); if ($result < 0) { return -1; } elseif ($result == 0) { @@ -2303,9 +2303,10 @@ class BookKeeping extends CommonObject * Is the bookkeeping can be modified or deleted ? * * @param int $id Bookkeeping ID + * @param string $mode Mode ('' or 'tmp_') * @return int Return integer <0 if KO, == 0 if No, == 1 if Yes */ - public function canModifyBookkeeping($id) + public function canModifyBookkeeping($id, $mode = '') { global $conf; @@ -2317,7 +2318,7 @@ class BookKeeping extends CommonObject } $bookkeeping = new BookKeeping($this->db); - $result = $bookkeeping->fetch($id); + $result = $bookkeeping->fetch($id, null, $mode); if ($result <= 0) { return $result; } @@ -2338,7 +2339,7 @@ class BookKeeping extends CommonObject } $bookkeeping = new BookKeeping($this->db); - $result = $bookkeeping->fetch($id); + $result = $bookkeeping->fetch($id, null, $mode); if ($result <= 0) { return $result; } From 07d12c48e9286cc685215c90e75eea9e503a48a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 00:49:45 +0100 Subject: [PATCH 481/862] FIX Bad management on error creation of bookkeeping Conflicts: htdocs/accountancy/bookkeeping/card.php --- htdocs/accountancy/bookkeeping/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 7d42cb64a00..a2a617502bf 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -204,6 +204,8 @@ if ($action == "confirm_update") { $result = $object->createStd($user, false, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); + + $action = 'create'; } else { if ($mode != '_tmp') { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); @@ -404,6 +406,7 @@ if ($action == 'create') { print ''; } else { $object = new BookKeeping($db); + $result = $object->fetchPerMvt($piece_num, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); From d9a114e63d98619b4f00434d29e33022fe2dca25 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 01:29:57 +0100 Subject: [PATCH 482/862] Look and feel --- htdocs/accountancy/closure/index.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index b33efc256e3..378c5a18778 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -309,7 +309,7 @@ if (isset($current_fiscal_period)) { $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; $head[0][1] = $langs->trans("AccountancyClosureStep1"); $head[0][2] = 'step1'; - print dol_get_fiche_head($head, 'step1', '', -1, 'title_accountancy'); + print dol_get_fiche_head($head, 'step1', '', -1, ''); print '' . $langs->trans("AccountancyClosureStep1Desc") . '
'; @@ -355,12 +355,14 @@ if (isset($current_fiscal_period)) { print "
'; - print($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); + print $itemurl; print "'; print dol_escape_htmltag($invoicetmp->ref_supplier); print "'; - print($salaryBonPl ? $usertmp->getNomUrl(-1) : $thirdpartytmp->getNomUrl(1)); + print $partyurl; print "'.$obj->Auto_increment.''.$obj->Check_time.''.$obj->Collation; - if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci")))) { + // Accept utf8, utf8mb3_unicode_ci, utf8mb4_unicode_ci + if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "latin1_swedish_ci")))) { print '
'.$langs->trans("Convert").' UTF8'; } print '
'.$obj->Rows.''.$obj->Avg_row_length.''.$obj->Data_length.''.$obj->Max_data_length.''.$obj->Index_length.''.$obj->Auto_increment.''.$obj->Check_time.''.$obj->Collation; - // Accept utf8, utf8mb3_unicode_ci, utf8mb4_unicode_ci - if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "latin1_swedish_ci")))) { - print '
'.$langs->trans("Convert").' UTF8'; + print '
'.$obj->Rows.''.$obj->Avg_row_length.''.$obj->Data_length.''.$obj->Max_data_length.''.$obj->Index_length.''.$obj->Auto_increment.''.$obj->Check_time.''.$obj->Collation; + // Link to convert collation + if (isset($obj->Collation)) { + print '
'.$langs->trans("ConvertInto"); + if (!in_array($obj->Collation, array("utf8_unicode_ci"))) { + print ' utf8'; + } + if (!in_array($obj->Collation, array("utf8mb4_unicode_ci"))) { + print ' utf8mb4'; + } + print ''; } print '
".$row[0]."".$row[1].""; + $proptype = $row[1]; + $pictoType = ''; + $matches = array(); + if (preg_match('/^varchar/', $proptype, $matches)) { + $pictoType = 'varchar'; + } elseif (strpos($proptype, 'int') === 0 || strpos($proptype, 'tinyint') === 0 || strpos($proptype, 'bigint') === 0) { + $pictoType = 'int'; + } elseif (strpos($proptype, 'timestamp') === 0) { + $pictoType = 'datetime'; + } elseif (strpos($proptype, 'real') === 0) { + $pictoType = 'double'; + } + print(!empty($pictoType) ? getPictoForType($pictoType) : getPictoForType($proptype)).''.dol_escape_htmltag($proptype).''; + print "".$row[2]."".(empty($row[2]) ? ' ' : $row[2]); + + // Link to convert collation + if (isset($row[2])) { + print '
'.$langs->trans("ConvertInto"); + if (!in_array($row[2], array("utf8_unicode_ci"))) { + print ' utf8'; + } + if (!in_array($row[2], array("utf8mb4_unicode_ci"))) { + print ' utf8mb4'; + } + print ''; + } else { + print '
 '; + } + + print "
".$row[3]."
'; $fieldsforcontent = array('topic', 'email_from','joinfiles', 'content'); From ae41b07b705aad3f99fdc7eb997c0bbfd2ad35d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 20:51:47 +0100 Subject: [PATCH 447/862] Fix trans --- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/public/eventorganization/attendee_new.php | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f20f46f5c03..ed6431ff1d6 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1666,7 +1666,7 @@ LDAPDescUsers=This page allows you to define LDAP attributes name in LDAP tree f LDAPDescGroups=This page allows you to define LDAP attributes name in LDAP tree for each data found on Dolibarr groups. LDAPDescMembers=This page allows you to define LDAP attributes name in LDAP tree for each data found on Dolibarr members module. LDAPDescMembersTypes=This page allows you to define LDAP attributes name in LDAP tree for each data found on Dolibarr members types. -LDAPDescValues=Example values are designed for OpenLDAP with following loaded schemas: core.schema, cosine.schema, inetorgperson.schema). If you use thoose values and OpenLDAP, modify your LDAP config file slapd.conf to have all thoose schemas loaded. +LDAPDescValues=Example values are designed for OpenLDAP with following loaded schemas: core.schema, cosine.schema, inetorgperson.schema). If you use those values and OpenLDAP, modify your LDAP config file slapd.conf to have all those schemas loaded. ForANonAnonymousAccess=For an authenticated access (for a write access for example) PerfDolibarr=Performance setup/optimizing report YouMayFindPerfAdviceHere=This page provides some checks or advice related to performance. @@ -2452,3 +2452,4 @@ VideoGeneration=Video generation AudioText=Audio - Text AIPromptForFeatures=AI custom prompts for features EnterAnIP=Enter an IP address +ConvertInto=Convert into diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 9d3b5c5fb08..e0e26dc460b 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -27,6 +27,7 @@ EventOrganizationMenuLeft = Organized events EventOrganizationConferenceOrBoothMenuLeft = Conference Or Booth PaymentEvent=Payment of event +EventFee=Event fee # # Admin page diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 3d6db67046d..3eb22bceb3a 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -510,6 +510,8 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen // TODO Use default language of $thirdparty->default_lang to build $outputlang + $outputlangs->loadLangs(array("eventorganization")); + // Get product to use for invoice $productforinvoicerow = new Product($db); $productforinvoicerow->id = 0; @@ -629,7 +631,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); + $outputlangs->loadLangs(array("main", "members", "eventorganization")); // Get email content from template $arraydefaultmessage = null; From dfa9ed67d07b9af4a4f7cf3e3e23f15c5519f170 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 20:38:51 +0100 Subject: [PATCH 448/862] Fix warnings --- htdocs/admin/mails_templates.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index cabbe69c319..7a6d513c589 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -681,7 +681,7 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu // Confirm deletion of record if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid).'&code='.urlencode($code).'&id='.((int) $id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid).'&id='.((int) $id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); } @@ -1096,7 +1096,7 @@ if ($num) { } print "
'; $fieldsforcontent = array('topic', 'email_from','joinfiles', 'content'); From 08ed8f9aaffba580ba2519d4700a4f7bed55e096 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 20:51:47 +0100 Subject: [PATCH 449/862] Fix trans --- htdocs/langs/en_US/admin.lang | 5 +++-- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/public/eventorganization/attendee_new.php | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 931cb74aa11..2d89a39b03a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1669,7 +1669,7 @@ LDAPDescUsers=This page allows you to define LDAP attributes name in LDAP tree f LDAPDescGroups=This page allows you to define LDAP attributes name in LDAP tree for each data found on Dolibarr groups. LDAPDescMembers=This page allows you to define LDAP attributes name in LDAP tree for each data found on Dolibarr members module. LDAPDescMembersTypes=This page allows you to define LDAP attributes name in LDAP tree for each data found on Dolibarr members types. -LDAPDescValues=Example values are designed for OpenLDAP with following loaded schemas: core.schema, cosine.schema, inetorgperson.schema). If you use thoose values and OpenLDAP, modify your LDAP config file slapd.conf to have all thoose schemas loaded. +LDAPDescValues=Example values are designed for OpenLDAP with following loaded schemas: core.schema, cosine.schema, inetorgperson.schema). If you use those values and OpenLDAP, modify your LDAP config file slapd.conf to have all those schemas loaded. ForANonAnonymousAccess=For an authenticated access (for a write access for example) PerfDolibarr=Performance setup/optimizing report YouMayFindPerfAdviceHere=This page provides some checks or advice related to performance. @@ -2442,4 +2442,5 @@ RecommendedForProduction=Recommended for Production RecommendedForDebug=Recommended for Debug ExportUseForce=Use the parameter -f ExportUseForceHelp=Force to continue the export even when an error is found (Backup may not be reliable) -EnterAnIP=Enter an IP address \ No newline at end of file +EnterAnIP=Enter an IP address +ConvertInto=Convert into diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 30c3f5d6b59..4dda951377a 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -27,6 +27,7 @@ EventOrganizationMenuLeft = Organized events EventOrganizationConferenceOrBoothMenuLeft = Conference Or Booth PaymentEvent=Payment of event +EventFee=Event fee # # Admin page diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index a2175e26ae3..154cac787c5 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -510,6 +510,8 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen // TODO Use default language of $thirdparty->default_lang to build $outputlang + $outputlangs->loadLangs(array("eventorganization")); + // Get product to use for invoice $productforinvoicerow = new Product($db); $productforinvoicerow->id = 0; @@ -629,7 +631,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); + $outputlangs->loadLangs(array("main", "members", "eventorganization")); // Get email content from template $arraydefaultmessage = null; From 8e372094ac20bae9f3e1a8d067fda4d977df70d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 18 Mar 2024 22:11:22 +0100 Subject: [PATCH 450/862] fix warning --- htdocs/admin/system/dbtable.php | 52 ++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index c7e7c5baa5e..c42067da6ce 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +28,9 @@ // Load Dolibarr environment require '../../main.inc.php'; +/** @var Conf $conf */ +/** @var DoliDB $db */ + $langs->load("admin"); if (!$user->admin) { @@ -43,12 +47,12 @@ $table = GETPOST('table', 'alpha'); llxHeader(); -print load_fiche_titre($langs->trans("Table")." ".$table, '', 'title_setup'); +print load_fiche_titre($langs->trans("Table") . " " . $table, '', 'title_setup'); // Define request to get table description $base = 0; if (preg_match('/mysql/i', $conf->db->type)) { - $sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'"; + $sql = "SHOW TABLE STATUS LIKE '" . $db->escape($table) . "'"; $base = 1; } elseif ($conf->db->type == 'pgsql') { $sql = "SELECT conname,contype FROM pg_constraint"; @@ -87,19 +91,19 @@ if (!$base) { print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; // $sql = "DESCRIBE ".$table; - $sql = "SHOW FULL COLUMNS IN ".$db->escape($table); + $sql = "SHOW FULL COLUMNS IN " . $db->escape($table); $resql = $db->query($sql); if ($resql) { @@ -110,27 +114,27 @@ if (!$base) { print ''; // field - print ""; + print ""; // type - print ""; + print ""; // collation - print ""; + print ""; // null - print ""; + print ""; // key - print ""; + print ""; // default - print ""; + print ""; // extra - print ""; + print ""; // privileges - print ""; + print ""; - print ""; + print ""; - print ''; - print ''; + print ''; + print ''; print ''; $i++; } From 03cda2dcc81148bf8abf39e8003beb6198d77908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 18 Mar 2024 22:25:13 +0100 Subject: [PATCH 451/862] fix --- htdocs/admin/system/dbtable.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index dde9adccea0..a47be52e386 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -226,4 +226,3 @@ if (!$base) { // End of page llxFooter(); $db->close(); - From f9797b82b48bee7e8174cd834d50713c341c6e02 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 18 Mar 2024 22:25:29 +0100 Subject: [PATCH 452/862] the surrounding lines contained an ' as ' in the SQL statement, works both with and without, but this brings consistency --- htdocs/societe/notify/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 0e0031e6f9c..69d8ce43b50 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -233,7 +233,7 @@ if ($result > 0) { $sql .= " c.rowid as contactid, c.lastname, c.firstname, c.email"; $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql .= " ".MAIN_DB_PREFIX."notify_def as n,"; - $sql .= " ".MAIN_DB_PREFIX."socpeople c"; + $sql .= " ".MAIN_DB_PREFIX."socpeople as c"; $sql .= " WHERE a.rowid = n.fk_action"; $sql .= " AND c.rowid = n.fk_contact"; $sql .= " AND c.fk_soc = ".((int) $object->id); From 1a35b20cb73fa2874b6e1935f79b36b8c08dc874 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 18 Mar 2024 22:28:10 +0100 Subject: [PATCH 453/862] only counts notifications for existing contacts. SQL code copy from htdocs/societe/notify/card.php --- htdocs/core/lib/company.lib.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 5e69aaba3df..902ed1f0cfe 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -321,10 +321,17 @@ function societe_prepare_head(Societe $object) if (!is_null($dataretrieved)) { $nbNotif = $dataretrieved; } else { + + // List of notifications enabled for contacts $sql = "SELECT COUNT(n.rowid) as nb"; - $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n"; - $sql .= " WHERE fk_soc = ".((int) $object->id); - $resql = $db->query($sql); + $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; + $sql .= " ".MAIN_DB_PREFIX."notify_def as n,"; + $sql .= " ".MAIN_DB_PREFIX."socpeople as c"; + $sql .= " WHERE a.rowid = n.fk_action"; + $sql .= " AND c.rowid = n.fk_contact"; + $sql .= " AND c.fk_soc = ".((int) $object->id); + + $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); $nbNotif = $obj->nb; From fce674e3472b0cdc0c47f6027935dd48824acc5d Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 18 Mar 2024 22:42:57 +0100 Subject: [PATCH 454/862] precommit check failed --- htdocs/core/lib/company.lib.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 902ed1f0cfe..bb9620d4a3b 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -321,7 +321,6 @@ function societe_prepare_head(Societe $object) if (!is_null($dataretrieved)) { $nbNotif = $dataretrieved; } else { - // List of notifications enabled for contacts $sql = "SELECT COUNT(n.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; @@ -330,8 +329,7 @@ function societe_prepare_head(Societe $object) $sql .= " WHERE a.rowid = n.fk_action"; $sql .= " AND c.rowid = n.fk_contact"; $sql .= " AND c.fk_soc = ".((int) $object->id); - - $resql = $db->query($sql); + $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); $nbNotif = $obj->nb; From defd044a747295564f79ea4b7011bfb1b927de8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 23:34:08 +0100 Subject: [PATCH 455/862] Fix phpunit --- htdocs/admin/system/dbtable.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index a47be52e386..2cec477994f 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -52,10 +52,10 @@ if ($action == 'convertutf8') { while ($i < $num) { $row = $db->fetch_row($resql); if ($row[0] == $field) { - $sql = 'ALTER TABLE '.$db->sanitize($table).' MODIFY '.$db->sanitize($row[0]).' '.$row[1].' CHARACTER SET utf8'; // We must not sanitize the $row[1] + $sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." CHARACTER SET utf8"; // We must not sanitize the $row[1] $db->query($sql); - $sql = 'ALTER TABLE '.$db->sanitize($table).' MODIFY '.$db->sanitize($row[0]).' '.$row[1].' COLLATE utf8_unicode_ci'; // We must not sanitize the $row[1] + $sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." COLLATE utf8_unicode_ci"; // We must not sanitize the $row[1] $db->query($sql); break; @@ -73,10 +73,10 @@ if ($action == 'convertutf8mb4') { while ($i < $num) { $row = $db->fetch_row($resql); if ($row[0] == $field) { - $sql = 'ALTER TABLE '.$db->sanitize($table).' MODIFY '.$db->sanitize($row[0]).' '.$row[1].' CHARACTER SET utf8mb4'; // We must not sanitize the $row[1] + $sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." CHARACTER SET utf8mb4"; // We must not sanitize the $row[1] $db->query($sql); - $sql = 'ALTER TABLE '.$db->sanitize($table).' MODIFY '.$db->sanitize($row[0]).' '.$row[1].' COLLATE utf8mb4_unicode_ci'; // We must not sanitize the $row[1] + $sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." COLLATE utf8mb4_unicode_ci"; // We must not sanitize the $row[1] $db->query($sql); break; From a08f330ca72fb62f72ea2bd634593dd981d23443 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 17:59:44 +0100 Subject: [PATCH 456/862] Qual: Always run phpcin pre-commit workflow # Qual: Always run phpcs in pre-commit workflow Developers are prioritizing the Travis Run because the pre-commit workflow only runs the phpcs checks if the other pre-commit checks did not fail. This modifies the action so that the phpcs checks are also run if the previous step failed. That should help limit travis load and delays. --- .github/workflows/pre-commit.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 384ef39880e..ff99f5bdd74 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -67,13 +67,16 @@ jobs: uses: shivammathur/setup-php@v2 # Install when we're going to run phpcs if: | - steps.changed-php.outputs.any_changed == 'true' - || + ! cancelled() && ( - github.event_name == 'push' - && ( - github.event.ref == 'refs/heads/develop' - || endsWith(github.event.ref, '.0') + steps.changed-php.outputs.any_changed == 'true' + || + ( + github.event_name == 'push' + && ( + github.event.ref == 'refs/heads/develop' + || endsWith(github.event.ref, '.0') + ) ) ) with: @@ -82,7 +85,7 @@ jobs: tools: phpcs - name: Run some pre-commit hooks on selected changed files only - if: steps.changed-php.outputs.any_changed == 'true' + if: "! cancelled() && steps.changed-php.outputs.any_changed == 'true'" env: ALL_CHANGED_FILES: ${{ steps.changed-php.outputs.all_changed_files }} run: | From c9e7fc0ca426705cebc2693c931357daf79aec4f Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 21:40:23 +0100 Subject: [PATCH 457/862] Qual: Update logToCheckStyle to version that extracts PHP Fatal Errors --- .github/workflows/windows-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-ci.yaml b/.github/workflows/windows-ci.yaml index defb42e0148..643c96bb21f 100644 --- a/.github/workflows/windows-ci.yaml +++ b/.github/workflows/windows-ci.yaml @@ -152,7 +152,7 @@ jobs: echo "PHPUNIT seems to have completed with a test result, reuse the exit code" for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A - name: Convert Raw Log to Annotations - uses: mdeweerd/logToCheckStyle@v2024.2.9 + uses: mdeweerd/logToCheckStyle@v2024.3.2 if: ${{ failure() }} with: in: ${{ env.PHPUNIT_LOG }} From f20ca9b0023291c53d13035943e4bbd69109e084 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 18 Mar 2024 23:51:44 +0100 Subject: [PATCH 458/862] actually delete notifications belonging to a contact when a contact is deleted --- htdocs/contact/class/contact.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 1c800456b76..d5d96b58f34 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1298,6 +1298,18 @@ class Contact extends CommonObject } } + if (!$error) { + // Remove Notifications + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def WHERE fk_contact = ".((int) $this->id); + dol_syslog(__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->error .= $this->db->lasterror(); + $errorflag = -1; + } + } + if (!$error) { // Remove category $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople = ".((int) $this->id); From 1a863a374d29a3ad98f9e8c96716e37ca2b03021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 19 Mar 2024 00:09:33 +0100 Subject: [PATCH 459/862] fix --- htdocs/public/stripe/ipn.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 9dcbc1248fa..ceba4a94a41 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -1,9 +1,8 @@ - * Copyright (C) 2018 Fédéric France - * Copyright (C) 2023 Laurent Destailleur +/* Copyright (C) 2018-2020 Thibault FOUCART + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2023 Laurent Destailleur * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 4500672cb4222fc5b8b6808931004b385577ae37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 00:11:59 +0100 Subject: [PATCH 460/862] Rename hooks --- htdocs/accountancy/bookkeeping/card.php | 11 ++++++----- htdocs/accountancy/class/bookkeeping.class.php | 10 ---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index a05e4e1bcef..79f7c44cda9 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -95,11 +95,11 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { * Actions */ $parameters = array(); -$reshook_onBeforeActions = $hookmanager->executeHooks('doActions', $parameters, $object, $action); -if ($reshook_onBeforeActions < 0) { +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); +if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -if (empty($reshook_onBeforeActions)) { +if (empty($reshook)) { if ($cancel) { header("Location: ".DOL_URL_ROOT.'/accountancy/bookkeeping/list.php'); exit; @@ -267,10 +267,11 @@ if (empty($reshook_onBeforeActions)) { $object->amount = 0; $result = $object->createStd($user, 0, $mode); - $reshook = $hookmanager->executeHooks('onConfirmCreate_onAfterCreateEmptyLine', $parameters, $object, $action); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { + $reshook = $hookmanager->executeHooks('afterCreateBookkeeping', $parameters, $object, $action); + if ($mode != '_tmp') { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } @@ -399,7 +400,7 @@ if ($action == 'create') { print ''; print ''; */ - $reshook_onCreate_onAfterShowFields = $hookmanager->executeHooks('onCreate_onAfterShowFields', $parameters, $object, $action); + $reshookAddLine = $hookmanager->executeHooks('bookkeepingAddLine', $parameters, $object, $action); print '
'.$langs->trans("Fields").''.$langs->trans("Type").''.$langs->trans("Collation").''.$langs->trans("Null").''.$langs->trans("Index").''.$langs->trans("Default").''.$langs->trans("Extra").''.$langs->trans("Privileges").''.$langs->trans("FieldsLinked").'' . $langs->trans("Fields") . '' . $langs->trans("Type") . '' . $langs->trans("Collation") . '' . $langs->trans("Null") . '' . $langs->trans("Index") . '' . $langs->trans("Default") . '' . $langs->trans("Extra") . '' . $langs->trans("Privileges") . '' . $langs->trans("FieldsLinked") . '
".$row[0]."" . $row[0] . "".$row[1]."" . $row[1] . "".$row[2]."" . $row[2] . "".$row[3]."" . $row[3] . "".(empty($row[4]) ? '' : $row[4])."" . (empty($row[4]) ? '' : $row[4]) . "".(empty($row[5]) ? '' : $row[5])."" . (empty($row[5]) ? '' : $row[5]) . "".(empty($row[6]) ? '' : $row[6])."" . (empty($row[6]) ? '' : $row[6]) . "".(empty($row[7]) ? '' : $row[7])."" . (empty($row[7]) ? '' : $row[7]) . "".(isset($link[$row[0]][0]) ? $link[$row[0]][0] : '')."."; - print(isset($link[$row[0]][1]) ? $link[$row[0]][1] : '')."" . (isset($link[$row[0]][0]) ? $link[$row[0]][0] : '') . "."; + print (isset($link[$row[0]][1]) ? $link[$row[0]][1] : '') . "
'; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6a261a146cd..5c07b8f637f 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -721,16 +721,6 @@ class BookKeeping extends CommonObject if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element.$mode); - - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. - //if (! $notrigger) { - - // // Call triggers - // $result=$this->call_trigger('MYOBJECT_CREATE',$user); - // if ($result < 0) $error++; - // // End call triggers - //} } // Commit or rollback From 87ac6e2f686edbf4f69c3a478d9c2b2d19072fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 19 Mar 2024 00:28:08 +0100 Subject: [PATCH 461/862] fix sql --- htdocs/compta/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 57748c27950..b17520685ad 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -9,7 +9,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2020 Josep Lluís Amador - * Copyright (C) 2021-2023 Frédéric France + * Copyright (C) 2021-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -137,7 +137,7 @@ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) { $sql .= ", s.rowid as socid"; $sql .= ", s.code_client, s.code_compta, s.email"; $sql .= ", cc.rowid as country_id, cc.code as country_code"; - $sql .= ", (SELECT SUM(pf.amount) FROM llx_paiement_facture as pf WHERE pf.fk_facture = f.rowid) as am"; + $sql .= ", (SELECT SUM(pf.amount) FROM ".MAIN_DB_PREFIX."paiement_facture as pf WHERE pf.fk_facture = f.rowid) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays"; @@ -283,7 +283,7 @@ if ((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO $sql .= ", s.nom as name"; $sql .= ", s.rowid as socid"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.email"; - $sql .= ", (SELECT SUM(pf.amount) FROM llx_paiementfourn_facturefourn as pf WHERE pf.fk_facturefourn = ff.rowid) as am"; + $sql .= ", (SELECT SUM(pf.amount) FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf WHERE pf.fk_facturefourn = ff.rowid) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql .= " WHERE s.rowid = ff.fk_soc"; $sql .= " AND ff.entity IN (".getEntity('facture_fourn').")"; From 2917b3451927f7811d9221ab87259ee92d3c2a42 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 18:42:43 +0100 Subject: [PATCH 462/862] Fix phpstan $fields property issue Fix Property FactureFournisseur::$fields (array) does not accept default value of type array{rowid: array --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index beb2a0d3564..845053a4d89 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -254,7 +254,7 @@ class FactureFournisseur extends CommonInvoice 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), 'ref' => array('type' => 'varchar(255)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 15), 'ref_supplier' => array('type' => 'varchar(255)', 'label' => 'RefSupplier', 'enabled' => 1, 'visible' => -1, 'position' => 20), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 25, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 25, 'index' => 1), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'visible' => 0, 'position' => 30), 'type' => array('type' => 'smallint(6)', 'label' => 'Type', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), 'subtype' => array('type' => 'smallint(6)', 'label' => 'InvoiceSubtype', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 36), From fd9d48faacb6fda2ec4c67d579c1fee79c3d8e51 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 18:59:41 +0100 Subject: [PATCH 463/862] Fix phpstan CommonObject->fields - notnull is optional field --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/adherents/class/subscription.class.php | 2 +- htdocs/asset/class/asset.class.php | 2 +- htdocs/asset/class/assetdepreciationoptions.class.php | 2 +- htdocs/asset/class/assetmodel.class.php | 2 +- htdocs/bom/class/bom.class.php | 4 ++-- htdocs/bookcal/class/availabilities.class.php | 2 +- htdocs/bookcal/class/calendar.class.php | 2 +- htdocs/comm/action/class/actioncommreminder.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/compta/bank/class/paymentvarious.class.php | 2 +- htdocs/compta/facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/compta/prelevement/class/bonprelevement.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 4 ++-- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/defaultvalues.class.php | 2 +- htdocs/core/class/emailsenderprofile.class.php | 2 +- htdocs/core/class/timespent.class.php | 2 +- htdocs/emailcollector/class/emailcollector.class.php | 2 +- htdocs/emailcollector/class/emailcollectoraction.class.php | 2 +- htdocs/emailcollector/class/emailcollectorfilter.class.php | 2 +- htdocs/eventorganization/class/conferenceorbooth.class.php | 2 +- .../class/conferenceorboothattendee.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expensereport/class/expensereport_ik.class.php | 2 +- htdocs/expensereport/class/expensereport_rule.class.php | 2 +- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- htdocs/hrm/class/evaluation.class.php | 2 +- htdocs/hrm/class/evaluationdet.class.php | 2 +- htdocs/hrm/class/job.class.php | 2 +- htdocs/hrm/class/position.class.php | 2 +- htdocs/hrm/class/skill.class.php | 2 +- htdocs/hrm/class/skilldet.class.php | 2 +- htdocs/hrm/class/skillrank.class.php | 2 +- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 2 +- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/opensurvey/class/opensurveysondage.class.php | 2 +- htdocs/partnership/class/partnership.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/class/productcustomerprice.class.php | 2 +- htdocs/product/class/productfournisseurprice.class.php | 2 +- htdocs/product/inventory/class/inventory.class.php | 4 ++-- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/class/productlot.class.php | 2 +- .../product/stock/stocktransfer/class/stocktransfer.class.php | 2 +- .../stock/stocktransfer/class/stocktransferline.class.php | 2 +- htdocs/projet/class/project.class.php | 2 +- htdocs/recruitment/class/recruitmentcandidature.class.php | 2 +- htdocs/recruitment/class/recruitmentjobposition.class.php | 2 +- htdocs/salaries/class/paymentsalary.class.php | 2 +- htdocs/societe/class/companybankaccount.class.php | 2 +- htdocs/societe/class/companypaymentmode.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- htdocs/societe/class/societeaccount.class.php | 2 +- htdocs/ticket/class/cticketcategory.class.php | 2 +- htdocs/variants/class/ProductAttribute.class.php | 2 +- htdocs/variants/class/ProductAttributeValue.class.php | 2 +- htdocs/webhook/class/target.class.php | 2 +- htdocs/webportal/class/webportalinvoice.class.php | 2 +- htdocs/webportal/class/webportalmember.class.php | 2 +- htdocs/webportal/class/webportalorder.class.php | 2 +- htdocs/webportal/class/webportalpartnership.class.php | 2 +- htdocs/webportal/class/webportalpropal.class.php | 2 +- htdocs/website/class/websitepage.class.php | 2 +- htdocs/workstation/class/workstation.class.php | 2 +- htdocs/workstation/class/workstationresource.class.php | 2 +- htdocs/workstation/class/workstationusergroup.class.php | 2 +- htdocs/zapier/class/hook.class.php | 2 +- 73 files changed, 76 insertions(+), 76 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b5f319bb70c..c6ce7429708 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -316,7 +316,7 @@ class Adherent extends CommonObject /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index c268ac3ab6e..c34420b67f2 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -104,7 +104,7 @@ class Subscription extends CommonObject public $fk_bank; /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 3d62ba4c91a..8666a469aee 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -94,7 +94,7 @@ class Asset extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index 0aa62c55919..dac2d1ad194 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -65,7 +65,7 @@ class AssetDepreciationOptions extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index 8576e5ee37e..51243277071 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -100,7 +100,7 @@ class AssetModel extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index c49f4a4cc89..72aab83ac21 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -111,7 +111,7 @@ class BOM extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), @@ -1714,7 +1714,7 @@ class BOMLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'LineID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index 3582ea707ec..ad34e08abcd 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -112,7 +112,7 @@ class Availabilities extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index 539ef39e5ed..b66f950fd12 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -112,7 +112,7 @@ class Calendar extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'right', 'comment' => "Id"), diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 1c8dd2b5b95..711e890e02d 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -76,7 +76,7 @@ class ActionCommReminder extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 69d3e5b59c9..9ea34ae4d3a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -308,7 +308,7 @@ class Propal extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8f89a1bb336..931fbbd94d6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -297,7 +297,7 @@ class Commande extends CommonOrder // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 67a067854f1..1dd17795fcc 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -307,7 +307,7 @@ class Account extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 6e3a2f28c67..7bb567f1536 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -198,7 +198,7 @@ class PaymentVarious extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( // TODO: fill this array diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index bb7a8ab2ace..e8d007be1fa 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -172,7 +172,7 @@ class FactureRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9b3e6733698..17cc796ff97 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -291,7 +291,7 @@ class Facture extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 1), diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index e3a3eb07439..f94983bb234 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -148,7 +148,7 @@ class BonPrelevement extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 0,), diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 1c800456b76..54a9983a6d9 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -98,7 +98,7 @@ class Contact extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 6110150e731..1202e840bd7 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -249,7 +249,7 @@ class Contrat extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -3148,7 +3148,7 @@ class ContratLigne extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 285e3915a79..f67471ee76e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -140,7 +140,7 @@ abstract class CommonObject /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index 9a47a8843e8..0b54bd8fb79 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -87,7 +87,7 @@ class DefaultValues extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index f3e1c04be92..abbd39f54e3 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -89,7 +89,7 @@ class EmailSenderProfile extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), diff --git a/htdocs/core/class/timespent.class.php b/htdocs/core/class/timespent.class.php index e0ca486ad9e..927dbed57ca 100644 --- a/htdocs/core/class/timespent.class.php +++ b/htdocs/core/class/timespent.class.php @@ -112,7 +112,7 @@ class TimeSpent extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index da23932c66b..281c658297a 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -120,7 +120,7 @@ class EmailCollector extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => 2, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1), diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index 85c9ad7dc83..bb139c8be38 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -79,7 +79,7 @@ class EmailCollectorAction extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 0089e5f0b6c..37e4cf4525c 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -81,7 +81,7 @@ class EmailCollectorFilter extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 683a8d016fe..16c91a9114f 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -112,7 +112,7 @@ class ConferenceOrBooth extends ActionComm // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'id' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 7b898c6cc12..f6e4bff74cd 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -100,7 +100,7 @@ class ConferenceOrBoothAttendee extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 90da7555450..7454e0b7832 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -92,7 +92,7 @@ class Expedition extends CommonObject /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 14727b498e7..96626648b24 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -72,7 +72,7 @@ class ExpenseReportIk extends CommonObject /** * Attribute object linked with database - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'index' => 1) diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index 7c640527055..418623df567 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -110,7 +110,7 @@ class ExpenseReportRule extends CommonObject /** * Attribute object linked with database - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'index' => 1) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 900ee4d014a..e1669cedc99 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -190,7 +190,7 @@ class FactureFournisseurRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 7bf46c30b86..6668df2a2f3 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -103,7 +103,7 @@ class Evaluation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index ad7c91c86d9..992e7fa4ce0 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -102,7 +102,7 @@ class EvaluationLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index e1a355b54cd..c38157e7133 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -101,7 +101,7 @@ class Job extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index f96cb1539a2..bcd91410fda 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -100,7 +100,7 @@ class Position extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 256956d55de..b696a8ecdaa 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -106,7 +106,7 @@ class Skill extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 12258e08025..6c02ca26c50 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -100,7 +100,7 @@ class Skilldet extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 4c599235f72..3cde6ae6476 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -104,7 +104,7 @@ class SkillRank extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 21168aea09f..1bb1040553a 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -99,7 +99,7 @@ class KnowledgeRecord extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index fbf37e0e025..4ff7f9ff232 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -116,7 +116,7 @@ class MyObject extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 082a27a1ead..c8589a3f4ba 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -94,7 +94,7 @@ class Mo extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 8e57437c2cd..91e62bdd414 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -101,7 +101,7 @@ class Opensurveysondage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'id_sondage' => array('type' => 'varchar(16)', 'label' => 'Idsondage', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => -1,), diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index b03747a8129..7d26d35cb44 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -104,7 +104,7 @@ class Partnership extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8f419c64607..17aa0d9a6bb 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -584,7 +584,7 @@ class Product extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 8a02380b629..6eda4aaf297 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; class ProductCustomerPrice extends CommonObject { /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 4, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'showoncombobox' => 1, 'noteditable' => 1), diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index d5f64ad5e0f..6e3b15405d0 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -92,7 +92,7 @@ class ProductFournisseurPrice extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 0,), diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index e793d442313..71de87fbb6a 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -96,7 +96,7 @@ class Inventory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), @@ -841,7 +841,7 @@ class InventoryLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 2ffb55706f8..a062d053ed9 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -121,7 +121,7 @@ class Entrepot extends CommonObject /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index a51b3d26d9c..3d46b4ff41e 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -99,7 +99,7 @@ class Productlot extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index f29ae639830..4bf107d58f3 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -124,7 +124,7 @@ class StockTransfer extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index af7e7946e72..b030daca098 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -94,7 +94,7 @@ class StockTransferLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 08c54b13fce..3c1d3ff67cb 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -293,7 +293,7 @@ class Project extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 8ded276c054..f80911e4381 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -107,7 +107,7 @@ class RecruitmentCandidature extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 219c2503053..90fe44b212d 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -113,7 +113,7 @@ class RecruitmentJobPosition extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index c099b10c41e..96d414b1d12 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -153,7 +153,7 @@ class PaymentSalary extends CommonObject public $datev = ''; /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index a30927fafb3..de22b6d4ea7 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -86,7 +86,7 @@ class CompanyBankAccount extends Account // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => -1,), diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index fae5b162b2e..20526bb32d9 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -83,7 +83,7 @@ class CompanyPaymentMode extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'Rowid', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 42bae7b3096..1bc51f9a903 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -188,7 +188,7 @@ class Societe extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 29819dbfdcc..97a07189c5f 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -76,7 +76,7 @@ class SocieteAccount extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index e4bcccb7e5e..c96779054ce 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -98,7 +98,7 @@ class CTicketCategory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 255a1428386..38fa0793305 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -98,7 +98,7 @@ class ProductAttribute extends CommonObject * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index a6ddfcd9570..1c291476d9e 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -76,7 +76,7 @@ class ProductAttributeValue extends CommonObjectLine * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 4b6db01486a..ef405bfadea 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -101,7 +101,7 @@ class Target extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/webportal/class/webportalinvoice.class.php b/htdocs/webportal/class/webportalinvoice.class.php index ddb7e7bec8a..751bb28e10f 100644 --- a/htdocs/webportal/class/webportalinvoice.class.php +++ b/htdocs/webportal/class/webportalinvoice.class.php @@ -97,7 +97,7 @@ class WebPortalInvoice extends Facture // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 1,), diff --git a/htdocs/webportal/class/webportalmember.class.php b/htdocs/webportal/class/webportalmember.class.php index c4954e4886d..803a405fd5d 100644 --- a/htdocs/webportal/class/webportalmember.class.php +++ b/htdocs/webportal/class/webportalmember.class.php @@ -113,7 +113,7 @@ class WebPortalMember extends Adherent // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10,), diff --git a/htdocs/webportal/class/webportalorder.class.php b/htdocs/webportal/class/webportalorder.class.php index e9cd8757b61..157dcb25775 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -98,7 +98,7 @@ class WebPortalOrder extends Commande // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10,), diff --git a/htdocs/webportal/class/webportalpartnership.class.php b/htdocs/webportal/class/webportalpartnership.class.php index 78b87cc04dd..c72ae9397f0 100644 --- a/htdocs/webportal/class/webportalpartnership.class.php +++ b/htdocs/webportal/class/webportalpartnership.class.php @@ -97,7 +97,7 @@ class WebPortalPartnership extends Partnership // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id",), diff --git a/htdocs/webportal/class/webportalpropal.class.php b/htdocs/webportal/class/webportalpropal.class.php index c49d8bfd686..47669b08c55 100644 --- a/htdocs/webportal/class/webportalpropal.class.php +++ b/htdocs/webportal/class/webportalpropal.class.php @@ -98,7 +98,7 @@ class WebPortalPropal extends Propal // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id",), diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 2da0b7f5390..7d9d21357ed 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -163,7 +163,7 @@ class WebsitePage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index f7542c226f1..fe291337135 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -96,7 +96,7 @@ class Workstation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 83a326ead04..1b92e15ed02 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -36,7 +36,7 @@ class WorkstationResource extends CommonObject public $element = 'workstationresource'; /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer'), diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index 290b6d34714..56c17415242 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -35,7 +35,7 @@ class WorkstationUserGroup extends CommonObject public $element = 'workstationusergroup'; /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer'), diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index edd9e77cb70..c7e07e39989 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -81,7 +81,7 @@ class Hook extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array( From 9c21e214d13f0894ac64263428d5b21d9d837f51 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 19:21:46 +0100 Subject: [PATCH 464/862] Fix return type for Categorie::getListForItem() --- htdocs/categories/class/categorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 57365ce5f50..0af6aa2953f 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -970,7 +970,7 @@ class Categorie extends CommonObject * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @return int<-1,0>|array,visible:int,ref_ext:string,picto:string,multilangs?:string}> Array of categories, 0 if no cat, -1 on error + * @return int<-1,0>|array,visible:int,ref_ext:string,picto:string,multilangs?:string}> Array of categories, 0 if no cat, -1 on error */ public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { From bd14c051333086dd4b8a757acad599000162ad21 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 19:24:48 +0100 Subject: [PATCH 465/862] Fix type for argument $method_trans of set_infotrans --- htdocs/compta/prelevement/class/bonprelevement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index f94983bb234..3e8e629fc7b 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -672,7 +672,7 @@ class BonPrelevement extends CommonObject * * @param User $user Id of user * @param int $date Date of action - * @param string $method Method of transmission to bank (0=Internet, 1=Api...) + * @param int $method Method of transmission to bank (0=Internet, 1=Api...) * @return int >0 if OK, <0 if KO */ public function set_infotrans($user, $date, $method) From d30b2d03627d7ec999f2d9912b66f59ddb1f69d6 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 19:28:28 +0100 Subject: [PATCH 466/862] Fix default in $fields init --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 5e69aaba3df..2a4a830d124 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1165,7 +1165,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible' => 3, 'position' => 35), 'role' => array('type' => 'checkbox', 'label' => 'Role', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 4, 'index' => 1, 'position' => 40), 'birthday' => array('type' => 'date', 'label' => 'Birthday', 'enabled' => 1, 'visible' => -1, 'notnull' => 0, 'position' => 45), - 'statut' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => 0, 'index' => 1, 'position' => 50, 'arrayofkeyval' => array(0 => $contactstatic->LibStatut(0, 1), 1 => $contactstatic->LibStatut(1, 1))), + 'statut' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 50, 'arrayofkeyval' => array(0 => $contactstatic->LibStatut(0, 1), 1 => $contactstatic->LibStatut(1, 1))), ); // Definition of fields for list From 4c8b9784951ebe795b68142568364e26dbff60f0 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 19:29:57 +0100 Subject: [PATCH 467/862] Fix typing for childtablesoncascade --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 281c658297a..ef98b294f70 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -94,7 +94,7 @@ class EmailCollector extends CommonObject protected $childtables = array(); /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. */ protected $childtablesoncascade = array('emailcollector_emailcollectorfilter', 'emailcollector_emailcollectoraction'); From a46dfec5c6595a7712915ec696cac2df501fed1b Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 19:31:28 +0100 Subject: [PATCH 468/862] Fix return type for deleteLine --- htdocs/expensereport/class/expensereport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 7fc5a866eec..c8372f95d95 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2346,7 +2346,7 @@ class ExpenseReport extends CommonObject * @param int $rowid Row id * @param User|string $fuser User * @param int<0,1> $notrigger 1=No trigger - * @return int<0,1> Return integer <0 if KO, >0 if OK + * @return int<-1,1> Return integer <0 if KO, >0 if OK */ public function deleteLine($rowid, $fuser = '', $notrigger = 0) { From 9730149fab6da07f28ea2aed802e47026e2bf5d9 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 19:35:43 +0100 Subject: [PATCH 469/862] Fix typing: childtables can also be list of strings --- 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 f67471ee76e..892fd02fcdb 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -786,7 +786,7 @@ abstract class CommonObject public $extraparams = array(); /** - * @var array List of child tables. To test if we can delete object. + * @var string[]|array List of child tables. To test if we can delete object. */ protected $childtables = array(); From c266bdb042ef00ead0f8184c26cbb7be3a9b28a0 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 19:50:22 +0100 Subject: [PATCH 470/862] Fix assignement to 'userassigned' --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 3d231680b21..1d4f5412ff2 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1818,7 +1818,7 @@ class Ticket extends CommonObject $actioncomm->socid = $this->socid; $actioncomm->label = $this->subject; $actioncomm->note_private = $this->message; - $actioncomm->userassigned = array($user->id); + $actioncomm->userassigned = array($user->id => array('id' => $user->id,'transparency' => 0)); $actioncomm->userownerid = $user->id; $actioncomm->datep = $now; $actioncomm->percentage = -1; // percentage is not relevant for punctual events From f892b3a27cc906d26635dafe3743a5ad09b4b3aa Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 19:51:57 +0100 Subject: [PATCH 471/862] Fix configuration --- htdocs/user/class/usergroup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 25a188fa8ee..401d661e5b7 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -113,7 +113,7 @@ class UserGroup extends CommonObject public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => 1, 'index' => 1, 'position' => 5), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => '1', 'index' => 1, 'position' => 5), 'nom' => array('type' => 'varchar(180)', 'label' => 'Name', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 10, 'searchall' => 1, 'comment' => 'Group name'), 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => 1, 'position' => 20, 'notnull' => -1, 'searchall' => 1), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 50, 'notnull' => 1,), From c8172c65ae73168bb0858708bc223d3faa354f77 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 20:01:36 +0100 Subject: [PATCH 472/862] Fix typing for Categorie::getListForItem() return value --- htdocs/categories/class/categorie.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 0af6aa2953f..78bfbb8bb4f 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -271,7 +271,7 @@ class Categorie extends CommonObject public $childs = array(); /** - * @var array multilangs + * @var array{string,array{label:string,description:string,note?:string}} multilangs */ public $multilangs; @@ -970,7 +970,7 @@ class Categorie extends CommonObject * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @return int<-1,0>|array,visible:int,ref_ext:string,picto:string,multilangs?:string}> Array of categories, 0 if no cat, -1 on error + * @return int<-1,0>|array,visible:int,ref_ext:string,multilangs?:array{string,array{label:string,description:string,note?:string}}}> Array of categories, 0 if no cat, -1 on error */ public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { From 2b4e2cdbb43481cd92fa6711daa08dd6c2ce36dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 00:47:32 +0100 Subject: [PATCH 473/862] FIX Inline edition not implemented --- htdocs/accountancy/admin/fiscalyear_card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 70eb459efda..447dcaab4c9 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -313,23 +313,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Label print '
'; - print $form->editfieldkey("Label", 'label', $object->label, $object, 1, 'alpha:32'); + print $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'alpha:32'); print ''; - print $form->editfieldval("Label", 'label', $object->label, $object, 1, 'alpha:32'); + print $form->editfieldval("Label", 'label', $object->label, $object, 0, 'alpha:32'); print "
'; - print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker'); + print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, 0, 'datepicker'); print ''; - print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker'); + print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, 0, 'datepicker'); print '
'; - print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker'); + print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, 0, 'datepicker'); print ''; - print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker'); + print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, 0, 'datepicker'); print '
'; - print $form->editfieldkey("Label", 'label', $object->label, $object, 1, 'alpha:32'); + print $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'alpha:32'); print ''; - print $form->editfieldval("Label", 'label', $object->label, $object, 1, 'alpha:32'); + print $form->editfieldval("Label", 'label', $object->label, $object, 0, 'alpha:32'); print "
'; - print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker'); + print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, 0, 'datepicker'); print ''; - print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker'); + print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, 0, 'datepicker'); print '
'; - print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker'); + print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, 0, 'datepicker'); print ''; - print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker'); + print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, 0, 'datepicker'); print '
\n"; print '
'; + print '
'; + // Step 2 $head = array(); $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; $head[0][1] = $langs->trans("AccountancyClosureStep2"); $head[0][2] = 'step2'; - print dol_get_fiche_head($head, 'step2', '', -1, 'title_accountancy'); + print dol_get_fiche_head($head, 'step2', '', -1, ''); // print '' . $langs->trans("AccountancyClosureStep2Desc") . '
'; @@ -371,12 +373,14 @@ if (isset($current_fiscal_period)) { } print_barre_liste('', '', '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0); + print '
'; + // Step 3 $head = array(); $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; $head[0][1] = $langs->trans("AccountancyClosureStep3"); $head[0][2] = 'step3'; - print dol_get_fiche_head($head, 'step3', '', -1, 'title_accountancy'); + print dol_get_fiche_head($head, 'step3', '', -1, ''); // print '' . $langs->trans("AccountancyClosureStep3Desc") . '
'; From 35670de57c3cf88398ff94bbd7c2085939b949a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 00:45:11 +0000 Subject: [PATCH 483/862] Bump mdeweerd/logToCheckStyle from 2024.2.9 to 2024.3.2 Bumps [mdeweerd/logToCheckStyle](https://github.com/mdeweerd/logtocheckstyle) from 2024.2.9 to 2024.3.2. - [Commits](https://github.com/mdeweerd/logtocheckstyle/compare/v2024.2.9...2024.3.2) --- updated-dependencies: - dependency-name: mdeweerd/logToCheckStyle dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/pre-commit.yml | 2 +- .github/workflows/windows-ci.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index ff99f5bdd74..ac6a5c23954 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -106,7 +106,7 @@ jobs: ls -l ~/.cache/pre-commit/ - name: Convert Raw Log to Annotations - uses: mdeweerd/logToCheckStyle@v2024.2.9 + uses: mdeweerd/logToCheckStyle@2024.3.2 if: ${{ failure() }} with: in: ${{ env.RAW_LOG }} diff --git a/.github/workflows/windows-ci.yaml b/.github/workflows/windows-ci.yaml index 643c96bb21f..927378fab59 100644 --- a/.github/workflows/windows-ci.yaml +++ b/.github/workflows/windows-ci.yaml @@ -152,7 +152,7 @@ jobs: echo "PHPUNIT seems to have completed with a test result, reuse the exit code" for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A - name: Convert Raw Log to Annotations - uses: mdeweerd/logToCheckStyle@v2024.3.2 + uses: mdeweerd/logToCheckStyle@2024.3.2 if: ${{ failure() }} with: in: ${{ env.PHPUNIT_LOG }} From 67e5e95fde871082b20b38870c3865cadee234fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 01:51:35 +0100 Subject: [PATCH 484/862] Update 19.0.0-20.0.0.sql --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 53502e05197..491b563a502 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -242,7 +242,7 @@ ALTER TABLE llx_ticket ADD COLUMN model_pdf varchar(255); ALTER TABLE llx_ticket ADD COLUMN last_main_doc varchar(255); ALTER TABLE llx_ticket ADD COLUMN extraparams varchar(255); ALTER TABLE llx_ticket ADD COLUMN origin_replyto varchar(128); -ALTER TABLE llx_ticket ADD COLUMN origin_references mediumtext; +ALTER TABLE llx_ticket ADD COLUMN origin_references text DEFAULT NULL; ALTER TABLE llx_expensereport MODIFY COLUMN model_pdf varchar(255) DEFAULT NULL; ALTER TABLE llx_fichinter_rec MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; From 57e2aea2557672243de9e42ee5ff7bd9c452280f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 01:52:03 +0100 Subject: [PATCH 485/862] Update llx_ticket-ticket.sql --- htdocs/install/mysql/tables/llx_ticket-ticket.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql index 305b8a1db87..7614bcc1ad7 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.sql @@ -26,7 +26,7 @@ CREATE TABLE llx_ticket fk_contract integer DEFAULT 0, origin_email varchar(128), origin_replyto varchar(128), - origin_references mediumtext, + origin_references text, fk_user_create integer, fk_user_assign integer, subject varchar(255), From 66faa6dd0e3e62edd7595fafb97d1b5958bad76e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 01:52:57 +0100 Subject: [PATCH 486/862] Update ticket.class.php --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 716a75672bb..fe795deac90 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -332,7 +332,7 @@ class Ticket extends CommonObject 'fk_user_create' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Author', 'visible' => 1, 'enabled' => 1, 'position' => 15, 'notnull' => 1, 'csslist' => 'tdoverflowmax100 maxwidth150onsmartphone'), 'origin_email' => array('type' => 'mail', 'label' => 'OriginEmail', 'visible' => -2, 'enabled' => 1, 'position' => 16, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'csslist' => 'tdoverflowmax150'), 'origin_replyto' => array('type' => 'mail', 'label' => 'EmailReplyto', 'visible' => -2, 'enabled' => 1, 'position' => 17, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Email to reply to", 'csslist' => 'tdoverflowmax150'), - 'origin_references' => array('type' => 'mediumtext', 'label' => 'EmailReferences', 'visible' => -2, 'enabled' => 1, 'position' => 18, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "References from origin email", 'csslist' => 'tdoverflowmax150'), + 'origin_references' => array('type' => 'text', 'label' => 'EmailReferences', 'visible' => -2, 'enabled' => 1, 'position' => 18, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "References from origin email", 'csslist' => 'tdoverflowmax150'), 'subject' => array('type' => 'varchar(255)', 'label' => 'Subject', 'visible' => 1, 'enabled' => 1, 'position' => 19, 'notnull' => -1, 'searchall' => 1, 'help' => "", 'css' => 'maxwidth200 tdoverflowmax200', 'autofocusoncreate' => 1), 'type_code' => array('type' => 'varchar(32)', 'label' => 'Type', 'visible' => 1, 'enabled' => 1, 'position' => 20, 'notnull' => -1, 'help' => "", 'csslist' => 'maxwidth125 tdoverflowmax50'), 'category_code' => array('type' => 'varchar(32)', 'label' => 'TicketCategory', 'visible' => -1, 'enabled' => 1, 'position' => 21, 'notnull' => -1, 'help' => "", 'css' => 'maxwidth100 tdoverflowmax200'), From 277f49aff62abe31bcb4899549741dc3256e37a5 Mon Sep 17 00:00:00 2001 From: xbloq Date: Mon, 18 Mar 2024 18:28:49 +0100 Subject: [PATCH 487/862] Update card.php #28938 Conflicts: htdocs/compta/prelevement/card.php --- htdocs/compta/prelevement/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 04b59c959ce..ed23a1b454d 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -460,7 +460,7 @@ if ($id > 0 || $ref) { if ($salaryBonPl) { $sql = "SELECT pl.rowid, pl.statut, pl.amount, pl.fk_user,"; $sql .= " u.rowid as socid, u.login as name"; - $sql .=" FROM llx_prelevement_lignes as pl"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb"; $sql .= ", ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id); From 2077c23c5eb2f7d50e12a61c84d3b6bc2aa36e3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 02:08:49 +0100 Subject: [PATCH 488/862] Update styles.css.php --- htdocs/ticket/css/styles.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/css/styles.css.php b/htdocs/ticket/css/styles.css.php index 2337ad760c2..5e3ec60d98c 100644 --- a/htdocs/ticket/css/styles.css.php +++ b/htdocs/ticket/css/styles.css.php @@ -65,7 +65,7 @@ html { html { From 16eee4775fa365ac1d391695f1841a0cd4da573f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Mar 2024 02:30:05 +0100 Subject: [PATCH 489/862] Fix warning --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 6da542ab668..f82945c5abb 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -603,7 +603,7 @@ function CloseBill() { if ($("#idcustomer").val() == "") { alert("trans('TakePosCustomerMandatory'); ?>"); - global->TAKEPOS_CHOOSE_CONTACT) { ?> + Contact(); Customer(); From 0a1cec7e9bca853c414225baf8b7b61ddb69ce0f Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:09:12 +0100 Subject: [PATCH 490/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/admin/system/database.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index 1f95458a8b2..01e1c5f28b6 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +54,7 @@ print ''.$langs->trans("DatabaseServer").''.$langs->trans("DatabasePort").''.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).''."\n"; print ''.$langs->trans("DatabaseName").''.$conf->db->name.''."\n"; print ''.$langs->trans("DriverType").''.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').''."\n"; +// @phan-suppress-next-line PhanTypeSuspiciousStringExpression (user is defined in the stdClass) print ''.$langs->trans("User").''.$conf->db->user.''."\n"; print ''.$langs->trans("Password").''.preg_replace('/./i', '*', $dolibarr_main_db_pass).''."\n"; print ''.$langs->trans("DBStoringCharset").''.$db->getDefaultCharacterSetDatabase().''."\n"; From f252a283d21d2801020abbaadc8e8592feee8045 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:09:17 +0100 Subject: [PATCH 491/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/class/CSMSFile.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 4e34d9a284f..e602896e82f 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -69,6 +69,9 @@ class CSMSFile public $priority; public $class; public $message; + /** + * @var bool + */ public $nostop; public $socid; @@ -242,7 +245,7 @@ class CSMSFile fwrite($fp, "Priority: ".$this->priority."\n"); fwrite($fp, "Class: ".$this->class."\n"); fwrite($fp, "Deferred: ".$this->deferred."\n"); - fwrite($fp, "DisableStop: ".$this->nostop."\n"); + fwrite($fp, "DisableStop: ".((string) (int) $this->nostop)."\n"); fwrite($fp, "DeliveryReceipt: ".$this->deliveryreceipt."\n"); fwrite($fp, "Message:\n".$this->message); From f43fd7c934928d14290080ffd24cd531417b9a8d Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:09:19 +0100 Subject: [PATCH 492/862] Fix PhanTypeSuspiciousStringExpression --- 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 892fd02fcdb..27a787447ba 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -10135,7 +10135,7 @@ abstract class CommonObject } } else { $error++; - $this->errors[] = "You defined a cascade delete on an object $childObject but there is no method deleteByParentField for it"; + $this->errors[] = "You defined a cascade delete on an object $className/$this->id but there is no method deleteByParentField for it"; break; } } else { From 0cd2b3f06934fce9eb3f51ac5f7ae180439047ca Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:09:21 +0100 Subject: [PATCH 493/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/class/html.formmail.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index edef301c3de..7d369ebe4f4 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -179,6 +179,9 @@ class FormMail extends Form public $substit = array(); public $substit_lines = array(); + /** + * @var array{models:string,langmodels?:string,fileinit?:string[],returnurl:string} + */ public $param = array(); public $withtouser = array(); From 2b7f9b2a865f5e7b5731ba3820ef4e738687dc3a Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:09:23 +0100 Subject: [PATCH 494/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/class/interfaces.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 72564645e59..4bc69ddc7e6 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2010 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,16 +82,16 @@ class Interfaces // Check parameters if (!is_object($object) || !is_object($conf)) { // Error - $error = 'function run_triggers called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf); + $error = 'function run_triggers called with wrong parameters action='.$action.' object='.((string) (int) is_object($object)).' user='.((string) (int) is_object($user)).' langs='.((string) (int) is_object($langs)).' conf='.((string) (int) is_object($conf)); dol_syslog(get_class($this).'::run_triggers '.$error, LOG_ERR); $this->errors[] = $error; return -1; } if (!is_object($langs)) { // Warning - dol_syslog(get_class($this).'::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING); + dol_syslog(get_class($this).'::run_triggers was called with wrong parameters action='.$action.' object='.((string) (int) is_object($object)).' user='.((string) (int) is_object($user)).' langs='.((string) (int) is_object($langs)).' conf='.((string) (int) is_object($conf)), LOG_WARNING); } if (!is_object($user)) { // Warning - dol_syslog(get_class($this).'::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING); + dol_syslog(get_class($this).'::run_triggers was called with wrong parameters action='.$action.' object='.((string) (int) is_object($object)).' user='.((string) (int) is_object($user)).' langs='.((string) (int) is_object($langs)).' conf='.((string) (int) is_object($conf)), LOG_WARNING); $user = new User($this->db); } From 4728b1ec5e06536477c4eaa4e8335c14387a453a Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:09:25 +0100 Subject: [PATCH 495/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/lib/bank.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index ffde1206773..5c22a696d6d 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -189,7 +189,7 @@ function bank_admin_prepare_head($object) * Prepare array with list of tabs * * @param Object $object Object related to tabs - * @param Object $num val to account statement + * @param string $num val to account statement * @return array Array of tabs to shoc */ function account_statement_prepare_head($object, $num) From 50379954541b6b2b6c87eddfeed127d9c8dfc07f Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:09:27 +0100 Subject: [PATCH 496/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4a1beee4bcf..0931f402eb1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3306,7 +3306,7 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'auto', try { $localtz = new DateTimeZone($default_timezone); } catch (Exception $e) { - dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING); + dol_syslog("Warning dol_tz_string contains an invalid value ".json_encode($_SESSION["dol_tz_string"] ?? null), LOG_WARNING); $default_timezone = @date_default_timezone_get(); } } elseif (strrpos($gm, "tz,") !== false) { @@ -7074,7 +7074,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $buyer_country_code = $thirdparty_buyer->country_code; $buyer_in_cee = isInEEC($thirdparty_buyer); - dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".$seller_in_cee.", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".$buyer_in_cee.", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(getDolGlobalString('SERVICES_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); + dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".((string) (int) $seller_in_cee).", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".((string) (int) $buyer_in_cee).", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(getDolGlobalString('SERVICES_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm) // we use the buyer VAT. @@ -11763,7 +11763,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * @param string $label Label or tooltip of button if $text is provided. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. * @param string $text Optional : short label on button. Can be escaped HTML content or full simple text. * @param string $actionType 'default', 'danger', 'email', 'clone', 'cancel', 'delete', ... - * @param string|array $url Url for link or array of subbutton description ('label'=>, 'url'=>, 'lang'=>, 'perm'=> ) + * @param string|array $url Url for link or array of subbutton description ('label'=>, 'url'=>, 'lang'=>, 'perm'=> ) * Example when an array is used: $arrayforbutaction = array( * 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("propal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), * 20 => array('lang'=>'orders', 'enabled'=>isModEnabled("order"), 'perm'=>$user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), From b683ad4b66e73885cba57372d44a277982982726 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:34:37 +0100 Subject: [PATCH 497/862] Fix $labelToUse --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index baf4e960678..b4e95f3fa18 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -11,6 +11,7 @@ * Copyright (C) 2018 Frédéric France * Copyright (C) 2022 Anthony Berton * Copyright (C) 2022 Alexandre Spangaro + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1921,7 +1922,7 @@ class pdf_sponge extends ModelePDFFactures // Credit note if ($creditnoteamount) { $labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes"); - $labeltouse .= (is_object($outputlangsbis) ? (' / '.($outputlangsbis->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangsbis->transnoentities("CreditNotesOrExcessReceived") : $outputlangsbis->transnoentities("CreditNotes")) : ''); + $labeltouse .= (is_object($outputlangsbis) ? (' / '.(($outputlangsbis->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangsbis->transnoentities("CreditNotesOrExcessReceived") : $outputlangsbis->transnoentities("CreditNotes"))) : ''); $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $labeltouse, 0, 'L', 0); From 0284ef4b6672bff053368feddd3e1f150585699f Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:38:30 +0100 Subject: [PATCH 498/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/lib/modulebuilder.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index b05628a951e..54107b65144 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -547,12 +547,12 @@ function compareFirstValue($a, $b) /** * Rewriting all permissions after any actions * @param string $file filename or path - * @param array $permissions permissions existing in file + * @param array $permissions permissions existing in file * @param int|null $key key for permission needed * @param array|null $right $right to update or add * @param string|null $objectname name of object * @param string|null $module name of module - * @param int $action 0 for delete, 1 for add, 2 for update, -1 when delete object completely, -2 for generate rights after add + * @param int<-2,2> $action 0 for delete, 1 for add, 2 for update, -1 when delete object completely, -2 for generate rights after add * @return int 1 if OK,-1 if KO */ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $module, $action) From 02ea350a340a57f1ef7730ccb3b63bad1eda58c6 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:38:32 +0100 Subject: [PATCH 499/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/menus/standard/auguria.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index ddbd7fab4b9..c12fbc08c45 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -92,6 +92,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined. if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($newTabMenu[$i]['url'])) { + // @phan-suppress-next-line PhanTypeSuspiciousStringExpression $param .= ($param ? '&' : '').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; } if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($newTabMenu[$i]['url'])) { From bbf2fb82e7fa71bccf5c410ce07d9dd1f05094c7 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:38:34 +0100 Subject: [PATCH 500/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/menus/standard/eldy.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 9c5d138dfc6..165e09c12b5 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -506,6 +506,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $param = (isset($tmp[1]) ? $tmp[1] : ''); if ((!preg_match('/mainmenu/i', $param)) || !preg_match('/leftmenu/i', $param)) { + // @phan-suppress-next-line PhanTypeSuspiciousStringExpression $param .= ($param ? '&' : '').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; } //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad From 1fc3c3a46d1f9e73f59cf44b472a22111c5eb689 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 02:38:36 +0100 Subject: [PATCH 501/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/menus/standard/empty.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index b69c34b8111..3d70364cbf9 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -370,6 +370,8 @@ class MenuManager return 0; } + '@phan-var-force array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $menu_array'; + if (empty($noout)) { $alt = 0; $altok = 0; From f9c3d1d48db8baef798b8112fa0df044f7b27a3e Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 16:40:21 +0100 Subject: [PATCH 502/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/photos_resize.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 393cb4067c1..70c8da59d2a 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -3,6 +3,7 @@ * Copyright (C) 2009 Meos * Copyright (C) 2012 Regis Houssin * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -581,7 +582,7 @@ if (!empty($conf->use_javascript_ajax)) { - + From e67d1de5bd6692db886a231d46c1997e64c9e75e Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 16:40:24 +0100 Subject: [PATCH 503/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/tpl/advtarget.tpl.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index a4c13f5cd4f..42aba1b10ba 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -108,8 +108,11 @@ print ''."\n"; print ''.$langs->trans('CustomerCode'); if (!empty($array_query['cust_code'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + $cust_code_str = (string) $array_query['cust_code']; +} else { + $cust_code_str = "null"; } -print ''."\n"; +print ''."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print ''."\n"; @@ -339,7 +342,7 @@ if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { $std_soc = new Societe($db); $action_search = 'query'; - $parameters = array('advtarget'=>1); + $parameters = array('advtarget' => 1); if (!empty($advTarget->id)) { $parameters = array('array_query' => $advTarget->filtervalue); } From 9d4aede5c7a5c1741ba054ed934db7fc3cd5b0b5 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 16:40:26 +0100 Subject: [PATCH 504/862] Fix PhanTypeSuspiciousStringExpression --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 1edea428b6f..3aaff1fe943 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -56,7 +56,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code - * @param Object $object Object + * @param CommonObject $object Object * @param User $user Object user * @param Translate $langs Object langs * @param conf $conf Object conf From 22e370c011ffdb4723e19e35a4d89611c6cb8f86 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 16:40:28 +0100 Subject: [PATCH 505/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/debugbar/class/DataCollector/DolibarrCollector.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php index c074068dba1..a114937ce59 100644 --- a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,6 +64,7 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid $info = $langs->trans('Host').': '.$conf->db->host.'
'; $info .= $langs->trans('Port').': '.$conf->db->port.'
'; $info .= $langs->trans('Name').': '.$conf->db->name.'
'; + // @phan-suppress-next-line PhanTypeSuspiciousStringExpression $info .= $langs->trans('User').': '.$conf->db->user.'
'; $info .= $langs->trans('Type').': '.$conf->db->type.'
'; $info .= $langs->trans('Prefix').': '.$conf->db->prefix.'
'; From fe18e88383448ce0f5b975bceb7f74121b09a1a4 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 16:40:31 +0100 Subject: [PATCH 506/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/don/list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 13ffaf15511..907ec01e668 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2019 Thibault FOUCART + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -465,10 +466,10 @@ while ($i < $imaxinloop) { if (!empty($obj->socid) && $company->id > 0) { print "".$company->getNomUrl(1).""; } else { - print "".$obj->societe.""; + print "".((string) $obj->societe).""; } } else { - print "".$obj->societe.""; + print "".((string) $obj->societe).""; } print "".$donationstatic->getFullName($langs).""; print ''.dol_print_date($db->jdate($obj->datedon), 'day').''; From 7f4c1fbd06482f295725f0983b3c7e442bee6319 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 16:40:34 +0100 Subject: [PATCH 507/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/emailcollector/class/emailcollector.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index ef98b294f70..792440a0db7 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -3495,6 +3495,7 @@ class EmailCollector extends CommonObject $params[strtolower($x->attribute)] = $x->value; } } + '@phan-var-force array{filename?:string,name?:string,charset?:string} $params'; // ATTACHMENT // Any part with a filename is an attachment, From f4c8bc5b1d9b3c5b41335e863c019b394d21dca2 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 16:40:36 +0100 Subject: [PATCH 508/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/expedition/class/expedition.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 7454e0b7832..dac6efee52c 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -3050,7 +3050,8 @@ class ExpeditionLigne extends CommonObjectLine // update lot if (!empty($batch) && isModEnabled('productbatch')) { - dol_syslog(get_class($this)."::update expedition batch id=$expedition_batch_id, batch_id=$batch_id, batch=$batch"); + $batch_id_str = $batch_id ?? 'null'; + dol_syslog(get_class($this)."::update expedition batch id=$expedition_batch_id, batch_id=$batch_id_str, batch=$batch"); if (empty($batch_id) || empty($this->fk_product)) { dol_syslog(get_class($this).'::update missing fk_origin_stock (batch_id) and/or fk_product', LOG_ERR); From c79ca14dd952ebbcf6190591d423588ed1423f63 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 19:59:47 +0100 Subject: [PATCH 509/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/boxes/modules_boxes.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 3ada87e0a10..11af741a6a4 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -194,12 +194,12 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo /** * Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function) * - * @param array $head Array with properties of box title - * @param array> $contents Array with properties of box lines + * @param array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title + * @param array> $contents Array with properties of box lines * @param int $nooutput No print, only return string * @return string */ - public function showBox($head = null, $contents = null, $nooutput = 0) + public function showBox($head, $contents, $nooutput = 0) { global $langs, $user, $conf; @@ -231,7 +231,6 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo $out .= "\n\n"; $out .= '
'."\n"; - if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) { $out .= ''."\n"; } @@ -295,7 +294,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo // Show box lines if ($nblines) { // Loop on each record - for ($i = 0, $n = $nblines; $i < $n; $i++) { + foreach (array_keys($contents) as $i) { if (isset($contents[$i])) { // TR if (isset($contents[$i][0]['tr'])) { @@ -306,7 +305,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo // Loop on each TD $nbcolthisline = count($contents[$i]); - for ($j = 0; $j < $nbcolthisline; $j++) { + foreach (array_keys($contents[$i]) as $j) { // Define tdparam $tdparam = ''; if (!empty($contents[$i][$j]['td'])) { @@ -417,7 +416,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo * Return list of widget. Function used by admin page htdoc/admin/widget. * List is sorted by widget filename so by priority to run. * - * @param array $forcedirwidget null=All default directories. This parameter is used by modulebuilder module only. + * @param ?string[] $forcedirwidget null=All default directories. This parameter is used by modulebuilder module only. * @return array Array list of widget */ public static function getWidgetsList($forcedirwidget = null) From 378bb482c7bb044852bc81cde8d20fcbe0924d47 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 20:51:00 +0100 Subject: [PATCH 510/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/lib/modulebuilder.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 54107b65144..95e4711b396 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -606,10 +606,11 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $ } else { $error++; } + '@phan-var-force array $permissions'; if (!$error) { // prepare permissions array $count_perms = count($permissions); - for ($i = 0;$i < $count_perms;$i++) { + foreach (array_keys($permissions) as $i) { $permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)"; $permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'"; $permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'"; From c6d0cb3f5b39b33867e64b7441f1970df7c78169 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 20:51:02 +0100 Subject: [PATCH 511/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/menus/standard/empty.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 3d70364cbf9..1a5fea91f01 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -377,7 +377,7 @@ class MenuManager $altok = 0; $blockvmenuopened = false; $num = count($menu_array); - for ($i = 0; $i < $num; $i++) { + foreach (array_keys($menu_array) as $i) { $alt++; if (empty($menu_array[$i]['level'])) { $altok++; From 5c007eede4e95722ddc6ae9c8294ff4cec35b5c1 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 20:51:04 +0100 Subject: [PATCH 512/862] Fix PhanTypeSuspiciousStringExpression --- ...ce_20_modWorkflow_WorkflowManager.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 3aaff1fe943..785aac5f0fc 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -135,7 +135,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['propal'] as $element) { $ret = $element->classifyBilled($user); @@ -160,7 +160,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['commande'] as $element) { $ret = $element->classifyBilled($user); @@ -179,7 +179,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['propal'] as $element) { $ret = $element->classifyBilled($user); @@ -198,7 +198,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); + dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG); if ($totalonlinkedelements == $object->total_ht) { foreach ($object->linkedObjects['shipping'] as $element) { $ret = $element->setClosed(); @@ -219,7 +219,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); + dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG); if ($totalonlinkedelements == $object->total_ht) { foreach ($object->linkedObjects['shipping'] as $element) { $ret = $element->setBilled(); @@ -249,7 +249,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['order_supplier'] as $element) { $ret = $element->classifyBilled($user); @@ -271,7 +271,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['supplier_proposal'] as $element) { $ret = $element->classifyBilled($user); @@ -317,7 +317,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked reception = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); + dol_syslog("Amount of linked reception = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG); if ($totalonlinkedelements == $object->total_ht) { foreach ($object->linkedObjects['reception'] as $element) { $ret = $element->setBilled(); @@ -345,7 +345,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['commande'] as $element) { $ret = $element->classifyBilled($user); From 702976afaba49864422c7ed6211af812c31353f8 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 21:43:26 +0100 Subject: [PATCH 513/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/install/repair.php | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 553796f7c6f..4f2b8adb94f 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2021 Frédéric France * Copyright (C) 2023 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -234,15 +235,15 @@ if ($ok && GETPOST('standard', 'alpha')) { $extrafields = new ExtraFields($db); // List of tables that has an extrafield table - $listofmodulesextra = array('societe'=>'societe', 'adherent'=>'adherent', 'product'=>'product', - 'socpeople'=>'socpeople', 'propal'=>'propal', 'commande'=>'commande', - 'facture'=>'facture', 'facturedet'=>'facturedet', 'facture_rec'=>'facture_rec', 'facturedet_rec'=>'facturedet_rec', - 'supplier_proposal'=>'supplier_proposal', 'commande_fournisseur'=>'commande_fournisseur', - 'facture_fourn'=>'facture_fourn', 'facture_fourn_rec'=>'facture_fourn_rec', 'facture_fourn_det'=>'facture_fourn_det', 'facture_fourn_det_rec'=>'facture_fourn_det_rec', - 'fichinter'=>'fichinter', 'fichinterdet'=>'fichinterdet', - 'inventory'=>'inventory', - 'actioncomm'=>'actioncomm', 'bom_bom'=>'bom_bom', 'mrp_mo'=>'mrp_mo', - 'adherent_type'=>'adherent_type', 'user'=>'user', 'partnership'=>'partnership', 'projet'=>'projet', 'projet_task'=>'projet_task', 'ticket'=>'ticket'); + $listofmodulesextra = array('societe' => 'societe', 'adherent' => 'adherent', 'product' => 'product', + 'socpeople' => 'socpeople', 'propal' => 'propal', 'commande' => 'commande', + 'facture' => 'facture', 'facturedet' => 'facturedet', 'facture_rec' => 'facture_rec', 'facturedet_rec' => 'facturedet_rec', + 'supplier_proposal' => 'supplier_proposal', 'commande_fournisseur' => 'commande_fournisseur', + 'facture_fourn' => 'facture_fourn', 'facture_fourn_rec' => 'facture_fourn_rec', 'facture_fourn_det' => 'facture_fourn_det', 'facture_fourn_det_rec' => 'facture_fourn_det_rec', + 'fichinter' => 'fichinter', 'fichinterdet' => 'fichinterdet', + 'inventory' => 'inventory', + 'actioncomm' => 'actioncomm', 'bom_bom' => 'bom_bom', 'mrp_mo' => 'mrp_mo', + 'adherent_type' => 'adherent_type', 'user' => 'user', 'partnership' => 'partnership', 'projet' => 'projet', 'projet_task' => 'projet_task', 'ticket' => 'ticket'); //$listofmodulesextra = array('fichinter'=>'fichinter'); print ''; @@ -275,7 +276,7 @@ if ($ok && GETPOST('standard', 'alpha')) { if (in_array($fieldname, array('rowid', 'tms', 'fk_object', 'import_key'))) { continue; } - $arrayoffieldsfound[$fieldname] = array('type'=>$fieldtype); + $arrayoffieldsfound[$fieldname] = array('type' => $fieldtype); } print ' - Found '.count($arrayoffieldsfound).' fields into table'; if (count($arrayoffieldsfound) > 0) { @@ -318,12 +319,12 @@ if ($ok && GETPOST('standard', 'alpha')) { } $field_desc = array( - 'type'=>$typedb, - 'value'=>$lengthdb, - 'attribute'=>$attribute, - 'default'=>$default, - 'extra'=>$extra, - 'null'=>$null + 'type' => $typedb, + 'value' => $lengthdb, + 'attribute' => $attribute, + 'default' => $default, + 'extra' => $extra, + 'null' => $null ); //var_dump($field_desc);exit; @@ -510,7 +511,7 @@ if ($ok && GETPOST('restore_thirdparties_logos')) { if (!empty($name)) { $filetotest = $dolibarr_main_data_root.'/societe/logos/'.$name.$ext; $filetotestsmall = $dolibarr_main_data_root.'/societe/logos/thumbs/'.$name.'_small'.$ext; - $exists = dol_is_file($filetotest); + $exists = (int) dol_is_file($filetotest); print 'Check thirdparty '.$obj->rowid.' name='.$obj->name.' logo='.$obj->logo.' file '.$filetotest." exists=".$exists."
\n"; if ($exists) { $filetarget = $dolibarr_main_data_root.'/societe/'.$obj->rowid.'/logos/'.$name.$ext; @@ -585,7 +586,7 @@ if ($ok && GETPOST('restore_user_pictures', 'alpha')) { $filetotest = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/'.$name.$ext; $filetotestsmall = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_small'.$ext; $filetotestmini = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_mini'.$ext; - $exists = dol_is_file($filetotest); + $exists = (int) dol_is_file($filetotest); print 'Check user '.$obj->rowid.' lastname='.$obj->lastname.' firstname='.$obj->firstname.' photo='.$obj->photo.' file '.$filetotest." exists=".$exists."
\n"; if ($exists) { $filetarget = $dolibarr_main_data_root.'/users/'.$obj->rowid.'/'.$name.$ext; From a9ac98f6c75ca5e3a51cb09f9f9bc181c59c9b7b Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 21:43:29 +0100 Subject: [PATCH 514/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/install/step1.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 85e77bbbd79..cc16184788e 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -264,8 +264,7 @@ if (!$error) { $db = getDoliDBInstance($db_type, $db_host, $userroot, $passroot, $databasefortest, (int) $db_port); - dol_syslog("databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected, LOG_DEBUG); - //print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected; + dol_syslog("databasefortest=".$databasefortest." connected=".json_encode($db->connected)." database_selected=".json_encode($db->database_selected), LOG_DEBUG); if (empty($db_create_database) && $db->connected && !$db->database_selected) { print '
'.$langs->trans("ErrorConnectedButDatabaseNotFound", $db_name).'
'; From 3e1aaf8195251f6ade5d71f96160d386d74d285d Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 21:43:32 +0100 Subject: [PATCH 515/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/install/step2.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 99170d4c9c6..f62e793beab 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2015 Cedric GROSS * Copyright (C) 2015-2016 Raphaël Doursenaud + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -171,7 +172,7 @@ if ($action == "set") { $ok = 0; $handle = opendir($dir); - dolibarr_install_syslog("step2: open tables directory ".$dir." handle=".$handle); + dolibarr_install_syslog("step2: open tables directory ".$dir." handle=".(is_bool($handle) ? json_encode($handle) : $handle)); $tablefound = 0; $tabledata = array(); if (is_resource($handle)) { @@ -269,7 +270,7 @@ if ($action == "set") { $okkeys = 0; $handle = opendir($dir); - dolibarr_install_syslog("step2: open keys directory ".$dir." handle=".$handle); + dolibarr_install_syslog("step2: open keys directory ".$dir." handle=".(is_bool($handle) ? json_encode($handle) : $handle)); $tablefound = 0; $tabledata = array(); if (is_resource($handle)) { @@ -400,7 +401,7 @@ if ($action == "set") { $file = "functions.sql"; if (file_exists($dir.$file)) { $fp = fopen($dir.$file, "r"); - dolibarr_install_syslog("step2: open function file ".$dir.$file." handle=".$fp); + dolibarr_install_syslog("step2: open function file ".$dir.$file." handle=".(is_bool($fp) ? json_encode($fp) : $fp)); if ($fp) { $buffer = ''; while (!feof($fp)) { @@ -467,7 +468,7 @@ if ($action == "set") { // Insert data $handle = opendir($dir); - dolibarr_install_syslog("step2: open directory data ".$dir." handle=".$handle); + dolibarr_install_syslog("step2: open directory data ".$dir." handle=".(is_bool($handle) ? json_encode($handle) : $handle)); $tablefound = 0; $tabledata = array(); if (is_resource($handle)) { @@ -492,7 +493,7 @@ if ($action == "set") { foreach ($tabledata as $file) { $name = substr($file, 0, dol_strlen($file) - 4); $fp = fopen($dir.$file, "r"); - dolibarr_install_syslog("step2: open data file ".$dir.$file." handle=".$fp); + dolibarr_install_syslog("step2: open data file ".$dir.$file." handle=".(is_bool($fp) ? json_encode($fp) : $fp)); if ($fp) { $arrayofrequests = array(); $linefound = 0; From c543f1b0021912d19aad1eef095241dc8863e219 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 21:43:35 +0100 Subject: [PATCH 516/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/install/upgrade.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 60055abf65e..d80205028c8 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2015-2016 Raphaël Doursenaud + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -417,7 +418,7 @@ if (!$ok && isset($argv[1])) { } dolibarr_install_syslog("Exit ".$ret); -dolibarr_install_syslog("--- upgrade: end ".(!$ok && empty($_GET["ignoreerrors"]))." dirmodule=".$dirmodule); +dolibarr_install_syslog("--- upgrade: end ".((int) (!$ok && empty($_GET["ignoreerrors"])))." dirmodule=".$dirmodule); $nonext = (!$ok && empty($_GET["ignoreerrors"])) ? 2 : 0; if ($dirmodule) { From 794dc257c759e38303c227f806f2e0b863e42851 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 21:43:38 +0100 Subject: [PATCH 517/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/mrp/class/api_mos.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 2951c1069eb..a67d23b6877 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2019 Maxime Kohlhaas + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -628,8 +629,7 @@ class Mos extends DolibarrApi } // Update status of MO - dol_syslog("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); - //var_dump("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); + dol_syslog("consumptioncomplete = ".json_encode($consumptioncomplete)." productioncomplete = ".json_encode($productioncomplete)); if ($consumptioncomplete && $productioncomplete) { $result = $this->mo->setStatut(Mo::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED'); } else { From 0ce51708f3e8f7eeac98179051fe29d8151db65a Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 21:43:40 +0100 Subject: [PATCH 518/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/mrp/mo_production.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index c13813c342f..7926ba1cfcf 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -3,6 +3,7 @@ * Copyright (C) 2023 Christian Humpel * Copyright (C) 2023 Vincent de Grandpré * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -422,8 +423,7 @@ if (empty($reshook)) { } // Update status of MO - dol_syslog("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); - //var_dump("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); + dol_syslog("consumptioncomplete = ".json_encode($consumptioncomplete)." productioncomplete = ".json_encode($productioncomplete)); if ($consumptioncomplete && $productioncomplete) { $result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED'); } else { @@ -823,7 +823,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $url = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addconsumeline&token='.newToken(); $permissiontoaddaconsumeline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED; - $parameters = array('morecss'=>'reposition'); + $parameters = array('morecss' => 'reposition'); $newcardbutton = ''; if ($action != 'consumeorproduce' && $action != 'consumeandproduceall') { @@ -1432,7 +1432,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $newcardbutton = ''; $url = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addproduceline&token='.newToken(); $permissiontoaddaproductline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED; - $parameters = array('morecss'=>'reposition'); + $parameters = array('morecss' => 'reposition'); if ($action != 'consumeorproduce' && $action != 'consumeandproduceall') { if ($nblinetoproduce == 0 || $object->mrptype == 1) { $newcardbutton = dolGetButtonTitle($langs->trans('AddNewProduceLines'), '', 'fa fa-plus-circle size15x', $url, '', $permissiontoaddaproductline, $parameters); From 31a6a3c9fc38245b4cfbefe66610601164baefa0 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 21:43:43 +0100 Subject: [PATCH 519/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index a6ad446ecbe..d9cb5fb5812 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -194,7 +194,7 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; $error = 0; - dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch); + dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".json_encode($skip_batch)); // Call hook at beginning global $action, $hookmanager; From 18600215a15b0d0408c2e6fa6cf6032ec6e1c59b Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 21:43:45 +0100 Subject: [PATCH 520/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/projet/class/project.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index b07a0981387..c8ded1e1b76 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1688,7 +1688,7 @@ class Project extends CommonObject * @param bool $clone_task_file Clone file of task (if task are copied) * @param bool $clone_note Clone note of project * @param bool $move_date Move task date on clone - * @param integer $notrigger No trigger flag + * @param int $notrigger No trigger flag * @param int $newthirdpartyid New thirdparty id * @return int New id of clone */ @@ -1698,7 +1698,7 @@ class Project extends CommonObject $error = 0; - dol_syslog("createFromClone clone_contact=".$clone_contact." clone_task=".$clone_task." clone_project_file=".$clone_project_file." clone_note=".$clone_note." move_date=".$move_date, LOG_DEBUG); + dol_syslog("createFromClone clone_contact=".json_encode($clone_contact)." clone_task=".json_encode($clone_task)." clone_project_file=".json_encode($clone_project_file)." clone_note=".json_encode($clone_note)." move_date=".json_encode($move_date), LOG_DEBUG); $now = dol_mktime(0, 0, 0, idate('m', dol_now()), idate('d', dol_now()), idate('Y', dol_now())); From 58c7c9acb4fb7bba6a3171b647a2d2802f2e6667 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 21:43:47 +0100 Subject: [PATCH 521/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/public/webportal/lib/webportal.lib.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/public/webportal/lib/webportal.lib.php b/htdocs/public/webportal/lib/webportal.lib.php index cc2ba9ec532..f15b59af5d9 100644 --- a/htdocs/public/webportal/lib/webportal.lib.php +++ b/htdocs/public/webportal/lib/webportal.lib.php @@ -1,4 +1,6 @@ + */ /** * \file htdocs/public/webportal/lib/webportal.lib.php @@ -9,7 +11,7 @@ /** * Get nav menu * - * @param array $Tmenu Array of menu + * @param array,children?:array}>}> $Tmenu Array of menu * @return string */ function getNav($Tmenu) @@ -27,7 +29,7 @@ function getNav($Tmenu) * Get nav item * * TODO : Dropdown is actually not css implemented - * @param array $item Item of menu + * @param array{id:string,rank:int,url:string,name:string,group:string,override?:int<0,1>,children?:array,active?:bool,separator?:bool}>} $item Item of menu * @param int $deep Level of deep * @return string */ @@ -53,14 +55,15 @@ function getNavItem($item, $deep = 0) } - if (!empty($item['overrride'])) { - $menu .= $item['overrride']; + if (!empty($item['override'])) { + $menu .= $item['override']; } elseif (!empty($item['children'])) { $menuChildren = ''; $haveChildActive = false; foreach ($item['children'] as $child) { $item = array_replace($itemDefault, $item); // applique les valeurs par default + '@phan-var-force array{id:string,rank:int,url:string,name:string,group:string,override?:int<0,1>,active?:bool,separator?:bool} $child'; if (!empty($child['separator'])) { $menuChildren .= ''; @@ -100,9 +103,9 @@ function getNavItem($item, $deep = 0) * Sort menu * uasort callback function to Sort menu fields * - * @param array $a PDF lines array fields configs - * @param array $b PDF lines array fields configs - * @return int Return compare result + * @param array{rank?:int} $a PDF lines array fields configs + * @param array{rank?:int} $b PDF lines array fields configs + * @return int<-1,1> Return compare result * * // Sorting * uasort ( $this->cols, array( $this, 'menuSort' ) ); From 16e5ca0b1ed7fc45dd94c8b9aed12ee22f90821e Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 22:53:07 +0100 Subject: [PATCH 522/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index ca71a510a1b..e6881132167 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -668,7 +668,7 @@ class Stripe extends CommonObject { global $conf; - dol_syslog("getSetupIntent description=".$description.' confirmnow='.$confirmnow, LOG_INFO, 1); + dol_syslog("getSetupIntent description=".$description.' confirmnow='.json_encode($confirmnow), LOG_INFO, 1); $error = 0; From fe5c6484d4e27b0d18d907e4efa7f5e533f30f39 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 22:53:10 +0100 Subject: [PATCH 523/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3d614e9fdd7..1d2430e5d55 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1507,7 +1507,7 @@ if (!empty($conf->use_javascript_ajax)) { $usediv = (GETPOST('format') == 'div'); -print ''."\n"; +print ''."\n"; print '
'; if ($usediv) { print '
'; From 439839f1aa888e8cafed2b9a547d0beb52280d62 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 22:53:12 +0100 Subject: [PATCH 524/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/webservices/server_actioncomm.php | 156 ++++++++++++----------- 1 file changed, 79 insertions(+), 77 deletions(-) diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index 6bd2c21a0b1..4347affafb2 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 Florian Henry + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,11 +83,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), ) ); @@ -98,37 +99,37 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); $actioncomm_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'type_id' => array('name'=>'type_id', 'type'=>'xsd:string'), - 'type_code' => array('name'=>'type_code', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:string'), - 'label' => array('name'=>'label', 'type'=>'xsd:string'), - 'datep' => array('name'=>'datep', 'type'=>'xsd:dateTime'), - 'datef' => array('name'=>'datef', 'type'=>'xsd:dateTime'), - 'datec' => array('name'=>'datec', 'type'=>'xsd:dateTime'), - 'datem' => array('name'=>'datem', 'type'=>'xsd:dateTime'), - 'note' => array('name'=>'note', 'type'=>'xsd:string'), - 'percentage' => array('name'=>'percentage', 'type'=>'xsd:string'), - 'author' => array('name'=>'author', 'type'=>'xsd:string'), - 'usermod' => array('name'=>'usermod', 'type'=>'xsd:string'), - 'userownerid' => array('name'=>'userownerid', 'type'=>'xsd:string'), - 'priority' => array('name'=>'priority', 'type'=>'xsd:string'), - 'fulldayevent' => array('name'=>'fulldayevent', 'type'=>'xsd:string'), - 'location' => array('name'=>'location', 'type'=>'xsd:string'), - 'socid' => array('name'=>'socid', 'type'=>'xsd:string'), - 'contactid' => array('name'=>'contactid', 'type'=>'xsd:string'), - 'projectid' => array('name'=>'projectid', 'type'=>'xsd:string'), - 'fk_element' => array('name'=>'fk_element', 'type'=>'xsd:string'), - 'elementtype' => array('name'=>'elementtype', 'type'=>'xsd:string')); + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'ref' => array('name' => 'ref', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'type_id' => array('name' => 'type_id', 'type' => 'xsd:string'), + 'type_code' => array('name' => 'type_code', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:string'), + 'label' => array('name' => 'label', 'type' => 'xsd:string'), + 'datep' => array('name' => 'datep', 'type' => 'xsd:dateTime'), + 'datef' => array('name' => 'datef', 'type' => 'xsd:dateTime'), + 'datec' => array('name' => 'datec', 'type' => 'xsd:dateTime'), + 'datem' => array('name' => 'datem', 'type' => 'xsd:dateTime'), + 'note' => array('name' => 'note', 'type' => 'xsd:string'), + 'percentage' => array('name' => 'percentage', 'type' => 'xsd:string'), + 'author' => array('name' => 'author', 'type' => 'xsd:string'), + 'usermod' => array('name' => 'usermod', 'type' => 'xsd:string'), + 'userownerid' => array('name' => 'userownerid', 'type' => 'xsd:string'), + 'priority' => array('name' => 'priority', 'type' => 'xsd:string'), + 'fulldayevent' => array('name' => 'fulldayevent', 'type' => 'xsd:string'), + 'location' => array('name' => 'location', 'type' => 'xsd:string'), + 'socid' => array('name' => 'socid', 'type' => 'xsd:string'), + 'contactid' => array('name' => 'contactid', 'type' => 'xsd:string'), + 'projectid' => array('name' => 'projectid', 'type' => 'xsd:string'), + 'fk_element' => array('name' => 'fk_element', 'type' => 'xsd:string'), + 'elementtype' => array('name' => 'elementtype', 'type' => 'xsd:string')); $elementtype = 'actioncomm'; @@ -150,7 +151,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie $type = 'xsd:string'; } - $extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type); + $extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type); } } if (is_array($extrafield_array)) { @@ -175,8 +176,8 @@ $server->wsdl->addComplexType( 'sequence', '', array( - 'code' => array('name'=>'code', 'type'=>'xsd:string'), - 'libelle' => array('name'=>'libelle', 'type'=>'xsd:string') + 'code' => array('name' => 'code', 'type' => 'xsd:string'), + 'libelle' => array('name' => 'libelle', 'type' => 'xsd:string') ) ); @@ -209,9 +210,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getListActionCommType', // Entry values - array('authentication'=>'tns:authentication'), + array('authentication' => 'tns:authentication'), // Exit values - array('result'=>'tns:result', 'actioncommtypes'=>'tns:actioncommtypes'), + array('result' => 'tns:result', 'actioncommtypes' => 'tns:actioncommtypes'), $ns, $ns.'#getListActionCommType', $styledoc, @@ -223,9 +224,9 @@ $server->register( $server->register( 'getActionComm', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'actioncomm'=>'tns:actioncomm'), + array('result' => 'tns:result', 'actioncomm' => 'tns:actioncomm'), $ns, $ns.'#getActionComm', $styledoc, @@ -237,9 +238,9 @@ $server->register( $server->register( 'createActionComm', // Entry values - array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'), + array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#createActionComm', $styledoc, @@ -251,9 +252,9 @@ $server->register( $server->register( 'updateActionComm', // Entry values - array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'), + array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#updateActionComm', $styledoc, @@ -303,29 +304,29 @@ function getActionComm($authentication, $id) if ($result > 0) { $actioncomm_result_fields = array( 'id' => $actioncomm->id, - 'ref'=> $actioncomm->ref, - 'ref_ext'=> $actioncomm->ref_ext, - 'type_id'=> $actioncomm->type_id, - 'type_code'=> $actioncomm->type_code, - 'type'=> $actioncomm->type, - 'label'=> $actioncomm->label, - 'datep'=> dol_print_date($actioncomm->datep, 'dayhourrfc'), - 'datef'=> dol_print_date($actioncomm->datef, 'dayhourrfc'), - 'datec'=> dol_print_date($actioncomm->datec, 'dayhourrfc'), - 'datem'=> dol_print_date($actioncomm->datem, 'dayhourrfc'), - 'note'=> $actioncomm->note_private, - 'percentage'=> $actioncomm->percentage, - 'author'=> $actioncomm->authorid, - 'usermod'=> $actioncomm->usermodid, - 'userownerid'=> $actioncomm->userownerid, - 'priority'=> $actioncomm->priority, - 'fulldayevent'=> $actioncomm->fulldayevent, - 'location'=> $actioncomm->location, - 'socid'=> $actioncomm->socid, - 'contactid'=> $actioncomm->contact_id, - 'projectid'=> $actioncomm->fk_project, - 'fk_element'=> $actioncomm->fk_element, - 'elementtype'=> $actioncomm->elementtype + 'ref' => $actioncomm->ref, + 'ref_ext' => $actioncomm->ref_ext, + 'type_id' => $actioncomm->type_id, + 'type_code' => $actioncomm->type_code, + 'type' => $actioncomm->type, + 'label' => $actioncomm->label, + 'datep' => dol_print_date($actioncomm->datep, 'dayhourrfc'), + 'datef' => dol_print_date($actioncomm->datef, 'dayhourrfc'), + 'datec' => dol_print_date($actioncomm->datec, 'dayhourrfc'), + 'datem' => dol_print_date($actioncomm->datem, 'dayhourrfc'), + 'note' => $actioncomm->note_private, + 'percentage' => $actioncomm->percentage, + 'author' => $actioncomm->authorid, + 'usermod' => $actioncomm->usermodid, + 'userownerid' => $actioncomm->userownerid, + 'priority' => $actioncomm->priority, + 'fulldayevent' => $actioncomm->fulldayevent, + 'location' => $actioncomm->location, + 'socid' => $actioncomm->socid, + 'contactid' => $actioncomm->contact_id, + 'projectid' => $actioncomm->fk_project, + 'fk_element' => $actioncomm->fk_element, + 'elementtype' => $actioncomm->elementtype ); $elementtype = 'actioncomm'; @@ -345,8 +346,8 @@ function getActionComm($authentication, $id) // Create $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'actioncomm'=>$actioncomm_result_fields); + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'actioncomm' => $actioncomm_result_fields); } else { $error++; $errorcode = 'NOT_FOUND'; @@ -360,7 +361,7 @@ function getActionComm($authentication, $id) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -399,12 +400,12 @@ function getListActionCommType($authentication) if ($result > 0) { $resultarray = array(); foreach ($cactioncomm->liste_array as $code => $libeller) { - $resultarray[] = array('code'=>$code, 'libelle'=>$libeller); + $resultarray[] = array('code' => $code, 'libelle' => $libeller); } $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'actioncommtypes'=>$resultarray); + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'actioncommtypes' => $resultarray); } else { $error++; $errorcode = 'NOT_FOUND'; @@ -418,7 +419,7 @@ function getListActionCommType($authentication) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -493,7 +494,7 @@ function createActionComm($authentication, $actioncomm) if (!$error) { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id); } else { $db->rollback(); $error++; @@ -503,7 +504,7 @@ function createActionComm($authentication, $actioncomm) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -586,12 +587,13 @@ function updateActionComm($authentication, $actioncomm) $error++; } } + '@phan-var-force array{id:string} $actioncomm'; if ((!$error) && ($objectfound)) { $db->commit(); $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'id'=>$object->id + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'id' => $object->id ); } elseif ($objectfound) { $db->rollback(); @@ -606,7 +608,7 @@ function updateActionComm($authentication, $actioncomm) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; From a19b3b20569eefbf81899c89da3ca787a401db1d Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 22:53:16 +0100 Subject: [PATCH 525/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/webservices/server_contact.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 388fe0392c2..0089b625dfe 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 JF FERRY + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -706,6 +707,7 @@ function updateContact($authentication, $contact) $error++; } } + '@phan-var-force array{id:string} $contact'; if ((!$error) && ($objectfound)) { $db->commit(); From 187e715bc5750362bc69308439be879f58da9dd3 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 22:53:19 +0100 Subject: [PATCH 526/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/core/lib/ws.lib.php | 5 +- htdocs/webservices/server_invoice.php | 215 +++++++++++++------------- 2 files changed, 111 insertions(+), 109 deletions(-) diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index a0150d403c8..34d1c8059ab 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,14 +20,14 @@ /** * \file htdocs/core/lib/ws.lib.php * \ingroup webservices - * \brief Set of function for manipulating web services + * \brief Set of functions for manipulating web services */ /** * Check authentication array and set error, errorcode, errorlabel * - * @param array $authentication Array with authentication information ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>) + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array with authentication information ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>) * @param int $error Number of errors * @param string $errorcode Error string code * @param string $errorlabel Error string label diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 90d916e72b0..bb4d104c18d 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,11 +84,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string') + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string') ) ); // Define WSDL Return object @@ -98,8 +99,8 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); @@ -111,22 +112,22 @@ $server->wsdl->addComplexType( 'all', '', array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:int'), - 'desc' => array('name'=>'desc', 'type'=>'xsd:string'), - 'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:double'), - 'qty' => array('name'=>'qty', 'type'=>'xsd:double'), - 'unitprice' => array('name'=>'unitprice', 'type'=>'xsd:double'), - 'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'), - 'total' => array('name'=>'total', 'type'=>'xsd:double'), - 'date_start' => array('name'=>'date_start', 'type'=>'xsd:date'), - 'date_end' => array('name'=>'date_end', 'type'=>'xsd:date'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:int'), + 'desc' => array('name' => 'desc', 'type' => 'xsd:string'), + 'vat_rate' => array('name' => 'vat_rate', 'type' => 'xsd:double'), + 'qty' => array('name' => 'qty', 'type' => 'xsd:double'), + 'unitprice' => array('name' => 'unitprice', 'type' => 'xsd:double'), + 'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'), + 'total' => array('name' => 'total', 'type' => 'xsd:double'), + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:date'), + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:date'), // From product - 'product_id' => array('name'=>'product_id', 'type'=>'xsd:int'), - 'product_ref' => array('name'=>'product_ref', 'type'=>'xsd:string'), - 'product_label' => array('name'=>'product_label', 'type'=>'xsd:string'), - 'product_desc' => array('name'=>'product_desc', 'type'=>'xsd:string') + 'product_id' => array('name' => 'product_id', 'type' => 'xsd:int'), + 'product_ref' => array('name' => 'product_ref', 'type' => 'xsd:string'), + 'product_label' => array('name' => 'product_label', 'type' => 'xsd:string'), + 'product_desc' => array('name' => 'product_desc', 'type' => 'xsd:string') ) ); @@ -168,29 +169,29 @@ $server->wsdl->addComplexType( 'all', '', array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'thirdparty_id' => array('name'=>'thirdparty_id', 'type'=>'xsd:int'), - 'fk_user_author' => array('name'=>'fk_user_author', 'type'=>'xsd:string'), - 'fk_user_valid' => array('name'=>'fk_user_valid', 'type'=>'xsd:string'), - 'date' => array('name'=>'date', 'type'=>'xsd:date'), - 'date_due' => array('name'=>'date_due', 'type'=>'xsd:date'), - 'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'), - 'date_validation' => array('name'=>'date_validation', 'type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'), - 'payment_mode_id' => array('name'=>'payment_mode_id', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:int'), - 'total_net' => array('name'=>'type', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'type', 'type'=>'xsd:double'), - 'total' => array('name'=>'type', 'type'=>'xsd:double'), - 'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'), - 'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'), - 'status' => array('name'=>'status', 'type'=>'xsd:int'), - 'close_code' => array('name'=>'close_code', 'type'=>'xsd:string'), - 'close_note' => array('name'=>'close_note', 'type'=>'xsd:string'), - 'project_id' => array('name'=>'project_id', 'type'=>'xsd:string'), - 'lines' => array('name'=>'lines', 'type'=>'tns:LinesArray2') + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'ref' => array('name' => 'ref', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'thirdparty_id' => array('name' => 'thirdparty_id', 'type' => 'xsd:int'), + 'fk_user_author' => array('name' => 'fk_user_author', 'type' => 'xsd:string'), + 'fk_user_valid' => array('name' => 'fk_user_valid', 'type' => 'xsd:string'), + 'date' => array('name' => 'date', 'type' => 'xsd:date'), + 'date_due' => array('name' => 'date_due', 'type' => 'xsd:date'), + 'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'), + 'date_validation' => array('name' => 'date_validation', 'type' => 'xsd:dateTime'), + 'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'), + 'payment_mode_id' => array('name' => 'payment_mode_id', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:int'), + 'total_net' => array('name' => 'type', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'type', 'type' => 'xsd:double'), + 'total' => array('name' => 'type', 'type' => 'xsd:double'), + 'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'), + 'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'), + 'status' => array('name' => 'status', 'type' => 'xsd:int'), + 'close_code' => array('name' => 'close_code', 'type' => 'xsd:string'), + 'close_note' => array('name' => 'close_note', 'type' => 'xsd:string'), + 'project_id' => array('name' => 'project_id', 'type' => 'xsd:string'), + 'lines' => array('name' => 'lines', 'type' => 'tns:LinesArray2') ) ); /* @@ -237,9 +238,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getInvoice', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'invoice'=>'tns:invoice'), + array('result' => 'tns:result', 'invoice' => 'tns:invoice'), $ns, $ns.'#getInvoice', $styledoc, @@ -249,9 +250,9 @@ $server->register( $server->register( 'getInvoicesForThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'idthirdparty'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'idthirdparty' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'invoices'=>'tns:InvoicesArray2'), + array('result' => 'tns:result', 'invoices' => 'tns:InvoicesArray2'), $ns, $ns.'#getInvoicesForThirdParty', $styledoc, @@ -261,9 +262,9 @@ $server->register( $server->register( 'createInvoice', // Entry values - array('authentication'=>'tns:authentication', 'invoice'=>'tns:invoice'), + array('authentication' => 'tns:authentication', 'invoice' => 'tns:invoice'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), $ns, $ns.'#createInvoice', $styledoc, @@ -273,9 +274,9 @@ $server->register( $server->register( 'createInvoiceFromOrder', // Entry values - array('authentication'=>'tns:authentication', 'id_order'=>'xsd:string', 'ref_order'=>'xsd:string', 'ref_ext_order'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id_order' => 'xsd:string', 'ref_order' => 'xsd:string', 'ref_ext_order' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), $ns, $ns.'#createInvoiceFromOrder', $styledoc, @@ -285,9 +286,9 @@ $server->register( $server->register( 'updateInvoice', // Entry values - array('authentication'=>'tns:authentication', 'invoice'=>'tns:invoice'), + array('authentication' => 'tns:authentication', 'invoice' => 'tns:invoice'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), $ns, $ns.'#updateInvoice', $styledoc, @@ -340,29 +341,29 @@ function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') foreach ($invoice->lines as $line) { //var_dump($line); exit; $linesresp[] = array( - 'id'=>$line->id, - 'type'=>$line->product_type, - 'desc'=>dol_htmlcleanlastbr($line->desc), - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'vat_rate'=>$line->tva_tx, - 'qty'=>$line->qty, - 'unitprice'=> $line->subprice, - 'date_start'=> $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '', - 'date_end'=> $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '', - 'product_id'=>$line->fk_product, - 'product_ref'=>$line->product_ref, - 'product_label'=>$line->product_label, - 'product_desc'=>$line->product_desc, + 'id' => $line->id, + 'type' => $line->product_type, + 'desc' => dol_htmlcleanlastbr($line->desc), + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'vat_rate' => $line->tva_tx, + 'qty' => $line->qty, + 'unitprice' => $line->subprice, + 'date_start' => $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '', + 'date_end' => $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '', + 'product_id' => $line->fk_product, + 'product_ref' => $line->product_ref, + 'product_label' => $line->product_label, + 'product_desc' => $line->product_desc, ); $i++; } // Create invoice $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'invoice'=>array( + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'invoice' => array( 'id' => $invoice->id, 'ref' => $invoice->ref, 'ref_ext' => $invoice->ref_ext ? $invoice->ref_ext : '', // If not defined, field is not added into soap @@ -400,7 +401,7 @@ function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -475,20 +476,20 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) $linesresp = array(); foreach ($invoice->lines as $line) { $linesresp[] = array( - 'id'=>$line->id, - 'type'=>$line->product_type, - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'vat_rate'=>$line->tva_tx, - 'qty'=>$line->qty, - 'unitprice'=> $line->subprice, - 'date_start'=> $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '', - 'date_end'=> $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '', - 'product_id'=>$line->fk_product, - 'product_ref'=>$line->product_ref, - 'product_label'=>$line->product_label, - 'product_desc'=>$line->product_desc, + 'id' => $line->id, + 'type' => $line->product_type, + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'vat_rate' => $line->tva_tx, + 'qty' => $line->qty, + 'unitprice' => $line->subprice, + 'date_start' => $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '', + 'date_end' => $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '', + 'product_id' => $line->fk_product, + 'product_ref' => $line->product_ref, + 'product_label' => $line->product_label, + 'product_desc' => $line->product_desc, ); } @@ -510,7 +511,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) 'total' => $invoice->total_ttc, 'note_private' => $invoice->note_private ? $invoice->note_private : '', 'note_public' => $invoice->note_public ? $invoice->note_public : '', - 'status'=> $invoice->statut, + 'status' => $invoice->statut, 'project_id' => $invoice->fk_project, 'close_code' => $invoice->close_code ? $invoice->close_code : '', 'close_note' => $invoice->close_note ? $invoice->close_note : '', @@ -523,8 +524,8 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) } $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'invoices'=>$linesinvoice + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'invoices' => $linesinvoice ); } else { @@ -535,7 +536,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -641,8 +642,8 @@ function createInvoice($authentication, $invoice) if (!$error) { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$new_invoice->id, - 'ref'=>$new_invoice->ref, 'ref_ext'=>$new_invoice->ref_ext); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $new_invoice->id, + 'ref' => $new_invoice->ref, 'ref_ext' => $new_invoice->ref_ext); } else { $db->rollback(); $error++; @@ -653,7 +654,7 @@ function createInvoice($authentication, $invoice) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -662,11 +663,11 @@ function createInvoice($authentication, $invoice) /** * Create an invoice from an order * - * @param array $authentication Array of authentication information + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information * @param string $id_order id of order to copy invoice from * @param string $ref_order ref of order to copy invoice from * @param string $ref_ext_order ref_ext of order to copy invoice from - * @return array Array result + * @return array{result:array{result_code:string,result_label:string},id?:int,ref?:string,ref_ext?:string} Array result */ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '', $ref_ext_order = '') { @@ -732,20 +733,20 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '' } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } else { - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref, 'ref_ext'=>$newobject->ref_ext); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref, 'ref_ext' => $newobject->ref_ext); } return $objectresp; } /** - * Uddate an invoice, only change the state of an invoice + * Update an invoice, only change the state of an invoice * - * @param array $authentication Array of authentication information - * @param array $invoice Invoice - * @return array Array result + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information + * @param array{id:string,ref:string,ref_ext:string,status?:string} $invoice Invoice + * @return array{result:array{result_code:string,result_label:string},id?:int,ref?:string,ref_ext?:string} Array result */ function updateInvoice($authentication, $invoice) { @@ -808,10 +809,10 @@ function updateInvoice($authentication, $invoice) if ((!$error) && ($objectfound)) { $db->commit(); $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'id'=>$object->id, - 'ref'=>$object->ref, - 'ref_ext'=>$object->ref_ext + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'id' => $object->id, + 'ref' => $object->ref, + 'ref_ext' => $object->ref_ext ); } elseif ($objectfound) { $db->rollback(); @@ -826,7 +827,7 @@ function updateInvoice($authentication, $invoice) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; From aa4b84a01874143fc3025dcba9aed217a84923f3 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 22:53:22 +0100 Subject: [PATCH 527/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/webservices/server_order.php | 251 ++++++++++++++-------------- 1 file changed, 126 insertions(+), 125 deletions(-) diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 792f7a5889b..11b375e0211 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2012 JF FERRY * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,11 +83,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string') + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string') ) ); // Define WSDL Return object @@ -97,37 +98,37 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); $line_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:int'), - 'fk_commande' => array('name'=>'fk_commande', 'type'=>'xsd:int'), - 'fk_parent_line' => array('name'=>'fk_parent_line', 'type'=>'xsd:int'), - 'desc' => array('name'=>'desc', 'type'=>'xsd:string'), - 'qty' => array('name'=>'qty', 'type'=>'xsd:double'), - 'price' => array('name'=>'price', 'type'=>'xsd:double'), - 'unitprice' => array('name'=>'unitprice', 'type'=>'xsd:double'), - 'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:double'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:int'), + 'fk_commande' => array('name' => 'fk_commande', 'type' => 'xsd:int'), + 'fk_parent_line' => array('name' => 'fk_parent_line', 'type' => 'xsd:int'), + 'desc' => array('name' => 'desc', 'type' => 'xsd:string'), + 'qty' => array('name' => 'qty', 'type' => 'xsd:double'), + 'price' => array('name' => 'price', 'type' => 'xsd:double'), + 'unitprice' => array('name' => 'unitprice', 'type' => 'xsd:double'), + 'vat_rate' => array('name' => 'vat_rate', 'type' => 'xsd:double'), - 'remise' => array('name'=>'remise', 'type'=>'xsd:double'), - 'remise_percent' => array('name'=>'remise_percent', 'type'=>'xsd:double'), + 'remise' => array('name' => 'remise', 'type' => 'xsd:double'), + 'remise_percent' => array('name' => 'remise_percent', 'type' => 'xsd:double'), - 'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'), - 'total' => array('name'=>'total', 'type'=>'xsd:double'), + 'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'), + 'total' => array('name' => 'total', 'type' => 'xsd:double'), - 'date_start' => array('name'=>'date_start', 'type'=>'xsd:date'), - 'date_end' => array('name'=>'date_end', 'type'=>'xsd:date'), + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:date'), + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:date'), // From product - 'product_id' => array('name'=>'product_id', 'type'=>'xsd:int'), - 'product_ref' => array('name'=>'product_ref', 'type'=>'xsd:string'), - 'product_label' => array('name'=>'product_label', 'type'=>'xsd:string'), - 'product_desc' => array('name'=>'product_desc', 'type'=>'xsd:string') + 'product_id' => array('name' => 'product_id', 'type' => 'xsd:int'), + 'product_ref' => array('name' => 'product_ref', 'type' => 'xsd:string'), + 'product_label' => array('name' => 'product_label', 'type' => 'xsd:string'), + 'product_desc' => array('name' => 'product_desc', 'type' => 'xsd:string') ); $elementtype = 'commandedet'; @@ -149,7 +150,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie } else { $type = 'xsd:string'; } - $extrafield_line_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type); + $extrafield_line_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type); } } if (is_array($extrafield_line_array)) { @@ -198,39 +199,39 @@ $server->wsdl->addComplexType( ); $order_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), - 'ref_client' => array('name'=>'ref_client', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'thirdparty_id' => array('name'=>'thirdparty_id', 'type'=>'xsd:int'), - 'status' => array('name'=>'status', 'type'=>'xsd:int'), - 'billed' => array('name'=>'billed', 'type'=>'xsd:string'), - 'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'), - 'total_localtax1' => array('name'=>'total_localtax1', 'type'=>'xsd:double'), - 'total_localtax2' => array('name'=>'total_localtax2', 'type'=>'xsd:double'), - 'total' => array('name'=>'total', 'type'=>'xsd:double'), - 'date' => array('name'=>'date', 'type'=>'xsd:date'), - 'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'), - 'date_validation' => array('name'=>'date_validation', 'type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'), - 'source' => array('name'=>'source', 'type'=>'xsd:string'), - 'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'), - 'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'), - 'project_id' => array('name'=>'project_id', 'type'=>'xsd:string'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'ref' => array('name' => 'ref', 'type' => 'xsd:string'), + 'ref_client' => array('name' => 'ref_client', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'thirdparty_id' => array('name' => 'thirdparty_id', 'type' => 'xsd:int'), + 'status' => array('name' => 'status', 'type' => 'xsd:int'), + 'billed' => array('name' => 'billed', 'type' => 'xsd:string'), + 'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'), + 'total_localtax1' => array('name' => 'total_localtax1', 'type' => 'xsd:double'), + 'total_localtax2' => array('name' => 'total_localtax2', 'type' => 'xsd:double'), + 'total' => array('name' => 'total', 'type' => 'xsd:double'), + 'date' => array('name' => 'date', 'type' => 'xsd:date'), + 'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'), + 'date_validation' => array('name' => 'date_validation', 'type' => 'xsd:dateTime'), + 'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'), + 'source' => array('name' => 'source', 'type' => 'xsd:string'), + 'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'), + 'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'), + 'project_id' => array('name' => 'project_id', 'type' => 'xsd:string'), - 'mode_reglement_id' => array('name'=>'mode_reglement_id', 'type'=>'xsd:string'), - 'mode_reglement_code' => array('name'=>'mode_reglement_code', 'type'=>'xsd:string'), - 'mode_reglement' => array('name'=>'mode_reglement', 'type'=>'xsd:string'), - 'cond_reglement_id' => array('name'=>'cond_reglement_id', 'type'=>'xsd:string'), - 'cond_reglement_code' => array('name'=>'cond_reglement_code', 'type'=>'xsd:string'), - 'cond_reglement' => array('name'=>'cond_reglement', 'type'=>'xsd:string'), - 'cond_reglement_doc' => array('name'=>'cond_reglement_doc', 'type'=>'xsd:string'), + 'mode_reglement_id' => array('name' => 'mode_reglement_id', 'type' => 'xsd:string'), + 'mode_reglement_code' => array('name' => 'mode_reglement_code', 'type' => 'xsd:string'), + 'mode_reglement' => array('name' => 'mode_reglement', 'type' => 'xsd:string'), + 'cond_reglement_id' => array('name' => 'cond_reglement_id', 'type' => 'xsd:string'), + 'cond_reglement_code' => array('name' => 'cond_reglement_code', 'type' => 'xsd:string'), + 'cond_reglement' => array('name' => 'cond_reglement', 'type' => 'xsd:string'), + 'cond_reglement_doc' => array('name' => 'cond_reglement_doc', 'type' => 'xsd:string'), - 'date_livraison' => array('name'=>'date_livraison', 'type'=>'xsd:date'), - 'demand_reason_id' => array('name'=>'demand_reason_id', 'type'=>'xsd:string'), + 'date_livraison' => array('name' => 'date_livraison', 'type' => 'xsd:date'), + 'demand_reason_id' => array('name' => 'demand_reason_id', 'type' => 'xsd:string'), - 'lines' => array('name'=>'lines', 'type'=>'tns:LinesArray2') + 'lines' => array('name' => 'lines', 'type' => 'tns:LinesArray2') ); $elementtype = 'commande'; @@ -252,7 +253,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie } else { $type = 'xsd:string'; } - $extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type); + $extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type); } } if (is_array($extrafield_array)) { @@ -312,8 +313,8 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped // Register WSDL $server->register( 'getOrder', - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), // Entry values - array('result'=>'tns:result', 'order'=>'tns:order'), // Exit values + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Entry values + array('result' => 'tns:result', 'order' => 'tns:order'), // Exit values $ns, $ns.'#getOrder', $styledoc, @@ -323,8 +324,8 @@ $server->register( $server->register( 'getOrdersForThirdParty', - array('authentication'=>'tns:authentication', 'idthirdparty'=>'xsd:string'), // Entry values - array('result'=>'tns:result', 'orders'=>'tns:OrdersArray2'), // Exit values + array('authentication' => 'tns:authentication', 'idthirdparty' => 'xsd:string'), // Entry values + array('result' => 'tns:result', 'orders' => 'tns:OrdersArray2'), // Exit values $ns, $ns.'#getOrdersForThirdParty', $styledoc, @@ -334,8 +335,8 @@ $server->register( $server->register( 'createOrder', - array('authentication'=>'tns:authentication', 'order'=>'tns:order'), // Entry values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string'), // Exit values + array('authentication' => 'tns:authentication', 'order' => 'tns:order'), // Entry values + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string'), // Exit values $ns, $ns.'#createOrder', $styledoc, @@ -345,8 +346,8 @@ $server->register( $server->register( 'updateOrder', - array('authentication'=>'tns:authentication', 'order'=>'tns:order'), // Entry values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), // Exit values + array('authentication' => 'tns:authentication', 'order' => 'tns:order'), // Entry values + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Exit values $ns, $ns.'#updateOrder', $styledoc, @@ -356,8 +357,8 @@ $server->register( $server->register( 'validOrder', - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'id_warehouse'=>'xsd:string'), // Entry values - array('result'=>'tns:result'), // Exit values + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'id_warehouse' => 'xsd:string'), // Entry values + array('result' => 'tns:result'), // Exit values $ns, $ns.'#validOrder', $styledoc, @@ -424,34 +425,34 @@ function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '') foreach ($order->lines as $line) { //var_dump($line); exit; $linesresp[] = array( - 'id'=>$line->rowid, - 'fk_commande'=>$line->fk_commande, - 'fk_parent_line'=>$line->fk_parent_line, - 'desc'=>$line->desc, - 'qty'=>$line->qty, - 'price'=>$line->price, - 'unitprice'=>$line->subprice, - 'vat_rate'=>$line->tva_tx, - 'remise'=>$line->remise, - 'remise_percent'=>$line->remise_percent, - 'product_id'=>$line->fk_product, - 'product_type'=>$line->product_type, - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'date_start'=>$line->date_start, - 'date_end'=>$line->date_end, - 'product_ref'=>$line->product_ref, - 'product_label'=>$line->product_label, - 'product_desc'=>$line->product_desc + 'id' => $line->rowid, + 'fk_commande' => $line->fk_commande, + 'fk_parent_line' => $line->fk_parent_line, + 'desc' => $line->desc, + 'qty' => $line->qty, + 'price' => $line->price, + 'unitprice' => $line->subprice, + 'vat_rate' => $line->tva_tx, + 'remise' => $line->remise, + 'remise_percent' => $line->remise_percent, + 'product_id' => $line->fk_product, + 'product_type' => $line->product_type, + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'date_start' => $line->date_start, + 'date_end' => $line->date_end, + 'product_ref' => $line->product_ref, + 'product_label' => $line->product_label, + 'product_desc' => $line->product_desc ); $i++; } // Create order $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'order'=>array( + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'order' => array( 'id' => $order->id, 'ref' => $order->ref, 'ref_client' => $order->ref_client, @@ -503,7 +504,7 @@ function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '') } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -579,26 +580,26 @@ function getOrdersForThirdParty($authentication, $idthirdparty) $linesresp = array(); foreach ($order->lines as $line) { $linesresp[] = array( - 'id'=>$line->rowid, - 'type'=>$line->product_type, - 'fk_commande'=>$line->fk_commande, - 'fk_parent_line'=>$line->fk_parent_line, - 'desc'=>$line->desc, - 'qty'=>$line->qty, - 'price'=>$line->price, - 'unitprice'=>$line->subprice, - 'tva_tx'=>$line->tva_tx, - 'remise'=>$line->remise, - 'remise_percent'=>$line->remise_percent, - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'date_start'=>$line->date_start, - 'date_end'=>$line->date_end, - 'product_id'=>$line->fk_product, - 'product_ref'=>$line->product_ref, - 'product_label'=>$line->product_label, - 'product_desc'=>$line->product_desc + 'id' => $line->rowid, + 'type' => $line->product_type, + 'fk_commande' => $line->fk_commande, + 'fk_parent_line' => $line->fk_parent_line, + 'desc' => $line->desc, + 'qty' => $line->qty, + 'price' => $line->price, + 'unitprice' => $line->subprice, + 'tva_tx' => $line->tva_tx, + 'remise' => $line->remise, + 'remise_percent' => $line->remise_percent, + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'date_start' => $line->date_start, + 'date_end' => $line->date_end, + 'product_id' => $line->fk_product, + 'product_ref' => $line->product_ref, + 'product_label' => $line->product_label, + 'product_desc' => $line->product_desc ); } @@ -644,8 +645,8 @@ function getOrdersForThirdParty($authentication, $idthirdparty) } $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'orders'=>$linesorders + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'orders' => $linesorders ); } else { @@ -656,7 +657,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -786,7 +787,7 @@ function createOrder($authentication, $order) if ($result >= 0) { dol_syslog("Webservice server_order:: order creation & validation succeeded, commit", LOG_DEBUG); $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref); } else { dol_syslog("Webservice server_order:: order creation or validation failed, rollback", LOG_ERR); $db->rollback(); @@ -797,7 +798,7 @@ function createOrder($authentication, $order) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -865,10 +866,10 @@ function validOrder($authentication, $id = 0, $id_warehouse = 0) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } else { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>'')); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => '')); } return $objectresp; @@ -878,7 +879,7 @@ function validOrder($authentication, $id = 0, $id_warehouse = 0) * Update an order * * @param array $authentication Array of authentication information - * @param array $order Order info + * @param array{id:string,ref:string,refext:string} $order Order info * @return array Array result */ function updateOrder($authentication, $order) @@ -969,10 +970,10 @@ function updateOrder($authentication, $order) if ((!$error) && ($objectfound)) { $db->commit(); $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'id'=>$object->id, - 'ref'=>$object->ref, - 'ref_ext'=>$object->ref_ext + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'id' => $object->id, + 'ref' => $object->ref, + 'ref_ext' => $object->ref_ext ); } elseif ($objectfound) { $db->rollback(); @@ -987,7 +988,7 @@ function updateOrder($authentication, $order) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; From 5b2758327d0bf3085ee76f19ab94a81569b05fb5 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 22:53:25 +0100 Subject: [PATCH 528/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/webservices/server_thirdparty.php | 165 ++++++++++++----------- 1 file changed, 84 insertions(+), 81 deletions(-) diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 353387f7681..a768b970652 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,11 +82,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), ) ); // Define WSDL Return object @@ -96,48 +97,48 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); $thirdparty_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'name', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'fk_user_author' => array('name'=>'fk_user_author', 'type'=>'xsd:string'), - 'status' => array('name'=>'status', 'type'=>'xsd:string'), - 'client' => array('name'=>'client', 'type'=>'xsd:string'), - 'supplier' => array('name'=>'supplier', 'type'=>'xsd:string'), - 'customer_code' => array('name'=>'customer_code', 'type'=>'xsd:string'), - 'supplier_code' => array('name'=>'supplier_code', 'type'=>'xsd:string'), - 'customer_code_accountancy' => array('name'=>'customer_code_accountancy', 'type'=>'xsd:string'), - 'supplier_code_accountancy' => array('name'=>'supplier_code_accountancy', 'type'=>'xsd:string'), - 'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'), - 'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'), - 'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'), - 'address' => array('name'=>'address', 'type'=>'xsd:string'), - 'zip' => array('name'=>'zip', 'type'=>'xsd:string'), - 'town' => array('name'=>'town', 'type'=>'xsd:string'), - 'region_code' => array('name'=>'region_code', 'type'=>'xsd:string'), - 'country_id' => array('name'=>'country_id', 'type'=>'xsd:string'), - 'country_code' => array('name'=>'country_code', 'type'=>'xsd:string'), - 'country' => array('name'=>'country', 'type'=>'xsd:string'), - 'phone' => array('name'=>'phone', 'type'=>'xsd:string'), - 'fax' => array('name'=>'fax', 'type'=>'xsd:string'), - 'email' => array('name'=>'email', 'type'=>'xsd:string'), - 'url' => array('name'=>'url', 'type'=>'xsd:string'), - 'profid1' => array('name'=>'profid1', 'type'=>'xsd:string'), - 'profid2' => array('name'=>'profid2', 'type'=>'xsd:string'), - 'profid3' => array('name'=>'profid3', 'type'=>'xsd:string'), - 'profid4' => array('name'=>'profid4', 'type'=>'xsd:string'), - 'profid5' => array('name'=>'profid5', 'type'=>'xsd:string'), - 'profid6' => array('name'=>'profid6', 'type'=>'xsd:string'), - 'capital' => array('name'=>'capital', 'type'=>'xsd:string'), - 'vat_used' => array('name'=>'vat_used', 'type'=>'xsd:string'), - 'vat_number' => array('name'=>'vat_number', 'type'=>'xsd:string')); + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'ref' => array('name' => 'name', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'fk_user_author' => array('name' => 'fk_user_author', 'type' => 'xsd:string'), + 'status' => array('name' => 'status', 'type' => 'xsd:string'), + 'client' => array('name' => 'client', 'type' => 'xsd:string'), + 'supplier' => array('name' => 'supplier', 'type' => 'xsd:string'), + 'customer_code' => array('name' => 'customer_code', 'type' => 'xsd:string'), + 'supplier_code' => array('name' => 'supplier_code', 'type' => 'xsd:string'), + 'customer_code_accountancy' => array('name' => 'customer_code_accountancy', 'type' => 'xsd:string'), + 'supplier_code_accountancy' => array('name' => 'supplier_code_accountancy', 'type' => 'xsd:string'), + 'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'), + 'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'), + 'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'), + 'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'), + 'address' => array('name' => 'address', 'type' => 'xsd:string'), + 'zip' => array('name' => 'zip', 'type' => 'xsd:string'), + 'town' => array('name' => 'town', 'type' => 'xsd:string'), + 'region_code' => array('name' => 'region_code', 'type' => 'xsd:string'), + 'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'), + 'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'), + 'country' => array('name' => 'country', 'type' => 'xsd:string'), + 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), + 'fax' => array('name' => 'fax', 'type' => 'xsd:string'), + 'email' => array('name' => 'email', 'type' => 'xsd:string'), + 'url' => array('name' => 'url', 'type' => 'xsd:string'), + 'profid1' => array('name' => 'profid1', 'type' => 'xsd:string'), + 'profid2' => array('name' => 'profid2', 'type' => 'xsd:string'), + 'profid3' => array('name' => 'profid3', 'type' => 'xsd:string'), + 'profid4' => array('name' => 'profid4', 'type' => 'xsd:string'), + 'profid5' => array('name' => 'profid5', 'type' => 'xsd:string'), + 'profid6' => array('name' => 'profid6', 'type' => 'xsd:string'), + 'capital' => array('name' => 'capital', 'type' => 'xsd:string'), + 'vat_used' => array('name' => 'vat_used', 'type' => 'xsd:string'), + 'vat_number' => array('name' => 'vat_number', 'type' => 'xsd:string')); $elementtype = 'societe'; @@ -159,7 +160,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie $type = 'xsd:string'; } - $extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type); + $extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type); } } @@ -186,9 +187,9 @@ $server->wsdl->addComplexType( '', array( //'limit' => array('name'=>'limit','type'=>'xsd:string'), - 'client' => array('name'=>'client', 'type'=>'xsd:string'), - 'supplier' => array('name'=>'supplier', 'type'=>'xsd:string'), - 'category' => array('name'=>'category', 'type'=>'xsd:string') + 'client' => array('name' => 'client', 'type' => 'xsd:string'), + 'supplier' => array('name' => 'supplier', 'type' => 'xsd:string'), + 'category' => array('name' => 'category', 'type' => 'xsd:string') ) ); @@ -200,7 +201,7 @@ $server->wsdl->addComplexType( 'SOAP-ENC:Array', array(), array( - array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:thirdparty[]') + array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:thirdparty[]') ), 'tns:thirdparty' ); @@ -232,9 +233,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string', 'barcode'=>'xsd:string', 'profid1'=>'xsd:string', 'profid2'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string', 'barcode' => 'xsd:string', 'profid1' => 'xsd:string', 'profid2' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'thirdparty'=>'tns:thirdparty'), + array('result' => 'tns:result', 'thirdparty' => 'tns:thirdparty'), $ns, $ns.'#getThirdParty', $styledoc, @@ -246,9 +247,9 @@ $server->register( $server->register( 'createThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'thirdparty'=>'tns:thirdparty'), + array('authentication' => 'tns:authentication', 'thirdparty' => 'tns:thirdparty'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string'), $ns, $ns.'#createThirdParty', $styledoc, @@ -260,9 +261,9 @@ $server->register( $server->register( 'updateThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'thirdparty'=>'tns:thirdparty'), + array('authentication' => 'tns:authentication', 'thirdparty' => 'tns:thirdparty'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#updateThirdParty', $styledoc, @@ -275,9 +276,9 @@ $server->register( $server->register( 'getListOfThirdParties', // Entry values - array('authentication'=>'tns:authentication', 'filterthirdparty'=>'tns:filterthirdparty'), + array('authentication' => 'tns:authentication', 'filterthirdparty' => 'tns:filterthirdparty'), // Exit values - array('result'=>'tns:result', 'thirdparties'=>'tns:ThirdPartiesArray2'), + array('result' => 'tns:result', 'thirdparties' => 'tns:ThirdPartiesArray2'), $ns, $ns.'#getListOfThirdParties', $styledoc, @@ -289,9 +290,9 @@ $server->register( $server->register( 'deleteThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#deleteThirdParty', $styledoc, @@ -401,8 +402,8 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar // Create $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'thirdparty'=>$thirdparty_result_fields); + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'thirdparty' => $thirdparty_result_fields); } elseif ($result == -2) { $error++; $errorcode = 'DUPLICATE_FOUND'; @@ -420,7 +421,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -544,7 +545,7 @@ function createThirdParty($authentication, $thirdparty) $newobject->add_commercial($fuser, $thirdparty["commid"]); } - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref); } else { $db->rollback(); $error++; @@ -554,7 +555,7 @@ function createThirdParty($authentication, $thirdparty) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -669,11 +670,13 @@ function updateThirdParty($authentication, $thirdparty) } } + '@phan-var-force array{id:string} $thirdparty'; + if ((!$error) && ($objectfound)) { $db->commit(); $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'id'=>$object->id + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'id' => $object->id ); } elseif ($objectfound) { $db->rollback(); @@ -688,7 +691,7 @@ function updateThirdParty($authentication, $thirdparty) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -769,16 +772,16 @@ function getListOfThirdParties($authentication, $filterthirdparty) } } - $arraythirdparties[] = array('id'=>$obj->socRowid, - 'ref'=>$obj->ref, - 'ref_ext'=>$obj->ref_ext, - 'address'=>$obj->address, - 'zip'=>$obj->zip, - 'town'=>$obj->town, - 'country'=>$obj->country, - 'phone'=>$obj->phone, - 'fax'=>$obj->fax, - 'url'=>$obj->url + $arraythirdparties[] = array('id' => $obj->socRowid, + 'ref' => $obj->ref, + 'ref_ext' => $obj->ref_ext, + 'address' => $obj->address, + 'zip' => $obj->zip, + 'town' => $obj->town, + 'country' => $obj->country, + 'phone' => $obj->phone, + 'fax' => $obj->fax, + 'url' => $obj->url ); $arraythirdparties[$i] = array_merge($arraythirdparties[$i], $extrafieldsOptions); @@ -793,13 +796,13 @@ function getListOfThirdParties($authentication, $filterthirdparty) if ($error) { $objectresp = array( - 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), - 'thirdparties'=>$arraythirdparties + 'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel), + 'thirdparties' => $arraythirdparties ); } else { $objectresp = array( - 'result'=>array('result_code' => 'OK', 'result_label' => ''), - 'thirdparties'=>$arraythirdparties + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'thirdparties' => $arraythirdparties ); } @@ -855,7 +858,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') if ($result > 0) { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>'')); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => '')); } else { $db->rollback(); $error++; @@ -876,7 +879,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; From 0538db746883cbbb7a52817cc79d460fff115b45 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 22:53:28 +0100 Subject: [PATCH 529/862] Fix PhanTypeSuspiciousStringExpression --- htdocs/website/class/website.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index e77e4b5b3c9..bd5e25f1932 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1319,7 +1319,7 @@ class Website extends CommonObject dol_syslog("In sql source file, we have the page ID ".$oldid." to replace with the new ID ".$newid.", and we must create the shortcut aliases: ".$reg[3]); //dol_move($conf->website->dir_output.'/'.$object->ref.'/page'.$oldid.'.tpl.php', $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php', 0, 1, 0, 0); - } elseif (preg_match('/^-- Page ID (\d+).*Aliases\s(.*)\s--;/i', $buf, $reg)) { + } elseif (preg_match('/^-- Page ID (\d+).*Aliases\s(.*)\s--;/i', $buf, /** @var string[] $reg */ $reg)) { // Example of line: "-- Page ID 1__+MAX_llx_website_page__ - Aliases about-us --;" $newid = ($reg[1] + $maxrowid); $aliasesarray = explode(',', $reg[2]); From 10b260a31dfebf220e5ea6112b117f49cd11c341 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 23:38:50 +0100 Subject: [PATCH 530/862] Fix PhanTypeSuspiciousStringExpression --- 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 ca0feede6c8..45dcad80025 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1207,7 +1207,7 @@ class Task extends CommonObjectLine { $arrayroles = array(); - dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks userp=".is_object($userp)." usert=".is_object($usert)." projectid=".$projectid." taskid=".$taskid); + dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks userp=".json_encode(is_object($userp))." usert=".json_encode(is_object($usert))." projectid=".$projectid." taskid=".$taskid); // We want role of user for a projet or role of user for a task. Both are not possible. if (empty($userp) && empty($usert)) { From 921431dbdcf95421b070cd62c75e4bdb6a96ae7f Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Mar 2024 19:58:26 +0100 Subject: [PATCH 531/862] Qual: Enable PhanTypeSuspiciousStringExpression --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 59853f259ac..4e7977ec76f 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -468,7 +468,7 @@ return [ 'PhanPluginUnknownArrayFunctionParamType', // 'PhanPluginDescriptionlessCommentOnPublicProperty', // 'PhanPluginUnknownFunctionParamType', // Finds certain errors in PHPdoc typing - 'PhanTypeSuspiciousStringExpression', + // 'PhanTypeSuspiciousStringExpression', // 'PhanPluginRedundantAssignment', 'PhanTypeExpectedObjectPropAccess', From 3c968477cbe93d77388860073ed0b64a9aac4559 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 16:37:58 +0100 Subject: [PATCH 532/862] Change type of global $website to string --- dev/tools/phan/config.php | 2 +- dev/tools/phan/config_extended.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 4e7977ec76f..9c084b8e0ad 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -179,7 +179,7 @@ $VALID_MODULE_MAPPING = array( 'webportal' => 'WebPortal', 'webservices' => 'WebServices', 'webservicesclient' => 'WebServicesClient', - 'website' => 'Website', + 'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 'workflow' => 'Workflow', 'workstation' => 'Workstation', 'zapier' => 'Zapier', diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index fc9fe8f6fd9..253032345ae 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -178,7 +178,7 @@ $VALID_MODULE_MAPPING = array( 'webportal' => 'WebPortal', 'webservices' => 'WebServices', 'webservicesclient' => 'WebServicesClient', - 'website' => 'Website', + 'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 'workflow' => 'Workflow', 'workstation' => 'Workstation', 'zapier' => 'Zapier', From 9647c463713cdd76f4205b0e6e4996cfdbd4704b Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 18:20:15 +0100 Subject: [PATCH 533/862] Add empty lines to avoid comment alignments --- htdocs/core/lib/functions.lib.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0931f402eb1..f9ce010b82f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11763,12 +11763,14 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * @param string $label Label or tooltip of button if $text is provided. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. * @param string $text Optional : short label on button. Can be escaped HTML content or full simple text. * @param string $actionType 'default', 'danger', 'email', 'clone', 'cancel', 'delete', ... - * @param string|array $url Url for link or array of subbutton description ('label'=>, 'url'=>, 'lang'=>, 'perm'=> ) - * Example when an array is used: $arrayforbutaction = array( - * 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("propal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - * 20 => array('lang'=>'orders', 'enabled'=>isModEnabled("order"), 'perm'=>$user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - * 30 => array('lang'=>'bills', 'enabled'=>isModEnabled("invoice"), 'perm'=>$user->hasRight('facture', 'creer'), 'label' => 'CreateBill', 'url'=>'/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - * ); + * + * @param string|array $url Url for link or array of subbutton description + * + * Example when an array is used: $arrayforbutaction = array( + * 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("propal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + * 20 => array('lang'=>'orders', 'enabled'=>isModEnabled("order"), 'perm'=>$user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + * 30 => array('lang'=>'bills', 'enabled'=>isModEnabled("invoice"), 'perm'=>$user->hasRight('facture', 'creer'), 'label' => 'CreateBill', 'url'=>'/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + * ); * @param string $id Attribute id of action button. Example 'action-delete'. This can be used for full ajax confirm if this code is reused into the ->formconfirm() method. * @param int|boolean $userRight User action right * // phpcs:disable @@ -13989,7 +13991,7 @@ function recordNotFound($message = '', $printheader = 1, $printfooter = 1, $show $hookmanager->initHooks(array('main')); } - $parameters = array('message'=>$message, 'params'=>$params); + $parameters = array('message' => $message, 'params' => $params); $reshook = $hookmanager->executeHooks('getErrorRecordNotFound', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks print $hookmanager->resPrint; } From cd3ea72f96eebb23059b1a06468c2d4a9474d443 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 18:35:45 +0100 Subject: [PATCH 534/862] Qual: Disable global variable suggestion for $website --- dev/tools/phan/config.php | 4 ++-- dev/tools/phan/config_extended.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 9c084b8e0ad..2bf21dfadab 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -179,7 +179,7 @@ $VALID_MODULE_MAPPING = array( 'webportal' => 'WebPortal', 'webservices' => 'WebServices', 'webservicesclient' => 'WebServicesClient', - 'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 + 'website' => 'Website', 'workflow' => 'Workflow', 'workstation' => 'Workstation', 'zapier' => 'Zapier', @@ -278,7 +278,7 @@ return [ 'objectoffield' => '\CommonObject', 'senderissupplier' => 'int<0,1,2>', 'user' => '\User', - 'website' => '\WebSite', + 'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 // Disable because Phan infers Website type 'websitepage' => '\WebSitePage', 'websitepagefile' => 'string', // 'object' => '\CommonObject', // Deprecated, not enabled because conflicts with $object assignments diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 253032345ae..7a2b4e8238d 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -178,7 +178,7 @@ $VALID_MODULE_MAPPING = array( 'webportal' => 'WebPortal', 'webservices' => 'WebServices', 'webservicesclient' => 'WebServicesClient', - 'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 + 'website' => 'Website', 'workflow' => 'Workflow', 'workstation' => 'Workstation', 'zapier' => 'Zapier', @@ -218,7 +218,7 @@ return [ 'disablemove' => 'int<0,1>', 'disableremove' => 'int<0,1>', // Found in dol_eval - 'website' => '\WebSite', + 'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 // Disable because Phan infers Website type 'websitepage' => '\WebSitePage', 'websitepagefile' => 'string', 'action' => 'string', From 79a0b7d234f6bd8e86cd7b5b17109ef677a964da Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 21:55:32 +0100 Subject: [PATCH 535/862] Fix array_key_exists in websiteaccount_card by adding key to initializer --- htdocs/societe/class/societeaccount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 97a07189c5f..75d05514f1f 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -87,7 +87,7 @@ class SocieteAccount extends CommonObject 'pass_crypted' => array('type' => 'password', 'label' => 'Password', 'visible' => -1, 'enabled' => 1, 'position' => 31, 'notnull' => 1), 'pass_temp' => array('type' => 'varchar(128)', 'label' => 'Temp', 'visible' => 0, 'enabled' => 0, 'position' => 32, 'notnull' => -1,), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'visible' => 1, 'enabled' => 1, 'position' => 40, 'notnull' => -1, 'index' => 1, 'picto' => 'company', 'css' => 'maxwidth300 widthcentpercentminusxx'), - 'site' => array('type' => 'varchar(128)', 'label' => 'WebsiteTypeLabel', 'visible' => 0, 'enabled' => 0, 'position' => 41, 'notnull' => 1, 'default' => '', 'help' => 'Name of the website or service if this is account on an external website or service'), + 'site' => array('type' => 'varchar(128)', 'label' => 'WebsiteTypeLabel', 'visible' => 0, 'enabled' => 0, 'position' => 41, 'notnull' => 1, 'default' => '', 'help' => 'Name of the website or service if this is account on an external website or service', 'arrayofkeyval' => array( /* For static analysis, filled in constructor */)), 'fk_website' => array('type' => 'integer:Website:website/class/website.class.php', 'label' => 'WebSite', 'visible' => 0, 'enabled' => 0, 'position' => 42, 'notnull' => -1, 'index' => 1, 'picto' => 'website', 'css' => 'maxwidth300 widthcentpercentminusxx'), 'site_account' => array('type' => 'varchar(128)', 'label' => 'ExternalSiteAccount', 'visible' => 0, 'enabled' => 1, 'position' => 44, 'help' => 'A key to identify the account on external web site if this is an account on an external website'), 'key_account' => array('type' => 'varchar(128)', 'label' => 'KeyAccount', 'visible' => 0, 'enabled' => 1, 'position' => 48, 'notnull' => 0, 'index' => 1, 'searchall' => 1, 'comment' => 'The id of third party in the external web site (for site_account if site_account defined)',), From 3c5599bb4703f514a5cf161f0fe5c01c627a4ce8 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 21:57:28 +0100 Subject: [PATCH 536/862] Correct annotation to ignore PhanTypeMismatchArgumentInternal --- htdocs/core/class/ldap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index f87638ed985..88a66289126 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -27,7 +27,7 @@ * Note: * LDAP_ESCAPE_FILTER is to escape char array('\\', '*', '(', ')', "\x00") * LDAP_ESCAPE_DN is to escape char array('\\', ',', '=', '+', '<', '>', ';', '"', '#') - * @phan-suppress-file PhanTypeMismatchArgumentInternal (notifications concern 'respource) + * @phan-file-suppress PhanTypeMismatchArgumentInternal (notifications concern 'resource) */ /** From 2c034e6aacbcf633e07393b77fce0590a2c04e47 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:02:46 +0100 Subject: [PATCH 537/862] Fix types of arguments for round and str_pad --- htdocs/comm/action/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f2427e17501..b59645dda05 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1731,8 +1731,8 @@ if (empty($mode) || $mode == 'show_month') { // View by month $maxnbofchar = 80; $tmp = explode('-', getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS')); - $minhour = round($tmp[0], 0); - $maxhour = round($tmp[1], 0); + $minhour = round((float) $tmp[0], 0); + $maxhour = round((float) $tmp[1], 0); if ($minhour > 23) { $minhour = 23; } @@ -1819,10 +1819,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print "\n"; $curtime = dol_mktime(0, 0, 0, $month, $day, $year); - $urltoshow = DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year.$newparam; + $urltoshow = DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&day='.str_pad((string) $day, 2, "0", STR_PAD_LEFT).'&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$year.$newparam; $urltocreate = ''; if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { - $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year; + $newparam .= '&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$year; $hourminsec = '100000'; $urltocreate = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $year, $month, $day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); } From 1933349eb0f9d877bdc2afae92ece1a02fe08601 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:04:24 +0100 Subject: [PATCH 538/862] Fix type of argument for str_pad --- htdocs/comm/action/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 408b64c6fc9..6eb5db86056 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -722,7 +722,7 @@ if (empty($reshook)) { $tmpforcreatebutton = dol_getdate(dol_now(), true); -$newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; +$newparam = '&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; $url .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; From 9958fde08a8561a315c38bcbe2c90df1fa11dafa Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:05:48 +0100 Subject: [PATCH 539/862] Fix type of argument for usleep --- htdocs/comm/mailing/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 9c512bfc047..d2c8e169342 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -411,7 +411,7 @@ if (empty($reshook)) { if (getDolGlobalString('MAILING_DELAY')) { dol_syslog("Wait a delay of MAILING_DELAY=".((float) $conf->global->MAILING_DELAY)); - usleep((float) $conf->global->MAILING_DELAY * 1000000); + usleep((int) ((float) $conf->global->MAILING_DELAY * 1000000)); } //test if CHECK READ change statut prospect contact From 4c5ceace408a40c5aaecc4bcc4129e8e547e8b8f Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:07:02 +0100 Subject: [PATCH 540/862] Fix type of argument for round --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 86898548291..035560a0fe0 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -400,7 +400,7 @@ if (empty($reshook)) { $action = ''; } else { $tmpvatratetoshow = explode('_', $vatrate); - $tmpvatratetoshow[0] = round($tmpvatratetoshow[0], 2); + $tmpvatratetoshow[0] = round((float) $tmpvatratetoshow[0], 2); if ($tmpvatratetoshow[0] != 0) { $langs->load("errors"); From d9970ff4e74ac1c5e07df58ce13f8cf1ef253a1e Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:09:35 +0100 Subject: [PATCH 541/862] Fix type of argument for round --- htdocs/compta/prelevement/class/bonprelevement.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 412bcc1182d..6a4b07b0156 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2141,7 +2141,7 @@ class BonPrelevement extends CommonObject * @param string $row_cb pl.code_banque AS cb, Not used for SEPA * @param string $row_cg pl.code_guichet AS cg, Not used for SEPA * @param string $row_cc pl.number AS cc, Not used for SEPA - * @param string $row_somme pl.amount AS somme, + * @param float $row_somme pl.amount AS somme, * @param string $row_ref Invoice ref (f.ref) or Salary ref * @param int $row_idfac p.fk_facture AS idfac or p.fk_facture_fourn or p.fk_salary, * @param string $row_iban rib.iban_prefix AS iban, @@ -2179,7 +2179,7 @@ class BonPrelevement extends CommonObject // Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum) $XML_DEBITOR .= ' '.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_DEBITOR .= ' '.$CrLf; - $XML_DEBITOR .= ' '.round($row_somme, 2).''.$CrLf; + $XML_DEBITOR .= ' '.round((float) $row_somme, 2).''.$CrLf; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$Rum.''.$CrLf; @@ -2244,7 +2244,7 @@ class BonPrelevement extends CommonObject $XML_CREDITOR .= ' ' . $CrLf; } $XML_CREDITOR .= ' '.$CrLf; - $XML_CREDITOR .= ' '.round($row_somme, 2).''.$CrLf; + $XML_CREDITOR .= ' '.round((float) $row_somme, 2).''.$CrLf; $XML_CREDITOR .= ' '.$CrLf; /* $XML_CREDITOR .= ' '.$CrLf; From 8077bf10f357aff8b2c4fe44ca6f92d9e1bb7cac Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:14:44 +0100 Subject: [PATCH 542/862] Fix type of argument to urlencode by rewrite --- htdocs/core/ajax/ajaxdirpreview.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 3fbd13840c2..45104b2ba27 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Pierre Morin * Copyright (C) 2013 Marcos García + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -182,7 +183,7 @@ if (!empty($websitekey)) { $param .= '&website='.urlencode($websitekey); } if (!empty($pageid)) { - $param .= '&pageid='.urlencode($pageid); + $param .= '&pageid='.((int) $pageid); } @@ -321,7 +322,7 @@ if ($type == 'directory') { $param .= '&website='.urlencode(GETPOST('website', 'alpha')); } if (!preg_match('/pageid=/', $param)) { - $param .= '&pageid='.urlencode((string) (GETPOSTINT('pageid'))); + $param .= '&pageid='.GETPOSTINT('pageid'); } //if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid); } From 7cc189489334d6b5c6688363cba98ca101b25de2 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:17:01 +0100 Subject: [PATCH 543/862] Fix type of param to fix strtoupper typing --- 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 27a787447ba..9bd531eb262 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5502,7 +5502,7 @@ abstract class CommonObject * Delete a link to resource line * * @param int $rowid Id of resource line to delete - * @param int $element element name (for trigger) TODO: use $this->element into commonobject class + * @param string $element element name (for trigger) TODO: use $this->element into commonobject class * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ From c8fa6b48277be90dbb397a87379ee4b4fe1acd69 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:23:34 +0100 Subject: [PATCH 544/862] Fix casting to fix strtoupper and more --- htdocs/core/class/cregion.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/cregion.class.php b/htdocs/core/class/cregion.class.php index 358935bb2a9..4fe381bdca8 100644 --- a/htdocs/core/class/cregion.class.php +++ b/htdocs/core/class/cregion.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2007-2011 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -149,7 +150,7 @@ class Cregion extends CommonDict * Load object in memory from database * * @param int $id Id object - * @param string $code_region Code + * @param int $code_region Code * @param int $fk_pays Country Id * @return int >0 if OK, 0 if not found, <0 if KO */ @@ -166,9 +167,9 @@ class Cregion extends CommonDict if ($id) { $sql .= " WHERE t.rowid = ".((int) $id); } elseif ($code_region) { - $sql .= " WHERE t.code_region = '".$this->db->escape(strtoupper($code_region))."'"; + $sql .= " WHERE t.code_region = ".((int) $code_region); } elseif ($fk_pays) { - $sql .= " WHERE t.fk_pays = '".$this->db->escape(strtoupper($fk_pays))."'"; + $sql .= " WHERE t.fk_pays = ".((int) $fk_pays); } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -179,8 +180,8 @@ class Cregion extends CommonDict if ($obj) { $this->id = $obj->rowid; - $this->code_region = $obj->code_region; - $this->fk_pays = $obj->fk_pays; + $this->code_region = (int) $obj->code_region; + $this->fk_pays = (int) $obj->fk_pays; $this->name = $obj->nom; $this->cheflieu = $obj->cheflieu; $this->active = $obj->active; @@ -233,8 +234,8 @@ class Cregion extends CommonDict // Update request $sql = "UPDATE ".$this->db->prefix()."c_regions SET"; - $sql .= " code_region=".(isset($this->code_region) ? "'".$this->db->escape($this->code_region)."'" : "null").","; - $sql .= " fk_pays=".(isset($this->fk_pays) ? "'".$this->db->escape($this->fk_pays)."'" : "null").","; + $sql .= " code_region=".(isset($this->code_region) ? ((int) $this->code_region) : "null").","; + $sql .= " fk_pays=".(isset($this->fk_pays) ? ((int) $this->fk_pays) : "null").","; $sql .= " nom=".(isset($this->name) ? "'".$this->db->escape($this->name)."'" : "null").","; $sql .= " cheflieu=".(isset($this->cheflieu) ? "'".$this->db->escape($this->cheflieu)."'" : "null").","; $sql .= " active=".(isset($this->active) ? $this->active : "null"); From 0032fe47468742d9d34a4fab26d4ac1802eff533 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:27:19 +0100 Subject: [PATCH 545/862] Fix wrong reference to this->rowid, must be this->id --- htdocs/core/class/cregion.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/cregion.class.php b/htdocs/core/class/cregion.class.php index 4fe381bdca8..789319c1d04 100644 --- a/htdocs/core/class/cregion.class.php +++ b/htdocs/core/class/cregion.class.php @@ -110,7 +110,7 @@ class Cregion extends CommonDict $sql .= "cheflieu,"; $sql .= "active"; $sql .= ") VALUES ("; - $sql .= " ".(!isset($this->rowid) ? 'NULL' : (int) $this->rowid).","; + $sql .= " ".(!isset($this->id) ? 'NULL' : (int) $this->id).","; $sql .= " ".(!isset($this->code_region) ? 'NULL' : (int) $this->code_region).","; $sql .= " ".(!isset($this->fk_pays) ? 'NULL' : (int) $this->fk_pays).","; $sql .= " ".(!isset($this->name) ? 'NULL' : "'".$this->db->escape($this->name)."'").","; From e0baa385b5e044483c9d7f89cc736d2503026c10 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 22:37:40 +0100 Subject: [PATCH 546/862] Fix args to strpos and count with typing and casting --- htdocs/core/class/dolgraph.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 215d9a9e0e0..4ad3cda07c3 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -50,11 +50,11 @@ class DolGraph public $cssprefix = ''; // To add into css styles /** - * @var int|string Width of graph. It can be a numeric for pixels or a string like '100%' + * @var int|string Width of graph. It can be a numeric for pixels or a string like '100%' or "100px' */ public $width = 380; /** - * @var int Height of graph + * @var int|string Height of graph. It can be a numeric for pixels or a string like '100%' or "100px' */ public $height = 200; @@ -242,7 +242,7 @@ class DolGraph /** * Set width * - * @param int|string $w Width (Example: 320 or '100%') + * @param int|string $w Width (Example: 320 or '100%' or '10px') * @return void */ public function SetWidth($w) @@ -441,7 +441,7 @@ class DolGraph /** * Set height * - * @param int $h Height + * @param int|string $h Height int or '90%' or '10px' * @return void */ public function SetHeight($h) @@ -1159,12 +1159,12 @@ class DolGraph if (count($this->data) > 20) { $dolxaxisvertical = 'dol-xaxis-vertical'; } - // No height for the pie grah + // No height for the pie graph $cssfordiv = 'dolgraphchart'; if (isset($this->type[$firstlot])) { $cssfordiv .= ' dolgraphchar' . $this->type[$firstlot]; } - $this->stringtoshow .= '
'."\n"; + $this->stringtoshow .= '
'."\n"; $this->stringtoshow .= '
'."\n"; $this->stringtoshow .= ' 0 ? getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) : ''; +$keyCodeForEnter = ''; +if (!empty($_SESSION['takeposterminal'])) { + $keyCodeForEnter = getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) > 0 ? getDolGlobalString('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) : ''; +} ?>
@@ -1134,7 +1137,11 @@ if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { - trans("TerminalName", $_SESSION["takeposterminal"])); ?> + trans("TerminalName", $_SESSION["takeposterminal"])); + } + ?> - '.dol_print_date(dol_now(), "day").''; ?> @@ -1416,7 +1423,7 @@ if (getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0 || getDolGlobalString('T $sql = "SELECT rowid, status, entity FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE"; $sql .= " entity = ".((int) $conf->entity)." AND "; -$sql .= " posnumber = ".((int) $_SESSION["takeposterminal"])." AND "; +$sql .= " posnumber = ".((int) empty($_SESSION["takeposterminal"]) ? 0 : $_SESSION["takeposterminal"])." AND "; $sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'"; $resql = $db->query($sql); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 1d2430e5d55..2592d778715 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1840,8 +1840,11 @@ if ($placeid > 0) { $sql .= " AND ps.fk_product = ".((int) $line->fk_product); $resql = $db->query($sql); if ($resql) { + $stock_real = 0; $obj = $db->fetch_object($resql); - $stock_real = price2num($obj->reel, 'MS'); + if ($obj) { + $stock_real = price2num($obj->reel, 'MS'); + } $htmlforlines .= $line->qty; if ($line->qty && $line->qty > $stock_real) { $htmlforlines .= ''; From e16d1d5de934e6e77c569d1899dc2208601a43e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 21:27:28 +0100 Subject: [PATCH 767/862] FIX #28978 FIX #28976 --- htdocs/takepos/index.php | 3 +-- htdocs/user/logout.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8d020c7e7d4..4eb11d2286f 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -74,7 +74,6 @@ if ($setcurrency != "") { // We will recalculate amount for foreign currency at next call of invoice.php when $_SESSION["takeposcustomercurrency"] differs from invoice->multicurrency_code. } -$_SESSION["urlfrom"] = '/takepos/index.php'; $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter", "banks")); @@ -1187,7 +1186,7 @@ if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { ?>
diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 75f2fa6f069..be39b2fda02 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -72,7 +72,7 @@ if ($reshook < 0) { } // Define url to go after disconnect -$urlfrom = empty($_SESSION["urlfrom"]) ? '' : $_SESSION["urlfrom"]; +$urlfrom = empty($_SESSION["urlfrom"]) ? GETPOST('urlfrom') : $_SESSION["urlfrom"]; // Define url to go $url = DOL_URL_ROOT."/index.php"; // By default go to login page From 440c7b4493c67cf4e938341fd07096b96fb3e61c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 21:27:28 +0100 Subject: [PATCH 768/862] FIX #28978 FIX #28976 --- htdocs/takepos/index.php | 3 +-- htdocs/user/logout.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index c58d0f5a81b..dc03d83ff90 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -73,7 +73,6 @@ if ($setcurrency != "") { // We will recalculate amount for foreign currency at next call of invoice.php when $_SESSION["takeposcustomercurrency"] differs from invoice->multicurrency_code. } -$_SESSION["urlfrom"] = '/takepos/index.php'; $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter", "banks")); @@ -1146,7 +1145,7 @@ if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { ?>
diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 4713d4e9e97..77fcb90a4b9 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -72,7 +72,7 @@ if ($reshook < 0) { } // Define url to go after disconnect -$urlfrom = empty($_SESSION["urlfrom"]) ? '' : $_SESSION["urlfrom"]; +$urlfrom = empty($_SESSION["urlfrom"]) ? GETPOST('urlfrom') : $_SESSION["urlfrom"]; // Define url to go $url = DOL_URL_ROOT."/index.php"; // By default go to login page From 5bae4ffe4d5cd6cbd323c92ecee6ef6e43f42460 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 21:27:28 +0100 Subject: [PATCH 769/862] FIX #28978 FIX #28976 --- htdocs/takepos/index.php | 3 +-- htdocs/user/logout.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 97dae7e1a14..99374eebc9f 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -73,7 +73,6 @@ if ($setcurrency != "") { // We will recalculate amount for foreign currency at next call of invoice.php when $_SESSION["takeposcustomercurrency"] differs from invoice->multicurrency_code. } -$_SESSION["urlfrom"] = '/takepos/index.php'; $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter", "banks")); @@ -1107,7 +1106,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { }?>
diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index d71ee34d93f..129ae24df06 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -72,7 +72,7 @@ if ($reshook < 0) { } // Define url to go after disconnect -$urlfrom = empty($_SESSION["urlfrom"]) ? '' : $_SESSION["urlfrom"]; +$urlfrom = empty($_SESSION["urlfrom"]) ? GETPOST('urlfrom') : $_SESSION["urlfrom"]; // Define url to go $url = DOL_URL_ROOT."/index.php"; // By default go to login page From dc15b2ee79f3a25722eee498b86b34f121de1ef2 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 13:39:11 +0100 Subject: [PATCH 770/862] Qual: Bump logToCheckStyle for better filename handling # Qual: Bump logToCheckStyle for better filename handling Some notifications from the PHPCS step in pre-commit extracted too many characters for the filename in a specific case. The update to logToCheckStyle fixes that. --- .github/workflows/pre-commit.yml | 2 +- .github/workflows/windows-ci.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index b29ae8aa809..671a266c767 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -106,7 +106,7 @@ jobs: ls -l ~/.cache/pre-commit/ - name: Convert Raw Log to Annotations - uses: mdeweerd/logToCheckStyle@2024.3.2 + uses: mdeweerd/logToCheckStyle@v2024.3.4 if: ${{ failure() }} with: in: ${{ env.RAW_LOG }} diff --git a/.github/workflows/windows-ci.yaml b/.github/workflows/windows-ci.yaml index edcb9d39226..cb467055156 100644 --- a/.github/workflows/windows-ci.yaml +++ b/.github/workflows/windows-ci.yaml @@ -150,7 +150,7 @@ jobs: for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A - name: Convert Raw Log to Annotations - uses: mdeweerd/logToCheckStyle@2024.3.2 + uses: mdeweerd/logToCheckStyle@v2024.3.4 if: ${{ failure() }} with: in: ${{ env.PHPUNIT_LOG }} From 33486f10c05b9e24796aa29ced078ccf31b13d3f Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 13:58:43 +0100 Subject: [PATCH 771/862] Fix PhanTypeMismatchReturnNullable by initialising return value --- htdocs/adherents/class/adherent.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index c6ce7429708..f71fa705c3f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -560,12 +560,13 @@ class Adherent extends CommonObject * Return translated label by the nature of a adherent (physical or moral) * * @param string $morphy Nature of the adherent (physical or moral) - * @param int $addbadge Add badge (1=Full label, 2=First letters only) + * @param int<0,2> $addbadge Add badge (1=Full label, 2=First letters only) * @return string Label */ public function getmorphylib($morphy = '', $addbadge = 0) { global $langs; + $s = ''; // Clean var if (!$morphy) { @@ -573,7 +574,6 @@ class Adherent extends CommonObject } if ($addbadge) { - $s = ''; $labeltoshowm = $langs->trans("Moral"); $labeltoshowp = $langs->trans("Physical"); if ($morphy == 'phy') { From 3b93de27097f3a8926d1d9f750a952472dffde8c Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 14:10:45 +0100 Subject: [PATCH 772/862] Fix PhanTypeMismatchReturnNullable by initialising return value + Some PHPdoc typing --- .../adherents/class/adherentstats.class.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index f99b20f86d5..612f408edd9 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -3,6 +3,7 @@ * Copyright (c) 2005-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2023 Waël Almoman + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -168,15 +169,15 @@ class AdherentStats extends Stats /** * Return count of member by status group by adh type, total and average * - * @param int $numberYears Number of years to scan (0 = all) - * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member type + * @param int $numberYears Number of years to scan (0 = all) + * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member type */ public function countMembersByTypeAndStatus($numberYears = 0) { global $user; $now = dol_now(); - $endYear = date('Y'); + $endYear = (int) date('Y'); $startYear = $endYear - $numberYears; $sql = "SELECT t.rowid as fk_adherent_type, t.libelle as label"; @@ -224,7 +225,7 @@ class AdherentStats extends Stats 'members_resiliated' => (int) $objp->members_resiliated ); $totalrow = 0; - foreach ($MembersCountArray[$objp->fk_adherent_type] as $key=>$nb) { + foreach ($MembersCountArray[$objp->fk_adherent_type] as $key => $nb) { if ($key != 'label') { $totalrow += $nb; $totalstatus[$key] += $nb; @@ -244,16 +245,17 @@ class AdherentStats extends Stats /** * Return count of member by status group by adh type, total and average * - * @param int $numberYears Number of years to scan (0 = all) - * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag + * @param int $numberYears Number of years to scan (0 = all) + * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag */ public function countMembersByTagAndStatus($numberYears = 0) { global $user; $now = dol_now(); - $endYear = date('Y'); + $endYear = (int) date('Y'); $startYear = $endYear - $numberYears; + $MembersCountArray = []; $sql = "SELECT c.rowid as fk_categorie, c.label as label"; $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft"; @@ -282,7 +284,6 @@ class AdherentStats extends Stats if ($result) { $num = $this->db->num_rows($result); $i = 0; - $MembersCountArray = []; $totalstatus = array( 'label' => 'Total', 'members_draft' => 0, @@ -304,7 +305,7 @@ class AdherentStats extends Stats 'members_resiliated' => (int) $objp->members_resiliated ); $totalrow = 0; - foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) { + foreach ($MembersCountArray[$objp->fk_categorie] as $key => $nb) { if ($key != 'label') { $totalrow += $nb; $totalstatus[$key] += $nb; From 3a27977b46fc942eb664e9f933bbab556051f5d8 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 14:18:37 +0100 Subject: [PATCH 773/862] Fix PhanTypeMismatchReturnNullable with typing test --- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f4f77bcaa9d..09e73b188f8 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1393,7 +1393,7 @@ class ActionComm extends CommonObject * * @param User $user Object user * @param int $load_state_board Load indicator array this->nb - * @return WorkboardResponse|int Return integer <0 if KO, WorkboardResponse if OK + * @return WorkboardResponse|int<-1,1> Return integer <0 if KO, WorkboardResponse if OK */ public function load_board($user, $load_state_board = 0) { @@ -1462,7 +1462,7 @@ class ActionComm extends CommonObject } $this->db->free($resql); - if (empty($load_state_board)) { + if (empty($load_state_board) && $response instanceof WorkboardResponse) { return $response; } else { return 1; From 0a1a663e3471360ce6a8b79e8df535ad027f6609 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 14:21:35 +0100 Subject: [PATCH 774/862] Fix PhanTypeMismatchReturnNullable with initialisation --- htdocs/comm/propal/class/api_proposals.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index aa1e3d0e980..546d40d052d 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2022 ATM Consulting * Copyright (C) 2022 OpenDSI + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -410,6 +411,7 @@ class Proposals extends DolibarrApi } $errors = []; + $updateRes = 0; $this->db->begin(); foreach ($request_data as $TData) { From d245dab56b56dcfab7454a395b790052a094a9c3 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 14:56:14 +0100 Subject: [PATCH 775/862] Fix PhanTypeMismatchReturnNullable by setting variable --- htdocs/projet/class/task.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 45dcad80025..84d78726599 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -2051,9 +2051,10 @@ class Task extends CommonObjectLine $this->error = $clone_task->error; $error++; } - // End - if (!$error) { + if ($error) { + $clone_task_id = 0; // For static tool check + } else { $clone_task_id = $clone_task->id; $clone_task_ref = $clone_task->ref; From 7e1bf61c0db34f4deb6308e03472444a8da63249 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 17:59:48 +0100 Subject: [PATCH 776/862] Fix PhanTypeMismatchReturnNullable with init --- htdocs/core/class/html.formprojet.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 9bbc5e75018..b6f50754c6b 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Charlene Benke * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -686,7 +687,7 @@ class FormProjets extends Form * @param string $morecss Add more css * @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $addcombojs 1=Add a js combo - * @return int|string The HTML select list of element or '' if nothing or -1 if KO + * @return int<-1,-1>|string The HTML select list of element or '' if nothing or -1 if KO */ public function selectOpportunityStatus($htmlname, $preselected = '-1', $showempty = 1, $useshortlabel = 0, $showallnone = 0, $showpercent = 0, $morecss = '', $noadmininfo = 0, $addcombojs = 0) { @@ -701,6 +702,7 @@ class FormProjets extends Form if ($resql) { $num = $this->db->num_rows($resql); $i = 0; + $sellist = ''; if ($num > 0) { $sellist = ''; print ''; $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/variants/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); @@ -561,7 +563,7 @@ foreach ($object->fields as $key => $val) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -618,7 +620,7 @@ foreach ($object->fields as $key => $val) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -757,7 +759,7 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Other @@ -826,7 +828,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 2d1e9d9fefc..3638739a101 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -149,6 +150,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan $permissiontoread = $user->hasRight('workstation', 'workstation', 'read'); $permissiontoadd = $user->hasRight('workstation', 'workstation', 'write'); From 44ef0de1ef1a8440bb666a32bf77990426fba2bb Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 20:05:35 +0100 Subject: [PATCH 791/862] Fix null return by initialising return value, forcing type --- htdocs/core/class/stats.class.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 14b636dd2ab..135c9118e03 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -129,6 +129,7 @@ abstract class Stats if ($foundintocache) { // Cache file found and is not too old dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); $data = json_decode(file_get_contents($newpathofdestfile), true); + '@phan-var-force array,array{0:int<1,12>,1:int}> $data'; } else { $year = $startyear; $sm = $startmonth - 1; @@ -188,7 +189,7 @@ abstract class Stats * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month * @param int $startmonth month of the fiscal year start min 1 max 12 ; if 1 = january - * @return array Array of values + * @return array,array> Array of values */ public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1) { @@ -199,6 +200,7 @@ abstract class Stats } $datay = array(); + $data = array(); // Return value // Search into cache if (!empty($cachedelay)) { @@ -238,7 +240,6 @@ abstract class Stats $year++; } - $data = array(); // $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...) for ($i = 0; $i < 12; $i++) { $data[$i][] = isset($datay[$endyear][($i + $sm) % 12]['label']) ? $datay[$endyear][($i + $sm) % 12]['label'] : $datay[$endyear][($i + $sm) % 12][0]; // set label @@ -272,17 +273,17 @@ abstract class Stats } /** - * @param int $year year number - * @return array array of values + * @param int $year year number + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ abstract protected function getAverageByMonth($year); /** - * Return average of entity by month for several years + * Return average of entity by month for several years * * @param int $endyear Start year * @param int $startyear End year - * @return array{int<0,11>,array} Array of values + * @return array> Array of values */ public function getAverageByMonthWithPrevYear($endyear, $startyear) { @@ -291,6 +292,7 @@ abstract class Stats } $datay = array(); + $data = array(); $year = $startyear; while ($year <= $endyear) { @@ -298,8 +300,6 @@ abstract class Stats $year++; } - $data = array(); - for ($i = 0; $i < 12; $i++) { $data[$i][] = $datay[$endyear][$i][0]; $year = $startyear; @@ -353,6 +353,7 @@ abstract class Stats if ($foundintocache) { // Cache file found and is not too old dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); $data = json_decode(file_get_contents($newpathofdestfile), true); + '@phan-var-force array,array{0:int<1,12>,1:int|float}> $data'; // Phan can't decode json_decode's return value } else { // This method is defined in parent object only, not into abstract, so we disable phpstan warning /** @phpstan-ignore-next-line */ From 5ee5a4ac2c705b8225a4eff1ee0068b1b197462d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 20:49:03 +0100 Subject: [PATCH 792/862] Suppress PhanDeprecatedFunction message for stripe --- htdocs/stripe/admin/stripe.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index d5a27ba20fb..919e80088c6 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -4,6 +4,7 @@ * Copyright (C) 2017 Saasprov * Copyright (C) 2018-2022 Thibault FOUCART * Copyright (C) 2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -256,6 +257,7 @@ if (empty($conf->stripeconnect->enabled)) { } } $endpoint->url = $url; + // @phan-suppress-next-line PhanDeprecatedFunction $endpoint->save(); if ($endpoint->status == 'enabled') { @@ -328,6 +330,7 @@ if (empty($conf->stripeconnect->enabled)) { } } $endpoint->url = $url; + // @phan-suppress-next-line PhanDeprecatedFunction $endpoint->save(); if ($endpoint->status == 'enabled') { print ''; From 942239b5d633be96558b2ac59c3f6543a2d52a81 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 19:56:20 +0100 Subject: [PATCH 793/862] Update PHPdoc to show nullable return --- htdocs/core/db/sqlite3.class.php | 12 ++++++------ htdocs/core/modules/DolibarrModules.class.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 060e7318b65..1c28d1d71a8 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -389,14 +389,14 @@ class DoliDBSqlite3 extends DoliDB } /** - * Execute a SQL request and return the resultset + * Execute a SQL request and return the resultset * - * @param string $query SQL query string - * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). + * @param string $query SQL query string + * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. - * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @param int $result_mode Result mode (not used with sqlite) - * @return bool|SQLite3Result Resultset of answer + * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) + * @param int $result_mode Result mode (not used with sqlite) + * @return bool|SQLite3Result|null Resultset of answer */ public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0) { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 0e0eb57ca22..850ec739d06 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1295,7 +1295,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } if (!$dirfound) { - dol_syslog("A module ask to load sql files into ".$reldir." but this directory was not found.", LOG_WARNING); + dol_syslog("A module wants to load sql files from ".$reldir." but this directory was not found.", LOG_WARNING); } return $ok; } From 53c628f2197d1177e53e9420380de8ac12010f84 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 20:06:46 +0100 Subject: [PATCH 794/862] Cast DolEditor::Create to string to avoid mistyping as void --- 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 b826ea69205..41a9a69114d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7269,7 +7269,7 @@ abstract class CommonObject if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); - $out = $doleditor->Create(1, '', true, '', '', '', $morecss); + $out = (string) $doleditor->Create(1, '', true, '', '', '', $morecss); } else { $out = ''; } @@ -7277,7 +7277,7 @@ abstract class CommonObject if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, isModEnabled('fckeditor') && $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%'); - $out = $doleditor->Create(1, '', true, '', '', $moreparam, $morecss); + $out = (string) $doleditor->Create(1, '', true, '', '', $moreparam, $morecss); } else { $out = ''; } From fc6af2047940c5b200a889985d14b97c2f226bff Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 22:48:53 +0100 Subject: [PATCH 795/862] Update typing for database functions --- htdocs/core/db/Database.interface.php | 7 ++++--- htdocs/core/db/DoliDB.class.php | 2 +- htdocs/core/db/mysqli.class.php | 6 +++--- htdocs/core/db/pgsql.class.php | 4 ++-- htdocs/core/db/sqlite3.class.php | 6 +++--- htdocs/debugbar/class/TraceableDB.php | 7 ++++--- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 72a5114558a..9613688e753 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -5,6 +5,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014-2015 Raphaël Doursenaud + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -326,7 +327,7 @@ interface Database * Create a table into database * * @param string $table Name of table - * @param array $fields Associative table [field name][table of descriptions] + * @param array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> $fields Associative table [field name][table of descriptions] * @param string $primary_key Name of the field that will be the primary key * @param string $type Type of the table * @param array $unique_keys Associative array Name of fields that will be unique key => value @@ -360,7 +361,7 @@ interface Database * * @param string $table Name of table * @param string $field_name Name of field to add - * @param string $field_desc Associative array of description of the field to insert [parameter name][parameter value] + * @param array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $field_desc Associative array of description of the field to insert [parameter name][parameter value] * @param string $field_position Optional ex .: "after field stuff" * @return int Return integer <0 if KO, >0 if OK */ @@ -384,7 +385,7 @@ interface Database * * @param string $table Name of table * @param string $field_name Name of field to modify - * @param string $field_desc Array with description of field format + * @param array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $field_desc Array with description of field format * @return int Return integer <0 if KO, >0 if OK */ public function DDLUpdateField($table, $field_name, $field_desc); diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 73470391fce..19bb694558b 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -266,7 +266,7 @@ abstract class DoliDB implements Database /** * Return version of database server into an array * - * @return array Version array + * @return string[] Version array */ public function getVersionArray() { diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index ff63113e47b..be8ed977963 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -814,7 +814,7 @@ class DoliDBMysqli extends DoliDB * Create a table into database * * @param string $table Name of table - * @param array $fields Tableau associatif [nom champ][tableau des descriptions] + * @param array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> $fields Tableau associatif [nom champ][tableau des descriptions] * @param string $primary_key Nom du champ qui sera la clef primaire * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur @@ -941,7 +941,7 @@ class DoliDBMysqli extends DoliDB * * @param string $table Name of table * @param string $field_name Name of field to add - * @param string $field_desc Associative table with description of field to insert [parameter name][parameter value] + * @param array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $field_desc Associative table with description of field to insert [parameter name][parameter value] * @param string $field_position Optional e.g.: "after some_field" * @return int Return integer <0 if KO, >0 if OK */ @@ -988,7 +988,7 @@ class DoliDBMysqli extends DoliDB * * @param string $table Name of table * @param string $field_name Name of field to modify - * @param string $field_desc Array with description of field format + * @param array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $field_desc Array with description of field format * @return int Return integer <0 if KO, >0 if OK */ public function DDLUpdateField($table, $field_name, $field_desc) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index cba500c0a0e..14ba90b5bd9 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1057,7 +1057,7 @@ class DoliDBPgsql extends DoliDB * Create a table into database * * @param string $table Nom de la table - * @param array $fields Tableau associatif [nom champ][tableau des descriptions] + * @param array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> $fields Tableau associatif [nom champ][tableau des descriptions] * @param string $primary_key Nom du champ qui sera la clef primaire * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur @@ -1257,7 +1257,7 @@ class DoliDBPgsql extends DoliDB * * @param string $table Name of table * @param string $field_name Name of field to modify - * @param string $field_desc Array with description of field format + * @param array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $field_desc Array with description of field format * @return int Return integer <0 if KO, >0 if OK */ public function DDLUpdateField($table, $field_name, $field_desc) diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 060e7318b65..b53bdeb8adc 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -959,7 +959,7 @@ class DoliDBSqlite3 extends DoliDB * Create a table into database * * @param string $table Nom de la table - * @param array $fields Tableau associatif [nom champ][tableau des descriptions] + * @param array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> $fields Tableau associatif [nom champ][tableau des descriptions] * @param string $primary_key Nom du champ qui sera la clef primaire * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur @@ -1082,7 +1082,7 @@ class DoliDBSqlite3 extends DoliDB * * @param string $table Table name * @param string $field_name Field name to add - * @param string $field_desc Associative table with description of field to insert [parameter name][parameter value] + * @param array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $field_desc Associative table with description of field to insert [parameter name][parameter value] * @param string $field_position Optional e.g.: "after some_field" * @return int Return integer <0 if KO, >0 if OK */ @@ -1129,7 +1129,7 @@ class DoliDBSqlite3 extends DoliDB * * @param string $table Name of table * @param string $field_name Name of field to modify - * @param string $field_desc Array with description of field format + * @param array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $field_desc Array with description of field format * @return int Return integer <0 if KO, >0 if OK */ public function DDLUpdateField($table, $field_name, $field_desc) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 6f9af2136c7..9dc266ea5e0 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -494,7 +495,7 @@ class TraceableDB extends DoliDB * Create a table into database * * @param string $table Name of table - * @param array $fields Tableau associatif [nom champ][tableau des descriptions] + * @param array $fields Tableau associatif [nom champ][tableau des descriptions] * @param string $primary_key Nom du champ qui sera la clef primaire * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur @@ -533,7 +534,7 @@ class TraceableDB extends DoliDB * * @param string $table Name of table * @param string $field_name Name of field to add - * @param string $field_desc Tableau associatif de description du champ a inserer[nom du parameter][valeur du parameter] + * @param array{type:string,label:string,enabled:int|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string} $field_desc Tableau associatif de description du champ a inserer[nom du parameter][valeur du parameter] * @param string $field_position Optionnel ex.: "after champtruc" * @return int Return integer <0 if KO, >0 if OK */ @@ -559,7 +560,7 @@ class TraceableDB extends DoliDB * * @param string $table Name of table * @param string $field_name Name of field to modify - * @param string $field_desc Array with description of field format + * @param array{type:string,label:string,enabled:int|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $field_desc Array with description of field format * @return int Return integer <0 if KO, >0 if OK */ public function DDLUpdateField($table, $field_name, $field_desc) From 2496d20d4fe19067463e67fe3a615e52c792d80a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 23:38:28 +0100 Subject: [PATCH 796/862] Fix nullable return with if($ok == 1) in stead of if($ok) # Fix nullable return with if($ok == 1) in stead of if($ok) This seems to be a bug in Phan where if($ok) changes the type of $ok. Testing with '$ok == 1' instead fixes the issue. This has been reported to the phan team. --- htdocs/core/modules/DolibarrModules.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 850ec739d06..41d2b20efd1 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1126,7 +1126,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it * * @param string $reldir Relative directory where to scan files. Example: '/install/mysql/' or '/module/sql/' * @param string $onlywithsuffix Only with the defined suffix - * @return int Return integer <=0 if KO, >0 if OK + * @return int<0,1> Return integer <=0 if KO, >0 if OK */ protected function _load_tables($reldir, $onlywithsuffix = '') { @@ -1135,6 +1135,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $error = 0; $dirfound = 0; + $ok = 1; if (empty($reldir)) { return 1; @@ -1142,9 +1143,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; - $ok = 1; foreach ($conf->file->dol_document_root as $dirroot) { - if ($ok) { + if ($ok == 1) { $dirsql = $dirroot.$reldir; $ok = 0; From 976686262d5ee858842ffaf93588e51f4b141b15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Maldonado?= Date: Thu, 21 Mar 2024 02:36:40 +0100 Subject: [PATCH 797/862] FIX: SQL syntax error in DDLUpdateField --- htdocs/core/db/pgsql.class.php | 4 ++-- test/phpunit/DoliDBTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 2923992e345..29989873d3c 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1273,9 +1273,9 @@ class DoliDBPgsql extends DoliDB if (isset($field_desc['default']) && $field_desc['default'] != '') { if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') { - $sql .= " DEFAULT ".$this->escape($field_desc['default']); + $sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT ".$this->escape($field_desc['default']); } elseif ($field_desc['type'] != 'text') { - $sql .= " DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields + $sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT '"." DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields } } diff --git a/test/phpunit/DoliDBTest.php b/test/phpunit/DoliDBTest.php index 999c3b3e54a..2a380fa637e 100644 --- a/test/phpunit/DoliDBTest.php +++ b/test/phpunit/DoliDBTest.php @@ -160,7 +160,7 @@ class DoliDBTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; // TODO Use $savtype and $savnull instead of hard coded - $field_desc = array('type'=>'varchar', 'value'=>'16', 'null'=>'NOT NULL'); + $field_desc = array('type'=>'varchar', 'value'=>'16', 'null'=>'NOT NULL', 'default'=>'aaaabbbbccccdddd'); $result = $db->DDLUpdateField($db->prefix().'c_paper_format', 'code', $field_desc); $this->assertEquals(1, $result); From 66d74b01f7c0f0231ccaf68857d39b305e93b01e Mon Sep 17 00:00:00 2001 From: brad Date: Thu, 21 Mar 2024 20:46:08 +1100 Subject: [PATCH 798/862] Fix send mail script - correctly send only set number of emails per call - will jump through each validated mailout --- scripts/emailings/mailing-send.php | 39 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 77871ecbf0b..2cdb4dacbb1 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -52,7 +52,7 @@ if (isset($argv[2]) || !empty($argv[2])) { $login = ''; } -$max = 0; +$max = -1; if (isset($argv[3]) || !empty($argv[3])) { $max = $argv[3]; @@ -105,7 +105,7 @@ if (!empty($login)) { } // We get list of emailing id to process -$sql = "SELECT m.rowid"; +$sql = "SELECT m.rowid, m.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql .= " WHERE m.statut IN (1,2)"; if ($id != 'all') { @@ -118,13 +118,22 @@ if ($resql) { $num = $db->num_rows($resql); $j = 0; - if ($num) { - for ($j = 0; $j < $num; $j++) { + if ($num) + { + for ($j = 0; $j < $num && $max!=0; $j++) + { $obj = $db->fetch_object($resql); dol_syslog("Process mailing with id ".$obj->rowid); print "Process mailing with id ".$obj->rowid."\n"; + if ($obj->status==1) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=2 WHERE rowid=".$obj->rowid; + $result_sql = $db->query($sql); + dol_syslog("Started mailing campaign ".$obj->rowid, LOG_DEBUG); + } + $emailing = new Mailing($db); $emailing->fetch($obj->rowid); @@ -185,6 +194,7 @@ if ($resql) { $now = dol_now(); $obj = $db->fetch_object($resql2); + $max--; // sendto en RFC2822 $sendto = str_replace(',', ' ', dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">"); @@ -405,25 +415,16 @@ if ($resql) { $i++; } } else { - $mesg = "Emailing id ".$id." has no recipient to target"; + //$mesg = "Emailing id ".$id." has no recipient to target"; print $mesg."\n"; dol_syslog($mesg, LOG_ERR); - } - // Loop finished, set global statut of mail - $statut = 2; - if (!$nbko) { - $statut = 3; - } + // Loop finished, set global statut of mail + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=3 WHERE rowid=".$obj->rowid; + $result_sql = $db->query($sql); - $sqlenddate = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".((int) $statut)." WHERE rowid=".((int) $id); - - dol_syslog("update global status", LOG_DEBUG); - print "Update status of emailing id ".$id." to ".$statut."\n"; - $resqlenddate = $db->query($sqlenddate); - if (!$resqlenddate) { - dol_print_error($db); - $error++; + dol_syslog("update global status", LOG_DEBUG); + print "Update status of emailing id ".$id." to ".$statut."\n"; } } else { dol_print_error($db); From 27c0192b7ca1657a48b559784f9e6df81437cc74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 11:14:39 +0100 Subject: [PATCH 799/862] cast smallint --- htdocs/core/db/mysqli.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index ff63113e47b..6e11faa9fee 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1013,8 +1013,8 @@ class DoliDBMysqli extends DoliDB } if (isset($field_desc['default']) && $field_desc['default'] != '') { - if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') { - $sql .= " DEFAULT ".$this->escape($field_desc['default']); + if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sql .= " DEFAULT ".((float) $field_desc['default']); } elseif ($field_desc['type'] != 'text') { $sql .= " DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields } From 01a058b2081d2fe031bbdc75d6fa903cd23fca76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 11:22:12 +0100 Subject: [PATCH 800/862] Fix regression --- htdocs/core/db/pgsql.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 29989873d3c..a5d226804b3 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1273,9 +1273,9 @@ class DoliDBPgsql extends DoliDB if (isset($field_desc['default']) && $field_desc['default'] != '') { if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') { - $sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT ".$this->escape($field_desc['default']); + $sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT ".((float) $field_desc['default']); } elseif ($field_desc['type'] != 'text') { - $sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT '"." DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields + $sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields } } From ebdcb0fa0ea995fa026273fd456fcdb85589e1f8 Mon Sep 17 00:00:00 2001 From: brad Date: Thu, 21 Mar 2024 21:56:09 +1100 Subject: [PATCH 801/862] Fix spaces/tabs --- scripts/emailings/mailing-send.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 2cdb4dacbb1..3d18373e86e 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -127,11 +127,10 @@ if ($resql) { dol_syslog("Process mailing with id ".$obj->rowid); print "Process mailing with id ".$obj->rowid."\n"; - if ($obj->status==1) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=2 WHERE rowid=".$obj->rowid; - $result_sql = $db->query($sql); - dol_syslog("Started mailing campaign ".$obj->rowid, LOG_DEBUG); + if ($obj->status==1) { + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=2 WHERE rowid=".$obj->rowid; + $result_sql = $db->query($sql); + dol_syslog("Started mailing campaign ".$obj->rowid, LOG_DEBUG); } $emailing = new Mailing($db); @@ -419,12 +418,12 @@ if ($resql) { print $mesg."\n"; dol_syslog($mesg, LOG_ERR); - // Loop finished, set global statut of mail - $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=3 WHERE rowid=".$obj->rowid; - $result_sql = $db->query($sql); + // Loop finished, set global statut of mail + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=3 WHERE rowid=".$obj->rowid; + $result_sql = $db->query($sql); - dol_syslog("update global status", LOG_DEBUG); - print "Update status of emailing id ".$id." to ".$statut."\n"; + dol_syslog("update global status", LOG_DEBUG); + print "Update status of emailing id ".$id." to ".$statut."\n"; } } else { dol_print_error($db); From 4fc50c3761b1b1c0bf63e0137eda7a65a3d79075 Mon Sep 17 00:00:00 2001 From: brad Date: Thu, 21 Mar 2024 22:05:50 +1100 Subject: [PATCH 802/862] Fix newline after parenthesis --- scripts/emailings/mailing-send.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 3d18373e86e..fce65e69db3 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -118,10 +118,8 @@ if ($resql) { $num = $db->num_rows($resql); $j = 0; - if ($num) - { - for ($j = 0; $j < $num && $max!=0; $j++) - { + if ($num) { + for ($j = 0; $j < $num && $max!=0; $j++) { $obj = $db->fetch_object($resql); dol_syslog("Process mailing with id ".$obj->rowid); From ce2959b022a3cc0e74fe3353c70ee4680d9be1db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 12:10:09 +0100 Subject: [PATCH 803/862] Clean method DDLCreateTable (used by modulebuilder only) #28996 --- htdocs/core/db/mysqli.class.php | 56 ++++++++++++++--------- htdocs/core/db/pgsql.class.php | 60 +++++++++++++++---------- htdocs/core/db/sqlite3.class.php | 65 ++++++++++++++++----------- htdocs/core/lib/modulebuilder.lib.php | 16 +++---- 4 files changed, 117 insertions(+), 80 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 6e11faa9fee..6f3feb04dcc 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -825,55 +825,66 @@ class DoliDBMysqli extends DoliDB public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null) { // phpcs:enable - // FIXME: $fulltext_keys parameter is unused + // @TODO: $fulltext_keys parameter is unused + + if (empty($type)) { + $type = 'InnoDB'; + } $pk = ''; $sqluq = $sqlk = array(); - // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra - // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); - $sql = "CREATE TABLE ".$table."("; + // Keys found into the array $fields: type,value,attribute,null,default,extra + // ex. : $fields['rowid'] = array( + // 'type'=>'int' or 'integer', + // 'value'=>'11', + // 'null'=>'not null', + // 'extra'=> 'auto_increment' + // ); + $sql = "CREATE TABLE ".$this->sanitize($table)."("; $i = 0; $sqlfields = array(); foreach ($fields as $field_name => $field_desc) { - $sqlfields[$i] = $field_name." "; - $sqlfields[$i] .= $field_desc['type']; - if (preg_match("/^[^\s]/i", $field_desc['value'])) { - $sqlfields[$i] .= "(".$field_desc['value'].")"; + $sqlfields[$i] = $this->sanitize($field_name)." "; + $sqlfields[$i] .= $this->sanitize($field_desc['type']); + if (!is_null($field_desc['value']) && $field_desc['value'] !== '') { + $sqlfields[$i] .= "(".$this->sanitize($field_desc['value']).")"; } - if (preg_match("/^[^\s]/i", $field_desc['attribute'])) { - $sqlfields[$i] .= " ".$field_desc['attribute']; + if (!is_null($field_desc['attribute']) && $field_desc['attribute'] !== '') { + $sqlfields[$i] .= " ".$this->sanitize($field_desc['attribute']); } - if (preg_match("/^[^\s]/i", $field_desc['default'])) { - if ((preg_match("/null/i", $field_desc['default'])) || (preg_match("/CURRENT_TIMESTAMP/i", $field_desc['default']))) { - $sqlfields[$i] .= " default ".$field_desc['default']; + if (!is_null($field_desc['default']) && $field_desc['default'] !== '') { + if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sqlfields[$i] .= " DEFAULT ".((float) $field_desc['default']); + } elseif ($field_desc['default'] == 'null' || $field_desc['default'] == 'CURRENT_TIMESTAMP') { + $sqlfields[$i] .= " DEFAULT ".$this->sanitize($field_desc['default']); } else { - $sqlfields[$i] .= " default '".$this->escape($field_desc['default'])."'"; + $sqlfields[$i] .= " DEFAULT '".$this->escape($field_desc['default'])."'"; } } - if (preg_match("/^[^\s]/i", $field_desc['null'])) { - $sqlfields[$i] .= " ".$field_desc['null']; + if (!is_null($field_desc['null']) && $field_desc['null'] !== '') { + $sqlfields[$i] .= " ".$this->sanitize($field_desc['null'], 0, 0, 1); } - if (preg_match("/^[^\s]/i", $field_desc['extra'])) { - $sqlfields[$i] .= " ".$field_desc['extra']; + if (!is_null($field_desc['extra']) && $field_desc['extra'] !== '') { + $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra']); } $i++; } if ($primary_key != "") { - $pk = "primary key(".$primary_key.")"; + $pk = "PRIMARY KEY(".$this->sanitize($primary_key).")"; } if (is_array($unique_keys)) { $i = 0; foreach ($unique_keys as $key => $value) { - $sqluq[$i] = "UNIQUE KEY '".$key."' ('".$this->escape($value)."')"; + $sqluq[$i] = "UNIQUE KEY '".$this->sanitize($key)."' ('".$this->escape($value)."')"; $i++; } } if (is_array($keys)) { $i = 0; foreach ($keys as $key => $value) { - $sqlk[$i] = "KEY ".$key." (".$value.")"; + $sqlk[$i] = "KEY ".$this->sanitize($key)." (".$value.")"; $i++; } } @@ -887,7 +898,8 @@ class DoliDBMysqli extends DoliDB if (is_array($keys)) { $sql .= ",".implode(',', $sqlk); } - $sql .= ") engine=".$type; + $sql .= ")"; + $sql .= " engine=".$this->sanitize($type); if (!$this->query($sql)) { return -1; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 250a7da0855..3cfe5671085 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1068,51 +1068,63 @@ class DoliDBPgsql extends DoliDB public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null) { // phpcs:enable - // FIXME: $fulltext_keys parameter is unused + // @TODO: $fulltext_keys parameter is unused $sqlfields = array(); $sqlk = array(); $sqluq = array(); - // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra - // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); - $sql = "create table ".$table."("; + // Keys found into the array $fields: type,value,attribute,null,default,extra + // ex. : $fields['rowid'] = array( + // 'type'=>'int' or 'integer', + // 'value'=>'11', + // 'null'=>'not null', + // 'extra'=> 'auto_increment' + // ); + $sql = "CREATE TABLE ".$this->sanitize($table)."("; $i = 0; + $sqlfields = array(); foreach ($fields as $field_name => $field_desc) { - $sqlfields[$i] = $field_name." "; - $sqlfields[$i] .= $field_desc['type']; - if (preg_match("/^[^\s]/i", $field_desc['value'])) { - $sqlfields[$i] .= "(".$field_desc['value'].")"; - } elseif (preg_match("/^[^\s]/i", $field_desc['attribute'])) { - $sqlfields[$i] .= " ".$field_desc['attribute']; - } elseif (preg_match("/^[^\s]/i", $field_desc['default'])) { - if (preg_match("/null/i", $field_desc['default'])) { - $sqlfields[$i] .= " default ".$field_desc['default']; + $sqlfields[$i] = $this->sanitize($field_name)." "; + $sqlfields[$i] .= $this->sanitize($field_desc['type']); + if (!is_null($field_desc['value']) && $field_desc['value'] !== '') { + $sqlfields[$i] .= "(".$this->sanitize($field_desc['value']).")"; + } + if (!is_null($field_desc['attribute']) && $field_desc['attribute'] !== '') { + $sqlfields[$i] .= " ".$this->sanitize($field_desc['attribute']); + } + if (!is_null($field_desc['default']) && $field_desc['default'] !== '') { + if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sqlfields[$i] .= " DEFAULT ".((float) $field_desc['default']); + } elseif ($field_desc['default'] == 'null' || $field_desc['default'] == 'CURRENT_TIMESTAMP') { + $sqlfields[$i] .= " DEFAULT ".$this->sanitize($field_desc['default']); } else { - $sqlfields[$i] .= " default '".$this->escape($field_desc['default'])."'"; + $sqlfields[$i] .= " DEFAULT '".$this->escape($field_desc['default'])."'"; } - } elseif (preg_match("/^[^\s]/i", $field_desc['null'])) { - $sqlfields[$i] .= " ".$field_desc['null']; - } elseif (preg_match("/^[^\s]/i", $field_desc['extra'])) { - $sqlfields[$i] .= " ".$field_desc['extra']; + } + if (!is_null($field_desc['null']) && $field_desc['null'] !== '') { + $sqlfields[$i] .= " ".$this->sanitize($field_desc['null'], 0, 0, 1); + } + if (!is_null($field_desc['extra']) && $field_desc['extra'] !== '') { + $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra']); } $i++; } if ($primary_key != "") { - $pk = "primary key(".$primary_key.")"; + $pk = "PRIMARY KEY(".$this->sanitize($primary_key).")"; } if (is_array($unique_keys)) { $i = 0; foreach ($unique_keys as $key => $value) { - $sqluq[$i] = "UNIQUE KEY '".$key."' ('".$this->escape($value)."')"; + $sqluq[$i] = "UNIQUE KEY '".$this->sanitize($key)."' ('".$this->escape($value)."')"; $i++; } } if (is_array($keys)) { $i = 0; foreach ($keys as $key => $value) { - $sqlk[$i] = "KEY ".$key." (".$value.")"; + $sqlk[$i] = "KEY ".$this->sanitize($key)." (".$value.")"; $i++; } } @@ -1120,15 +1132,15 @@ class DoliDBPgsql extends DoliDB if ($primary_key != "") { $sql .= ",".$pk; } - if (is_array($unique_keys)) { + if ($unique_keys != "") { $sql .= ",".implode(',', $sqluq); } if (is_array($keys)) { $sql .= ",".implode(',', $sqlk); } - $sql .= ") type=".$type; + $sql .= ")"; + //$sql .= " engine=".$this->sanitize($type); - dol_syslog($sql, LOG_DEBUG); if (!$this->query($sql)) { return -1; } else { diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 060e7318b65..477d7d33c42 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -970,51 +970,63 @@ class DoliDBSqlite3 extends DoliDB public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null) { // phpcs:enable - // FIXME: $fulltext_keys parameter is unused + // @TODO: $fulltext_keys parameter is unused $sqlfields = array(); $sqlk = array(); $sqluq = array(); - // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra - // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); - $sql = "create table ".$table."("; + // Keys found into the array $fields: type,value,attribute,null,default,extra + // ex. : $fields['rowid'] = array( + // 'type'=>'int' or 'integer', + // 'value'=>'11', + // 'null'=>'not null', + // 'extra'=> 'auto_increment' + // ); + $sql = "CREATE TABLE ".$this->sanitize($table)."("; $i = 0; + $sqlfields = array(); foreach ($fields as $field_name => $field_desc) { - $sqlfields[$i] = $field_name." "; - $sqlfields[$i] .= $field_desc['type']; - if (preg_match("/^[^\s]/i", $field_desc['value'])) { - $sqlfields[$i] .= "(".$field_desc['value'].")"; - } elseif (preg_match("/^[^\s]/i", $field_desc['attribute'])) { - $sqlfields[$i] .= " ".$field_desc['attribute']; - } elseif (preg_match("/^[^\s]/i", $field_desc['default'])) { - if (preg_match("/null/i", $field_desc['default'])) { - $sqlfields[$i] .= " default ".$field_desc['default']; + $sqlfields[$i] = $this->sanitize($field_name)." "; + $sqlfields[$i] .= $this->sanitize($field_desc['type']); + if (!is_null($field_desc['value']) && $field_desc['value'] !== '') { + $sqlfields[$i] .= "(".$this->sanitize($field_desc['value']).")"; + } + if (!is_null($field_desc['attribute']) && $field_desc['attribute'] !== '') { + $sqlfields[$i] .= " ".$this->sanitize($field_desc['attribute']); + } + if (!is_null($field_desc['default']) && $field_desc['default'] !== '') { + if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sqlfields[$i] .= " DEFAULT ".((float) $field_desc['default']); + } elseif ($field_desc['default'] == 'null' || $field_desc['default'] == 'CURRENT_TIMESTAMP') { + $sqlfields[$i] .= " DEFAULT ".$this->sanitize($field_desc['default']); } else { - $sqlfields[$i] .= " default '".$this->escape($field_desc['default'])."'"; + $sqlfields[$i] .= " DEFAULT '".$this->escape($field_desc['default'])."'"; } - } elseif (preg_match("/^[^\s]/i", $field_desc['null'])) { - $sqlfields[$i] .= " ".$field_desc['null']; - } elseif (preg_match("/^[^\s]/i", $field_desc['extra'])) { - $sqlfields[$i] .= " ".$field_desc['extra']; + } + if (!is_null($field_desc['null']) && $field_desc['null'] !== '') { + $sqlfields[$i] .= " ".$this->sanitize($field_desc['null'], 0, 0, 1); + } + if (!is_null($field_desc['extra']) && $field_desc['extra'] !== '') { + $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra']); } $i++; } if ($primary_key != "") { - $pk = "primary key(".$primary_key.")"; + $pk = "PRIMARY KEY(".$this->sanitize($primary_key).")"; } if (is_array($unique_keys)) { $i = 0; foreach ($unique_keys as $key => $value) { - $sqluq[$i] = "UNIQUE KEY '".$key."' ('".$this->escape($value)."')"; + $sqluq[$i] = "UNIQUE KEY '".$this->sanitize($key)."' ('".$this->escape($value)."')"; $i++; } } if (is_array($keys)) { $i = 0; foreach ($keys as $key => $value) { - $sqlk[$i] = "KEY ".$key." (".$value.")"; + $sqlk[$i] = "KEY ".$this->sanitize($key)." (".$value.")"; $i++; } } @@ -1022,19 +1034,20 @@ class DoliDBSqlite3 extends DoliDB if ($primary_key != "") { $sql .= ",".$pk; } - if (is_array($unique_keys)) { + if ($unique_keys != "") { $sql .= ",".implode(',', $sqluq); } if (is_array($keys)) { $sql .= ",".implode(',', $sqlk); } - $sql .= ") type=".$type; + $sql .= ")"; + //$sql .= " engine=".$this->sanitize($type); - dol_syslog($sql, LOG_DEBUG); - if (!$this -> query($sql)) { + if (!$this->query($sql)) { return -1; + } else { + return 1; } - return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 95e4711b396..159c5712399 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -1288,12 +1288,12 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul } $columns = array( - 'rowid' => array('type' => 'integer(11)'), - 'code' => array('type' => 'varchar(255) NOT NULL'), - 'label' => array('type' => 'varchar(255) NOT NULL'), - 'position' => array('type' => 'integer(11) NULL'), - 'use_default' => array('type' => 'varchar(255) DEFAULT 1'), - 'active' => array('type' => 'integer') + 'rowid' => array('type' => 'integer', 'value' => 11), + 'code' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), + 'label' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), + 'position' => array('type' => 'integer', 'value' => 11, 'null'=>'NULL'), + 'use_default' => array('type' => 'varchar', 'value' => 11, 'default'=>'1'), + 'active' => array('type' => 'integer', 'value' => 3) ); @@ -1309,13 +1309,13 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul } } // check if tablename exist in Database and create it if not - $query = "SHOW TABLES LIKE '" . MAIN_DB_PREFIX.strtolower($namedic) . "'"; + $query = "SHOW TABLES LIKE '" . $db->sanitize(MAIN_DB_PREFIX.strtolower($namedic)) . "'"; $checkTable = $db->query($query); if ($checkTable && $db->num_rows($checkTable) > 0) { setEventMessages($langs->trans("ErrorTableExist", $namedic), null, 'errors'); return; } else { - $_results = $db->DDLCreateTable(MAIN_DB_PREFIX.strtolower($namedic), $columns, $primaryKey, "InnoDB"); + $_results = $db->DDLCreateTable(MAIN_DB_PREFIX.strtolower($namedic), $columns, $primaryKey, ""); if ($_results < 0) { dol_print_error($db); $langs->load("errors"); From 171c32be342f08dd1c17a4997eb8b2f9123c424e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 12:21:38 +0100 Subject: [PATCH 804/862] Add DDLDropTable and DDLCreateTable into phpunit tests --- htdocs/core/db/mysqli.class.php | 2 +- test/phpunit/DoliDBTest.php | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 6f3feb04dcc..9c2948cb262 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -920,7 +920,7 @@ class DoliDBMysqli extends DoliDB // phpcs:enable $tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table); - $sql = "DROP TABLE ".$tmptable; + $sql = "DROP TABLE ".$this->sanitize($tmptable); if (!$this->query($sql)) { return -1; diff --git a/test/phpunit/DoliDBTest.php b/test/phpunit/DoliDBTest.php index c2a0de05a20..34f70e459c9 100644 --- a/test/phpunit/DoliDBTest.php +++ b/test/phpunit/DoliDBTest.php @@ -48,6 +48,41 @@ $conf->global->MAIN_DISABLE_ALL_MAILS = 1; */ class DoliDBTest extends CommonClassTest { + /** + * testDDLUpdateField + * + * @return int + */ + public function testDDLCreateTable() + { + global $conf,$user,$langs,$db; + $conf = $this->savconf; + $user = $this->savuser; + $langs = $this->savlangs; + $db = $this->savdb; + + $namedic = MAIN_DB_PREFIX.'tmptesttabletoremove'; + + $res = $db->DDLDropTable($namedic); + + $columns = array( + 'rowid' => array('type' => 'integer', 'value' => 11), + 'code' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), + 'label' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), + 'position' => array('type' => 'integer', 'value' => 11, 'null'=>'NULL'), + 'use_default' => array('type' => 'varchar', 'value' => 11, 'default'=>'1'), + 'active' => array('type' => 'integer', 'value' => 3) + ); + $primaryKey = 'rowid'; + + print __METHOD__.' db->type = '.$db->type."\n"; + + $res = $db->DDLCreateTable($namedic, $columns, $primaryKey, ""); + + $this->assertEquals(1, $res); + print __METHOD__." result=".$res."\n"; + } + /** * testDDLUpdateField * @@ -84,6 +119,7 @@ class DoliDBTest extends CommonClassTest $field_desc = array('type'=>'varchar', 'value'=>'16', 'null'=>'NOT NULL', 'default'=>'aaaabbbbccccdddd'); $result = $db->DDLUpdateField($db->prefix().'c_paper_format', 'code', $field_desc); + $this->assertEquals(1, $result); print __METHOD__." result=".$result."\n"; From aa77573cd9f6f4b16a39face533bdf78d03e0978 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 12:45:58 +0100 Subject: [PATCH 805/862] Sanitize DDL instructions --- htdocs/core/db/mysqli.class.php | 42 ++++++----- htdocs/core/db/pgsql.class.php | 104 +++++++++++++------------- htdocs/core/db/sqlite3.class.php | 22 +++--- htdocs/core/lib/modulebuilder.lib.php | 2 +- test/phpunit/DoliDBTest.php | 2 +- 5 files changed, 89 insertions(+), 83 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 9c2948cb262..5b43b4e2cbc 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -866,7 +866,7 @@ class DoliDBMysqli extends DoliDB $sqlfields[$i] .= " ".$this->sanitize($field_desc['null'], 0, 0, 1); } if (!is_null($field_desc['extra']) && $field_desc['extra'] !== '') { - $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra']); + $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra'], 0, 0, 1); } $i++; } @@ -940,7 +940,7 @@ class DoliDBMysqli extends DoliDB public function DDLDescTable($table, $field = "") { // phpcs:enable - $sql = "DESC ".$table." ".$field; + $sql = "DESC ".$this->sanitize($table)." ".$this->sanitize($field); dol_syslog(get_class($this)."::DDLDescTable ".$sql, LOG_DEBUG); $this->_results = $this->query($sql); @@ -962,30 +962,32 @@ class DoliDBMysqli extends DoliDB // phpcs:enable // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); - $sql = "ALTER TABLE ".$table." ADD ".$field_name." "; - $sql .= $field_desc['type']; - if (preg_match("/^[^\s]/i", $field_desc['value'])) { - if (!in_array($field_desc['type'], array('date', 'datetime')) && $field_desc['value']) { - $sql .= "(".$field_desc['value'].")"; + $sql = "ALTER TABLE ".$this->sanitize($table)." ADD ".$this->sanitize($field_name)." "; + $sql .= $this->sanitize($field_desc['type']); + if (isset($field_desc['value']) && preg_match("/^[^\s]/i", $field_desc['value'])) { + if (!in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'date', 'datetime')) && $field_desc['value']) { + $sql .= "(".$this->sanitize($field_desc['value']).")"; } } if (isset($field_desc['attribute']) && preg_match("/^[^\s]/i", $field_desc['attribute'])) { - $sql .= " ".$field_desc['attribute']; + $sql .= " ".$this->sanitize($field_desc['attribute']); } if (isset($field_desc['null']) && preg_match("/^[^\s]/i", $field_desc['null'])) { $sql .= " ".$field_desc['null']; } if (isset($field_desc['default']) && preg_match("/^[^\s]/i", $field_desc['default'])) { - if (preg_match("/null/i", $field_desc['default'])) { - $sql .= " default ".$field_desc['default']; + if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sql .= " DEFAULT ".((float) $field_desc['default']); + } elseif ($field_desc['default'] == 'null' || $field_desc['default'] == 'CURRENT_TIMESTAMP') { + $sql .= " DEFAULT ".$this->sanitize($field_desc['default']); } else { - $sql .= " default '".$this->escape($field_desc['default'])."'"; + $sql .= " DEFAULT '".$this->escape($field_desc['default'])."'"; } } if (isset($field_desc['extra']) && preg_match("/^[^\s]/i", $field_desc['extra'])) { - $sql .= " ".$field_desc['extra']; + $sql .= " ".$this->escape($field_desc['extra'], 0, 0, 1); } - $sql .= " ".$field_position; + $sql .= " ".$this->escape($field_position, 0, 0, 1); dol_syslog(get_class($this)."::DDLAddField ".$sql, LOG_DEBUG); if ($this->query($sql)) { @@ -1006,18 +1008,18 @@ class DoliDBMysqli extends DoliDB public function DDLUpdateField($table, $field_name, $field_desc) { // phpcs:enable - $sql = "ALTER TABLE ".$table; - $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; + $sql = "ALTER TABLE ".$this->sanitize($table); + $sql .= " MODIFY COLUMN ".$this->sanitize($field_name)." ".$this->sanitize($field_desc['type']); if (in_array($field_desc['type'], array('double', 'tinyint', 'int', 'varchar')) && $field_desc['value']) { - $sql .= "(".$field_desc['value'].")"; + $sql .= "(".$this->sanitize($field_desc['value']).")"; } if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') { // We will try to change format of column to NOT NULL. To be sure the ALTER works, we try to update fields that are NULL if ($field_desc['type'] == 'varchar' || $field_desc['type'] == 'text') { - $sqlbis = "UPDATE ".$table." SET ".$field_name." = '".$this->escape(isset($field_desc['default']) ? $field_desc['default'] : '')."' WHERE ".$field_name." IS NULL"; + $sqlbis = "UPDATE ".$this->sanitize($table)." SET ".$this->sanitize($field_name)." = '".$this->escape(isset($field_desc['default']) ? $field_desc['default'] : '')."' WHERE ".$this->sanitize($field_name)." IS NULL"; $this->query($sqlbis); - } elseif ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') { - $sqlbis = "UPDATE ".$table." SET ".$field_name." = ".((int) $this->escape(isset($field_desc['default']) ? $field_desc['default'] : 0))." WHERE ".$field_name." IS NULL"; + } elseif (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sqlbis = "UPDATE ".$this->sanitize($table)." SET ".$this->sanitize($field_name)." = ".((float) $this->escape(isset($field_desc['default']) ? $field_desc['default'] : 0))." WHERE ".$this->sanitize($field_name)." IS NULL"; $this->query($sqlbis); } @@ -1053,7 +1055,7 @@ class DoliDBMysqli extends DoliDB // phpcs:enable $tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i', '', $field_name); - $sql = "ALTER TABLE ".$table." DROP COLUMN `".$tmp_field_name."`"; + $sql = "ALTER TABLE ".$this->sanitize($table)." DROP COLUMN `".$this->sanitize($tmp_field_name)."`"; if ($this->query($sql)) { return 1; } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 3cfe5671085..51ea5e84447 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1160,7 +1160,7 @@ class DoliDBPgsql extends DoliDB // phpcs:enable $tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table); - $sql = "DROP TABLE ".$tmptable; + $sql = "DROP TABLE ".$this->sanitize($tmptable); if (!$this->query($sql)) { return -1; @@ -1169,31 +1169,6 @@ class DoliDBPgsql extends DoliDB } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Create a user to connect to database - * - * @param string $dolibarr_main_db_host Ip server - * @param string $dolibarr_main_db_user Name of user to create - * @param string $dolibarr_main_db_pass Password of user to create - * @param string $dolibarr_main_db_name Database name where user must be granted - * @return int Return integer <0 if KO, >=0 if OK - */ - public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name) - { - // phpcs:enable - // Note: using ' on user does not works with pgsql - $sql = "CREATE USER ".$this->escape($dolibarr_main_db_user)." with password '".$this->escape($dolibarr_main_db_pass)."'"; - - dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log - $resql = $this->query($sql); - if (!$resql) { - return -1; - } - - return 1; - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return a pointer of line with description of a table or field @@ -1231,30 +1206,32 @@ class DoliDBPgsql extends DoliDB // phpcs:enable // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); - $sql = "ALTER TABLE ".$table." ADD ".$field_name." "; - $sql .= $field_desc['type']; - if (preg_match("/^[^\s]/i", $field_desc['value'])) { - if (!in_array($field_desc['type'], array('smallint', 'int', 'date', 'datetime')) && $field_desc['value']) { - $sql .= "(".$field_desc['value'].")"; + $sql = "ALTER TABLE ".$this->sanitize($table)." ADD ".$this->sanitize($field_name)." "; + $sql .= $this->sanitize($field_desc['type']); + if (isset($field_desc['value']) && preg_match("/^[^\s]/i", $field_desc['value'])) { + if (!in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'date', 'datetime')) && $field_desc['value']) { + $sql .= "(".$this->sanitize($field_desc['value']).")"; } } - if (preg_match("/^[^\s]/i", $field_desc['attribute'])) { - $sql .= " ".$field_desc['attribute']; + if (isset($field_desc['attribute']) && preg_match("/^[^\s]/i", $field_desc['attribute'])) { + $sql .= " ".$this->sanitize($field_desc['attribute']); } - if (preg_match("/^[^\s]/i", $field_desc['null'])) { + if (isset($field_desc['null']) && preg_match("/^[^\s]/i", $field_desc['null'])) { $sql .= " ".$field_desc['null']; } - if (preg_match("/^[^\s]/i", $field_desc['default'])) { - if (preg_match("/null/i", $field_desc['default'])) { - $sql .= " default ".$field_desc['default']; + if (isset($field_desc['default']) && preg_match("/^[^\s]/i", $field_desc['default'])) { + if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sql .= " DEFAULT ".((float) $field_desc['default']); + } elseif ($field_desc['default'] == 'null' || $field_desc['default'] == 'CURRENT_TIMESTAMP') { + $sql .= " DEFAULT ".$this->sanitize($field_desc['default']); } else { - $sql .= " default '".$this->escape($field_desc['default'])."'"; + $sql .= " DEFAULT '".$this->escape($field_desc['default'])."'"; } } - if (preg_match("/^[^\s]/i", $field_desc['extra'])) { - $sql .= " ".$field_desc['extra']; + if (isset($field_desc['extra']) && preg_match("/^[^\s]/i", $field_desc['extra'])) { + $sql .= " ".$this->escape($field_desc['extra'], 0, 0, 1); } - $sql .= " ".$field_position; + $sql .= " ".$this->escape($field_position, 0, 0, 1); dol_syslog($sql, LOG_DEBUG); if (!$this -> query($sql)) { @@ -1275,30 +1252,30 @@ class DoliDBPgsql extends DoliDB public function DDLUpdateField($table, $field_name, $field_desc) { // phpcs:enable - $sql = "ALTER TABLE ".$table; - $sql .= " ALTER COLUMN ".$this->escape($field_name)." TYPE ".$field_desc['type']; + $sql = "ALTER TABLE ".$this->sanitize($table); + $sql .= " ALTER COLUMN ".$this->sanitize($field_name)." TYPE ".$this->sanitize($field_desc['type']); if (preg_match("/^[^\s]/i", $field_desc['value'])) { if (!in_array($field_desc['type'], array('smallint', 'int', 'date', 'datetime')) && $field_desc['value']) { - $sql .= "(".$field_desc['value'].")"; + $sql .= "(".$this->sanitize($field_desc['value']).")"; } } if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') { // We will try to change format of column to NOT NULL. To be sure the ALTER works, we try to update fields that are NULL if ($field_desc['type'] == 'varchar' || $field_desc['type'] == 'text') { - $sqlbis = "UPDATE ".$table." SET ".$this->escape($field_name)." = '".$this->escape(isset($field_desc['default']) ? $field_desc['default'] : '')."' WHERE ".$this->escape($field_name)." IS NULL"; + $sqlbis = "UPDATE ".$this->sanitize($table)." SET ".$this->escape($field_name)." = '".$this->escape(isset($field_desc['default']) ? $field_desc['default'] : '')."' WHERE ".$this->escape($field_name)." IS NULL"; $this->query($sqlbis); - } elseif ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') { - $sqlbis = "UPDATE ".$table." SET ".$this->escape($field_name)." = ".((int) $this->escape(isset($field_desc['default']) ? $field_desc['default'] : 0))." WHERE ".$this->escape($field_name)." IS NULL"; + } elseif (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sqlbis = "UPDATE ".$this->sanitize($table)." SET ".$this->escape($field_name)." = ".((float) $this->escape(isset($field_desc['default']) ? $field_desc['default'] : 0))." WHERE ".$this->escape($field_name)." IS NULL"; $this->query($sqlbis); } } if (isset($field_desc['default']) && $field_desc['default'] != '') { - if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') { - $sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT ".((float) $field_desc['default']); + if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sql .= ", ALTER COLUMN ".$this->sanitize($field_name)." SET DEFAULT ".((float) $field_desc['default']); } elseif ($field_desc['type'] != 'text') { // Default not supported on text fields ? - $sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT '".$this->escape($field_desc['default'])."'"; + $sql .= ", ALTER COLUMN ".$this->sanitize($field_name)." SET DEFAULT '".$this->escape($field_desc['default'])."'"; } } @@ -1322,7 +1299,7 @@ class DoliDBPgsql extends DoliDB // phpcs:enable $tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i', '', $field_name); - $sql = "ALTER TABLE ".$table." DROP COLUMN ".$tmp_field_name; + $sql = "ALTER TABLE ".$this->sanitize($table)." DROP COLUMN ".$this->sanitize($tmp_field_name); if (!$this->query($sql)) { $this->error = $this->lasterror(); return -1; @@ -1330,6 +1307,31 @@ class DoliDBPgsql extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Create a user to connect to database + * + * @param string $dolibarr_main_db_host Ip server + * @param string $dolibarr_main_db_user Name of user to create + * @param string $dolibarr_main_db_pass Password of user to create + * @param string $dolibarr_main_db_name Database name where user must be granted + * @return int Return integer <0 if KO, >=0 if OK + */ + public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name) + { + // phpcs:enable + // Note: using ' on user does not works with pgsql + $sql = "CREATE USER ".$this->sanitize($dolibarr_main_db_user)." with password '".$this->escape($dolibarr_main_db_pass)."'"; + + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log + $resql = $this->query($sql); + if (!$resql) { + return -1; + } + + return 1; + } + /** * Return charset used to store data in database * diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 477d7d33c42..392b5addffa 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1118,16 +1118,18 @@ class DoliDBSqlite3 extends DoliDB $sql .= " ".$field_desc['null']; } if (preg_match("/^[^\s]/i", $field_desc['default'])) { - if (preg_match("/null/i", $field_desc['default'])) { - $sql .= " default ".$field_desc['default']; + if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { + $sql .= " DEFAULT ".((float) $field_desc['default']); + } elseif ($field_desc['default'] == 'null' || $field_desc['default'] == 'CURRENT_TIMESTAMP') { + $sql .= " DEFAULT ".$this->sanitize($field_desc['default']); } else { - $sql .= " default '".$this->escape($field_desc['default'])."'"; + $sql .= " DEFAULT '".$this->escape($field_desc['default'])."'"; } } - if (preg_match("/^[^\s]/i", $field_desc['extra'])) { - $sql .= " ".$field_desc['extra']; + if (isset($field_desc['extra']) && preg_match("/^[^\s]/i", $field_desc['extra'])) { + $sql .= " ".$this->escape($field_desc['extra'], 0, 0, 1); } - $sql .= " ".$field_position; + $sql .= " ".$this->escape($field_position, 0, 0, 1); dol_syslog(get_class($this)."::DDLAddField ".$sql, LOG_DEBUG); if (!$this->query($sql)) { @@ -1148,10 +1150,10 @@ class DoliDBSqlite3 extends DoliDB public function DDLUpdateField($table, $field_name, $field_desc) { // phpcs:enable - $sql = "ALTER TABLE ".$table; - $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; + $sql = "ALTER TABLE ".$this->sanitize($table); + $sql .= " MODIFY COLUMN ".$this->sanitize(($field_name)." ".$this->sanitize($field_desc['type']); if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { - $sql .= "(".$field_desc['value'].")"; + $sql .= "(".$this->sanitize($field_desc['value']).")"; } dol_syslog(get_class($this)."::DDLUpdateField ".$sql, LOG_DEBUG); @@ -1174,7 +1176,7 @@ class DoliDBSqlite3 extends DoliDB // phpcs:enable $tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i', '', $field_name); - $sql = "ALTER TABLE ".$table." DROP COLUMN `".$tmp_field_name."`"; + $sql = "ALTER TABLE ".$this->sanitize($table)." DROP COLUMN `".$this->sanitize($tmp_field_name)."`"; if (!$this->query($sql)) { $this->error = $this->lasterror(); return -1; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 159c5712399..1ae0d52d93a 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -1288,7 +1288,7 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul } $columns = array( - 'rowid' => array('type' => 'integer', 'value' => 11), + 'rowid' => array('type' => 'integer', 'value' => 11, 'extra' => 'AUTO_INCREMENT PRIMARY KEY'), 'code' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), 'label' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), 'position' => array('type' => 'integer', 'value' => 11, 'null'=>'NULL'), diff --git a/test/phpunit/DoliDBTest.php b/test/phpunit/DoliDBTest.php index 34f70e459c9..adafc6a676c 100644 --- a/test/phpunit/DoliDBTest.php +++ b/test/phpunit/DoliDBTest.php @@ -66,7 +66,7 @@ class DoliDBTest extends CommonClassTest $res = $db->DDLDropTable($namedic); $columns = array( - 'rowid' => array('type' => 'integer', 'value' => 11), + 'rowid' => array('type' => 'integer', 'value' => 11, 'AUTO_INCREMENT PRIMARY KEY'), 'code' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), 'label' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), 'position' => array('type' => 'integer', 'value' => 11, 'null'=>'NULL'), From ba9a84667225316dee92134d9a5a5178eb8af485 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 12:50:30 +0100 Subject: [PATCH 806/862] Fix trans missing --- dev/translation/dynamic_translation_keys.lst | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/translation/dynamic_translation_keys.lst b/dev/translation/dynamic_translation_keys.lst index 6be815d4eca..47ab2e14a79 100644 --- a/dev/translation/dynamic_translation_keys.lst +++ b/dev/translation/dynamic_translation_keys.lst @@ -40,6 +40,7 @@ Reservation ACCOUNTING_ACCOUNT_CUSTOMER ACCOUNTING_ACCOUNT_CUSTOMER_Desc ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY +ACCOUNTING_ACCOUNT_EXPENSEREPORT ACCOUNTING_ACCOUNT_SUPPLIER ACCOUNTING_ACCOUNT_SUPPLIER_Desc ACCOUNTING_ACCOUNT_SUSPENSE From 84f21216107d3961bcf12567c819bf241ee536f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 12:58:39 +0100 Subject: [PATCH 807/862] Add a FIXME --- htdocs/core/lib/modulebuilder.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 1ae0d52d93a..0250110d229 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -1308,8 +1308,10 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul break; } } + // check if tablename exist in Database and create it if not - $query = "SHOW TABLES LIKE '" . $db->sanitize(MAIN_DB_PREFIX.strtolower($namedic)) . "'"; + // @FIXME We must use $db->DDLDescTable($table) to know if a table exists. + $query = "SHOW TABLES LIKE '" . $db->escape(MAIN_DB_PREFIX.strtolower($namedic)) . "'"; $checkTable = $db->query($query); if ($checkTable && $db->num_rows($checkTable) > 0) { setEventMessages($langs->trans("ErrorTableExist", $namedic), null, 'errors'); From 9d5aa4a44841ff0f474741d8596379e1590157b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 13:02:41 +0100 Subject: [PATCH 808/862] Fix sanitization --- htdocs/core/db/mysqli.class.php | 4 ++-- htdocs/core/db/pgsql.class.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 5b43b4e2cbc..0c50397d386 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -985,9 +985,9 @@ class DoliDBMysqli extends DoliDB } } if (isset($field_desc['extra']) && preg_match("/^[^\s]/i", $field_desc['extra'])) { - $sql .= " ".$this->escape($field_desc['extra'], 0, 0, 1); + $sql .= " ".$this->sanitize($field_desc['extra'], 0, 0, 1); } - $sql .= " ".$this->escape($field_position, 0, 0, 1); + $sql .= " ".$this->sanitize($field_position, 0, 0, 1); dol_syslog(get_class($this)."::DDLAddField ".$sql, LOG_DEBUG); if ($this->query($sql)) { diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 51ea5e84447..430351e6317 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1106,7 +1106,7 @@ class DoliDBPgsql extends DoliDB $sqlfields[$i] .= " ".$this->sanitize($field_desc['null'], 0, 0, 1); } if (!is_null($field_desc['extra']) && $field_desc['extra'] !== '') { - $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra']); + $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra'], 0, 0, 1); } $i++; } @@ -1229,9 +1229,9 @@ class DoliDBPgsql extends DoliDB } } if (isset($field_desc['extra']) && preg_match("/^[^\s]/i", $field_desc['extra'])) { - $sql .= " ".$this->escape($field_desc['extra'], 0, 0, 1); + $sql .= " ".$this->sanitize($field_desc['extra'], 0, 0, 1); } - $sql .= " ".$this->escape($field_position, 0, 0, 1); + $sql .= " ".$this->sanitize($field_position, 0, 0, 1); dol_syslog($sql, LOG_DEBUG); if (!$this -> query($sql)) { From 58e719eb56f154345f26c06b9e3ae36e56c6ffd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 13:03:30 +0100 Subject: [PATCH 809/862] Fix sanitization --- htdocs/core/db/sqlite3.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index c210c7a836f..adcb7bf9f65 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1151,7 +1151,7 @@ class DoliDBSqlite3 extends DoliDB { // phpcs:enable $sql = "ALTER TABLE ".$this->sanitize($table); - $sql .= " MODIFY COLUMN ".$this->sanitize(($field_name)." ".$this->sanitize($field_desc['type']); + $sql .= " MODIFY COLUMN ".$this->sanitize($field_name)." ".$this->sanitize($field_desc['type']); if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { $sql .= "(".$this->sanitize($field_desc['value']).")"; } From aee4ccc32c4dbeafbed508b076919df3c9d61355 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 13:06:20 +0100 Subject: [PATCH 810/862] Fix warnings --- htdocs/core/db/mysqli.class.php | 2 +- htdocs/core/db/pgsql.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 0c50397d386..d915bb27de0 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1013,7 +1013,7 @@ class DoliDBMysqli extends DoliDB if (in_array($field_desc['type'], array('double', 'tinyint', 'int', 'varchar')) && $field_desc['value']) { $sql .= "(".$this->sanitize($field_desc['value']).")"; } - if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') { + if (isset($field_desc['value']) && ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL')) { // We will try to change format of column to NOT NULL. To be sure the ALTER works, we try to update fields that are NULL if ($field_desc['type'] == 'varchar' || $field_desc['type'] == 'text') { $sqlbis = "UPDATE ".$this->sanitize($table)." SET ".$this->sanitize($field_name)." = '".$this->escape(isset($field_desc['default']) ? $field_desc['default'] : '')."' WHERE ".$this->sanitize($field_name)." IS NULL"; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 430351e6317..531dc7cb07d 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1254,13 +1254,13 @@ class DoliDBPgsql extends DoliDB // phpcs:enable $sql = "ALTER TABLE ".$this->sanitize($table); $sql .= " ALTER COLUMN ".$this->sanitize($field_name)." TYPE ".$this->sanitize($field_desc['type']); - if (preg_match("/^[^\s]/i", $field_desc['value'])) { + if (isset($field_desc['value']) && preg_match("/^[^\s]/i", $field_desc['value'])) { if (!in_array($field_desc['type'], array('smallint', 'int', 'date', 'datetime')) && $field_desc['value']) { $sql .= "(".$this->sanitize($field_desc['value']).")"; } } - if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') { + if (isset($field_desc['value']) && ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL')) { // We will try to change format of column to NOT NULL. To be sure the ALTER works, we try to update fields that are NULL if ($field_desc['type'] == 'varchar' || $field_desc['type'] == 'text') { $sqlbis = "UPDATE ".$this->sanitize($table)." SET ".$this->escape($field_name)." = '".$this->escape(isset($field_desc['default']) ? $field_desc['default'] : '')."' WHERE ".$this->escape($field_name)." IS NULL"; From f3e6b38d9dd29d4569058c303e7263c56c78deaf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 13:16:59 +0100 Subject: [PATCH 811/862] Fix warning --- htdocs/core/db/sqlite3.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index adcb7bf9f65..a41aea9d1ea 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1008,7 +1008,7 @@ class DoliDBSqlite3 extends DoliDB $sqlfields[$i] .= " ".$this->sanitize($field_desc['null'], 0, 0, 1); } if (!is_null($field_desc['extra']) && $field_desc['extra'] !== '') { - $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra']); + $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra'], 0, 0, 1); } $i++; } @@ -1106,18 +1106,18 @@ class DoliDBSqlite3 extends DoliDB // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "ALTER TABLE ".$table." ADD ".$field_name." "; $sql .= $field_desc['type']; - if (preg_match("/^[^\s]/i", $field_desc['value'])) { + if (isset($field_desc['value']) && preg_match("/^[^\s]/i", $field_desc['value'])) { if (!in_array($field_desc['type'], array('date', 'datetime'))) { $sql .= "(".$field_desc['value'].")"; } } - if (preg_match("/^[^\s]/i", $field_desc['attribute'])) { - $sql .= " ".$field_desc['attribute']; + if (isset($field_desc['attribute']) && preg_match("/^[^\s]/i", $field_desc['attribute'])) { + $sql .= " ".$this->sanitize($field_desc['attribute']); } - if (preg_match("/^[^\s]/i", $field_desc['null'])) { - $sql .= " ".$field_desc['null']; + if (isset($field_desc['null']) && preg_match("/^[^\s]/i", $field_desc['null'])) { + $sql .= " ".$this->sanitize($field_desc['null'], 0, 0, 1); } - if (preg_match("/^[^\s]/i", $field_desc['default'])) { + if (isset($field_desc['default']) && preg_match("/^[^\s]/i", $field_desc['default'])) { if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { $sql .= " DEFAULT ".((float) $field_desc['default']); } elseif ($field_desc['default'] == 'null' || $field_desc['default'] == 'CURRENT_TIMESTAMP') { @@ -1127,9 +1127,9 @@ class DoliDBSqlite3 extends DoliDB } } if (isset($field_desc['extra']) && preg_match("/^[^\s]/i", $field_desc['extra'])) { - $sql .= " ".$this->escape($field_desc['extra'], 0, 0, 1); + $sql .= " ".$this->sanitize($field_desc['extra'], 0, 0, 1); } - $sql .= " ".$this->escape($field_position, 0, 0, 1); + $sql .= " ".$this->sanitize($field_position, 0, 0, 1); dol_syslog(get_class($this)."::DDLAddField ".$sql, LOG_DEBUG); if (!$this->query($sql)) { From 380c1092ebcbd96a51cf075708efb779909419af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 13:19:31 +0100 Subject: [PATCH 812/862] Fix warnings --- htdocs/core/db/mysqli.class.php | 3 ++- htdocs/core/db/pgsql.class.php | 1 - htdocs/core/db/sqlite3.class.php | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index d915bb27de0..68fe297edf9 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -832,7 +832,8 @@ class DoliDBMysqli extends DoliDB } $pk = ''; - $sqluq = $sqlk = array(); + $sqlk = array(); + $sqluq = array(); // Keys found into the array $fields: type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array( diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 531dc7cb07d..71ba5f5279a 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1070,7 +1070,6 @@ class DoliDBPgsql extends DoliDB // phpcs:enable // @TODO: $fulltext_keys parameter is unused - $sqlfields = array(); $sqlk = array(); $sqluq = array(); diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index a41aea9d1ea..532ae556eb5 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -972,7 +972,6 @@ class DoliDBSqlite3 extends DoliDB // phpcs:enable // @TODO: $fulltext_keys parameter is unused - $sqlfields = array(); $sqlk = array(); $sqluq = array(); From b5804aecfdf807e6bf70acf067b532398406ce4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 13:34:16 +0100 Subject: [PATCH 813/862] Fix bad cast for name newtoken --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 4eb11d2286f..952b2d8a7ad 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1186,7 +1186,7 @@ if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { ?>
From 3908b4df9d23fe0c0a08f1018a57ea7295fe39c0 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 12:21:23 +0100 Subject: [PATCH 814/862] Qual: Enable PhanTypeInvalidLeftOperandOfBitwiseOp (all fixed) --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 4875cd7bafd..01043b3adc3 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -495,7 +495,7 @@ return [ 'PhanPossiblyNullTypeMismatchProperty', 'PhanRedefineClass', 'PhanRedefineFunction', - 'PhanTypeInvalidLeftOperandOfBitwiseOp', + // 'PhanTypeInvalidLeftOperandOfBitwiseOp', // 'PhanTypeMismatchDimAssignment', // 'PhanPluginDescriptionlessCommentOnProtectedMethod', // 'PhanPluginPrintfIncompatibleArgumentTypeWeak', From 81d9e8aa01f6403dbc6abc14b13fab3d6a87f20b Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 11:36:51 +0100 Subject: [PATCH 815/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = $var || ... . Add cast before ... when needed (@include does not always return bool). --- htdocs/asset/class/asset.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 8666a469aee..ada95d4de5a 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -1548,7 +1548,7 @@ class Asset extends CommonObject $dir = dol_buildpath($reldir."core/modules/asset/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = $mybool || (bool) @include_once $dir.$file; } if ($mybool === false) { From b6ac5dcf76f62482e770fec366a260a3b4eb8588 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:20:54 +0100 Subject: [PATCH 816/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/asset/class/asset.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index ada95d4de5a..ed7a57e3af5 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -1548,7 +1548,7 @@ class Asset extends CommonObject $dir = dol_buildpath($reldir."core/modules/asset/"); // Load file with numbering class (if found) - $mybool = $mybool || (bool) @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 43a7db166e40d15de71b7203fbf3f659838b31fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 13:44:57 +0100 Subject: [PATCH 817/862] Update mailing-send.php --- scripts/emailings/mailing-send.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 78fb388acce..dac34f9ff65 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -128,8 +128,8 @@ if ($resql) { dol_syslog("Process mailing with id ".$obj->rowid); print "Process mailing with id ".$obj->rowid."\n"; - if ($obj->status==1) { - $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=2 WHERE rowid=".$obj->rowid; + if ($obj->status == 1) { + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut = 2 WHERE rowid = ".((int) $obj->rowid); $result_sql = $db->query($sql); dol_syslog("Started mailing campaign ".$obj->rowid, LOG_DEBUG); } From bf4243e0ab380b1e9a78fa1932ffeaea795e0c0f Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:20:56 +0100 Subject: [PATCH 818/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/bom/class/bom.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 702ddb9fb8f..6de866029f7 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -875,7 +875,7 @@ class BOM extends CommonObject $dir = dol_buildpath($reldir."core/modules/bom/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 66804f5f4dc825f287e08932f32bdb2fa4e690ed Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:20:59 +0100 Subject: [PATCH 819/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/bookcal/class/availabilities.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index ad34e08abcd..6a4553e15f2 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -975,7 +975,7 @@ class Availabilities extends CommonObject $dir = dol_buildpath($reldir."core/modules/bookcal/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From e114884d118d66a07833cb3e8777ed8a249dd0fe Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:02 +0100 Subject: [PATCH 820/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/bookcal/class/calendar.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index b66f950fd12..d64aad6791c 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -964,7 +964,7 @@ class Calendar extends CommonObject $dir = dol_buildpath($reldir."core/modules/bookcal/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From e44e29c446fa1923f330f75d4b90109607a1a07c Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:04 +0100 Subject: [PATCH 821/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 97f818d82a3..04b4a6e99b2 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3615,7 +3615,7 @@ class Propal extends CommonObject $dir = dol_buildpath($reldir."core/modules/propale/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if (!$mybool) { From 170a9296564023dc1290fc2b9feb2933f239aad1 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:06 +0100 Subject: [PATCH 822/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 11e5a4adc8c..291ead61cd3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -416,7 +416,7 @@ class Commande extends CommonOrder $dir = dol_buildpath($reldir."core/modules/commande/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From ecf24fd3b4139c569b917dc473e259b4a0ada061 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:09 +0100 Subject: [PATCH 823/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b3d8b940673..8f5c63a86f0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4609,7 +4609,7 @@ class Facture extends CommonInvoice // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = ((bool) include_once $dir.$file) || $mybool; } } @@ -4624,7 +4624,7 @@ class Facture extends CommonInvoice // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } } From 8e5871d1fc22959d1dd476d99c430f972ad0c776 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:12 +0100 Subject: [PATCH 824/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 2be5b322d69..71496b46c6f 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2011-2016 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -423,7 +424,7 @@ class RemiseCheque extends CommonObject // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } @@ -438,7 +439,7 @@ class RemiseCheque extends CommonObject // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } } From a42203cc9356faa6a4335d7452fd1911ecfa6619 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:16 +0100 Subject: [PATCH 825/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/compta/paiement/class/paiement.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index d60aa17ce3b..921ecddab78 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -13,6 +13,7 @@ * Copyright (C) 2021 OpenDsi * Copyright (C) 2023 Joachim Kueter * Copyright (C) 2023 Sylvain Legrand + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -847,7 +848,7 @@ class Paiement extends CommonObject // Add link to the Direct Debit if invoice refused ('InvoiceRefused') in bank_url if (!$error && $label == '(InvoiceRefused)') { - $result=$acc->add_url_line( + $result = $acc->add_url_line( $bank_line_id, $this->id_prelevement, DOL_URL_ROOT.'/compta/prelevement/card.php?id=', @@ -1182,7 +1183,7 @@ class Paiement extends CommonObject // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } @@ -1197,7 +1198,7 @@ class Paiement extends CommonObject // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } } @@ -1352,7 +1353,7 @@ class Paiement extends CommonObject $result .= $linkend; global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From 6a14a8304df9f44e2a58c18fdbe9a831fec42256 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:20 +0100 Subject: [PATCH 826/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ccd92dccf39..c3e5001b2af 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -337,7 +337,7 @@ class Contrat extends CommonObject $dir = dol_buildpath($reldir."core/modules/contract/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if (!$mybool) { From 2ec5504dcbbae5c585026894210607d0a223bf19 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:22 +0100 Subject: [PATCH 827/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/core/class/timespent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/timespent.class.php b/htdocs/core/class/timespent.class.php index 927dbed57ca..e32be223840 100644 --- a/htdocs/core/class/timespent.class.php +++ b/htdocs/core/class/timespent.class.php @@ -951,7 +951,7 @@ class TimeSpent extends CommonObject $dir = dol_buildpath($reldir."core/modules/timespent/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 4cac66ba178232fc02eb0aac74fbed94ae0a2e82 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:24 +0100 Subject: [PATCH 828/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- .../eventorganization/class/conferenceorboothattendee.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index f6e4bff74cd..f30196c2ef3 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -969,7 +969,7 @@ class ConferenceOrBoothAttendee extends CommonObject $dir = dol_buildpath($reldir."core/modules/eventorganization/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 5be1600c5231baf646b92d7bb8c8da1ddd59dfa5 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:27 +0100 Subject: [PATCH 829/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/expedition/class/expedition.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 259d1470a24..897927b03d6 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -306,7 +306,7 @@ class Expedition extends CommonObject $dir = dol_buildpath($reldir."core/modules/expedition/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if (!$mybool) { From 1e0f368d6a6f0bfc0230072bf97fefe56961eb8d Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:30 +0100 Subject: [PATCH 830/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/expensereport/class/expensereport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 551390582f4..b7aced293b3 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1729,7 +1729,7 @@ class ExpenseReport extends CommonObject $dir = dol_buildpath($reldir."core/modules/expensereport/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From d3a58e2e487ac45a69d12cbeebc9b8ee31807b99 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:33 +0100 Subject: [PATCH 831/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/fichinter/class/fichinter.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index f5b57037c0d..d54497125c1 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -200,17 +200,17 @@ class Fichinter extends CommonObject /* * Signed by sender */ - CONST STATUS_SIGNED_SENDER = 1; + const STATUS_SIGNED_SENDER = 1; /* * Signed by receiver */ - CONST STATUS_SIGNED_RECEIVER = 2; + const STATUS_SIGNED_RECEIVER = 2; /* * Signed by all */ - CONST STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) + const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) /** * Date delivery @@ -1010,7 +1010,7 @@ class Fichinter extends CommonObject $dir = dol_buildpath($reldir."core/modules/fichinter/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 476d8cfd9c9495e2025becf5e10441d22dd4db7a Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:36 +0100 Subject: [PATCH 832/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- 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 d9f7863c16c..3f30bf444de 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1129,7 +1129,7 @@ class CommandeFournisseur extends CommonOrder $dir = dol_buildpath($reldir."core/modules/supplier_order/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From e19a60cd6237355fe1f8cbaf7039c6678002ac8f Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:38 +0100 Subject: [PATCH 833/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 7c733bc8f5a..576645afab4 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2963,7 +2963,7 @@ class FactureFournisseur extends CommonInvoice $dir = dol_buildpath($reldir."core/modules/supplier_invoice/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From effe9e79b5043687f6739c5271127ad8de6f8ec0 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:40 +0100 Subject: [PATCH 834/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/fourn/class/paiementfourn.class.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index c01feb22892..8c221fff4d9 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2023 Joachim Kueter * Copyright (C) 2023 Sylvain Legrand * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -279,9 +280,9 @@ class PaiementFourn extends Paiement // If we want to closed paid invoices if ($closepaidinvoices) { $paiement = $invoice->getSommePaiement(); - $creditnotes=$invoice->getSumCreditNotesUsed(); + $creditnotes = $invoice->getSumCreditNotesUsed(); //$creditnotes = 0; - $deposits=$invoice->getSumDepositsUsed(); + $deposits = $invoice->getSumDepositsUsed(); //$deposits = 0; $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT'); $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); @@ -712,7 +713,7 @@ class PaiementFourn extends Paiement global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -783,7 +784,7 @@ class PaiementFourn extends Paiement // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } @@ -798,7 +799,7 @@ class PaiementFourn extends Paiement // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } } From 1a6ad0ea67f70b615670e8391cae1dbbf8a99926 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:42 +0100 Subject: [PATCH 835/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/holiday/class/holiday.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index e5afa1e524a..6608cbbbb34 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -232,7 +232,7 @@ class Holiday extends CommonObject $dir = dol_buildpath($reldir."core/modules/holiday/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 0df51158dd177f4a028e4ec024826b39b9703528 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:45 +0100 Subject: [PATCH 836/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/hrm/class/evaluation.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 7b551e80d99..0598a8cf46b 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -952,7 +952,7 @@ class Evaluation extends CommonObject $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 169d1a2ff8d37af1d8e63f81b286f74f49e8ce19 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:48 +0100 Subject: [PATCH 837/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/hrm/class/evaluationdet.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index 992e7fa4ce0..0c6b5149f8a 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -922,7 +922,7 @@ class EvaluationLine extends CommonObjectLine $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From f28af956f997a4d8e8205679671c0c651bb31f77 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:50 +0100 Subject: [PATCH 838/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/hrm/class/job.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 5c2f34a5588..ec9cbea1b91 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -961,7 +961,7 @@ class Job extends CommonObject $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 579f2dee4c59a23e8442341385f356813c53a81c Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:52 +0100 Subject: [PATCH 839/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/hrm/class/position.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index bcd91410fda..197ac19eb5b 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -1001,7 +1001,7 @@ class Position extends CommonObject $dir = dol_buildpath($reldir . "core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir . $file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From b3cda67e361eb5baef56a89cee7b1a5c709c769e Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:54 +0100 Subject: [PATCH 840/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/hrm/class/skill.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index b6759336016..4ce76501127 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -1001,7 +1001,7 @@ class Skill extends CommonObject $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From ee5d837fcc67602edddc760aeebac8c71e48d1bd Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:56 +0100 Subject: [PATCH 841/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/hrm/class/skilldet.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 6c02ca26c50..9190c413bcc 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -889,7 +889,7 @@ class Skilldet extends CommonObjectLine $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 519da008972b545b0bdd74fbdf6cbd5888d7f5a9 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:21:58 +0100 Subject: [PATCH 842/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/hrm/class/skillrank.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 3cde6ae6476..7640049c4f5 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -965,7 +965,7 @@ class SkillRank extends CommonObject $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From fe5e5b4bc4256e8fd9769ba9de21cbc135183468 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:00 +0100 Subject: [PATCH 843/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 1bb1040553a..402e41c7d76 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -1027,7 +1027,7 @@ class KnowledgeRecord extends CommonObject $dir = dol_buildpath($reldir."core/modules/knowledgemanagement/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 67f43f0558751ab76e9792c4c32a1f8a5c8c84e5 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:02 +0100 Subject: [PATCH 844/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/mrp/class/mo.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index c8589a3f4ba..c82f54d4568 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1020,7 +1020,7 @@ class Mo extends CommonObject $dir = dol_buildpath($reldir."core/modules/mrp/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From c9f314958edc4c9bdb40328ed99edab6bf46c4dd Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:05 +0100 Subject: [PATCH 845/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/partnership/class/partnership.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 7d26d35cb44..68ffaeb291c 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -1230,7 +1230,7 @@ class Partnership extends CommonObject $dir = dol_buildpath($reldir."core/modules/partnership/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 4e22e336380a1fb9c7ac2b405ab7fe09db39be38 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:08 +0100 Subject: [PATCH 846/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/product/class/productfournisseurprice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 6e3b15405d0..93666b0431b 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -824,7 +824,7 @@ class ProductFournisseurPrice extends CommonObject $dir = dol_buildpath($reldir."core/modules/buypricehistory/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 6ebe4f1b22f8f9acebc96b528d8fefb71496a0bb Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:11 +0100 Subject: [PATCH 847/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- .../product/stock/stocktransfer/class/stocktransfer.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index 4bf107d58f3..a8e1267175d 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -975,7 +975,7 @@ class StockTransfer extends CommonObject $dir = dol_buildpath($reldir."core/modules/stocktransfer/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 25bd4930a28dc9d4a940f951ab3f5ac85b495452 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:13 +0100 Subject: [PATCH 848/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- .../stock/stocktransfer/class/stocktransferline.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index ac930e58b94..cd77a955806 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -939,7 +939,7 @@ class StockTransferLine extends CommonObjectLine $dir = dol_buildpath($reldir."core/modules/stocktransfer/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From a960e74a5cd4df7c134ccc9e64f1dfdfb42993f6 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:15 +0100 Subject: [PATCH 849/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/reception/class/reception.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 8ba93145914..92a59e101e5 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -180,7 +180,7 @@ class Reception extends CommonObject $dir = dol_buildpath($reldir."core/modules/reception/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if (!$mybool) { From 105a4d0402c65cd4d2e01421a196799abdc0ad3b Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:18 +0100 Subject: [PATCH 850/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/recruitment/class/recruitmentcandidature.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index f80911e4381..59c152cac47 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -953,7 +953,7 @@ class RecruitmentCandidature extends CommonObject $dir = dol_buildpath($reldir."core/modules/recruitment/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From b452a89cc3a68db7d1edd8d5e2aae9500fd8fd00 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:21 +0100 Subject: [PATCH 851/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/recruitment/class/recruitmentjobposition.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 90fe44b212d..dbc9e11cce1 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -1010,7 +1010,7 @@ class RecruitmentJobPosition extends CommonObject $dir = dol_buildpath($reldir."core/modules/recruitment/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From 15f38d472ebc5d8a643cd93f1a8d2f67ed1a925e Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:22 +0100 Subject: [PATCH 852/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index fee21d4365b..503f99b65aa 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2429,7 +2429,7 @@ class SupplierProposal extends CommonObject $dir = dol_buildpath($reldir."core/modules/supplier_proposal/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if (!$mybool) { From 474c85825f74b33bfb01d4775cc98379d389dba0 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:26 +0100 Subject: [PATCH 853/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/webhook/class/target.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index ef405bfadea..abd25cd844e 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -901,7 +901,7 @@ class Target extends CommonObject $dir = dol_buildpath($reldir."core/modules/webhook/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { From c9d897ee356bc3cb93468bf38118df751d8e43f4 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:22:28 +0100 Subject: [PATCH 854/862] Fix $mybool |=... which is binary op, not boolean op # Fix $mybool |=... which is binary op, not boolean op This fixes PhanTypeInvalidLeftOperandOfBitwiseOp. Replace $var |= ... with $var = ... || $var . Add cast before ... when needed (@include does not always return bool). |= always evaluates expression, there for || $var, not $var || --- htdocs/workstation/class/workstation.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index c4b4cecc710..bed11601dc0 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -878,7 +878,7 @@ class Workstation extends CommonObject // Load file with numbering class (if found) if (file_exists($dir.$file)) { - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } } From 9d31390e7483ad1a0c69790d8215746305429d1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 13:48:50 +0100 Subject: [PATCH 855/862] Update mailing-send.php --- scripts/emailings/mailing-send.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index dac34f9ff65..a9a701f9f80 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -122,7 +122,7 @@ if ($resql) { $j = 0; if ($num) { - for ($j = 0; $j < $num && $max!=0; $j++) { + for ($j = 0; $j < $num && $max != 0; $j++) { $obj = $db->fetch_object($resql); dol_syslog("Process mailing with id ".$obj->rowid); From 477fb7a03526079e643eaaa900c55737377cf662 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 13:55:23 +0100 Subject: [PATCH 856/862] Fix warning --- htdocs/core/db/mysqli.class.php | 10 +++++----- scripts/emailings/mailing-send.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 68fe297edf9..c1b7bdd487c 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -848,13 +848,13 @@ class DoliDBMysqli extends DoliDB foreach ($fields as $field_name => $field_desc) { $sqlfields[$i] = $this->sanitize($field_name)." "; $sqlfields[$i] .= $this->sanitize($field_desc['type']); - if (!is_null($field_desc['value']) && $field_desc['value'] !== '') { + if (isset($field_desc['value']) && $field_desc['value'] !== '') { $sqlfields[$i] .= "(".$this->sanitize($field_desc['value']).")"; } - if (!is_null($field_desc['attribute']) && $field_desc['attribute'] !== '') { + if (isset($field_desc['attribute']) && $field_desc['attribute'] !== '') { $sqlfields[$i] .= " ".$this->sanitize($field_desc['attribute']); } - if (!is_null($field_desc['default']) && $field_desc['default'] !== '') { + if (isset($field_desc['default']) && $field_desc['default'] !== '') { if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { $sqlfields[$i] .= " DEFAULT ".((float) $field_desc['default']); } elseif ($field_desc['default'] == 'null' || $field_desc['default'] == 'CURRENT_TIMESTAMP') { @@ -863,10 +863,10 @@ class DoliDBMysqli extends DoliDB $sqlfields[$i] .= " DEFAULT '".$this->escape($field_desc['default'])."'"; } } - if (!is_null($field_desc['null']) && $field_desc['null'] !== '') { + if (isset($field_desc['null']) && $field_desc['null'] !== '') { $sqlfields[$i] .= " ".$this->sanitize($field_desc['null'], 0, 0, 1); } - if (!is_null($field_desc['extra']) && $field_desc['extra'] !== '') { + if (isset($field_desc['extra']) && $field_desc['extra'] !== '') { $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra'], 0, 0, 1); } $i++; diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index bd3f7e45953..2a724ab2042 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -154,7 +154,7 @@ if ($resql) { $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql2 .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".((int) $id); if (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && empty($max)) { - $sql2 .= " LIMIT " . getDolGlobalString('MAILING_LIMIT_SENDBYCLI'); + $sql2 .= " LIMIT " . getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'); } elseif (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && $max > 0) { $sql2 .= " LIMIT ".min(getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'), $max); } elseif ($max > 0) { From 7032578914b30e766891e993d36f5e0bd039277d Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 21 Mar 2024 13:55:29 +0100 Subject: [PATCH 857/862] Fix PHPdoc typing --- htdocs/debugbar/class/TraceableDB.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 9dc266ea5e0..013a31b66ac 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -495,7 +495,7 @@ class TraceableDB extends DoliDB * Create a table into database * * @param string $table Name of table - * @param array $fields Tableau associatif [nom champ][tableau des descriptions] + * @param array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> $fields Associative table [field name][table of descriptions] * @param string $primary_key Nom du champ qui sera la clef primaire * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur @@ -534,7 +534,7 @@ class TraceableDB extends DoliDB * * @param string $table Name of table * @param string $field_name Name of field to add - * @param array{type:string,label:string,enabled:int|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string} $field_desc Tableau associatif de description du champ a inserer[nom du parameter][valeur du parameter] + * @param array{type:string,label:string,enabled:int|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $field_desc Tableau associatif de description du champ a inserer[nom du parameter][valeur du parameter] * @param string $field_position Optionnel ex.: "after champtruc" * @return int Return integer <0 if KO, >0 if OK */ From 2d0e57ce7cf8b4ba6df6623c9bc5c8a58748bc75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 14:13:17 +0100 Subject: [PATCH 858/862] Fix test for pgsql --- htdocs/core/db/mysqli.class.php | 2 +- htdocs/core/db/pgsql.class.php | 2 +- test/phpunit/DoliDBTest.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index c1b7bdd487c..245eb650990 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -889,7 +889,7 @@ class DoliDBMysqli extends DoliDB $i++; } } - $sql .= implode(',', $sqlfields); + $sql .= implode(', ', $sqlfields); if ($primary_key != "") { $sql .= ",".$pk; } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 71ba5f5279a..0a32d49325e 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1127,7 +1127,7 @@ class DoliDBPgsql extends DoliDB $i++; } } - $sql .= implode(',', $sqlfields); + $sql .= implode(', ', $sqlfields); if ($primary_key != "") { $sql .= ",".$pk; } diff --git a/test/phpunit/DoliDBTest.php b/test/phpunit/DoliDBTest.php index adafc6a676c..e2af4b7071c 100644 --- a/test/phpunit/DoliDBTest.php +++ b/test/phpunit/DoliDBTest.php @@ -66,11 +66,11 @@ class DoliDBTest extends CommonClassTest $res = $db->DDLDropTable($namedic); $columns = array( - 'rowid' => array('type' => 'integer', 'value' => 11, 'AUTO_INCREMENT PRIMARY KEY'), + 'rowid' => array('type' => 'integer', 'AUTO_INCREMENT PRIMARY KEY'), 'code' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), 'label' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), - 'position' => array('type' => 'integer', 'value' => 11, 'null'=>'NULL'), - 'use_default' => array('type' => 'varchar', 'value' => 11, 'default'=>'1'), + 'position' => array('type' => 'integer', 'null'=>'NULL'), + 'use_default' => array('type' => 'varchar', 'value' => 1, 'default'=>'1'), 'active' => array('type' => 'integer', 'value' => 3) ); $primaryKey = 'rowid'; From 7cbff76f9dce43c3bb4b28dd5f2654b4eb5cc893 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 14:48:03 +0100 Subject: [PATCH 859/862] Fix phpunit --- test/phpunit/DoliDBTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/DoliDBTest.php b/test/phpunit/DoliDBTest.php index e2af4b7071c..5cc4cd695fe 100644 --- a/test/phpunit/DoliDBTest.php +++ b/test/phpunit/DoliDBTest.php @@ -71,7 +71,7 @@ class DoliDBTest extends CommonClassTest 'label' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), 'position' => array('type' => 'integer', 'null'=>'NULL'), 'use_default' => array('type' => 'varchar', 'value' => 1, 'default'=>'1'), - 'active' => array('type' => 'integer', 'value' => 3) + 'active' => array('type' => 'integer') ); $primaryKey = 'rowid'; From 5121185541171380a7894e0355ee49af7ad19b79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 15:00:54 +0100 Subject: [PATCH 860/862] Code readability --- htdocs/societe/notify/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index e79ccda49a0..4962c150888 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -260,7 +260,7 @@ if ($result > 0) { // Add notification form //print load_fiche_titre($titlelist.' ('.$num.')', '', ''); $num = $nbtotalofrecords; - print_barre_liste($titlelist, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, empty($nbtotalofrecords) ? -1 : $nbtotalofrecords, 'email', 0, $newcardbutton, '', $limit, 0, 0, 1); + print_barre_liste($titlelist, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, (empty($nbtotalofrecords) ? -1 : $nbtotalofrecords), 'email', 0, $newcardbutton, '', $limit, 0, 0, 1); print '
'; print ''; From 7290ffd1ab7206432319f8586161219afe60d314 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 15:57:45 +0100 Subject: [PATCH 861/862] Better support for postgesql --- htdocs/core/db/mysqli.class.php | 9 +++------ htdocs/core/db/pgsql.class.php | 19 ++++++++----------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index cd184db9a5c..7fc92bf23ff 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -869,11 +869,11 @@ class DoliDBMysqli extends DoliDB if (isset($field_desc['extra']) && $field_desc['extra'] !== '') { $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra'], 0, 0, 1); } + if (!empty($primary_key) && $primary_key == $field_name) { + $sqlfields[$i] .= " AUTO_INCREMENT PRIMARY KEY"; // mysql instruction that will be converted by driver late + } $i++; } - if ($primary_key != "") { - $pk = "PRIMARY KEY(".$this->sanitize($primary_key).")"; - } if (is_array($unique_keys)) { $i = 0; @@ -890,9 +890,6 @@ class DoliDBMysqli extends DoliDB } } $sql .= implode(', ', $sqlfields); - if ($primary_key != "") { - $sql .= ",".$pk; - } if ($unique_keys != "") { $sql .= ",".implode(',', $sqluq); } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 5615ee37255..43facbe2a19 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1086,13 +1086,13 @@ class DoliDBPgsql extends DoliDB foreach ($fields as $field_name => $field_desc) { $sqlfields[$i] = $this->sanitize($field_name)." "; $sqlfields[$i] .= $this->sanitize($field_desc['type']); - if (!is_null($field_desc['value']) && $field_desc['value'] !== '') { + if (isset($field_desc['value']) && $field_desc['value'] !== '') { $sqlfields[$i] .= "(".$this->sanitize($field_desc['value']).")"; } - if (!is_null($field_desc['attribute']) && $field_desc['attribute'] !== '') { + if (isset($field_desc['attribute']) && $field_desc['attribute'] !== '') { $sqlfields[$i] .= " ".$this->sanitize($field_desc['attribute']); } - if (!is_null($field_desc['default']) && $field_desc['default'] !== '') { + if (isset($field_desc['default']) && $field_desc['default'] !== '') { if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) { $sqlfields[$i] .= " DEFAULT ".((float) $field_desc['default']); } elseif ($field_desc['default'] == 'null' || $field_desc['default'] == 'CURRENT_TIMESTAMP') { @@ -1101,17 +1101,17 @@ class DoliDBPgsql extends DoliDB $sqlfields[$i] .= " DEFAULT '".$this->escape($field_desc['default'])."'"; } } - if (!is_null($field_desc['null']) && $field_desc['null'] !== '') { + if (isset($field_desc['null']) && $field_desc['null'] !== '') { $sqlfields[$i] .= " ".$this->sanitize($field_desc['null'], 0, 0, 1); } - if (!is_null($field_desc['extra']) && $field_desc['extra'] !== '') { + if (isset($field_desc['extra']) && $field_desc['extra'] !== '') { $sqlfields[$i] .= " ".$this->sanitize($field_desc['extra'], 0, 0, 1); } + if (!empty($primary_key) && $primary_key == $field_name) { + $sqlfields[$i] .= " AUTO_INCREMENT PRIMARY KEY"; // mysql instruction that will be converted by driver late + } $i++; } - if ($primary_key != "") { - $pk = "PRIMARY KEY(".$this->sanitize($primary_key).")"; - } if (is_array($unique_keys)) { $i = 0; @@ -1128,9 +1128,6 @@ class DoliDBPgsql extends DoliDB } } $sql .= implode(', ', $sqlfields); - if ($primary_key != "") { - $sql .= ",".$pk; - } if ($unique_keys != "") { $sql .= ",".implode(',', $sqluq); } From fd1322c095fab3eeb2bb44587f431a55a88b3e79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 16:33:57 +0100 Subject: [PATCH 862/862] Fix warning --- htdocs/install/repair.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index bf0b8cd6534..d9c5a808bb5 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1534,12 +1534,12 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { $first_iteration = false; } else { $sql_attach_values = array( - ((int) $obj_dispatch->fk_element), - ((int) $obj_dispatch->fk_product), - ((int) $obj_line->rowid), - ((float) $qty_for_line), - ((int) $obj_dispatch->fk_entrepot), - ((int) $obj_dispatch->fk_user), + (string) ((int) $obj_dispatch->fk_element), + (string) ((int) $obj_dispatch->fk_product), + (string) ((int) $obj_line->rowid), + (string) ((float) $qty_for_line), + (string) ((int) $obj_dispatch->fk_entrepot), + (string) ((int) $obj_dispatch->fk_user), $obj_dispatch->datec ? "'".$db->idate($db->jdate($obj_dispatch->datec))."'" : 'NULL', $obj_dispatch->comment ? "'".$db->escape($obj_dispatch->comment)."'" : 'NULL', $obj_dispatch->status ? (string) ((int) $obj_dispatch->status) : 'NULL', @@ -1552,7 +1552,7 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { $sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'receptiondet_batch'; $sql_attach .= ' (fk_element, fk_product, fk_elementdet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)'; - $sql_attach .= " VALUES (".$sql_attach_values.")"; + $sql_attach .= " VALUES (".$sql_attach_values.")"; // The string is already sanitized } if ($repair_link_dispatch_lines_supplier_order_lines == 'confirmed') {

*** Check fields into extra table structure match table of definition. If not add column into table