From f7bd03fb751d611aee6e8483e29c1b8eaaa779e2 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 12 Feb 2025 16:02:00 +0100 Subject: [PATCH 01/21] FIX #33038 drag and drop files are not prefixed with object reference --- htdocs/core/class/fileupload.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index ec6465e42f2..c2d44f8b496 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -58,6 +58,7 @@ class FileUpload $pathname = str_replace('/class', '', $element_prop['classpath']); $filename = $element_prop['classfile']; $dir_output = $element_prop['dir_output']; + $savingDocMask = ''; //print 'fileupload.class.php: element='.$element.' pathname='.$pathname.' filename='.$filename.' dir_output='.$dir_output."\n"; @@ -73,6 +74,11 @@ class FileUpload $object_ref = dol_sanitizeFileName($object->ref); + // add object reference as file name prefix if const MAIN_DISABLE_SUGGEST_REF_AS_PREFIX is not enabled + if (!getDolGlobalInt('MAIN_DISABLE_SUGGEST_REF_AS_PREFIX')) { + $savingDocMask = $object_ref.'-__file__'; + } + // Special cases to forge $object_ref used to forge $upload_dir if ($element == 'invoice_supplier') { $object_ref = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$object_ref; @@ -98,6 +104,7 @@ class FileUpload 'script_url' => $_SERVER['PHP_SELF'], 'upload_dir' => $dir_output.'/'.$object_ref.'/', 'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object_ref.'/', + 'saving_doc_mask' => $savingDocMask, 'param_name' => 'files', // Set the following option to 'POST', if your server does not support // DELETE requests. This is a parameter sent to the client: @@ -417,6 +424,14 @@ class FileUpload if ($validate) { if (dol_mkdir($this->options['upload_dir']) >= 0) { + // add object reference as file name prefix if const MAIN_DISABLE_SUGGEST_REF_AS_PREFIX is not enabled + $fileNameWithoutExt = preg_replace('/\.[^\.]+$/', '', $file->name); + $savingDocMask = $this->options['saving_doc_mask']; + if ($savingDocMask && strpos($savingDocMask, $fileNameWithoutExt) !== 0) { + $fileNameWithPrefix = preg_replace('/__file__/', $file->name, $savingDocMask); + $file->name = $fileNameWithPrefix; + } + $file_path = $this->options['upload_dir'].$file->name; $append_file = !$this->options['discard_aborted_uploads'] && is_file($file_path) && $file->size > filesize($file_path); From 7997e927a03c51abbc7776c21b7dfc6f0500b5c9 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 13 Feb 2025 14:59:15 +0100 Subject: [PATCH 02/21] fix: On Supplier Order create, if insertExtrafield failed, Dolibarr do not return error and continue --- htdocs/fourn/class/fournisseur.commande.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4f72be4c417..de27129124a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1610,8 +1610,13 @@ class CommandeFournisseur extends CommonOrder // End call triggers } - $this->db->commit(); - return $this->id; + if (!$error) { + $this->db->commit(); + return $this->id; + } else { + $this->db->rollback(); + return -4; + } } else { $this->error = $this->db->lasterror(); $this->db->rollback(); From 5fd5eae3b1c2b481cbb55c26409ab236e18261eb Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 14 Feb 2025 09:35:57 +0100 Subject: [PATCH 03/21] set deposit percent to zero on change --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 67a8dab7845..880c450f798 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4332,7 +4332,7 @@ class Form if (depositPercent.length > 0) { $("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); } else { - $("#' . $htmlname . '_deposit_percent_container").hide(); + $("#' . $htmlname . '_deposit_percent_container").hide().find("#' . $htmlname . '_deposit_percent").val(0); } return true; From bd9bf8b5a8c9ebebfb09265beea8832b05588d79 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 13 Feb 2025 20:29:25 +0100 Subject: [PATCH 04/21] FIX #CVE-2024-34051 --- htdocs/main.inc.php | 8 ++++---- test/phpunit/SecurityTest.php | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e4e85ad053e..264bd10a07c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -170,25 +170,25 @@ function testSqlAndScriptInject($val, $type) $inj += preg_match('/=data:/si', $val); // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/Events $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)[a-z]*\s*=/i', $val); // onmousexxx can be set on img or any html tag like - $inj += preg_match('/on(abort|after|animation|auxclick|before|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)[a-z]*\s*=/i', $val); + $inj += preg_match('/on(abort|after|animation|auxclick|before|blur|bounce|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)[a-z]*\s*=/i', $val); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', $val); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)[a-z]*\s*=/i', $val); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)[a-z]*\s*=/i', $val); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)[a-z]*\s*=/i', $val); // More not into the previous list - $inj += preg_match('/on(repeat|begin|finish|beforeinput)[a-z]*\s*=/i', $val); + $inj += preg_match('/on(repeat|begin|finish)[a-z]*\s*=/i', $val); // We refuse html into html because some hacks try to obfuscate evil strings by inserting HTML into HTML. Example: error=alert(1) to bypass test on onerror $tmpval = preg_replace('/<[^<]+>/', '', $val); // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/Events $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)[a-z]*\s*=/i', $tmpval); // onmousexxx can be set on img or any html tag like - $inj += preg_match('/on(abort|after|animation|auxclick|before|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)[a-z]*\s*=/i', $tmpval); + $inj += preg_match('/on(abort|after|animation|auxclick|before|blur|bounce|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)[a-z]*\s*=/i', $tmpval); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', $tmpval); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)[a-z]*\s*=/i', $tmpval); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)[a-z]*\s*=/i', $tmpval); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)[a-z]*\s*=/i', $tmpval); // More not into the previous list - $inj += preg_match('/on(repeat|begin|finish|beforeinput)[a-z]*\s*=/i', $tmpval); + $inj += preg_match('/on(repeat|begin|finish)[a-z]*\s*=/i', $tmpval); //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val); // To lock event handlers onAbort(), ... $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index fb3132a17ff..410371f46d2 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -276,6 +276,14 @@ class SecurityTest extends PHPUnit\Framework\TestCase $result=testSqlAndScriptInject($test, 0); $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject aaa7'); + $test=''; + $result=testSqlAndScriptInject($test, 0); + $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject onbeforeintput'); + $test=''; + $result=testSqlAndScriptInject($test, 0); + $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject onbounce'); + + $test=''; $result=testSqlAndScriptInject($test, 0); $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject bbb'); From 9d9d890c974939ffc175565f0de74534579a4ed5 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 18 Feb 2025 12:07:19 +0100 Subject: [PATCH 05/21] FIX accountancy export Quadratus when doc ref is less than 10 char --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index d986e5c0d56..472f5b5ce38 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -966,7 +966,7 @@ class AccountancyExport // We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part // $tab['num_piece3'] = str_pad(self::trunc($line->piece_num, 10), 10); - $tab['num_piece3'] = substr(self::trunc($line->doc_ref, 20), -10); + $tab['num_piece3'] = str_pad(substr(self::trunc($line->doc_ref, 20), -10), 10); $tab['reserved'] = str_repeat(' ', 10); // position 159 $tab['currency_amount'] = str_repeat(' ', 13); // position 169 // get document file From f89aff96f7aed4967221242795977c4c1643bcb8 Mon Sep 17 00:00:00 2001 From: tnegre Date: Wed, 19 Feb 2025 11:25:26 +0100 Subject: [PATCH 06/21] FIX invoice creation : use dol_include_once instead of require_once to allow external modules --- htdocs/fourn/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d2699019a63..b09244a027d 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1042,7 +1042,7 @@ if (empty($reshook)) { $object->origin_id = GETPOST('originid', 'int'); - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') { $classname = 'CommandeFournisseur'; @@ -1070,7 +1070,7 @@ if (empty($reshook)) { // Add lines if ($id > 0) { - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') { $classname = 'CommandeFournisseur'; @@ -2026,7 +2026,7 @@ if ($action == 'create') { $element = 'fourn'; $subelement = 'fournisseur.commande'; } - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') { $classname = 'CommandeFournisseur'; From 41e54529b0e6b54bf08878a94928e8d721a23587 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 19 Feb 2025 17:26:54 +0100 Subject: [PATCH 07/21] FIX #33145 wrong label status buy on prodcut tooltip --- htdocs/core/class/commonobject.class.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cf013497aec..807c5f37bfc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5213,14 +5213,10 @@ abstract class CommonObject $discount->fk_soc = $this->socid; $this->tpl['label'] .= $discount->getNomUrl(0, 'discount'); } elseif (!empty($line->fk_product)) { - $productstatic = new Product($this->db); - $productstatic->id = $line->fk_product; - $productstatic->ref = $line->ref; - $productstatic->type = $line->fk_product_type; - if (empty($productstatic->ref)) { + if (empty($line->product)) { $line->fetch_product(); - $productstatic = $line->product; } + $productstatic = $line->product; $this->tpl['label'] .= $productstatic->getNomUrl(1); $this->tpl['label'] .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); From 5911d7d0c00aad720b22928789e3d8432c9aa6b3 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 20 Feb 2025 08:21:50 +0100 Subject: [PATCH 08/21] Protect product object for line label --- 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 807c5f37bfc..085b77dd532 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5218,7 +5218,7 @@ abstract class CommonObject } $productstatic = $line->product; - $this->tpl['label'] .= $productstatic->getNomUrl(1); + $this->tpl['label'] .= (is_object($productstatic) ? $productstatic->getNomUrl(1) : $line->ref); $this->tpl['label'] .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); // Dates if ($line->product_type == 1 && ($date_start || $date_end)) { From db8df90ea8452752272d1418ee2e30d0b773896d Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 20 Feb 2025 14:46:02 +0100 Subject: [PATCH 09/21] Fix #33160 dol_check_secure_access_document bad value for productlot --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 24d223c02cc..6f1fe961852 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3296,7 +3296,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } elseif (isModEnabled("service")) { $original_file = $conf->service->multidir_output[$entity].'/'.$original_file; } - } elseif ($modulepart == 'product_batch' || $modulepart == 'produitlot') { + } elseif ($modulepart == 'product_batch' || $modulepart == 'productlot') { // Wrapping pour les lots produits if (empty($entity) || (empty($conf->productbatch->multidir_output[$entity]))) { return array('accessallowed' => 0, 'error' => 'Value entity must be provided'); From 431a9de17ab26318257137e5da72d9260839e9e4 Mon Sep 17 00:00:00 2001 From: Maximilien Valenzano Date: Fri, 21 Feb 2025 08:21:17 +0100 Subject: [PATCH 10/21] fix(fourn): use float for multicurrency tx --- htdocs/fourn/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a7d7df70c25..a37b6c7dbbd 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -910,7 +910,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx'); $object->transport_mode_id = GETPOSTINT('transport_mode_id'); // Proprietes particulieres a facture avoir @@ -1013,7 +1013,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx'); // Source facture $object->fac_rec = $fac_recid; @@ -1080,7 +1080,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx'); $object->transport_mode_id = GETPOSTINT('transport_mode_id'); // Auto calculation of date due if not filled by user From 0759814b22b03797609130dbc260940ca761079e Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 21 Feb 2025 11:33:43 +0100 Subject: [PATCH 11/21] Doc --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 87f353f6cd2..3c52f18a9e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,7 +61,7 @@ FIX: if $force_entity = 0 ($force_entity != 'default') = false FIX: Loan - Insurance amount need decimals FIX: Many status on invoice linked object block FIX: merge problem -FIX: missing company name if dontaion is linked to third party +FIX: missing company name if donation is linked to third party FIX: missing default values if $objsrc or $soc fields are empty FIX: missing edit extrafields inline for member card FIX: missing quick edit for extrafields From 0dd57bdada4f2026f00e93649d63735931ebd64b Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 21 Feb 2025 11:53:57 +0100 Subject: [PATCH 12/21] Fix signature --- htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php | 3 ++- .../core/modules/supplier_order/doc/pdf_muscadet.modules.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 885a25b84b5..f760deb2dc7 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1143,9 +1143,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array * @param string $currency Currency code + * @param Translate $outputlangsbis Langs object bis * @return void */ - protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') + protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null) { global $conf; diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 9fd63c8ce7e..93aea2559f5 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -998,9 +998,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array * @param string $currency Currency code + * @param Translate $outputlangsbis Langs object bis * @return void */ - protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') + protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null) { global $conf; From 2e0a29d28e17a73f6f9967b0a89271becd3ee407 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 21 Feb 2025 13:21:51 +0100 Subject: [PATCH 13/21] FIX Missing quotes when using __NOW__ --- htdocs/core/lib/functions.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cb6b009f99f..95f69e8e3fe 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -13502,7 +13502,7 @@ function forgeSQLFromUniversalSearchCriteria($filter, &$errorstr = '', $noand = $ret = ($noand ? "" : " AND ").($nopar ? "" : '(').preg_replace_callback('/'.$regexstring.'/i', 'dolForgeCriteriaCallback', $filter).($nopar ? "" : ')'); if (is_object($db)) { - $ret = str_replace('__NOW__', $db->idate(dol_now()), $ret); + $ret = str_replace('__NOW__', "'".$db->idate(dol_now())."'", $ret); } if (is_object($user)) { $ret = str_replace('__USER_ID__', (string) $user->id, $ret); @@ -13733,8 +13733,10 @@ function dolForgeCriteriaCallback($matches) $tmpescaped = 'NULL'; } elseif (is_int($tmpescaped)) { $tmpescaped = (int) $tmpescaped; - } else { + } elseif (is_numeric((string) $tmpescaped)) { // it can be a float with a . $tmpescaped = (float) $tmpescaped; + } else { + $tmpescaped = preg_replace('/[^a-z0-9_]/i', '', $tmpescaped); // it can be a name of field or a substitution variable like '__NOW__' } } From 6acbaf81f22f0dd12805c77bf0f20766893af104 Mon Sep 17 00:00:00 2001 From: Pratush Raj Date: Fri, 21 Feb 2025 19:05:08 +0530 Subject: [PATCH 14/21] Fixed: 33178 --- htdocs/bom/class/bom.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 1099a9d0ff7..9952525b258 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -292,7 +292,7 @@ class BOM extends CommonObject * @param int $notrigger false=launch triggers after, true=disable triggers * @return int Return integer <0 if KO, Id of created object if OK */ - public function create(User $user, $notrigger = 1) + public function create(User $user, $notrigger = 0) { if ($this->efficiency <= 0 || $this->efficiency > 1) { $this->efficiency = 1; @@ -546,7 +546,7 @@ class BOM extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int Return integer <0 if KO, >0 if OK */ - public function update(User $user, $notrigger = 1) + public function update(User $user, $notrigger = 0) { if ($this->efficiency <= 0 || $this->efficiency > 1) { $this->efficiency = 1; From 7cc16734f946c72c70d14ec4d6d9566ddc0bdc9b Mon Sep 17 00:00:00 2001 From: Quentin VIAL--GOUTEYRON Date: Fri, 21 Feb 2025 16:25:28 +0100 Subject: [PATCH 15/21] Missing filter for skill tab --- htdocs/hrm/skill_tab.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index 8f700a087cd..85338f7e486 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -283,6 +283,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $sql_skill .=" FROM ".MAIN_DB_PREFIX."hrm_skillrank AS sr"; $sql_skill .=" JOIN ".MAIN_DB_PREFIX."hrm_skill AS s ON sr.fk_skill = s.rowid"; $sql_skill .= " AND sr.fk_object = ".((int) $id); + $sql_skill .= " AND sr.objecttype = '".$db->escape($objecttype)."'"; $result = $db->query($sql_skill); $numSkills = $db->num_rows($result); for ($i=0; $i < $numSkills; $i++) { From c295314edcfe1d0998b27efd743acba9ae082237 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Sat, 22 Feb 2025 02:00:19 +0100 Subject: [PATCH 16/21] FIX - Warehouse default --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a9a84415f4b..b343affbd48 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1922,7 +1922,7 @@ if ($action == 'create') { if (empty($object->warehouse_id) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE')) { $warehouse_id = getDolGlobalString('MAIN_DEFAULT_WAREHOUSE'); } - if (empty($object->warehouse_id) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE_USER') && !empty($user->warehouse_id)) { + if (empty($object->warehouse_id) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE_USER') && !empty($user->fk_warehouse)) { $warehouse_id = $user->fk_warehouse; } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 586eb8bcbaa..db21f28fd8a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1836,7 +1836,7 @@ if ($action == 'create' && $usercancreate) { if (empty($object->warehouse_id) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE')) { $warehouse_id = getDolGlobalString('MAIN_DEFAULT_WAREHOUSE'); } - if (empty($object->warehouse_id) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE_USER') && !empty($user->warehouse_id)) { + if (empty($object->warehouse_id) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE_USER') && !empty($user->fk_warehouse)) { $warehouse_id = $user->fk_warehouse; } } From 51e96dfb608e848ebf452aa52b0ca3c137022bc1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 23 Feb 2025 14:16:20 +0100 Subject: [PATCH 17/21] FIX wrong object and avoid warnings --- htdocs/core/lib/signature.lib.php | 2 +- htdocs/fourn/commande/card.php | 1 + htdocs/reception/list.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 4c2e13693ec..d07b2a410f2 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -176,7 +176,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1, $o if ($mode == 1) { $out .= "hash('".$securekeyseed."' + '".$type."' + $type + '_ref)"; } else { - $out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0'); + $out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $obj->entity), '0'); } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8f3041a20ec..0f23e7776a6 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1962,6 +1962,7 @@ if ($action == 'create') { $formconfirm = ''; + $text = ''; // Confirmation de la suppression de la commande if ($action == 'delete') { diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 13f20113775..b8334a9c729 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -1441,7 +1441,7 @@ print ''; $db->free($resql); $hidegeneratedfilelistifempty = 1; -if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { +if ($massaction == 'builddoc' || $action == 'remove_file' || !empty($show_files)) { $hidegeneratedfilelistifempty = 0; } From 1a55de511ac1f922a64592a7ca216f2207926391 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 23 Feb 2025 22:26:38 +0100 Subject: [PATCH 18/21] FIX Cancel button on edit line must go back to card --- htdocs/compta/facture/card-rec.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 8e996becd5c..292d092bc85 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -145,10 +145,13 @@ $result = restrictedArea($user, 'facture', $object->id, $objecttype); /* * Actions */ - if (GETPOST('cancel', 'alpha')) { - $action = 'list'; - $massaction = ''; + if ($action != 'updateline') { + $action = 'list'; + $massaction = ''; + } else { + $cancel = ''; + } } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; From d375a4b7940a331f8ad24fbea935f55da4c5757f Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 24 Feb 2025 12:40:04 +0100 Subject: [PATCH 19/21] Doc --- htdocs/admin/modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index b4bc00f68ca..ef0a83fa579 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -614,7 +614,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled $deschelp .= '
'.$desc."
\n"; } - if (getDolGlobalString('MAIN_SETUP_MODULES_INFO')) { // Show a custom message + if (getDolGlobalString('MAIN_SETUP_MODULES_INFO')) { // Show a custom message. A good usage for SaaS with option MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING. $deschelp .= '
'.$langs->trans(getDolGlobalString('MAIN_SETUP_MODULES_INFO'))."
\n"; } if ($deschelp) { From 70422e891cd18ef3b7a08650afc66d3a0147700b Mon Sep 17 00:00:00 2001 From: tnegre Date: Wed, 19 Feb 2025 11:25:26 +0100 Subject: [PATCH 20/21] FIX invoice creation : use dol_include_once instead of require_once to allow external modules --- htdocs/fourn/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 01f43d6dc45..6791444e8b2 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1111,7 +1111,7 @@ if (empty($reshook)) { $object->origin_id = GETPOST('originid', 'int'); - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') { $classname = 'CommandeFournisseur'; @@ -1139,7 +1139,7 @@ if (empty($reshook)) { // Add lines if ($id > 0) { - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') { $classname = 'CommandeFournisseur'; @@ -2097,7 +2097,7 @@ if ($action == 'create') { $subelement = 'fournisseur.commande'; } - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') { $classname = 'CommandeFournisseur'; From c8cfb5ae90571043f2e8ffa57af4d94104f2d246 Mon Sep 17 00:00:00 2001 From: tnegre Date: Wed, 19 Feb 2025 11:25:26 +0100 Subject: [PATCH 21/21] FIX invoice creation : use dol_include_once instead of require_once to allow external modules --- htdocs/fourn/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a37b6c7dbbd..f1ab09df0d6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1122,7 +1122,7 @@ if (empty($reshook)) { $object->origin_id = GETPOSTINT('originid'); - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') { $classname = 'CommandeFournisseur'; @@ -1150,7 +1150,7 @@ if (empty($reshook)) { // Add lines if ($id > 0) { - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') { $classname = 'CommandeFournisseur'; @@ -2121,7 +2121,7 @@ if ($action == 'create') { $subelement = 'fournisseur.commande'; } - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') { $classname = 'CommandeFournisseur';