From 33a2be35fbcb28fdd2595abcd56a7a5f003419e8 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:16:05 +0200 Subject: [PATCH 01/51] Fix trans --- htdocs/langs/en_US/admin.lang | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 90e30555733..3a7196da08f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2144,10 +2144,10 @@ MAIN_PDF_NO_RECIPENT_FRAME=Hide borders on recipient address frame MAIN_PDF_HIDE_CUSTOMER_CODE=Hide customer code MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE=Hide customer accounting code MAIN_PDF_HIDE_SENDER_NAME=Hide sender/company name in address block -TERMSOFSALE=Conditions de vente -MAIN_PDF_ADD_TERMSOFSALE_PROPAL=Add the conditions of sale after the proposal -MAIN_PDF_ADD_TERMSOFSALE_ORDER=Add the conditions of sale after the order -MAIN_PDF_ADD_TERMSOFSALE_INVOICE=Add the conditions of sale after the invoice +TERMSOFSALE=Terms and conditions of sale +MAIN_PDF_ADD_TERMSOFSALE_PROPAL=Add the terms and conditions of sale after the proposal +MAIN_PDF_ADD_TERMSOFSALE_ORDER=Add the terms and conditions of sale after the order +MAIN_PDF_ADD_TERMSOFSALE_INVOICE=Add the terms and conditions of sale after the invoice PROPOSAL_PDF_HIDE_PAYMENTTERM=Hide payments conditions PROPOSAL_PDF_HIDE_PAYMENTMODE=Hide payment mode MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING=Add a hidden markup into the signature area to allow electronic signature tool to reuse it. May be used by external tools or in the future by the online signature feature. @@ -2582,7 +2582,7 @@ DolibarrStandardCaptcha=A native captcha generated by Dolibarr SALES_ORDER_SHOW_SHIPPING_ADDRESS=Show shipping address SALES_ORDER_SHOW_SHIPPING_ADDRESSMore=Compulsory indication in some countries (France, ...) PDF_INVOICE_SHOW_VAT_ANALYSIS=Show vat analysis per rate -MaxNbOfRecordOnListIsOk=You have a max size for lists is set to %s lines. This is a good value. +MaxNbOfRecordOnListIsOk=You have a max size for lists set to %s lines. This is a good value. YouHaveALargeAmountOfRecordOnLists=You have a default max size for lists set to %s lines. This is a large value that need scrolling to see all answers. It is better to have a value lower than %s and use pagination to see record over this number. Change this in menu Home - Setup - Display. RoundBorders=Round borders CheckIfModuleIsNotBlackListed=Block install for modules found into the Remote blacklist @@ -2593,7 +2593,7 @@ SensitiveData=Sensitive data ToolToDecryptAString=Tool to decrypt a string Decrypt=Decrypt FilesIntegrityDesc=If you want to check the integrity of files instead of database, you can do it by using this tool. -AttributeCodeHelp=A code of your choice (without special char and space) to identify the property.
Note that if an object B is created from an existing object A that has a different type (for example creation of an invoice from an order), the value of the complementary attributes of A are also copied into the complementary attributes of B when the code of the attribute is the same. +AttributeCodeHelp=A code of your choice (without special chars and spaces) to identify the property.
Note that if an object B is created from an existing object A that has a different type (for example creation of an invoice from an order), the value of the complementary attributes of A are also copied into the complementary attributes of B when the code of the attribute is the same. ThereIsMoreThanXAnswers=There is more than %s answers with your filter. Please add more filters... -PdfAddTermOfSaleHelp=Upload the condition of sales from file input at the bottom of this setup page -WarningOnlineSignature=Please note that this function allows a person (customer, supplier...) to insert, online, the image of his signature in the PDF document. As for a handwritten signature, such a signature can be made by anyone and does not have the same legal value as a legal electronic signature system going through a paying trusted third party. If you need this level of security, you can contact an integrator for more information or check for addons on www.dolistore.org. +PdfAddTermOfSaleHelp=You can upload the terms and conditions of sale file at the bottom of this setup page +WarningOnlineSignature=Please note that this function allows a person (customer, supplier...) to insert, online, the image of his signature in the PDF document. As for a handwritten signature, such a signature can be made by anyone and might not have the same legal value as a legal electronic signature system going through an authorized trusted third party. If you need this level of security, you can contact an integrator for more information or check for addons on www.dolistore.org. From 5591e3a8c0e3c3c91dacac139e4c6dbd3c381b01 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:19:22 +0200 Subject: [PATCH 02/51] Fix trans --- htdocs/langs/en_US/errors.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 0e6576f3176..485917e7d86 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -344,8 +344,8 @@ ErrorStartHourIsNull=Start date field cannot be empty ErrorTooManyLinesToProcessPleaseUseAMoreSelectiveFilter=Too many lines to process. Please use a more selective filter. ErrorEmptyValueForQty=Quantity cannot be zero. ErrorNoCloneWithoutName=The new user must have a name -ErrorNoCloneWithoutEmail=The new user must have a email -ErrorUserClone=Error when clone categories user +ErrorNoCloneWithoutEmail=The new user must have an email +ErrorUserClone=Error in user clone categories ErrorQtyOrderedLessQtyShipped = The quantity ordered cannot be less than the quantity shipped. ErrorVariousPaymentOnBankAccountWithADifferentCurrencyNotYetSupported=Error, creating a various payment on a bank account with a currency different than the currency of the company is not yet supported. ErrorStreamMustBeEnabled=The PHP stream %s is not available. Check your PHP modules and Dolibarr parameter $dolibarr_main_stream_to_disable. From 2c988d28c9455bb76f0da30a134a956f0b128c29 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 14:05:28 +0100 Subject: [PATCH 03/51] Debug v21 - fix multiselect --- htdocs/modulebuilder/template/myobject_list.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 6bde6bf10d1..864ad8adf9d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -343,8 +343,14 @@ foreach ($search as $key => $val) { } $mode_search = 2; } - if ($search[$key] != '') { - $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + if (empty($object->fields[$key]['searchmulti'])) { + if (!is_array($search[$key]) && $search[$key] != '') { + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + } + } else { + if (is_array($search[$key]) && !empty($search[$key])) { + $sql .= natural_search("t.".$db->escape($key), implode(',', $search[$key]), (($key == 'status') ? 2 : $mode_search)); + } } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { @@ -632,7 +638,11 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + if (empty($val['searchmulti'])) { + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + } else { + print $form->multiselectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 0, 0, 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + } } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { From ba6bbdda0e84f3bff2b35ec11831127844ebec87 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 15:05:03 +0100 Subject: [PATCH 04/51] Fix legal mention of VAT intra europe --- .../modules/facture/doc/pdf_crabe.modules.php | 17 ++++++++++------- .../modules/facture/doc/pdf_octopus.modules.php | 17 ++++++++++------- .../modules/facture/doc/pdf_sponge.modules.php | 15 +++++++++------ htdocs/langs/en_US/bills.lang | 1 + 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 5297f1839cb..a5c514576e1 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1231,15 +1231,18 @@ class pdf_crabe extends ModelePDFFactures } // If France, show VAT mention if applicable - if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { - $pdf->SetFont('', 'B', $default_font_size - 2); + if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) { + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - if ($mysoc->forme_juridique_code == 92) { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); - } else { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if (empty($mysoc->tva_assuj)) { + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } + } elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', 0); } - $posy = $pdf->GetY() + 4; } diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index b59ecd85c04..6c75e61ae9c 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1398,15 +1398,18 @@ class pdf_octopus extends ModelePDFFactures } // If France, show VAT mention if applicable - if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { - $pdf->SetFont('', 'B', $default_font_size - 2); + if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) { + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - if ($mysoc->forme_juridique_code == 92) { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); - } else { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if (empty($mysoc->tva_assuj)) { + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } + } elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', 0); } - $posy = $pdf->GetY() + 4; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 908d9d2f328..7fa776dff12 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1329,15 +1329,18 @@ class pdf_sponge extends ModelePDFFactures } // If France, show VAT mention if applicable - if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { + if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) { $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - if ($mysoc->forme_juridique_code == 92) { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); - } else { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if (empty($mysoc->tva_assuj)) { + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } + } elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', 0); } - $posy = $pdf->GetY() + 4; } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 8e2381466f8..e6f04f74572 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -523,6 +523,7 @@ SendTo=sent to PaymentByTransferOnThisBankAccount=Payment by transfer to the following bank account VATIsNotUsedForInvoice=* Non applicable VAT art-293B of CGI VATIsNotUsedForInvoiceAsso=* Non applicable VAT art-261-7 of CGI +VATIsNotUsedReverseChargeProcedure=* Non applicable VAT art-259-1 of CGI LawApplicationPart1=By application of the law 80.335 of 12/05/80 LawApplicationPart2=the goods remain the property of LawApplicationPart3=the seller until full payment of From 88465b7b422fbd5e8e42b64db3416c747e944a3c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 17:51:16 +0100 Subject: [PATCH 05/51] Add TODO --- htdocs/core/modules/modStock.class.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index c9bc793fb36..1531a9245ae 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -44,7 +44,7 @@ class modStock extends DolibarrModules */ public function __construct($db) { - global $conf, $langs; + global $langs; $this->db = $db; $this->numero = 52; @@ -156,6 +156,17 @@ class modStock extends DolibarrModules $this->rights[$r][4] = 'mouvement'; $this->rights[$r][5] = 'creer'; + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + // Not yet implemented. TODO + $r++; + $this->rights[$r][0] = 1008; + $this->rights[$r][1] = 'Read stock value'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'value_advance'; + $this->rights[$r][5] = 'read'; + } + $r++; $this->rights[$r][0] = 1011; $this->rights[$r][1] = 'inventoryReadPermission'; // Permission label From 19e4b8f269beb9ab036f32d1da5d1701eeb806e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 17:55:20 +0100 Subject: [PATCH 06/51] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b436d3ce5d3..3c007cca51a 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -25470,12 +25470,6 @@ parameters: count: 2 path: ../../htdocs/product/class/product.class.php - - - message: '#^Ternary operator condition is always true\.$#' - identifier: ternary.alwaysTrue - count: 1 - path: ../../htdocs/product/class/product.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue From bf46df80d4aedc730453cadd6687553dd3477907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:04:05 +0100 Subject: [PATCH 07/51] fix phpstan --- htdocs/product/class/product.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c5ab3793d34..f555e133299 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -646,6 +646,10 @@ class Product extends CommonObject * @var array{}|array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:float,customers_consumed:int,nb_consumed:int,qty_consumed:float,customers_toproduce:int,nb_toproduce:int,qty_toproduce:float,customers_produced:int,nb_produced:int,qty_produced:float} stats by role toconsume, consumed, toproduce, produced */ public $stats_mo = array(); + + /** + * @var array{}|array{nb_toproduce:int,nb_toconsume:int,qty_toproduce:float,qty_toconsume:float} + */ public $stats_bom = array(); public $stats_mrptoconsume = array(); public $stats_mrptoproduce = array(); From 45fa431092c6a3728e4fa079a306b7cb2c411709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:07:16 +0100 Subject: [PATCH 08/51] fix phpstan --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f555e133299..e987b88377e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3083,7 +3083,7 @@ class Product extends CommonObject $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on - $this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].($result ? ' ('.$result['default_vat_code'].')' : '') : null; + $this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].(!empty($result['default_vat_code']) ? ' ('.$result['default_vat_code'].')' : '') : null; $this->multiprices_recuperableonly[$i] = $result ? $result["recuperableonly"] : null; // Price by quantity From 3bb34cbf24f548d023a62b28b2b2e515929138fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:12:08 +0100 Subject: [PATCH 09/51] fix phpstan --- build/phpstan/phpstan-baseline.neon | 30 -------------------------- htdocs/product/class/product.class.php | 8 +++---- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 3c007cca51a..6fd43263efc 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -25410,36 +25410,6 @@ parameters: count: 1 path: ../../htdocs/product/class/product.class.php - - - message: '#^Property Product\:\:\$stats_bom has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_facture_fournisseur has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_facturerec has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_mrptoconsume has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_mrptoproduce has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - message: '#^Property Product\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e987b88377e..3b34af84ed5 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1141,10 +1141,10 @@ class Product extends CommonObject if ($id > 0) { $this->id = $id; - $this->price = $price_ht; - $this->price_ttc = $price_ttc; - $this->price_min = $price_min_ht; - $this->price_min_ttc = $price_min_ttc; + $this->price = $price_ht; + $this->price_ttc = $price_ttc; + $this->price_min = $price_min_ht; + $this->price_min_ttc = $price_min_ttc; $result = $this->_log_price($user); if ($result > 0) { From a97ffa85537e7aeba782440ed006a1cc1fef18d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:16:28 +0100 Subject: [PATCH 10/51] fix phpstan --- htdocs/product/class/product.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3b34af84ed5..580983d03c0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -651,9 +651,25 @@ class Product extends CommonObject * @var array{}|array{nb_toproduce:int,nb_toconsume:int,qty_toproduce:float,qty_toconsume:float} */ public $stats_bom = array(); + + /** + * @var array{} + */ public $stats_mrptoconsume = array(); + + /** + * @var array{} + */ public $stats_mrptoproduce = array(); + + /** + * @var array{} + */ public $stats_facturerec = array(); + + /** + * @var array{} + */ public $stats_facture_fournisseur = array(); /** From 9738afbab532ba04d3932955f7ed9cca4439e3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:29:46 +0100 Subject: [PATCH 11/51] fix phpstan --- htdocs/product/class/product.class.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 580983d03c0..4b9d61e6b44 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -653,12 +653,12 @@ class Product extends CommonObject public $stats_bom = array(); /** - * @var array{} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} */ public $stats_mrptoconsume = array(); /** - * @var array{} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} */ public $stats_mrptoproduce = array(); @@ -3940,25 +3940,25 @@ class Product extends CommonObject if ($result) { while ($obj = $this->db->fetch_object($result)) { if ($obj->role == 'toconsume' && empty($warehouseid)) { - $this->stats_mrptoconsume['customers'] += $obj->nb_customers; - $this->stats_mrptoconsume['nb'] += $obj->nb; - $this->stats_mrptoconsume['rows'] += $obj->nb_rows; - $this->stats_mrptoconsume['qty'] += ($obj->qty ? $obj->qty : 0); + $this->stats_mrptoconsume['customers'] += (int) $obj->nb_customers; + $this->stats_mrptoconsume['nb'] += (int) $obj->nb; + $this->stats_mrptoconsume['rows'] += (int) $obj->nb_rows; + $this->stats_mrptoconsume['qty'] += ($obj->qty ? (float) $obj->qty : 0.0); } if ($obj->role == 'consumed' && empty($warehouseid)) { //$this->stats_mrptoconsume['customers'] += $obj->nb_customers; //$this->stats_mrptoconsume['nb'] += $obj->nb; //$this->stats_mrptoconsume['rows'] += $obj->nb_rows; - $this->stats_mrptoconsume['qty'] -= ($obj->qty ? $obj->qty : 0); + $this->stats_mrptoconsume['qty'] -= ($obj->qty ? (float) $obj->qty : 0.0); } if ($obj->role == 'toproduce') { if ($warehouseid) { - $this->stock_warehouse[$warehouseid]->stats_mrptoproduce['qty'] += ($obj->qty ? $obj->qty : 0); + $this->stock_warehouse[$warehouseid]->stats_mrptoproduce['qty'] += ($obj->qty ? (float) $obj->qty : 0.0); } else { - $this->stats_mrptoproduce['customers'] += $obj->nb_customers; - $this->stats_mrptoproduce['nb'] += $obj->nb; - $this->stats_mrptoproduce['rows'] += $obj->nb_rows; - $this->stats_mrptoproduce['qty'] += ($obj->qty ? $obj->qty : 0); + $this->stats_mrptoproduce['customers'] += (int) $obj->nb_customers; + $this->stats_mrptoproduce['nb'] += (int) $obj->nb; + $this->stats_mrptoproduce['rows'] += (int) $obj->nb_rows; + $this->stats_mrptoproduce['qty'] += ($obj->qty ? (float) $obj->qty : 0.0); } } if ($obj->role == 'produced') { From a30e367b9d96e92d88b0ba8990e11e6a726e713d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:40:48 +0100 Subject: [PATCH 12/51] fix phpstan --- htdocs/product/class/product.class.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4b9d61e6b44..66d3bbe97c6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -663,12 +663,12 @@ class Product extends CommonObject public $stats_mrptoproduce = array(); /** - * @var array{} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats facture rec */ public $stats_facturerec = array(); /** - * @var array{} + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats supplier invoices */ public $stats_facture_fournisseur = array(); @@ -3929,11 +3929,11 @@ class Product extends CommonObject $this->stats_mrptoconsume['customers'] = 0; $this->stats_mrptoconsume['nb'] = 0; $this->stats_mrptoconsume['rows'] = 0; - $this->stats_mrptoconsume['qty'] = 0; + $this->stats_mrptoconsume['qty'] = 0.0; $this->stats_mrptoproduce['customers'] = 0; $this->stats_mrptoproduce['nb'] = 0; $this->stats_mrptoproduce['rows'] = 0; - $this->stats_mrptoproduce['qty'] = 0; + $this->stats_mrptoproduce['qty'] = 0.0; } $result = $this->db->query($sql); @@ -4184,10 +4184,10 @@ class Product extends CommonObject $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $this->stats_facturerec['customers'] = $obj->nb_customers; - $this->stats_facturerec['nb'] = $obj->nb; - $this->stats_facturerec['rows'] = $obj->nb_rows; - $this->stats_facturerec['qty'] = $obj->qty ? $obj->qty : 0; + $this->stats_facturerec['customers'] = (int) $obj->nb_customers; + $this->stats_facturerec['nb'] = (int) $obj->nb; + $this->stats_facturerec['rows'] = (int) $obj->nb_rows; + $this->stats_facturerec['qty'] = $obj->qty ? (float) $obj->qty : 0.0; // if it's a virtual product, maybe it is in invoice by extension if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) { @@ -4258,10 +4258,10 @@ class Product extends CommonObject $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $this->stats_facture_fournisseur['suppliers'] = $obj->nb_suppliers; - $this->stats_facture_fournisseur['nb'] = $obj->nb; - $this->stats_facture_fournisseur['rows'] = $obj->nb_rows; - $this->stats_facture_fournisseur['qty'] = $obj->qty ? $obj->qty : 0; + $this->stats_facture_fournisseur['suppliers'] = (int) $obj->nb_suppliers; + $this->stats_facture_fournisseur['nb'] = (int) $obj->nb; + $this->stats_facture_fournisseur['rows'] = (int) $obj->nb_rows; + $this->stats_facture_fournisseur['qty'] = $obj->qty ? (float) $obj->qty : 0.0; $parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('loadStatsSupplierInvoice', $parameters, $this, $action); From e5449c7a67c7251f526a7e5a6b361c35a4a6457c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:53:16 +0100 Subject: [PATCH 13/51] fix phpstan --- htdocs/core/modules/modStock.class.php | 2 +- htdocs/product/class/product.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 1531a9245ae..bd6f23aeb9d 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -44,7 +44,7 @@ class modStock extends DolibarrModules */ public function __construct($db) { - global $langs; + global $conf, $langs; // do not remove $conf $this->db = $db; $this->numero = 52; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 66d3bbe97c6..a94aa6d490a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -653,12 +653,12 @@ class Product extends CommonObject public $stats_bom = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:float} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats mrp to consume */ public $stats_mrptoconsume = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:float} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats mrp to produce */ public $stats_mrptoproduce = array(); From e72f23895b5a609f2088fc851120893ee4fa2bc2 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 19:40:39 +0100 Subject: [PATCH 14/51] Fix regression --- 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 1531a9245ae..62b15d2116e 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -44,7 +44,7 @@ class modStock extends DolibarrModules */ public function __construct($db) { - global $langs; + global $conf, $langs; // $conf is used by inc.php $this->db = $db; $this->numero = 52; From 9733ac1f591defae61eeefa1b36875573bf90d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:03:59 +0100 Subject: [PATCH 15/51] fix phpstan --- build/phpstan/phpstan-baseline.neon | 36 ----------------------------- htdocs/public/payment/paymentok.php | 26 ++++++++------------- 2 files changed, 10 insertions(+), 52 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b436d3ce5d3..dd84a15d6e4 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -28482,42 +28482,6 @@ parameters: count: 1 path: ../../htdocs/public/payment/newpayment.php - - - message: '#^Variable \$PAYPAL_API_KO might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_OK might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_PASSWORD might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_SANDBOX might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_SIGNATURE might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_USER might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - message: '#^Variable \$attendee might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 8fa92e88b89..2abb3b01311 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -77,23 +77,17 @@ $hookmanager->initHooks(array('newpayment')); $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe")); // Clean parameters +$PAYPAL_API_USER = ""; +$PAYPAL_API_PASSWORD = ""; +$PAYPAL_API_SIGNATURE = ""; +$PAYPAL_API_SANDBOX = ""; +$PAYPALTOKEN = ""; +$PAYPALPAYERID = ""; if (isModEnabled('paypal')) { - $PAYPAL_API_USER = ""; - if (getDolGlobalString('PAYPAL_API_USER')) { - $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); - } - $PAYPAL_API_PASSWORD = ""; - if (getDolGlobalString('PAYPAL_API_PASSWORD')) { - $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); - } - $PAYPAL_API_SIGNATURE = ""; - if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { - $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); - } - $PAYPAL_API_SANDBOX = ""; - if (getDolGlobalString('PAYPAL_API_SANDBOX')) { - $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); - } + $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); + $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); + $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); + $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); /*$PAYPAL_API_OK = ""; if ($urlok) { $PAYPAL_API_OK = $urlok; From 0f3098689038bed1d79e296ee984b3b3f34a9d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:07:27 +0100 Subject: [PATCH 16/51] fix phpstan --- htdocs/public/payment/paymentko.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index f99deda6845..a8ae18fb64d 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -71,7 +71,8 @@ if (isModEnabled('paypal')) { */ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe")); - +$PAYPALTOKEN = ""; +$PAYPALPAYERID = ""; if (isModEnabled('paypal')) { $PAYPALTOKEN = GETPOST('TOKEN'); if (empty($PAYPALTOKEN)) { From 58e2cd6afdc465ef9c22a6d142bd1273028560a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:12:03 +0100 Subject: [PATCH 17/51] fix phpstan --- htdocs/public/payment/newpayment.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 54af1723370..048f523bc08 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -231,6 +231,8 @@ $ref = $REF = GETPOST('ref', 'alpha'); $TAG = GETPOST("tag", 'alpha'); $FULLTAG = GETPOST("fulltag", 'alpha'); // fulltag is tag with more information $SECUREKEY = GETPOST("securekey"); // Secure key +$PAYPAL_API_OK = ""; +$PAYPAL_API_KO = ""; if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) { $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; From 8716550a9a2e878214c5ce7558343148482431c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:14:49 +0100 Subject: [PATCH 18/51] fix phpstan --- htdocs/public/payment/newpayment.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 048f523bc08..b7da4eded52 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -233,6 +233,7 @@ $FULLTAG = GETPOST("fulltag", 'alpha'); // fulltag is tag with more information $SECUREKEY = GETPOST("securekey"); // Secure key $PAYPAL_API_OK = ""; $PAYPAL_API_KO = ""; +$PAYPAL_API_SANDBOX = ""; if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) { $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; @@ -286,7 +287,11 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @phan-var-force string $PAYPAL_API_OK @phan-var-force string $PAYPAL_API_KO '; - +/** +* @var string $PAYPAL_API_SANDBOX +* @var string $PAYPAL_API_OK +* @var string $PAYPAL_API_KO +*/ if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From d2754efbe4d87166d2f928986a9752c2c0e193ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:23:04 +0100 Subject: [PATCH 19/51] fix phpstan --- htdocs/public/payment/newpayment.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b7da4eded52..78a4b96e72e 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -234,6 +234,9 @@ $SECUREKEY = GETPOST("securekey"); // Secure key $PAYPAL_API_OK = ""; $PAYPAL_API_KO = ""; $PAYPAL_API_SANDBOX = ""; +$PAYPAL_API_USER = ""; +$PAYPAL_API_PASSWORD = ""; +$PAYPAL_API_SIGNATURE = ""; if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) { $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; @@ -288,10 +291,12 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @phan-var-force string $PAYPAL_API_KO '; /** -* @var string $PAYPAL_API_SANDBOX -* @var string $PAYPAL_API_OK -* @var string $PAYPAL_API_KO -*/ + * @var string $PAYPAL_API_SANDBOX + * @var string $PAYPAL_API_OK + * @var string $PAYPAL_API_KO + * @var string $PAYPAL_API_PASSWORD + * @var string $PAYPAL_API_SIGNATURE + */ if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From 69ecc4c74368ea3b8bde08e21f3f9787c17d71c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:28:56 +0100 Subject: [PATCH 20/51] fix phpstan --- htdocs/public/payment/newpayment.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 78a4b96e72e..7b1f8ab4226 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -290,14 +290,9 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @phan-var-force string $PAYPAL_API_OK @phan-var-force string $PAYPAL_API_KO '; -/** - * @var string $PAYPAL_API_SANDBOX - * @var string $PAYPAL_API_OK - * @var string $PAYPAL_API_KO - * @var string $PAYPAL_API_PASSWORD - * @var string $PAYPAL_API_SIGNATURE - */ + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { + global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From a7614342cd041473db3d5019db3e870f8001b030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:38:48 +0100 Subject: [PATCH 21/51] fix phpstan --- htdocs/paypal/lib/paypalfunctions.lib.php | 27 +++++++---------------- htdocs/public/payment/newpayment.php | 2 +- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/htdocs/paypal/lib/paypalfunctions.lib.php b/htdocs/paypal/lib/paypalfunctions.lib.php index b3a714489a2..eba524caab4 100644 --- a/htdocs/paypal/lib/paypalfunctions.lib.php +++ b/htdocs/paypal/lib/paypalfunctions.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2024 MDW +/* Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2011 Regis Houssin + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,22 +58,10 @@ if (getDolGlobalString('PAYPAL_API_SANDBOX') || GETPOST('forcesandbox', 'alpha') } // Clean parameters -$PAYPAL_API_USER = ""; -if (getDolGlobalString('PAYPAL_API_USER')) { - $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); -} -$PAYPAL_API_PASSWORD = ""; -if (getDolGlobalString('PAYPAL_API_PASSWORD')) { - $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); -} -$PAYPAL_API_SIGNATURE = ""; -if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { - $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); -} -$PAYPAL_API_SANDBOX = ""; -if (getDolGlobalString('PAYPAL_API_SANDBOX')) { - $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); -} +$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); +$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); +$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); +$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); // Proxy $PROXY_HOST = getDolGlobalString('MAIN_PROXY_HOST'); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 7b1f8ab4226..3ad6cbb59fa 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -292,7 +292,7 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & '; if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { - global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; + global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From a85bb16de514d6ed8376a1d003dfc782db7c6978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:44:48 +0100 Subject: [PATCH 22/51] fix phpstan --- htdocs/paypal/lib/paypal.lib.php | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 15ed29f8d9f..cd942116585 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2011-2012 Regis Houssin - * Copyright (C) 2024 MDW +/* Copyright (C) 2008-2012 Laurent Destailleur + * Copyright (C) 2011-2012 Regis Houssin + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -467,22 +468,10 @@ function hash_call($methodName, $nvpStr) } // Clean parameters - $PAYPAL_API_USER = ""; - if (getDolGlobalString('PAYPAL_API_USER')) { - $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); - } - $PAYPAL_API_PASSWORD = ""; - if (getDolGlobalString('PAYPAL_API_PASSWORD')) { - $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); - } - $PAYPAL_API_SIGNATURE = ""; - if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { - $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); - } - $PAYPAL_API_SANDBOX = ""; - if (getDolGlobalString('PAYPAL_API_SANDBOX')) { - $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); - } + $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); + $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); + $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); + $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); // TODO END problem with triggers dol_syslog("Paypal API endpoint ".$API_Endpoint); @@ -514,8 +503,8 @@ function hash_call($methodName, $nvpStr) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ($ssl_verifypeer ? true : false)); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? true : false)); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, !getDolGlobalString('MAIN_USE_CONNECT_TIMEOUT') ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); - curl_setopt($ch, CURLOPT_TIMEOUT, !getDolGlobalString('MAIN_USE_RESPONSE_TIMEOUT') ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, getDolGlobalInt('MAIN_USE_CONNECT_TIMEOUT', 5)); + curl_setopt($ch, CURLOPT_TIMEOUT, getDolGlobalInt('MAIN_USE_RESPONSE_TIMEOUT', 30)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); From d01d63da0b99c514323c5d8bfd384bac91100634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:53:45 +0100 Subject: [PATCH 23/51] fix phpstan --- htdocs/paypal/admin/paypal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 22a53c5d1ef..fab3c789429 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -267,7 +267,7 @@ if (isModEnabled("bank")) { print ''; print $langs->trans("CSSUrlForPaymentForm").''; print ''; -print '   '.$langs->trans("Example").': http://mysite/mycss.css'; +print '   '.$langs->trans("Example").': https://mysite/mycss.css'; print ''; From 4ec1b7a5465441ab951db4948a806ae9b194d2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 21:03:15 +0100 Subject: [PATCH 24/51] fix phpstan --- htdocs/paypal/admin/paypal.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index fab3c789429..0c3f08e241d 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -374,17 +374,19 @@ print 'Your API authentication information can be found with following steps. We print ''; if (!empty($conf->use_javascript_ajax)) { - print "\n".''; + print ' + + '; } print '

'; From f2430b0d7f31945fc1abcc203e2070957aa900ee Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:42:03 +0200 Subject: [PATCH 25/51] Fix space --- htdocs/langs/en_US/mails.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index c2a7d07b030..b7ca6c62f19 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -32,7 +32,7 @@ NewMailing=New mass Email NewSMSing=New smsing EditMailing=Edit mass Email ResetMailing=Resend mass Email -ConfirmResetMailingTargetMassaction=Confirmation of the reset of targets statusin error +ConfirmResetMailingTargetMassaction=Confirmation of the reset of targets status in error ResetMailingTargetMassaction=Reset status in error DeleteMailing=Delete mass Email PreviewMailing=Preview mass Email From f07ca2a9141d0aa39ceba2995ffba7e79e2c36a8 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 14:39:49 +0100 Subject: [PATCH 26/51] css --- htdocs/theme/eldy/global.inc.php | 5 ++--- htdocs/theme/md/style.css.php | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 15558ad11d7..88adc86552b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4695,12 +4695,11 @@ table.hidepaginationnext .paginationnext { } - /* Set the color for hover lines */ -.oddeven:hover, .evenodd:hover, .oddevenimport:hover, .evenoddimport:hover, .impair:hover, .pair:hover -{ +.oddeven:hover:not(.nohover), .evenodd:hover:not(.nohover), .oddevenimport:hover:not(.nohover), .evenoddimport:hover:not(.nohover), .impair:hover:not(.nohover), .pair:hover:not(.nohover) { background: var(--colorbacklinepairhover) !important; /* Must be background to be stronger than background of odd or even */ } + .tredited, .tredited td { background: var(--colorbacklinepairchecked) !important; /* Must be background to be stronger than background of odd or even */ border-bottom: 0 !important; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fcdc79aeb95..8dbb46a008d 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4761,7 +4761,6 @@ ul.noborder li:nth-child(odd):not(.liste_titre) { /* Set the color for hover lines */ - .tmenucompanylogo.nohover, .tmenucompanylogo.nohover:hover { opacity: unset !important; } @@ -4770,11 +4769,11 @@ ul.noborder li:nth-child(odd):not(.liste_titre) { box-shadow: unset; -webkit-box-shadow: unset; } - -.oddeven:hover, .evenodd:hover, .oddevenimport:hover, .evenoddimport:hover, .impair:hover, .pair:hover +.oddeven:hover:not(.nohover), .evenodd:hover:not(.nohover), .oddevenimport:hover:not(.nohover), .evenoddimport:hover:not(.nohover), .impair:hover:not(.nohover), .pair:hover:not(.nohover) { { background: rgb() !important; } + .tredited { background: rgb() !important; /* Must be background to be stronger than background of odd or even */ } From f5206566904279370f8ae3ead1e6077c2b970f3e Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 14:47:48 +0100 Subject: [PATCH 27/51] Fix warning --- htdocs/admin/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 2fe24da05e9..0aa392a0c52 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -61,16 +61,16 @@ print load_fiche_titre($langs->trans("SetupArea"), '', 'tools'); if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) { - $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('//i', '
', $conf->global->MAIN_MOTD_SETUPPAGE); + $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('//i', '
', getDolGlobalString('MAIN_MOTD_SETUPPAGE')); if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) { $i = 0; $reg = array(); - while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) { + while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', getDolGlobalString('MAIN_MOTD_SETUPPAGE'), $reg) && $i < 100) { $tmp = explode('|', $reg[1]); if (!empty($tmp[1])) { $langs->load($tmp[1]); } - $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE); + $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), getDolGlobalString('MAIN_MOTD_SETUPPAGE')); $i++; } From 32924c1811383f9ac93290ee1e483c3f3fd0a0c9 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 14:59:47 +0100 Subject: [PATCH 28/51] Debug v21 --- htdocs/core/class/extrafields.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ecb4ada7f88..752a1527f5b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2011,7 +2011,6 @@ class ExtraFields } //if ($computed) $value = // $value is already calculated into $value before calling this method - $showsize = 0; if ($type == 'date') { $showsize = 10; @@ -2039,9 +2038,9 @@ class ExtraFields } elseif ($type == 'double') { if (!empty($value)) { //$value=price($value); - $sizeparts = explode(",", $size); - $number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0; - $value = price($value, 0, $outputlangs, 0, 0, $number_decimals, ''); + //$sizeparts = explode(",", $size); + //$number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0; + $value = price($value, 0, $outputlangs, 0, 0, -2, ''); } } elseif ($type == 'boolean') { $checked = ''; From 02ae579a3f864943d17e3c9d6622579bce378b11 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 15:42:14 +0100 Subject: [PATCH 29/51] Add information to help debug --- htdocs/core/lib/functions.lib.php | 21 ++++++++++++++++++++- htdocs/core/tpl/objectline_view.tpl.php | 17 +++++++++++++++-- htdocs/langs/en_US/main.lang | 3 +++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dac7bfdc92f..a3849578d8b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11733,7 +11733,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) */ function showDirectDownloadLink($object) { - global $conf, $langs; + global $langs; $out = ''; $url = $object->getLastMainDocLink($object->element); @@ -11845,6 +11845,25 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param } } +/** + * Make content of an input box selected when we click into input field. + * + * @param int $idcode Id of special code + * @return string + */ +function getLabelSpecialCode($idcode) +{ + global $langs; + + $arrayspecialines = array(1 => 'Transport', 2 => 'EcoTax', 3 => 'Option'); + if ($idcode > 10) { + return 'Module ID '.$idcode; + } + if (!empty($arrayspecialines[$idcode])) { + return $langs->trans($arrayspecialines[$idcode]); + } + return ''; +} /** * Make content of an input box selected when we click into input field. diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index e50370f4c45..1d9e118cee3 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -312,8 +312,8 @@ $tooltiponpricemultiprice = ''; $tooltiponpriceend = ''; $tooltiponpriceendmultiprice = ''; if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht, 0, '', 0, 0); - $tooltiponpricemultiprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->multicurrency_total_ht, 0, '', 0, 0); + $tooltiponprice .= $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht, 0, '', 0, 0); + $tooltiponpricemultiprice .= $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->multicurrency_total_ht, 0, '', 0, 0); $tooltiponprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva, 0, '', 0, 0); $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->multicurrency_total_tva, 0, '', 0, 0); if (is_object($object->thirdparty)) { @@ -347,6 +347,19 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc, 0, '', 0, 0); $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->multicurrency_total_ttc, 0, '', 0, 0); + if (!empty($line->special_code) || $line->product_type == 9) { + $tooltiponprice .= '
'; + $tooltiponpricemultiprice .= '
'; + if (!empty($line->special_code)) { + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + } + if ($line->product_type == 9) { + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); + } + } + $tooltiponprice = ''; $tooltiponpricemultiprice = ''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 4b451e58c72..744d4dfed24 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1341,3 +1341,6 @@ Operator=Operator AllFieldsRequired=All fields are required. IsDefined=Is defined IsNotDefined=Is not defined +SpecialLine=Special Line +EcoTax=Eco-Tax +GroupingLine=Grouping line From c7eb63f41f490c90557ac7f17ddd6cbcf6cf5edd Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 16:44:06 +0100 Subject: [PATCH 30/51] Try to close a TODO --- htdocs/admin/mails.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index b4e9267eec0..afda0e31733 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -1059,9 +1059,24 @@ if ($action == 'edit') { $text .= /* ($text ? '

