From 715ce8b7459527bfd6b10613c77e5a3fcfbf9052 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Mon, 18 Mar 2024 15:22:00 +0100 Subject: [PATCH 01/32] Backport #23972 --- htdocs/includes/tcpdi/tcpdi_parser.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/includes/tcpdi/tcpdi_parser.php b/htdocs/includes/tcpdi/tcpdi_parser.php index 174c496d4f4..ef4162d5f4f 100644 --- a/htdocs/includes/tcpdi/tcpdi_parser.php +++ b/htdocs/includes/tcpdi/tcpdi_parser.php @@ -715,8 +715,7 @@ class tcpdi_parser { $next = strcspn($data, "\r\n", $offset); if ($next > 0) { $offset += $next; - list($obj, $unused) = $this->getRawObject($offset, $data); - return $obj; + return $this->getRawObject($offset, $data); } break; } From 5b2cb4b06375823c963bdbb7307dbe8e741d1d1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 11:24:16 +0100 Subject: [PATCH 02/32] Fix remove bad entry into array of the rss box --- htdocs/core/boxes/box_external_rss.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 8bc4943e50b..70786334fa6 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -167,7 +167,6 @@ class box_external_rss extends ModeleBoxes $title = preg_replace("/([[:alnum:]])\?([[:alnum:]])/", "\\1'\\2", $title); // Gere probleme des apostrophes mal codee/decodee par utf8 $title = preg_replace("/^\s+/", "", $title); // Supprime espaces de debut - $this->info_box_contents["$href"] = "$title"; $tooltip = $title; $description = !empty($item['description']) ? $item['description'] : ''; From 9e7aeca44744a86e5208ae85a11b9bae6c92f118 Mon Sep 17 00:00:00 2001 From: Kamel Khelifa Date: Wed, 20 Mar 2024 15:26:19 +0100 Subject: [PATCH 03/32] FIX: Fix save directory for invoice ODT and multientities --- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 6b28da3e1e1..66182bcebba 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -253,7 +253,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $object->fetch_thirdparty(); - $dir = $conf->facture->dir_output; + $dir = empty($conf->facture->multidir_output[$object->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$object->entity]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; From 8ab3333eec2dc009ef294e783b5f83e15d87131a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 20:59:08 +0100 Subject: [PATCH 04/32] FIX logo of paypal payment on payment page --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 9e5d578e01a..9825b331f1b 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2151,7 +2151,7 @@ if ($action != 'dopayment') { if (getDolGlobalString('PAYPAL_API_INTEGRAL_OR_PAYPALONLY') != 'integral') { print '
 
