From 701fbcc15a152956315b90b6300dd05d21a23523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 26 Oct 2024 13:01:38 +0200 Subject: [PATCH 1/6] Update phpstan.neon.dist for level 6 (#31561) --- phpstan.neon.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3eeba57f01d39..8f96fbcae870a 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -116,7 +116,7 @@ parameters: - '#Call to function array_key_exists.. with .error. .* will always evaluate to false.#' - '#function dolGetButtonAction expects array\{confirm\?: array.*confirm: true} given.#' - '#(?:make_substitutions expects array,) string given\.#' - - '# (DolibarrApiAccess|Documents|Login|Setup|Status|Boms|Categories|AgendaEvents|Proposals|Orders|BankAccounts|Invoices|Contracts|Donations|Shipments|KnowledgeManagement|Mos|MultiCurrencies|Partnerships|Products|Tasks|Warehouses|Tickets|Workstation|WorkstationResource|WorkstationUserGroup|Zapier)::.* no value type specified in iterable type array\.#' + - '# (DolibarrApiAccess|Documents|Login|Setup|Status|Boms|Categories|ExpenseReports|Interventions|AgendaEvents|Proposals|Orders|BankAccounts|Invoices|Contracts|Donations|Shipments|SupplierInvoices|SupplierOrders|KnowledgeManagement|Mos|MultiCurrencies|Partnerships|Products|Tasks|Warehouses|Tickets|Workstation|WorkstationResource|WorkstationUserGroup|Zapier)::.* no value type specified in iterable type array\.#' - '#Property RemiseCheque::\$account_id \(int\) does not accept string\.#' - '#Property Contact::\$roles \(array\) does not accept non-empty-array\.#' From e0c1b067d80e0d80c0d6d483cfbd2debaf3bac5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 26 Oct 2024 13:02:00 +0200 Subject: [PATCH 2/6] add phpdoc (#31562) * add phpdoc * add phpdoc * add phpdoc * add phpdoc * add phpdoc --- htdocs/core/lib/invoice.lib.php | 4 +-- htdocs/user/class/usergroup.class.php | 41 ++++++++++++++++++--------- htdocs/webservices/server_user.php | 10 +++---- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index aa5a656b64f11..fd21d5462b2a4 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -274,7 +274,7 @@ function invoice_rec_prepare_head($object) $obj = $db->fetch_object($resql); $nbFacture = $obj->nb; } else { - dol_syslog('Failed to count facture with facture_rec '.$db->lasterror(), LOG_ERR); + dol_syslog('Failed to count invoices with invoice model '.$db->lasterror(), LOG_ERR); } if ($nbFacture > 0) { $head[$h][1] .= ''.$nbFacture.''; @@ -391,7 +391,7 @@ function supplier_invoice_rec_prepare_head($object) $obj = $db->fetch_object($resql); $nbFactureFourn = $obj->nb; } else { - dol_syslog('Failed to count facture with facture fournisseur model '.$db->lasterror(), LOG_ERR); + dol_syslog('Failed to count invoices with supplier invoice model '.$db->lasterror(), LOG_ERR); } if ($nbFactureFourn > 0) { $head[$h][1] .= ''.$nbFactureFourn.''; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 399eef86db3c8..275b229032038 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -1,14 +1,14 @@ - * Copyright (c) 2005-2018 Laurent Destailleur - * Copyright (c) 2005-2018 Regis Houssin - * Copyright (C) 2012 Florian Henry - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2014 Alexis Algoud - * Copyright (C) 2018 Nicolas ZABOURI +/* Copyright (c) 2005 Rodolphe Quiedeville + * Copyright (c) 2005-2018 Laurent Destailleur + * Copyright (c) 2005-2018 Regis Houssin + * Copyright (C) 2012 Florian Henry + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Alexis Algoud + * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Abbes Bahfir - * Copyright (C) 2023-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,15 +93,28 @@ class UserGroup extends CommonObject public $note; /** - * @var User[] + * @var User[] Array of users */ - public $members = array(); // Array of users + public $members = array(); - public $nb_rights; // Number of rights granted to the user - public $nb_users; // Number of users in the group + /** + * @var int Number of rights granted to the user + */ + public $nb_rights; - public $rights; // Permissions of the group + /** + * @var int Number of users in the group + */ + public $nb_users; + /** + * @var stdClass Permissions of the group + */ + public $rights; + + /** + * @var array Cache array of already loaded permissions + */ private $_tab_loaded = array(); // Array of cache of already loaded permissions /** diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 6d6bd486fd4d4..e066bf36ccaf7 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * @@ -324,7 +324,7 @@ /** * Get produt or service * - * @param array $authentication Array of authentication information + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information * @param int $id Id of object * @param string $ref Ref of object * @param string $ref_ext Ref external of object @@ -417,7 +417,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') /** * getListOfGroups * - * @param array $authentication Array of authentication information + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information * @return array Array result */ function getListOfGroups($authentication) @@ -485,7 +485,7 @@ function getListOfGroups($authentication) /** * Create an external user with thirdparty and contact * - * @param array $authentication Array of authentication information + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information * @param array $thirdpartywithuser Datas * @return mixed */ @@ -684,7 +684,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) /** * Set password of an user * - * @param array $authentication Array of authentication information + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information * @param array $shortuser Array of login/password info * @return mixed */ From 19b653a599f1471e1785a0fc2d97b19d4b57a200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 26 Oct 2024 13:03:04 +0200 Subject: [PATCH 3/6] fix phpstan (#31564) * fix phpstan * fix phpstan --- htdocs/core/lib/functionsnumtoword.lib.php | 9 +++++---- .../doc/pdf_standard_supplierpayment.modules.php | 2 +- phpstan.neon.dist | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 50b0dacbe923b..7c7ace312da77 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2015 Víctor Ortiz Pérez - * Copyright (C) 2024 MDW +/* Copyright (C) 2015 Laurent Destailleur + * Copyright (C) 2015 Víctor Ortiz Pérez + * 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 @@ -139,7 +140,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) $concatWords .= ' '.$langs->transnoentities('and'); } - $concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true); + $concatWords .= ' '.dol_convertToWord((float) $decimalpart, $langs, '', true); if (!empty($currency)) { $concatWords .= ' '.$langs->transnoentities('centimes'); } diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php index 27b79ba5c41e1..57ac56922204a 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php @@ -524,7 +524,7 @@ protected function _tableau_cheque(&$pdf, $object, $posy, $outputlangs) // translate amount $currency = $conf->currency; - $translateinletter = strtoupper(dol_convertToWord(price2num($object->amount, 'MT'), $outputlangs, $currency)); + $translateinletter = strtoupper(dol_convertToWord((float) price2num($object->amount, 'MT'), $outputlangs, $currency)); $pdf->SetXY($this->marge_gauche + 50, $posy); $pdf->SetFont('', '', $default_font_size - 3); $pdf->MultiCell(90, 8, $translateinletter, 0, 'L', 1); diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 8f96fbcae870a..483e829b74e9a 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -88,7 +88,7 @@ parameters: - '#(?:dol_(?:mktime|remove_file_process)|print_actions_filter) expects int, array\|string given\.#' - '# (CSMSFile) constructor expects int, array\|string given.#' - '#(?:ProductFournisseur::logPrice\(\)) expects float\|null#' - - '#(?:(?:Asset::addDepreciationL|Facture(?:(?:(?:Fournisseur)?::add|Fournisseur::update)l))ine\(\)|calcul_price_total|dol_convertToWord|(?:loanCalcMonthlyPaymen|print_paypal_redirec)t) expects float, string given.#' + - '#(?:(?:Asset::addDepreciationL|Facture(?:(?:(?:Fournisseur)?::add|Fournisseur::update)l))ine\(\)|calcul_price_total|(?:loanCalcMonthlyPaymen|print_paypal_redirec)t) expects float, string given.#' - '#EvalMath::trigger\(\) expects string\|null,#' - '#(?:F(?:acture(?:(?:Fournisseur)?Rec::addline\(\))|ichinterRec::addLineRec\(\))|dolMd2Html|setEventMessages) expects string\|null,#' - '#::printStdColumnContent\(\) expects string, float(\|(int|array)(\<.*\>)?)* given.#' From 17e69f8a2142f161087cf89106c567ac99ab7f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 26 Oct 2024 13:03:52 +0200 Subject: [PATCH 4/6] fix phpstan (#31565) * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan --- htdocs/admin/debugbar.php | 3 +- htdocs/admin/fckeditor.php | 2 +- htdocs/core/actions_extrafields.inc.php | 71 ++++++++++--------- htdocs/expedition/dispatch.php | 23 +++--- htdocs/fourn/commande/dispatch.php | 24 +++---- .../commande/tpl/linkedobjectblock.tpl.php | 9 ++- htdocs/reception/dispatch.php | 4 +- phpstan.neon.dist | 2 +- 8 files changed, 73 insertions(+), 65 deletions(-) diff --git a/htdocs/admin/debugbar.php b/htdocs/admin/debugbar.php index 1f0ae7679caf3..ce41dd013340e 100644 --- a/htdocs/admin/debugbar.php +++ b/htdocs/admin/debugbar.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2013 Juanjo Menent + * 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 @@ -60,7 +61,7 @@ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessages($error, null, 'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index db18b396bcb73..4f2d66f1dc4b2 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -152,7 +152,7 @@ print '
'; if (empty($conf->use_javascript_ajax)) { - setEventMessages(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), null, 'errors'); + setEventMessages(null, array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), 'errors'); } else { print ''; print ''; diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 816699e898908..1cbe46885d76e 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -24,9 +24,11 @@ * \brief Code for actions on extrafields admin pages */ + /** @var ExtraFields $extrafields */ $maxsizestring = 255; $maxsizeint = 10; -$mesg = array(); +$mesg = ''; +$mesgs = array(); $extrasize = GETPOST('size', 'intcomma'); $type = GETPOST('type', 'alphanohtml'); @@ -69,61 +71,61 @@ if (!$type) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); + $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); $action = 'create'; } if ($type == 'varchar' && $extrasize <= 0) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size")); + $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size")); $action = 'edit'; } if ($type == 'varchar' && $extrasize > $maxsizestring) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring); + $mesgs[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring); $action = 'create'; } if ($type == 'int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint); + $mesgs[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint); $action = 'create'; } if ($type == 'stars' && ($extrasize < 1 || $extrasize > 10)) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeForStarsType"); + $mesgs[] = $langs->trans("ErrorSizeForStarsType"); $action = 'create'; } if ($type == 'select' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForSelectType"); + $mesgs[] = $langs->trans("ErrorNoValueForSelectType"); $action = 'create'; } if ($type == 'sellist' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForSelectListType"); + $mesgs[] = $langs->trans("ErrorNoValueForSelectListType"); $action = 'create'; } if ($type == 'checkbox' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForCheckBoxType"); + $mesgs[] = $langs->trans("ErrorNoValueForCheckBoxType"); $action = 'create'; } if ($type == 'link' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForLinkType"); + $mesgs[] = $langs->trans("ErrorNoValueForLinkType"); $action = 'create'; } if ($type == 'radio' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForRadioType"); + $mesgs[] = $langs->trans("ErrorNoValueForRadioType"); $action = 'create'; } if ((($type == 'radio') || ($type == 'checkbox')) && $param) { @@ -136,13 +138,13 @@ if (count($matches[0]) > 1) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); + $mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'create'; } } else { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); + $mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'create'; } } @@ -153,7 +155,7 @@ if (strlen(GETPOST('attrname', 'aZ09')) < 3) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3); + $mesgs[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3); $action = 'create'; } } @@ -163,7 +165,7 @@ if (in_array(strtoupper(GETPOST('attrname', 'aZ09')), $listofreservedwords)) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09')); + $mesgs[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09')); $action = 'create'; } } @@ -233,17 +235,18 @@ } else { $error++; $mesg = $extrafields->error; - setEventMessages($mesg, null, 'errors'); + $mesgs = array_merge($mesgs, $extrafields->errors); + setEventMessages($mesg, $mesgs, 'errors'); } } else { $error++; $langs->load("errors"); $mesg = $langs->trans("ErrorFieldCanNotContainSpecialNorUpperCharacters", $langs->transnoentities("AttributeCode")); - setEventMessages($mesg, null, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); $action = 'create'; } } else { - setEventMessages($mesg, null, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); } } } @@ -255,55 +258,55 @@ if (!$type) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); + $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); $action = 'edit'; } if ($type == 'varchar' && $extrasize <= 0) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size")); + $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size")); $action = 'edit'; } if ($type == 'varchar' && $extrasize > $maxsizestring) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring); + $mesgs[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring); $action = 'edit'; } if ($type == 'int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint); + $mesgs[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint); $action = 'edit'; } if ($type == 'select' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForSelectType"); + $mesgs[] = $langs->trans("ErrorNoValueForSelectType"); $action = 'edit'; } if ($type == 'sellist' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForSelectListType"); + $mesgs[] = $langs->trans("ErrorNoValueForSelectListType"); $action = 'edit'; } if ($type == 'stars' && ($extrasize < 1|| $extrasize > 10)) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeForStarsType"); + $mesgs[] = $langs->trans("ErrorSizeForStarsType"); $action = 'edit'; } if ($type == 'checkbox' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForCheckBoxType"); + $mesgs[] = $langs->trans("ErrorNoValueForCheckBoxType"); $action = 'edit'; } if ($type == 'radio' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForRadioType"); + $mesgs[] = $langs->trans("ErrorNoValueForRadioType"); $action = 'edit'; } if ((($type == 'radio') || ($type == 'checkbox')) && $param) { @@ -316,13 +319,13 @@ if (count($matches[0]) > 1) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); + $mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'edit'; } } else { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); + $mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'edit'; } } @@ -333,7 +336,7 @@ if (strlen(GETPOST('attrname', 'aZ09')) < 3 && !getDolGlobalString('MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE')) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3); + $mesgs[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3); $action = 'edit'; } } @@ -343,7 +346,7 @@ if (in_array(strtoupper(GETPOST('attrname', 'aZ09')), $listofreservedwords) && !getDolGlobalString('MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE')) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09')); + $mesgs[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09')); $action = 'edit'; } } @@ -416,7 +419,8 @@ } else { $error++; $mesg = $extrafields->error; - setEventMessages($mesg, null, 'errors'); + $mesgs = array_merge($mesgs, $extrafields->errors); + setEventMessages($mesg, $mesgs, 'errors'); } } else { $error++; @@ -425,7 +429,7 @@ setEventMessages($mesg, null, 'errors'); } } else { - setEventMessages($mesg, null, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); } } } @@ -443,6 +447,7 @@ exit; } else { $mesg = $extrafields->error; + $mesgs = array_merge($mesgs, $extrafields->errors); } } else { $error++; diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 83961579dd85e..696e220e9b50d 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -1,14 +1,14 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2021 Juanjo Menent - * Copyright (C) 2014 Cedric Gross - * Copyright (C) 2016 Florian Henry - * Copyright (C) 2017-2022 Ferran Marcet - * Copyright (C) 2018-2022 Frédéric France - * Copyright (C) 2019-2020 Christophe Battarel +/* Copyright (C) 2004-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2021 Juanjo Menent + * Copyright (C) 2014 Cedric Gross + * Copyright (C) 2016 Florian Henry + * Copyright (C) 2017-2022 Ferran Marcet + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2019-2020 Christophe Battarel * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -202,7 +202,6 @@ } } } - //var_dump($key.' '.$newqty.' '.$idline.' '.$error); if (!$error) { $qtystart = 0; @@ -345,7 +344,7 @@ if ($error > 0) { $db->rollback(); - setEventMessages($error, $errors, 'errors'); + setEventMessages($langs->trans("Error"), $errors, 'errors'); } else { $db->commit(); setEventMessages($langs->trans("ReceptionUpdated"), null); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index a9e7e84677927..7007b5f8430c5 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1,15 +1,15 @@ - * Copyright (C) 2004-2023 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2021 Juanjo Menent - * Copyright (C) 2014 Cedric Gross - * Copyright (C) 2016 Florian Henry - * Copyright (C) 2017-2022 Ferran Marcet - * Copyright (C) 2018-2022 Frédéric France - * Copyright (C) 2019-2020 Christophe Battarel - * Copyright (C) 2024 MDW +/* Copyright (C) 2004-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2023 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2021 Juanjo Menent + * Copyright (C) 2014 Cedric Gross + * Copyright (C) 2016 Florian Henry + * Copyright (C) 2017-2022 Ferran Marcet + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2019-2020 Christophe Battarel + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -507,7 +507,7 @@ } if ($error > 0) { $db->rollback(); - setEventMessages($error, $errors, 'errors'); + setEventMessages($langs->trans("Error"), $errors, 'errors'); } else { $db->commit(); } diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 2f7826c5ea63b..bcbcda0465628 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -1,7 +1,8 @@ - * Copyright (C) 2014 Marcos García - * Copyright (C) 2024 MDW +/* Copyright (C) 2010-2011 Regis Houssin + * Copyright (C) 2014 Marcos García + * 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 @@ -32,8 +33,10 @@ $langs = $GLOBALS['langs']; '@phan-var-force Translate $langs'; +/** @var Translate $langs */ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; '@phan-var-force CommonObject[] $linkedObjectBlock'; +/** @var CommonObject[] $linkedObjectBlock */ $langs->load("orders"); diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php index 0f152e82cfcd0..e57bed8ba8d4d 100644 --- a/htdocs/reception/dispatch.php +++ b/htdocs/reception/dispatch.php @@ -7,7 +7,7 @@ * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry * Copyright (C) 2017-2022 Ferran Marcet - * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019-2020 Christophe Battarel * Copyright (C) 2024 MDW * @@ -280,7 +280,7 @@ } if ($error > 0) { $db->rollback(); - setEventMessages($error, $errors, 'errors'); + setEventMessages($langs->trans("Error"), $errors, 'errors'); } else { $db->commit(); setEventMessages($langs->trans("ReceptionUpdated"), null); diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 483e829b74e9a..9b047a5794561 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -90,7 +90,7 @@ parameters: - '#(?:ProductFournisseur::logPrice\(\)) expects float\|null#' - '#(?:(?:Asset::addDepreciationL|Facture(?:(?:(?:Fournisseur)?::add|Fournisseur::update)l))ine\(\)|calcul_price_total|(?:loanCalcMonthlyPaymen|print_paypal_redirec)t) expects float, string given.#' - '#EvalMath::trigger\(\) expects string\|null,#' - - '#(?:F(?:acture(?:(?:Fournisseur)?Rec::addline\(\))|ichinterRec::addLineRec\(\))|dolMd2Html|setEventMessages) expects string\|null,#' + - '#(?:F(?:acture(?:(?:Fournisseur)?Rec::addline\(\))|ichinterRec::addLineRec\(\))|dolMd2Html) expects string\|null,#' - '#::printStdColumnContent\(\) expects string, float(\|(int|array)(\<.*\>)?)* given.#' - '#::HTML2OpenIDServer\(\) expects string, array given.#' - '# dol_stringtotime expects string, DateTime given.#' From 0d7523d9286a7e152db76ab926b30e5ce88089d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 26 Oct 2024 13:05:05 +0200 Subject: [PATCH 5/6] fix phpstan (#31567) * fix phpstan * fix phpstan * fix phpstan * fix phpstan --- htdocs/core/modules/printing/modules_printing.php | 4 ++-- htdocs/core/modules/printing/printgcp.modules.php | 4 ++-- .../stocktransfer/doc/pdf_eagle_proforma.modules.php | 4 ++-- .../modules/supplier_order/doc/pdf_muscadet.modules.php | 6 +++--- phpstan.neon.dist | 1 - 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php index 4bc49d2c37c3d..782cc9a9b3d31 100644 --- a/htdocs/core/modules/printing/modules_printing.php +++ b/htdocs/core/modules/printing/modules_printing.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2014-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 13db8922c58be..a1c995a3de5c7 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2014-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 6f3b40e2ceae8..6e2f6fbe475ce 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -1019,8 +1019,8 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs) /** * Show total to pay * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param TCPDF $pdf Object PDF + * @param StockTransfer $object Object StockTransfer * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Object langs diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 01d05924a153d..2e41df1238cbf 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -729,7 +729,7 @@ protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs) * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param CommandeFournisseur $object Object to show + * @param CommandeFournisseur $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return integer @@ -793,8 +793,8 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) * Show total to pay * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice - * @param int $deja_regle Montant deja regle + * @param CommandeFournisseur $object Object CommandeFournisseur + * @param int $deja_regle Amount already paid * @param int $posy Position depart * @param Translate $outputlangs Object langs * @return int Position pour suite diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 9b047a5794561..40e993709bfc8 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -108,7 +108,6 @@ parameters: - '#(?:ftp_(?:c(?:dup|hdir|lose)|delete|get|mkdir|put|rmdir)) expects FTP\\Connection#' - '#(?:ldap_(?:(?:ad|bin)d|delete|err(?:no|or)|first_entry|get_(?:(?:attribut|entri)es|(?:optio|values_le)n)|mod_(?:add|del|replace)|rename|set_option|unbind)) expects LDAP\\Connection#' - '#(?:MultiCurrencies::_cleanObjectDatasRate\(\)) expects MultiCurrency#' - - '# (?:pdf_(?:(?:eagle_proforma::drawTotalTable|muscadet::_tableau_tot)\(\))) expects Facture#' - '# (?:pg_(?:affected_rows|f(?:etch_(?:array|object|row)|ree_result)|num_rows)) expects PgSql\\Result#' - '# (?:Holiday::getNextNumRef\(\)|get_localtax|pdf_pagefoot|societe_prepare_head) expects Societe#' - '# (?:Common(?:DocGenerator::get(?:(?:ExtrafieldsInHtml|_substitutionarray_lines)\(\))|Object::printO(?:(?:bject|rigin)Line\(\)))) expects CommonObjectLine#' From 57fa01759105fbe8bb4e5ff7f405c39092bbd428 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sat, 26 Oct 2024 14:07:33 +0300 Subject: [PATCH 6/6] NEW Add payment reference - SQL Part (#31553) * NEW Add payment reference - SQL Part * NEW Add payment reference - SQL Part * NEW Add payment reference - SQL Part * Update llx_facture.sql * Update llx_societe.sql --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_facture.sql | 2 +- htdocs/install/mysql/tables/llx_societe.sql | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index e158fed274f24..ad47c2bac298e 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -282,3 +282,5 @@ CREATE TABLE llx_product_customer_price_extrafields ( ) ENGINE=innodb; ALTER TABLE llx_product_customer_price_extrafields ADD UNIQUE INDEX uk_product_customer_price_extrafields (fk_object); +ALTER TABLE llx_facture ADD COLUMN payment_reference varchar(25) AFTER date_lim_reglement; +ALTER TABLE llx_societe ADD COLUMN tp_payment_reference varchar(25) AFTER code_fournisseur; diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index b5a1f95db90e3..9e2f2ad1890c2 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -79,7 +79,7 @@ create table llx_facture fk_cond_reglement integer DEFAULT 1 NOT NULL, -- payment term (30 days, end of month...) fk_mode_reglement integer, -- payment mode (Virement, Prelevement) date_lim_reglement date, -- due date - + payment_reference varchar(25), -- SEPA and any other national or custom payment id note_private text, note_public text, model_pdf varchar(255), diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index a4ce431ada2eb..4f6fc0800a9cf 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -38,7 +38,7 @@ create table llx_societe code_client varchar(24), -- code client code_fournisseur varchar(24), -- code fournisseur - + tp_payment_reference varchar(25), -- SEPA and any other national or custom payment id accountancy_code_customer_general varchar(32) DEFAULT NULL, -- customer accountancy general account code_compta varchar(32), -- customer accountancy auxiliary account accountancy_code_supplier_general varchar(32) DEFAULT NULL, -- supplier accountancy general account