' : ''). */$langs->trans("WarningPHPMailSPF", getDolGlobalString('MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD')); } if (getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')) { // Not defined by default. Depend on platform. + $ipstoshow = ''; // List of IP shown as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]' - // TODO Add a key to allow to show the IP/name of server detected dynamically - $text .= ($text ? '

' : '').$langs->trans("WarningPHPMail2", getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')); + $arrayipstoshow = explode(',', getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')); + foreach ($arrayipstoshow as $iptoshow) { + // If MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is an URL to get/show the public IP/name of server detected dynamically + if (preg_match('/^http/i', $iptoshow)) { + $tmpresult = getURLContent($iptoshow, 'GET', '', 1, array(), array('http', 'https'), 0); + if (!empty($tmpresult['content'])) { + $iptoshow = $tmpresult['content']; + } else { + $iptoshow = ''; // Failed to get IP + } + } + $ipstoshow .= ($ipstoshow ? ', ' : '').trim($iptoshow); + } + if ($ipstoshow) { + $text .= ($text ? '

' : '').$langs->trans("WarningPHPMail2", $ipstoshow); + } } } From c2c3f2ff45687e0e9ecdf7ce1d723c59d81bba08 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 12 Dec 2024 16:47:31 +0100 Subject: [PATCH 31/51] FIX to have two lists with total on same screen --- htdocs/core/tpl/list_print_total.tpl.php | 77 ++++++++++++------------ 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 3e6af0c8a20..d79d844484c 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -23,6 +23,46 @@ */ '@phan-var-force array{nbfield:int,type?:array,pos?:array,val?:array} $totalarray'; +if (!function_exists('printTotalValCell')) { // allow two list with total on same screen + + /** print a total cell value according to its type + * + * @param string $type of field (duration, string..) + * @param string $val the value to display + * + * @return void (direct print) + */ + function printTotalValCell($type, $val) + { + // if $totalarray['type'] not present we consider it as number + if (empty($type)) { + $type = 'real'; + } + switch ($type) { + case 'duration': + print ''; + print(!empty($val) ? convertSecondToTime((int) $val, 'allhourmin') : 0); + print ''; + break; + case 'string': // This type is no more used. type is now varchar(x) + print ''; + print(!empty($val) ? $val : ''); + print ''; + break; + case 'stock': + print ''; + print price2num(!empty($val) ? $val : 0, 'MS'); + print ''; + break; + default: + print ''; + print price(!empty($val) ? $val : 0); + print ''; + break; + } + } +} + // Move fields of totalizable into the common array pos and val if (!empty($totalarray['totalizable']) && is_array($totalarray['totalizable'])) { foreach ($totalarray['totalizable'] as $keytotalizable => $valtotalizable) { @@ -107,40 +147,3 @@ if (isset($totalarray['pos'])) { } //print ''; } - -/** print a total cell value according to its type - * - * @param string $type of field (duration, string..) - * @param string $val the value to display - * - * @return void (direct print) - */ -function printTotalValCell($type, $val) -{ - // if $totalarray['type'] not present we consider it as number - if (empty($type)) { - $type = 'real'; - } - switch ($type) { - case 'duration': - print ''; - print(!empty($val) ? convertSecondToTime((int) $val, 'allhourmin') : 0); - print ''; - break; - case 'string': // This type is no more used. type is now varchar(x) - print ''; - print(!empty($val) ? $val : ''); - print ''; - break; - case 'stock': - print ''; - print price2num(!empty($val) ? $val : 0, 'MS'); - print ''; - break; - default: - print ''; - print price(!empty($val) ? $val : 0); - print ''; - break; - } -} From 3d02e406d82acb3009cc77737015b3c56680fc7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Thu, 12 Dec 2024 17:05:21 +0100 Subject: [PATCH 32/51] FIX: camelcase for getLabelSpecialCode() calling --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e118cee3..9e34f4ba39f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -351,8 +351,8 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'; $tooltiponpricemultiprice .= '
'; if (!empty($line->special_code)) { - $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); - $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); } if ($line->product_type == 9) { $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); From b4bf92018ec6f87d4269df6843c8b89877bc1fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 12 Dec 2024 20:46:16 +0100 Subject: [PATCH 33/51] fix phpstan --- build/phpstan/phpstan-baseline.neon | 12 ------------ htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- htdocs/cron/class/cronjob.class.php | 4 ++-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b436d3ce5d3..d64771c69b9 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17394,18 +17394,6 @@ parameters: count: 4 path: ../../htdocs/cron/class/cronjob.class.php - - - message: '#^Variable \$ExecTimeLimit in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/cron/class/cronjob.class.php - - - - message: '#^Variable \$MemoryLimit in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/cron/class/cronjob.class.php - - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e118cee3..9e34f4ba39f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -351,8 +351,8 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'; $tooltiponpricemultiprice .= '
'; if (!empty($line->special_code)) { - $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); - $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); } if ($line->product_type == 9) { $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index f7bb85395c8..455002b097a 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1223,7 +1223,7 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs jobtype=".$this->jobtype." userlogin=".$userlogin, LOG_DEBUG); // Increase limit of time. Works only if we are not in safe mode - $ExecTimeLimit = 600; + $ExecTimeLimit = getDolGlobalInt('MAIN_CRON_EXEC_TIME_LIMIT', 600); if (!empty($ExecTimeLimit)) { $err = error_reporting(); error_reporting(0); // Disable all errors @@ -1231,7 +1231,7 @@ class Cronjob extends CommonObject @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 error_reporting($err); } - $MemoryLimit = 0; + $MemoryLimit = getDolGlobalString('MAIN_CRON_EXEC_TIME_LIMIT'); if (!empty($MemoryLimit)) { @ini_set('memory_limit', $MemoryLimit); } From 923e85f0a811e061174d141b8da31f2acdee2c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 12 Dec 2024 20:55:03 +0100 Subject: [PATCH 34/51] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/projet/tasks.php | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index d64771c69b9..58850605ffd 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -27804,12 +27804,6 @@ parameters: count: 2 path: ../../htdocs/projet/tasks.php - - - message: '#^Variable \$param might not be defined\.$#' - identifier: variable.undefined - count: 17 - path: ../../htdocs/projet/tasks.php - - message: '#^Variable \$permissiontodelete might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 6df3685b01a..7d41c983205 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -448,6 +448,7 @@ $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-project page-card_tasks'); $arrayofselected = is_array($toselect) ? $toselect : array(); +$param = ''; if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); From f5f4e500bdfe176612b34b6ee61371df02b2d076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 12 Dec 2024 21:06:51 +0100 Subject: [PATCH 35/51] fix phpstan --- build/phpstan/phpstan-baseline.neon | 18 ------------------ htdocs/core/actions_massactions.inc.php | 3 +++ htdocs/cron/class/cronjob.class.php | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 58850605ffd..36791e8dce0 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -8196,12 +8196,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 14 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$from might not be defined\.$#' identifier: variable.undefined @@ -8220,12 +8214,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$month might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable @@ -8256,12 +8244,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$year might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$classfile might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 94964dfae8e..82a25fd2678 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -55,10 +55,13 @@ * @var ?string $objectlabel * @var ?string $option * @var ?int $deliveryreceipt + * @var string $action * @var string $massaction * @var string $objectclass * @var string $uploaddir * @var string $confirm + * @var string $month + * @var string $year * @var int $error */ ' diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 455002b097a..b814567f710 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1231,7 +1231,7 @@ class Cronjob extends CommonObject @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 error_reporting($err); } - $MemoryLimit = getDolGlobalString('MAIN_CRON_EXEC_TIME_LIMIT'); + $MemoryLimit = getDolGlobalString('MAIN_CRON_MEMORY_LIMIT'); if (!empty($MemoryLimit)) { @ini_set('memory_limit', $MemoryLimit); } From 064846f4c99f5ced9f047d7c6867097643d3a059 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 00:53:18 +0100 Subject: [PATCH 36/51] Trans --- htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/fr_FR/main.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 744d4dfed24..16db52a9770 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -498,7 +498,7 @@ ActionRunningNotStarted=To start ActionRunningShort=In progress ActionDoneShort=Finished ActionUncomplete=Incomplete -LatestLinkedEvents=Latest %s linked events +LatestLinkedEvents=The last %s events CompanyFoundation=Company/Organization Accountant=Accountant ContactsForCompany=Contacts for this third party diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 22a9411997d..3c45a60d556 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -496,7 +496,7 @@ ActionRunningNotStarted=A réaliser ActionRunningShort=En cours ActionDoneShort=Terminé ActionUncomplete=Incomplet -LatestLinkedEvents=Les %s derniers événements liés +LatestLinkedEvents=Les %s derniers événements CompanyFoundation=Société/Organisation Accountant=Comptable ContactsForCompany=Contacts de ce tiers From 1443e48a309e6356543010905ffdedc38ad357d8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 07:34:49 +0100 Subject: [PATCH 37/51] FIX missing init function to create accounting table --- htdocs/core/modules/modAccounting.class.php | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 1dc084ee7cd..a630b1f9fd3 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -400,4 +400,37 @@ class modAccounting extends DolibarrModules 'b.multicurrency_code'=>"US (Necessary if devise is different than EUR)", ); } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + $result = $this->_load_tables('/install/mysql/', 'accounting'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + + $sql = array(); + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function remove($options = '') + { + $sql = array(); + return $this->_remove($sql, $options); + } } From 977aa546f1f24c29651df2994a4c726a10e2ba51 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 07:43:15 +0100 Subject: [PATCH 38/51] FIX phpstan error --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e118cee3..9e34f4ba39f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -351,8 +351,8 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'; $tooltiponpricemultiprice .= '
'; if (!empty($line->special_code)) { - $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); - $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); } if ($line->product_type == 9) { $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); From dd918323cf9fca2c1a286e1ee8dd07a6da193ccd Mon Sep 17 00:00:00 2001 From: Hystepik Date: Fri, 13 Dec 2024 09:50:29 +0100 Subject: [PATCH 39/51] Fix #32352 upload file and URL form on firefox --- htdocs/core/class/html.formfile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8c7524cd1a2..8623377e7ad 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1387,7 +1387,7 @@ class FormFile // Show title of list of existing files $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); }'; + $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); void(0);}'; $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline); } @@ -2221,7 +2221,7 @@ class FormFile $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open addlink form"); jQuery(".divlinkfile").toggle();', '', $permissiontoedit); + $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open addlink form"); jQuery(".divlinkfile").toggle(); void(0);', '', $permissiontoedit); } // Show list of associated links From a5d4be4a66a0c6e94c4786a60927a4a628334c39 Mon Sep 17 00:00:00 2001 From: Hystepik Date: Fri, 13 Dec 2024 09:55:50 +0100 Subject: [PATCH 40/51] better fix for file --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8623377e7ad..b7f6f705ece 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1387,7 +1387,7 @@ class FormFile // Show title of list of existing files $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); void(0);}'; + $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click();}void(0);'; $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline); } From 9c5d76cbd9d494a9d7b5fe0ab4114df3f78a6dd5 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 12:00:57 +0100 Subject: [PATCH 41/51] FIX #32355 Add mising POS ID in unalterable log --- htdocs/blockedlog/class/blockedlog.class.php | 5 +++-- htdocs/compta/facture/list.php | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index ef209ae6b85..00a158952f0 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -169,7 +169,7 @@ class BlockedLog // Customer Invoice/Facture / Payment if (isModEnabled('invoice')) { $this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE'; - $this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE'; + //$this->trackedevents['BILL_UPDATE'] = 'logBILL_UPDATE'; $this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL'; $this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload'; $this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview'; @@ -532,7 +532,8 @@ class BlockedLog continue; // Discard some properties } if (!in_array($key, array( - 'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines' + 'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines', + 'module_source', 'pos_source' ))) { continue; // Discard if not into a dedicated list } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 33f8026d589..a13fce05ea5 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2343,10 +2343,10 @@ if ($num > 0) { } // Type ent if (!empty($arrayfields['typent.code']['checked'])) { - print ''; if (!is_array($typenArray) || count($typenArray) == 0) { $typenArray = $formcompany->typent_array(1); } + print ''; if (!empty($obj->typent_code)) { print $typenArray[$obj->typent_code]; } @@ -2357,10 +2357,10 @@ if ($num > 0) { } // Staff if (!empty($arrayfields['staff.code']['checked'])) { - print ''; if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) { $conf->cache['staff'] = $formcompany->effectif_array(1); } + print ''; print $conf->cache['staff'][$obj->staff_code]; print ''; if (!$i) { @@ -2532,8 +2532,6 @@ if ($num > 0) { } } //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; } print ''; if (!$i) { From 48336356524a063b91f89e0c7790916935a38156 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 12:40:05 +0100 Subject: [PATCH 42/51] Debug v21 --- htdocs/blockedlog/admin/blockedlog_list.php | 28 +++++++++++--------- htdocs/blockedlog/class/blockedlog.class.php | 8 +++--- htdocs/langs/en_US/blockedlog.lang | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 95da9f8f9ee..71178aff819 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -502,9 +502,6 @@ print ''; // Ref print ''; -// Link to ref -print ''; - // Amount print ''; @@ -521,6 +518,9 @@ print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors print ''; // Status note +//print ''; + +// Link to original ref into business software print ''; // Action column @@ -543,12 +543,12 @@ print getTitleFieldOfList($langs->trans('Date'), 0, $_SERVER["PHP_SELF"], 'date_ print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"], 'user_fullname', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n"; -print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ')."\n"; print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp').'
'.$langs->trans('DataOfArchivedEventHelp2'), 1)."\n"; print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; -print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +//print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, 'class="center"', $sortfield, $sortorder, '')."\n"; @@ -633,12 +633,6 @@ if (is_array($blocks)) { print dol_escape_htmltag($block->ref_object); print ''; - // Link to source object - print ''; - print ''; // $object_link can be a ''; - // Amount print ''.price($block->amounts).''; @@ -666,13 +660,15 @@ if (is_array($blocks)) { } else { print 'OK'; } - print ''; + //print ''; // Note - print ''; + //print ''; if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error if ($checkresult[$block->id]) { print $form->textwithpicto('', $langs->trans('OkCheckFingerprintValidityButChainIsKo')); + } else { + //print $form->textwithpicto('', $langs->trans('KoCheckFingerprintValidity')); } } @@ -681,6 +677,12 @@ if (is_array($blocks)) { } print ''; + // Link to source object + print ''; + print ''; // $object_link can be a ''; + // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 00a158952f0..dda8647e791 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -902,12 +902,10 @@ class BlockedLog */ public function create($user, $forcesignature = '') { - global $conf, $langs, $hookmanager; + global $conf, $langs; $langs->load('blockedlog'); - $error = 0; - // Clean data $this->amounts = (float) $this->amounts; @@ -942,9 +940,9 @@ class BlockedLog $this->db->begin(); - $previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done + $previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done and transaction closed - $keyforsignature = $this->buildKeyForSignature(); + $keyforsignature = $this->buildKeyForSignature(); // All the information for the has (meta data + data saved) include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 75ab23f6b73..9b74b8a787c 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -7,7 +7,7 @@ BrowseBlockedLog=Unalterable logs ShowAllFingerPrintsMightBeTooLong=Show all archived logs (might be long) ShowAllFingerPrintsErrorsMightBeTooLong=Show all non-valid archive logs (might be long) DownloadBlockChain=Download fingerprints -KoCheckFingerprintValidity=Archived log entry is not valid. It means someone (a hacker?) has modified some data of this record after it was recorded, or has erased the previous archived record (check that line with previous # exists) or has modified checksum of the previous record. +KoCheckFingerprintValidity=Archived log entry is not valid. It means someone (a hacker?) has modified some data of this record after it was recorded, OR has erased the previous archived record (check that the line with previous # exists) OR has modified the checksum of the previous record. OkCheckFingerprintValidity=Archived log record is valid. The data on this line was not modified and the entry follows the previous one. OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to previous one but the chain was corrupted previously. AddedByAuthority=Stored into remote authority From 837fadcc7a23d83c2f1662b4ceb81a4bdfe56cad Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 12:53:55 +0100 Subject: [PATCH 43/51] Fix filter on event type --- htdocs/blockedlog/admin/blockedlog_list.php | 7 +++-- htdocs/blockedlog/class/blockedlog.class.php | 32 ++++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 71178aff819..376120d7981 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -80,7 +80,7 @@ $search_end = -1; if (GETPOST('search_endyear') != '') { $search_end = dol_mktime(23, 59, 59, $search_endmonth, $search_endday, $search_endyear); } -$search_code = GETPOST('search_code', 'alpha'); +$search_code = GETPOST('search_code', 'array:alpha'); $search_ref = GETPOST('search_ref', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); @@ -138,7 +138,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_fk_user = ''; $search_start = -1; $search_end = -1; - $search_code = ''; + $search_code = array(); $search_ref = ''; $search_amount = ''; $search_showonlyerrors = 0; @@ -496,7 +496,8 @@ print ''; // Actions code print ''; -print $form->selectarray('search_code', $block_static->trackedevents, $search_code, 1, 0, 0, '', 1, 0, 0, 'ASC', 'maxwidth150', 1); +//print $form->selectarray('search_code', $block_static->trackedevents, $search_code, 1, 0, 0, '', 1, 0, 0, 'ASC', 'maxwidth150', 1); +print $form->multiselectarray('search_code', $block_static->trackedevents, $search_code, 0, 0, 'maxwidth150', 1); print ''; // Ref diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index dda8647e791..b970612e1c5 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1141,17 +1141,17 @@ class BlockedLog /** * Return array of log objects (with criteria) * - * @param string $element element to search - * @param int $fk_object id of object to search - * @param int<0,max> $limit max number of element, 0 for all - * @param string $sortfield sort field - * @param string $sortorder sort order - * @param int $search_fk_user id of user(s) - * @param int $search_start start time limit - * @param int $search_end end time limit - * @param string $search_ref search ref - * @param string $search_amount search amount - * @param string $search_code search code + * @param string $element element to search + * @param int $fk_object id of object to search + * @param int<0,max> $limit max number of element, 0 for all + * @param string $sortfield sort field + * @param string $sortorder sort order + * @param int $search_fk_user id of user(s) + * @param int $search_start start time limit + * @param int $search_end end time limit + * @param string $search_ref search ref + * @param string $search_amount search amount + * @param string|array $search_code search code * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') @@ -1194,8 +1194,14 @@ class BlockedLog if ($search_amount != '') { $sql .= natural_search("amounts", $search_amount, 1); } - if ($search_code != '' && $search_code != '-1') { - $sql .= natural_search("action", $search_code, 3); + if (is_array($search_code)) { + if (!empty($search_code)) { + $sql .= natural_search("action", implode(',', $search_code), 3); + } + } else { + if ($search_code != '' && $search_code != '-1') { + $sql .= natural_search("action", $search_code, 3); + } } $sql .= $this->db->order($sortfield, $sortorder); From 738abd9d5cb2ec7e1a1efc4bae8a1f25167533c8 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 13:03:26 +0100 Subject: [PATCH 44/51] Fix missing unit price in the unalterable log --- htdocs/blockedlog/class/blockedlog.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index b970612e1c5..eafe04365f7 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -543,7 +543,13 @@ class BlockedLog $lineid++; foreach ($tmpline as $keyline => $valueline) { if (!in_array($keyline, array( - 'ref', 'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', 'qty', 'product_type', 'product_label', 'vat_src_code', 'tva_tx', 'info_bits', 'localtax1_tx', 'localtax2_tx', 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2' + 'ref', 'product_type', 'product_label', + 'qty', + 'subprice', + 'vat_src_code', 'tva_tx', 'localtax1_tx', 'localtax2_tx', + 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2', + 'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', + 'info_bits', 'special_code', ))) { continue; // Discard if not into a dedicated list } From 5da555e7eb1764bf11cb4fb3935a4d8ecb8f702c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 13:05:42 +0100 Subject: [PATCH 45/51] Trans --- htdocs/blockedlog/admin/blockedlog_list.php | 6 ++++-- htdocs/langs/en_US/blockedlog.lang | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 376120d7981..01cb2c58f1c 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -545,9 +545,9 @@ print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"], 'use print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ')."\n"; -print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp').'
'.$langs->trans('DataOfArchivedEventHelp2'), 1)."\n"; +print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp'), 1)."\n"; print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; -print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +print getTitleFieldOfList($form->textwithpicto($langs->trans('Status'), $langs->trans('DataOfArchivedEventHelp2')), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; //print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; // Action column @@ -671,6 +671,8 @@ if (is_array($blocks)) { } else { //print $form->textwithpicto('', $langs->trans('KoCheckFingerprintValidity')); } + } else { + //print $form->textwithpicto('', $langs->trans('DataOfArchivedEventHelp2')); } if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY') && getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL')) { diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 9b74b8a787c..3b399063ad2 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -18,9 +18,9 @@ BlockedlogInfoDialog=Log Details ListOfTrackedEvents=List of tracked events Fingerprint=Fingerprint DownloadLogCSV=Export archived logs (CSV) -DataOfArchivedEvent=Full data of archived event -DataOfArchivedEventHelp=This field contains the unalterable and structured data that was archived on real time. Even if some parent business event could have been purged or modified, the data archived here is the original data, and it can't be modified. -DataOfArchivedEventHelp2=Its integrity is guaranteed if the status of the line is OK +DataOfArchivedEvent=Complementary data of archived event +DataOfArchivedEventHelp=This field contains the complementary data that was archived on real time. Even if some parent business event could have been purged or modified, the data archived here is the original data, and it can't be modified. +DataOfArchivedEventHelp2=The integrity of data on each lines is guaranteed if the status of the line is OK ImpossibleToReloadObject=Original object (type %s, id %s) not linked (see 'Full datas' column to get unalterable saved data) BlockedLogAreRequiredByYourCountryLegislation=Unalterable Logs module may be required by the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit. BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs module was activated because of the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they cannot be validated by a tax audit. From 33ca018120e561bf24fd82a75a44d3264447765b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:03:20 +0100 Subject: [PATCH 46/51] fix CI --- htdocs/blockedlog/class/blockedlog.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index eafe04365f7..c539f2774a9 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1157,7 +1157,7 @@ class BlockedLog * @param int $search_end end time limit * @param string $search_ref search ref * @param string $search_amount search amount - * @param string|array $search_code search code + * @param string|string[] $search_code search code * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') From 426e12a5cae1e8a0c12c336b3c63740ff4ac2d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:08:13 +0100 Subject: [PATCH 47/51] fix CI --- build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/blockedlog/class/blockedlog.class.php | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 36791e8dce0..9783c4edad9 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -2652,12 +2652,6 @@ parameters: count: 1 path: ../../htdocs/blockedlog/class/blockedlog.class.php - - - message: '#^Variable \$aaa might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/blockedlog/class/blockedlog.class.php - - message: '#^Property BOM\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index c539f2774a9..30bd80915b4 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -853,12 +853,12 @@ class BlockedLog */ public function dolEncodeBlockedData($data, $mode = 0) { + $aaa = ''; try { $aaa = json_encode($data); } catch (Exception $e) { - //print $e->getErrs); + // print $e->getErrs); } - //var_dump($aaa); return $aaa; } @@ -873,12 +873,12 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { + $aaa = null; try { $aaa = (object) jsonOrUnserialize($data); } catch (Exception $e) { - //print $e->getErrs); + // print $e->getErrs); } - //var_dump($aaa); return $aaa; } From 10698ebf2a49e6b88685dc3c0f2186caf62e5309 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 14:13:17 +0100 Subject: [PATCH 48/51] Doc --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index ffe840e9483..26833536fee 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -374,7 +374,7 @@ class Adherent extends CommonObject */ const STATUS_VALIDATED = 1; /** - * Resiliated + * Resiliated (membership end and was not renew) */ const STATUS_RESILIATED = 0; /** From c403fc901b1918d747febe6fb5d3091b23c15600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:17:46 +0100 Subject: [PATCH 49/51] fix CI --- htdocs/blockedlog/class/blockedlog.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 30bd80915b4..f80cca3d489 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -873,7 +873,6 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { - $aaa = null; try { $aaa = (object) jsonOrUnserialize($data); } catch (Exception $e) { From 532435f6e100062583d37f559787fb20a5faff29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:22:35 +0100 Subject: [PATCH 50/51] fix CI --- htdocs/blockedlog/class/blockedlog.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index f80cca3d489..30bd80915b4 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -873,6 +873,7 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { + $aaa = null; try { $aaa = (object) jsonOrUnserialize($data); } catch (Exception $e) { From 3bb56e6dd11e87e63d3c8be8da50e39f9cd378af Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 14:25:44 +0100 Subject: [PATCH 51/51] Fix phpunit --- htdocs/blockedlog/class/blockedlog.class.php | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index eafe04365f7..f5b1f9ce64d 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1147,18 +1147,18 @@ class BlockedLog /** * Return array of log objects (with criteria) * - * @param string $element element to search - * @param int $fk_object id of object to search - * @param int<0,max> $limit max number of element, 0 for all - * @param string $sortfield sort field - * @param string $sortorder sort order - * @param int $search_fk_user id of user(s) - * @param int $search_start start time limit - * @param int $search_end end time limit - * @param string $search_ref search ref - * @param string $search_amount search amount - * @param string|array $search_code search code - * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error + * @param string $element element to search + * @param int $fk_object id of object to search + * @param int<0,max> $limit max number of element, 0 for all + * @param string $sortfield sort field + * @param string $sortorder sort order + * @param int $search_fk_user id of user(s) + * @param int $search_start start time limit + * @param int $search_end end time limit + * @param string $search_ref search ref + * @param string $search_amount search amount + * @param string|array $search_code search code + * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') {