From 9a96aad737bd7b447e8438ec8d53ce3e073e8157 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 28 Sep 2022 23:39:23 +0200 Subject: [PATCH 01/10] FIX #22440 --- htdocs/langs/en_US/accountancy.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index fd5ff8461fe..d890377866a 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -58,6 +58,7 @@ MainAccountForSuppliersNotDefined=Main accounting account for vendors not define MainAccountForUsersNotDefined=Main accounting account for users not defined in setup MainAccountForVatPaymentNotDefined=Main accounting account for VAT payment not defined in setup MainAccountForSubscriptionPaymentNotDefined=Main accounting account for subscription payment not defined in setup +UserAccountNotDefined=Accounting account for user not defined in setup AccountancyArea=Accounting area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: From fe59054522c1fe7878d149faa4ae271e107e75cc Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Thu, 29 Sep 2022 22:56:06 +0200 Subject: [PATCH 02/10] Supplier Reference is lost when page breaks https://www.dolibarr.org/forum/t/pdf-aurore-modules-php-seems-to-loose-track-of-supplier-references/22856 --- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 14af31976d8..b3c73c57e16 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -483,7 +483,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc); + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); From 65b5f002ea4ac2fdd7682a01c95d1f5c5fb654d6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 3 Oct 2022 08:22:27 +0200 Subject: [PATCH 03/10] FIX missing class "societe" when create another object with workflow --- htdocs/core/ajax/onlineSign.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 3ec4cfa0f20..7de590eb98e 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -28,9 +28,10 @@ if (!defined('NOREQUIREHTML')) { if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } -if (!defined('NOREQUIRESOC')) { +// Needed for create other object with workflow +/*if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); -} +}*/ if (!defined('NOCSRFCHECK')) { define('NOCSRFCHECK', '1'); } From 787de2fd8a83b1f261ef3b7002bf998edea2a5f5 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Mon, 3 Oct 2022 15:16:41 +0200 Subject: [PATCH 04/10] FIX: contact deletion: execute trigger before really deleting --- htdocs/contact/class/contact.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index db99a8203bc..89d84df9426 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1208,6 +1208,15 @@ class Contact extends CommonObject $this->db->begin(); + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('CONTACT_DELETE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + if (!$error) { // Get all rowid of element_contact linked to a type that is link to llx_socpeople $sql = "SELECT ec.rowid"; @@ -1298,15 +1307,6 @@ class Contact extends CommonObject } } - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('CONTACT_DELETE', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - if (!$error) { $this->db->commit(); return 1; From 013d136bf7debe3611f6fe4699190dcec2c6969e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Oct 2022 13:57:42 +0200 Subject: [PATCH 05/10] FIX @ must be allowed into dol_eval --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f5206c700d0..3ea1a741ed2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8232,7 +8232,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' // Test dangerous char (used for RCE), we allow only PHP variable testing. if ($onlysimplestring == '1') { //print preg_quote('$_->&|', '/'); - if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/', '/').']/i', $s)) { + if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/@', '/').']/i', $s)) { if ($returnvalue) { return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s; } else { @@ -8242,11 +8242,11 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' } } elseif ($onlysimplestring == '2') { //print preg_quote('$_->&|', '/'); - if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/;[]', '/').']/i', $s)) { + if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/@;[]', '/').']/i', $s)) { if ($returnvalue) { - return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s; + return 'Bad string syntax to evaluate (found chars that are not chars for simplestring 2): '.$s; } else { - dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s); + dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring 2): '.$s); return ''; } } From 68c018896995b578383873ace77a265e3e14962f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Oct 2022 14:17:57 +0200 Subject: [PATCH 06/10] Revert "FIX: Preview button position on documents list (case when the file is too long)" This reverts commit 88b5594af31f54bed54d0c89e61930f78c48404e. --- htdocs/core/class/html.formfile.class.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 78e54731f05..4bcf742d461 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -884,7 +884,6 @@ class FormFile // Show file name with link to download $out .= ''; - $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param, 'paddingright')."\n"; $out .= 'trans("File").': '.$file["name"]); $out .= dol_trunc($file["name"], 150); - $out .= ''; + $out .= ''."\n"; + $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param); $out .= ''; // Show file size @@ -1341,11 +1341,6 @@ class FormFile // File name print ''; - // Preview link - if (!$editline) { - print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity), 'paddingright') . "\n"; - } - // Show file name with link to download //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; @@ -2145,10 +2144,9 @@ class FormFile * @param string $relativepath Relative path of docs * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) * @param string $param More param on http links - * @param string $moreclass Add more class to class style * @return string $out Output string with HTML */ - public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '', $moreclass = '') + public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '') { global $langs, $conf; @@ -2156,7 +2154,7 @@ class FormFile if ($conf->browser->layout != 'phone' && !empty($conf->use_javascript_ajax)) { $urladvancedpreview = getAdvancedPreviewUrl($modulepart, $relativepath, 1, $param); // Return if a file is qualified for preview. if (count($urladvancedpreview)) { - $out .= ''; + $out .= ''; //$out.= ''; if (empty($ruleforpicto)) { //$out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); From a73aa6c0dfc548cdbce43c07c872e7fc7aa38ba8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Oct 2022 09:55:51 +0200 Subject: [PATCH 07/10] Fix bad muticurrency rate --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b9d6e199015..c8ada26a316 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1215,7 +1215,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); + $object->multicurrency_tx = price2num(GETPOST('originmulticurrency_tx', 'alpha')); $object->fk_project = GETPOST('projectid', 'int'); // Fill array 'array_options' with data from add form From b2cd5fc3ca4f69c0b27d4c9144194f9a98676ec2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 5 Oct 2022 16:14:59 +0200 Subject: [PATCH 08/10] fix: remove php warning non_numeric_value --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 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 1bbbb2c9f3f..b1830e367e6 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1428,7 +1428,7 @@ class pdf_sponge extends ModelePDFFactures // Total remise $total_line_remise = 0; foreach ($object->lines as $i => $line) { - $total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib + $total_line_remise += (float)pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib // Gestion remise sous forme de ligne négative if ($line->total_ht < 0) { $total_line_remise += -$line->total_ht; From a72fff4a5d07e48bec38ab805db84d35ef2e3633 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 5 Oct 2022 16:39:26 +0200 Subject: [PATCH 09/10] FIX #22241 --- 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 82e7f8e3a90..dec6565be80 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5974,7 +5974,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, // Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle. if (($seller_country_code == $buyer_country_code) - || (in_array($seller_country_code, array('FR,MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined + || (in_array($seller_country_code, array('FR', 'MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined //print 'VATRULE 2'; return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); } From 82cb267fb884635a3ec4624b214d11e81b0e240c Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 5 Oct 2022 14:57:47 +0000 Subject: [PATCH 10/10] Fixing style errors. --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 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 b1830e367e6..4489f26268c 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1428,7 +1428,7 @@ class pdf_sponge extends ModelePDFFactures // Total remise $total_line_remise = 0; foreach ($object->lines as $i => $line) { - $total_line_remise += (float)pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib + $total_line_remise += (float) pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib // Gestion remise sous forme de ligne négative if ($line->total_ht < 0) { $total_line_remise += -$line->total_ht;