'; } - print ' '; + print ' '; if (getDolGlobalString('PAYPAL_API_INTEGRAL_OR_PAYPALONLY') == 'integral') { print '
'; print ''.$langs->trans("CreditOrDebitCard").' - '; From 34bd1f0fd300bfda0c263a5cce60a5122a94c213 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 21:00:37 +0100 Subject: [PATCH 05/32] Doc --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 32270994e3b..9f275d641ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -72,7 +72,7 @@ FIX: #yogosha21416 For users: ---------- -NEW: Compatibility with PHP 8.2 +NEW: Compatibility with PHP 8.2 (warning must be disabled) NEW: Module Workstation (used to enhance the module BOM and Manufacturing Order) is now stable NEW: Add a confirmation popup when deleting extrafields NEW: Add type 'icon' type for extrafields From 440c7b4493c67cf4e938341fd07096b96fb3e61c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 21:27:28 +0100 Subject: [PATCH 06/32] 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 07/32] 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 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 08/32] 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 5f1c05308a3a7a93164caba8807335cb2532b3b5 Mon Sep 17 00:00:00 2001 From: PsyCrow <93346975+PsyCrow-code@users.noreply.github.com> Date: Thu, 21 Mar 2024 00:54:54 -0600 Subject: [PATCH 09/32] PHP Warning: Undefined array key 1 on line 533 PHP Warning: Undefined array key 1 on line 533 --- htdocs/compta/bank/releve.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index bf0a08f02db..feeefb00425 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -529,8 +529,12 @@ if (empty($numref)) { print ''; $reg = array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction - if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) { - print $langs->trans($reg[1]); + if (!empty($reg[1])) { + if ($langs->trans($reg[1]) != $reg[1]) { + print $langs->trans($reg[1]); + } else { + print $objp->label; + } } else { print $objp->label; } From 3b5aa4e03a3d1e0f61f4322b1283a2a906398af7 Mon Sep 17 00:00:00 2001 From: ATM-Lucas Date: Thu, 21 Mar 2024 10:46:45 +0100 Subject: [PATCH 10/32] FIX default workstation on BOM --- htdocs/bom/ajax/ajax.php | 23 ++++++++++++++++++++++- htdocs/bom/class/bom.class.php | 2 +- htdocs/bom/tpl/objectline_create.tpl.php | 17 +++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/htdocs/bom/ajax/ajax.php b/htdocs/bom/ajax/ajax.php index 9a55c609252..eddb8a40dc5 100644 --- a/htdocs/bom/ajax/ajax.php +++ b/htdocs/bom/ajax/ajax.php @@ -53,7 +53,7 @@ $idproduct = GETPOST('idproduct', 'int'); * View */ -top_httphead(); +top_httphead('application/json'); if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) { $product = new Product($db); @@ -65,3 +65,24 @@ if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) echo json_encode($fk_unit); exit(); } + +if ($action == 'getWorkstationByProduct' && $user->hasRight('product', 'lire')) { + $product = new Product($db); + $res = $product->fetch($idproduct); + + $result = array(); + + if ($res < 0) { + $error = 'SQL ERROR'; + } elseif ($res == 0) { + $error = 'NOT FOUND'; + } else { + $error = null; + $result['defaultWk']=$product->fk_default_workstation; + } + + $result['error']=$error; + + echo json_encode($result); + exit(); +} diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index cfae2ea3e0c..8ea8e3e3edd 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -792,7 +792,7 @@ class BOM extends CommonObject $line->array_options[$key] = $array_options[$key]; } } - if ($fk_default_workstation > 0 && $line->fk_default_workstation != $fk_default_workstation) { + if ($fk_default_workstation >= 0 && $line->fk_default_workstation != $fk_default_workstation) { $line->fk_default_workstation = $fk_default_workstation; } diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index db3991eac7d..8beefbc8b01 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -185,7 +185,7 @@ if ($filtertype != 1) { $coldisplay++; print ''; - print ' '; + print $formproduct->selectWorkstations('', 'idworkstations', 1); print ''; $coldisplay++; @@ -235,14 +235,27 @@ jQuery(document).ready(function() { ,type: 'POST' ,data: { 'action': 'getDurationUnitByProduct' + ,'token' : "" ,'idproduct' : idproduct } }).done(function(data) { console.log(data); - var data = JSON.parse(data); $("#fk_unit").val(data).change(); }); + + $.ajax({ + url : "" + ,type: 'POST' + ,data: { + 'action': 'getWorkstationByProduct' + ,'token' : "" + ,'idproduct' : idproduct + } + }).done(function(data) { + $('#idworkstations').val(data.defaultWk).select2(); + + }); }); }); From 01a058b2081d2fe031bbdc75d6fa903cd23fca76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 11:22:12 +0100 Subject: [PATCH 11/32] 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 ab10f29db72ea6e984a295137dc5b05587c31534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= Date: Thu, 21 Mar 2024 13:06:09 +0100 Subject: [PATCH 12/32] add invoice id --- htdocs/takepos/index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 97dae7e1a14..33367b95535 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -504,11 +504,12 @@ function ClickProduct(position, qty = 1) { } else{ console.log($('#prodiv4').data('rowid')); + invoiceid = $("#invoiceid").val(); idproduct=$('#prodiv'+position).data('rowid'); console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty); if (idproduct=="") return; // Call page invoice.php to generate the section with product lines - $("#poslines").load("invoice.php?action=addline&token=&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty, function() { + $("#poslines").load("invoice.php?action=addline&token=&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty+"&invoiceid="+invoiceid, function() { global->TAKEPOS_CUSTOMER_DISPLAY)) echo "CustomerDisplay();";?> }); } @@ -527,7 +528,8 @@ function ChangeThirdparty(idcustomer) { function deleteline() { console.log("Delete line"); - $("#poslines").load("invoice.php?action=deleteline&token=&place="+place+"&idline="+selectedline, function() { + invoiceid = $("#invoiceid").val(); + $("#poslines").load("invoice.php?action=deleteline&token=&place="+place+"&idline="+selectedline+"invoiceid="+invoiceid, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); ClearSearch(); From 5ffdc449524a1d63bda824eadb8556c547af5b86 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 21 Mar 2024 13:35:51 +0100 Subject: [PATCH 13/32] FIX missing entity parameter for ajax_constantonoff --- htdocs/core/class/html.formsetup.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index ac6bbc42e0d..03b9695b18f 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -26,6 +26,9 @@ class FormSetup */ public $db; + /** @var int */ + public $entity; + /** @var FormSetupItem[] */ public $items = array(); @@ -86,7 +89,8 @@ class FormSetup */ public function __construct($db, $outputLangs = false) { - global $langs; + global $conf, $langs; + $this->db = $db; $this->form = new Form($this->db); $this->formAttributes['action'] = $_SERVER["PHP_SELF"]; @@ -94,6 +98,7 @@ class FormSetup $this->formHiddenInputs['token'] = newToken(); $this->formHiddenInputs['action'] = 'update'; + $this->entity = (is_null($this->entity) ? $conf->entity : $this->entity); if ($outputLangs) { $this->langs = $outputLangs; @@ -446,6 +451,8 @@ class FormSetup { $item = new FormSetupItem($confKey); + $item->entity = $this->entity; + // set item rank if not defined as last item if (empty($item->rank)) { $item->rank = $this->getCurentItemMaxRank() + 1; @@ -638,7 +645,7 @@ class FormSetupItem /** * Constructor * - * @param string $confKey the conf key used in database + * @param string $confKey the conf key used in database */ public function __construct($confKey) { @@ -652,7 +659,7 @@ class FormSetupItem } $this->langs = $langs; - $this->entity = $conf->entity; + $this->entity = (is_null($this->entity) ? $conf->entity : ((int) $this->entity)); $this->confKey = $confKey; $this->loadValueFromConf(); @@ -1089,7 +1096,7 @@ class FormSetupItem $out.= $this->generateOutputFieldColor(); } elseif ($this->type == 'yesno') { if (!empty($conf->use_javascript_ajax)) { - $out.= ajax_constantonoff($this->confKey); + $out.= ajax_constantonoff($this->confKey, array(), $this->entity); // TODO possibility to add $input parameter } else { if ($this->fieldValue == 1) { $out.= $langs->trans('yes'); From d8b87ff6eb820f32998452e47688574bfd8fddf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= Date: Thu, 21 Mar 2024 14:22:12 +0100 Subject: [PATCH 14/32] 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 33367b95535..540fa54f19c 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -529,7 +529,7 @@ function ChangeThirdparty(idcustomer) { function deleteline() { console.log("Delete line"); invoiceid = $("#invoiceid").val(); - $("#poslines").load("invoice.php?action=deleteline&token=&place="+place+"&idline="+selectedline+"invoiceid="+invoiceid, function() { + $("#poslines").load("invoice.php?action=deleteline&token=&place="+place+"&idline="+selectedline+"&invoiceid="+invoiceid, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); ClearSearch(); From ea1762f0fda2d8faeda8c82d028b8cbc9d47cf1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 14:36:31 +0100 Subject: [PATCH 15/32] Update releve.php --- htdocs/compta/bank/releve.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index feeefb00425..af21117d21c 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -529,14 +529,10 @@ if (empty($numref)) { print ''; $reg = array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction - if (!empty($reg[1])) { - if ($langs->trans($reg[1]) != $reg[1]) { - print $langs->trans($reg[1]); - } else { - print $objp->label; - } + if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) { + print $langs->trans($reg[1]); } else { - print $objp->label; + print dol_escape_htmltag($objp->label); } print ''; From 5f1796b39aca86d0261df8312b45d42d5bfeec0c Mon Sep 17 00:00:00 2001 From: Delthair <41671350+Delthair@users.noreply.github.com> Date: Fri, 22 Mar 2024 18:49:12 +0100 Subject: [PATCH 16/32] FIX #29029 Impossible to delete an order line Impossible to delete a line because the code lead to add an error if the request is valid therefore leading to a rollback of the request --- 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 410713d7c12..9a3319c8138 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4445,7 +4445,7 @@ class OrderLine extends CommonOrderLine dol_syslog("OrderLine::delete", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) { + if (!$resql) { $this->error = $this->db->lasterror(); $error++; } From 4d6bd2a8e004df59c1c43ba04692229acea040a2 Mon Sep 17 00:00:00 2001 From: Can Arslan <138895927+mc2rcanarslan@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:17:39 -0600 Subject: [PATCH 17/32] FIX: PHP Warning: Undefined properties --- htdocs/comm/action/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index a7118ccffcf..dbc0b02d8bf 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -267,7 +267,7 @@ if (empty($reshook)) { $objectlabel = 'Events'; $uploaddir = true; // Only users that can delete any event can remove records. - $permissiontodelete = $user->rights->agenda->allactions->delete; + $permissiontodelete = $user->hasRight('agenda', 'allactions', 'delete'); $permissiontoadd = $user->hasRight('agenda', 'myactions', 'create'); include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -708,7 +708,7 @@ $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; $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')); +$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')); $param .= '&mode='.$mode; From 1282e6840e95710804458bafded99238cb7fefc5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Mar 2024 11:58:55 +0100 Subject: [PATCH 18/32] FIX navigation after filter in subaccount --- htdocs/accountancy/admin/subaccount.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index fb9a61e36d0..38e672e132d 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -128,6 +128,7 @@ $form = new Form($db); // Page Header $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; $title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger'); + llxHeader('', $title, $help_url); @@ -300,14 +301,17 @@ if ($resql) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } + if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); + } if ($search_subaccount) { $param .= '&search_subaccount='.urlencode($search_subaccount); } if ($search_label) { $param .= '&search_label='.urlencode($search_label); } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); + if ($search_type) { + $param .= '&search_type='.urlencode($search_type); } // List of mass actions available @@ -373,7 +377,7 @@ if ($resql) { print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch '); } if (!empty($arrayfields['subaccount']['checked'])) { print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder); @@ -391,7 +395,7 @@ if ($resql) { } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch '); } print "\n"; From 8d1e21150021dc0ee48f93c984dc3086ceed8e68 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 16:50:34 +0100 Subject: [PATCH 19/32] Fix access to db results (fix PhanNonClassMethodCall) Fixed the access to db results - may need to be backported --- htdocs/accountancy/bookkeeping/balance.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 0b5b0005694..697962ef486 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -473,9 +473,12 @@ if ($action != 'export_csv') { $resql = $db->query($sql); $nrows = $resql->num_rows; $opening_balances = array(); - for ($i = 0; $i < $nrows; $i++) { - $arr = $resql->fetch_array(); - $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance']; + if ($resql) { + $nrows = $db->num_rows($resql); + for ($i = 0; $i < $nrows; $i++) { + $arr = $db->fetch_array($resql); + $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance']; + } } } From 401d32cad54a1f139d2d3f17a1b9f42583ed381a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Mar 2024 19:39:47 +0100 Subject: [PATCH 20/32] Update filefunc.inc.php --- htdocs/filefunc.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 4c4df29af50..d5f972b64f8 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -82,7 +82,8 @@ $result = @include_once $conffile; // Keep @ because with some error reporting t $listofwrappers = stream_get_wrappers(); // We need '.phar' for geoip2. TODO Replace phar in geoip with exploded files so we can disable phar by default. // phar stream does not auto unserialize content (possible code execution) since PHP 8.1 -$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zip', 'zlib'); +// zip stream is necessary by excel import module +$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zlib'); if (!empty($dolibarr_main_stream_to_disable) && is_array($dolibarr_main_stream_to_disable)) { $arrayofstreamtodisable = $dolibarr_main_stream_to_disable; } From 9bb7b88aac813eda1946c94f7e6f332f30205645 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Mar 2024 20:38:59 +0100 Subject: [PATCH 21/32] Fix doc --- htdocs/cron/class/cronjob.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index be7f3f98f8b..266909fe17b 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -119,7 +119,7 @@ class Cronjob extends CommonObject public $lastoutput; /** - * @var string Unit frequency of job execution + * @var int Unit frequency of job execution (60, 86400, ...) */ public $unitfrequency; From 5378c85c5da5586931c9d8e93384db8376e9d781 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 24 Mar 2024 11:35:18 +0100 Subject: [PATCH 22/32] FIX missing hide "new" button where "product" or "service" module is disable --- htdocs/product/agenda.php | 2 +- htdocs/product/composition/card.php | 2 +- htdocs/product/document.php | 2 +- htdocs/product/fournisseurs.php | 2 +- htdocs/product/list.php | 4 ++-- htdocs/product/note.php | 2 +- htdocs/product/price.php | 2 +- htdocs/product/stats/card.php | 2 +- htdocs/product/stats/facture.php | 2 +- htdocs/product/stock/product.php | 2 +- htdocs/product/traduction.php | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index ed5d456b3a5..8e154485178 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -160,7 +160,7 @@ if ($id > 0 || $ref) { $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index f7ea2478da7..25ac2d93664 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -226,7 +226,7 @@ if ($id > 0 || !empty($ref)) { * Product card */ if ($user->rights->produit->lire || $user->hasRight('service', 'lire')) { - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/document.php b/htdocs/product/document.php index f7753432043..c38e30123d0 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -239,7 +239,7 @@ if ($object->id) { } - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index b36c134d20b..5812b019726 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -390,7 +390,7 @@ if ($id > 0 || $ref) { print dol_get_fiche_head($head, 'suppliers', $titre, -1, $picto); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index c8295800dcc..e99857ee454 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -848,11 +848,11 @@ if ($type === "") { $params['forcenohideoftext'] = 1; } -if ($type === "" || $type == Product::TYPE_PRODUCT) { +if ((isModEnabled('product') && $type === "") || $type == Product::TYPE_PRODUCT) { $label = 'NewProduct'; $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); } -if ($type === "" || $type == Product::TYPE_SERVICE) { +if ((isModEnabled('service') && $type === "") || $type == Product::TYPE_SERVICE) { $label = 'NewService'; $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=1', '', $perm, $params); } diff --git a/htdocs/product/note.php b/htdocs/product/note.php index f8dab5e6bf3..13a611e9f25 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_head($head, 'note', $titre, -1, $picto); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 9dc217f782c..33f26a0dd39 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -866,7 +866,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'price', $titre, -1, $picto); -$linkback = ''.$langs->trans("BackToList").''; +$linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index a91927e77d4..93e3ef2d3e2 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -151,7 +151,7 @@ if ($result && ($id > 0 || !empty($ref)) && empty($notab)) { print dol_get_fiche_head($head, 'stats', $titre, -1, $picto); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', '', 1); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index c5209b725b5..2c9befc5c4e 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -128,7 +128,7 @@ if ($id > 0 || !empty($ref)) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index d52b15ca307..fe9d71aa526 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -611,7 +611,7 @@ if ($id > 0 || $ref) { dol_htmloutput_events(); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; if ($user->socid && !in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 1544df1ca2c..8fc7c415692 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -212,7 +212,7 @@ if (!empty($object->multilangs)) { print dol_get_fiche_head($head, 'translation', $titre, 0, $picto); -$linkback = ''.$langs->trans("BackToList").''; +$linkback = ''.$langs->trans("BackToList").''; $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { From ca2056d2192e54ab9be55c24db914cc20c03884d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Mar 2024 01:08:33 +0100 Subject: [PATCH 23/32] Fix look and feel v19 --- htdocs/exports/class/export.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 2a741b7a18f..92385c6ace1 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -474,11 +474,11 @@ class Export case 'FormSelect': //var_dump($NameField); if ($InfoFieldList[1] == 'select_company') { - $szFilterField .= $form->select_company('', $NameField, '', 1); + $szFilterField .= $form->select_company('', $NameField, '', 1, 0, 0, [], 0, 'maxwidth200'); } elseif ($InfoFieldList[1] == 'selectcontacts') { - $szFilterField .= $form->selectcontacts(0, '', $NameField, ' '); + $szFilterField .= $form->selectcontacts(0, '', $NameField, ' ', '', '', 0, 'maxwidth200'); } elseif ($InfoFieldList[1] == 'select_dolusers') { - $szFilterField .= $form->select_dolusers('', $NameField, 1); + $szFilterField .= $form->select_dolusers('', $NameField, 1, null, 0, '', '', '', 0, 0, "", 0, "", "maxwidth200"); } break; case 'List': From 0ed297d8caecc62ea4be7c530e5f18db5d80e6aa Mon Sep 17 00:00:00 2001 From: Can Arslan <138895927+mc2rcanarslan@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:03:28 -0600 Subject: [PATCH 24/32] FIX: used hasRight function Also fixes; PHP Warning: Undefined property: stdClass::$write in /htdocs/hrm/position_list.php on line 138 PHP Warning: Undefined property: stdClass::$delete in /htdocs/hrm/position_list.php on line 139 --- htdocs/hrm/position_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index 461e0259a82..29f9637b285 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -134,9 +134,9 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; -$permissiontodelete = $user->rights->hrm->all->delete; +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); +$permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); // Security check (enable the most restrictive one) if ($user->socid > 0) { From e1787360d5c93351e0c7b74f761b0bb7420b3364 Mon Sep 17 00:00:00 2001 From: Can Arslan <138895927+mc2rcanarslan@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:06:18 -0600 Subject: [PATCH 25/32] FIX: hasRight function Also fixes; PHP Warning: Undefined property: stdClass::$write in /htdocs/hrm/job_list.php on line 137 PHP Warning: Undefined property: stdClass::$delete in /htdocs/hrm/job_list.php on line 138 --- htdocs/hrm/job_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index 1d2ed7ab515..3668d71a6de 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -133,9 +133,9 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; -$permissiontodelete = $user->rights->hrm->all->delete; +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); +$permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); // Security check (enable the most restrictive one) if ($user->socid > 0) { From 6b723711635f7f16d2ab8351fd1e810ea18ab9a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Mar 2024 18:31:59 +0100 Subject: [PATCH 26/32] Fix warning --- htdocs/core/class/stats.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 801ce765a8c..cc12e5aeedf 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -158,8 +158,12 @@ abstract class Stats dol_mkdir($conf->user->dir_temp); } $fp = fopen($newpathofdestfile, 'w'); - fwrite($fp, json_encode($data)); - fclose($fp); + if ($fp) { + fwrite($fp, json_encode($data)); + fclose($fp); + } else { + dol_syslog("Failed to save cache file ".$newpathofdestfile); + } dolChmod($newpathofdestfile); $this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt; From 38156a84fcf063e764131f8e963d1e29a4ea98bc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Mar 2024 20:40:26 +0100 Subject: [PATCH 27/32] FIX wrong sql request with product category filter --- htdocs/fourn/facture/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 2f8fb164205..f071292aa33 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -628,17 +628,17 @@ if (!empty($searchCategoryProductList)) { $listofcategoryid = ''; foreach ($searchCategoryProductList as $searchCategoryProduct) { if (intval($searchCategoryProduct) == -2) { - $searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product)"; + $searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product)"; } elseif (intval($searchCategoryProduct) > 0) { if ($searchCategoryProductOperator == 0) { - $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")"; + $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")"; } else { $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct); } } } if ($listofcategoryid) { - $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))"; + $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))"; } if ($searchCategoryProductOperator == 1) { if (!empty($searchCategoryProductSqlList)) { From d8e102a24c2d822e46ad52d6afccf515baba642f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Mar 2024 01:14:05 +0100 Subject: [PATCH 28/32] FIX wrong stock permission number --- htdocs/core/modules/modStock.class.php | 133 ++++++++++++++----------- 1 file changed, 73 insertions(+), 60 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 439826effdf..9e55f9a77bb 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -113,78 +113,91 @@ class modStock extends DolibarrModules $this->rights = array(); $this->rights_class = 'stock'; - $this->rights[0][0] = 1001; - $this->rights[0][1] = 'Lire les stocks'; - $this->rights[0][2] = 'r'; - $this->rights[0][3] = 0; - $this->rights[0][4] = 'lire'; - $this->rights[0][5] = ''; + $r = 0; - $this->rights[1][0] = 1002; - $this->rights[1][1] = 'Creer/Modifier les stocks'; - $this->rights[1][2] = 'w'; - $this->rights[1][3] = 0; - $this->rights[1][4] = 'creer'; - $this->rights[1][5] = ''; + $this->rights[$r][0] = 1001; + $this->rights[$r][1] = 'Lire les stocks'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'lire'; + $this->rights[$r][5] = ''; - $this->rights[2][0] = 1003; - $this->rights[2][1] = 'Supprimer les stocks'; - $this->rights[2][2] = 'd'; - $this->rights[2][3] = 0; - $this->rights[2][4] = 'supprimer'; - $this->rights[2][5] = ''; + $r++; + $this->rights[$r][0] = 1002; + $this->rights[$r][1] = 'Creer/Modifier les stocks'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'creer'; + $this->rights[$r][5] = ''; - $this->rights[3][0] = 1004; - $this->rights[3][1] = 'Lire mouvements de stocks'; - $this->rights[3][2] = 'r'; - $this->rights[3][3] = 0; - $this->rights[3][4] = 'mouvement'; - $this->rights[3][5] = 'lire'; + $r++; + $this->rights[$r][0] = 1003; + $this->rights[$r][1] = 'Supprimer les stocks'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'supprimer'; + $this->rights[$r][5] = ''; - $this->rights[4][0] = 1005; - $this->rights[4][1] = 'Creer/modifier mouvements de stocks'; - $this->rights[4][2] = 'w'; - $this->rights[4][3] = 0; - $this->rights[4][4] = 'mouvement'; - $this->rights[4][5] = 'creer'; + $r++; + $this->rights[$r][0] = 1004; + $this->rights[$r][1] = 'Lire mouvements de stocks'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvement'; + $this->rights[$r][5] = 'lire'; - $this->rights[5][0] = 1011; - $this->rights[5][1] = 'inventoryReadPermission'; // Permission label - $this->rights[5][3] = 0; // Permission by default for new user (0/1) - $this->rights[5][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[5][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1005; + $this->rights[$r][1] = 'Creer/modifier mouvements de stocks'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvement'; + $this->rights[$r][5] = 'creer'; - $this->rights[6][0] = 1012; - $this->rights[6][1] = 'inventoryCreatePermission'; // Permission label - $this->rights[6][3] = 0; // Permission by default for new user (0/1) - $this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[6][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1011; + $this->rights[$r][1] = 'inventoryReadPermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[6][0] = 1013; - $this->rights[6][1] = 'inventoryDeletePermission'; // Permission label - $this->rights[6][3] = 0; // Permission by default for new user (0/1) - $this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[6][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1012; + $this->rights[$r][1] = 'inventoryCreatePermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1013; + $this->rights[$r][1] = 'inventoryDeletePermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + // TODO and if MAIN_FEATURES_LEVEL >= 2 after module is activated ? if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $this->rights[8][0] = 1014; - $this->rights[8][1] = 'inventoryValidatePermission'; // Permission label - $this->rights[8][3] = 0; // Permission by default for new user (0/1) - $this->rights[8][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[8][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[9][0] = 1015; - $this->rights[9][1] = 'inventoryChangePMPPermission'; // Permission label - $this->rights[9][3] = 0; // Permission by default for new user (0/1) - $this->rights[9][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[9][5] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1014; + $this->rights[$r][1] = 'inventoryValidatePermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[10][0] = 1016; - $this->rights[10][1] = 'inventoryDeletePermission'; // Permission label - $this->rights[10][3] = 0; // Permission by default for new user (0/1) - $this->rights[10][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[10][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1015; + $this->rights[$r][1] = 'inventoryChangePMPPermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + + $r++; + $this->rights[$r][0] = 1016; + $this->rights[$r][1] = 'inventoryDeletePermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) } // Main menu entries From f16b08fbdb8f8c78635c8d3280227c21ffb4c6e3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Mar 2024 01:21:15 +0100 Subject: [PATCH 29/32] FIX peut pas faire mieux ! --- htdocs/core/modules/modStock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 9e55f9a77bb..6d2dd563a7d 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -89,7 +89,7 @@ class modStock extends DolibarrModules $this->const[$r][0] = "MOUVEMENT_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "stdmovement"; - $this->const[$r][3] = 'Name of PDF model of stock mouvement'; + $this->const[$r][3] = 'Name of PDF model of stock movement'; $this->const[$r][4] = 0; $r++; From 2ae4f94eed8e9dd6e9e02246df16b8c4a71a83dc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Mar 2024 02:24:57 +0100 Subject: [PATCH 30/32] FIX inventoryDeletePermission id define twice --- htdocs/core/modules/modStock.class.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 6d2dd563a7d..a5ae3f31e53 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -191,13 +191,6 @@ class modStock extends DolibarrModules $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - - $r++; - $this->rights[$r][0] = 1016; - $this->rights[$r][1] = 'inventoryDeletePermission'; // Permission label - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) } // Main menu entries From dd42f45d1ab45e4b0c8646e9c8d3b3ede43f38d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2024 10:59:05 +0100 Subject: [PATCH 31/32] Fix precommit --- htdocs/core/modules/modStock.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index a5ae3f31e53..e9e9ccc79a6 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -116,7 +116,7 @@ class modStock extends DolibarrModules $r = 0; $this->rights[$r][0] = 1001; - $this->rights[$r][1] = 'Lire les stocks'; + $this->rights[$r][1] = 'Read stocks'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; @@ -124,7 +124,7 @@ class modStock extends DolibarrModules $r++; $this->rights[$r][0] = 1002; - $this->rights[$r][1] = 'Creer/Modifier les stocks'; + $this->rights[$r][1] = 'Create/Modify stocks'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'creer'; @@ -132,7 +132,7 @@ class modStock extends DolibarrModules $r++; $this->rights[$r][0] = 1003; - $this->rights[$r][1] = 'Supprimer les stocks'; + $this->rights[$r][1] = 'Delete stock'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'supprimer'; @@ -140,7 +140,7 @@ class modStock extends DolibarrModules $r++; $this->rights[$r][0] = 1004; - $this->rights[$r][1] = 'Lire mouvements de stocks'; + $this->rights[$r][1] = 'Read stock movements'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'mouvement'; @@ -148,7 +148,7 @@ class modStock extends DolibarrModules $r++; $this->rights[$r][0] = 1005; - $this->rights[$r][1] = 'Creer/modifier mouvements de stocks'; + $this->rights[$r][1] = 'Create/modify stock movements'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'mouvement'; @@ -177,7 +177,6 @@ class modStock extends DolibarrModules // TODO and if MAIN_FEATURES_LEVEL >= 2 after module is activated ? if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $r++; $this->rights[$r][0] = 1014; $this->rights[$r][1] = 'inventoryValidatePermission'; // Permission label From 1aa3d70c68d98b662f242c7630617fe38e087c8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2024 14:23:43 +0100 Subject: [PATCH 32/32] Fix link on external url on menu --- htdocs/admin/menus/edit.php | 8 ++++---- htdocs/core/menus/standard/eldy_menu.php | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index c11fe60553e..40a8bb29971 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -360,14 +360,14 @@ if ($action == 'create') { print ''.$langs->trans('Title').''; print ''.$langs->trans('DetailTitre').''; - // Picto - print ''.$langs->trans('Image').''; - print ''.$langs->trans('Example').': fa-global'; - // URL print ''.$langs->trans('URL').''; print ''.$langs->trans('DetailUrl').''; + // Picto + print ''.$langs->trans('Image').''; + print ''.$langs->trans('Example').': fa-global'; + // Langs print ''.$langs->trans('LangFile').''; print ''.$langs->trans('DetailLangs').''; diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 50d1086104e..f93575649d4 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -184,7 +184,12 @@ class MenuManager $substitarray['__USERID__'] = $user->id; // For backward compatibility $val['url'] = make_substitutions($val['url'], $substitarray); - $relurl = dol_buildpath($val['url'], 1); + if (!preg_match('/^http/', $val['url'])) { + $relurl = dol_buildpath($val['url'], 1); + } else { + $relurl = $val['url']; + } + $canonurl = preg_replace('/\?.*$/', '', $val['url']); print '';