From 092767d9fba4c2045ac65540cbea9342c50b4cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Fri, 7 Feb 2025 17:57:57 +0100 Subject: [PATCH 01/19] fix ci --- build/phpstan/phpstan-baseline.neon | 314 ++-------------------------- 1 file changed, 13 insertions(+), 301 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 51af91680f6..848ca2bbc58 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -7920,12 +7920,6 @@ parameters: count: 3 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$obj might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$permissiontoadd might not be defined\.$#' identifier: variable.undefined @@ -8880,12 +8874,6 @@ parameters: count: 1 path: ../../htdocs/core/class/comment.class.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, CommonObject given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/class/commondocgenerator.class.php - - message: '#^Parameter \#2 \$array_to_fill of method CommonDocGenerator\:\:fill_substitutionarray_with_extrafields\(\) expects array\, array\ given\.$#' identifier: argument.type @@ -12000,18 +11988,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/action/doc/pdf_standard_actions.class.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Asset given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' identifier: argument.type @@ -12024,12 +12000,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -12211,13 +12181,7 @@ parameters: path: ../../htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, BOM given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -12234,12 +12198,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -12265,13 +12223,7 @@ parameters: path: ../../htdocs/core/modules/cheque/mod_chequereceipt_mint.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Commande given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -12288,12 +12240,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php - - message: '#^Parameter \#2 \$addpercent of function vatrate expects bool, int given\.$#' identifier: argument.type @@ -12487,13 +12433,7 @@ parameters: path: ../../htdocs/core/modules/commande/mod_commande_marbre.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Contrat given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -12504,12 +12444,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php - - message: '#^Parameter \#3 \$tab_height of method pdf_strato\:\:tabSignature\(\) expects int, float given\.$#' identifier: argument.type @@ -12865,13 +12799,7 @@ parameters: path: ../../htdocs/core/modules/expensereport/mod_expensereport_jade.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Facture given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -12888,12 +12816,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php - - message: '#^Variable \$array_propal_object in isset\(\) always exists and is not nullable\.$#' identifier: isset.variable @@ -14569,13 +14491,7 @@ parameters: path: ../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Mo given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -14592,12 +14508,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php - - message: '#^Property Mo\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14790,12 +14700,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Product given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' identifier: argument.type @@ -14808,12 +14712,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php - - message: '#^Property Product\:\:\$weight_units \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14844,18 +14742,6 @@ parameters: count: 2 path: ../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Project given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method doc_generic_project_odt\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - message: '#^Parameter \#2 \$array_to_fill of method CommonDocGenerator\:\:fill_substitutionarray_with_extrafields\(\) expects array\, array\ given\.$#' identifier: argument.type @@ -14868,12 +14754,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - message: '#^Variable \$objectdetail might not be defined\.$#' identifier: variable.undefined @@ -14929,13 +14809,7 @@ parameters: path: ../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Project\|Task given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - - message: '#^Parameter \#1 \$task of method doc_generic_task_odt\:\:get_substitutionarray_tasks\(\) expects Task, array\ given\.$#' + message: '#^Parameter \#1 \$task of method doc_generic_task_odt\:\:get_substitutionarray_tasks\(\) expects Task, array\\|CommonObject given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -14952,12 +14826,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - message: '#^Variable \$listlines might not be defined\.$#' identifier: variable.undefined @@ -14977,13 +14845,7 @@ parameters: path: ../../htdocs/core/modules/project/task/mod_task_simple.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Propal given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -15000,12 +14862,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -15205,13 +15061,7 @@ parameters: path: ../../htdocs/core/modules/rapport/pdf_paiement.class.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Reception given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -15228,12 +15078,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php - - message: '#^Parameter \#4 \$posy of method pdf_squille\:\:_tableau_tot\(\) expects int, float given\.$#' identifier: argument.type @@ -15348,12 +15192,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/societe/mod_codecompta_panicum.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Entrepot given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' identifier: argument.type @@ -15366,12 +15204,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php - - message: '#^Property pdf_standard_stock\:\:\$wref has no type specified\.$#' identifier: missingType.property @@ -15517,13 +15349,7 @@ parameters: path: ../../htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, FactureFournisseur given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -15540,12 +15366,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php - - message: '#^Variable \$objectref might not be defined\.$#' identifier: variable.undefined @@ -15595,13 +15415,7 @@ parameters: path: ../../htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, CommandeFournisseur given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -15618,12 +15432,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php - - message: '#^Variable \$objectref might not be defined\.$#' identifier: variable.undefined @@ -16080,12 +15888,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, UserGroup given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' identifier: argument.type @@ -16098,12 +15900,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php - - message: '#^Variable \$contactobject might not be defined\.$#' identifier: variable.undefined @@ -16218,36 +16014,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/bloc_showhide.tpl.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 12 - path: ../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$defaulttopic might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$diroutput might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$file might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/card_presend.tpl.php - - message: '#^Variable \$hidedesc might not be defined\.$#' identifier: variable.undefined @@ -16266,18 +16032,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/card_presend.tpl.php - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../htdocs/core/tpl/card_presend.tpl.php - - message: '#^Variable \$modelmail might not be defined\.$#' identifier: variable.undefined @@ -16290,12 +16044,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/card_presend.tpl.php - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 36 - path: ../../htdocs/core/tpl/card_presend.tpl.php - - message: '#^Variable \$user might not be defined\.$#' identifier: variable.undefined @@ -16683,7 +16431,7 @@ parameters: - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined - count: 5 + count: 4 path: ../../htdocs/core/tpl/objectline_create.tpl.php - @@ -18966,12 +18714,6 @@ parameters: count: 1 path: ../../htdocs/expensereport/tpl/expensereport_linktofile.tpl.php - - - message: '#^Variable \$minifile might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/expensereport/tpl/expensereport_linktofile.tpl.php - - message: '#^Variable \$object might not be defined\.$#' identifier: variable.undefined @@ -23443,13 +23185,7 @@ parameters: path: ../../htdocs/modulebuilder/template/core/modules/modMyModule.class.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, MyObject given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -23466,12 +23202,6 @@ parameters: count: 1 path: ../../htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php - - message: '#^Property MyObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -29395,13 +29125,7 @@ parameters: path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, RecruitmentJobPosition given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' + message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' identifier: argument.type count: 1 path: ../../htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -29418,12 +29142,6 @@ parameters: count: 1 path: ../../htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php - - message: '#^Property RecruitmentJobPosition\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -31626,12 +31344,6 @@ parameters: count: 1 path: ../../htdocs/ticket/card.php - - - message: '#^Variable \$limit might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/ticket/card.php - - message: '#^Variable \$mine might not be defined\.$#' identifier: variable.undefined From 603f97f111bee3ef74f45c86691aecad95f00e8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Feb 2025 03:51:10 +0100 Subject: [PATCH 02/19] Fix debug v21 --- htdocs/categories/traduction.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 84992cc45bc..fa40a1860b6 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -124,6 +124,8 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $permissiontoadd) if ($forcelangprod == $current_lang) { $object->label = $libelle; $object->description = dol_htmlcleanlastbr($desc); + + $object->update($user); } else { $object->multilangs[$forcelangprod]["label"] = $libelle; $object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc); From 0064958589f9505409056cd4fb002013f3313650 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Feb 2025 17:16:42 +0100 Subject: [PATCH 03/19] Fix debug v21 --- htdocs/commande/class/orderline.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/orderline.class.php b/htdocs/commande/class/orderline.class.php index 0c8499658d0..eb3592e7b34 100644 --- a/htdocs/commande/class/orderline.class.php +++ b/htdocs/commande/class/orderline.class.php @@ -481,7 +481,7 @@ class OrderLine extends CommonOrderLine if (!$error) { $this->db->commit(); - return 1; + return $this->id; } foreach ($this->errors as $errmsg) { From 95622c22dfbde3d859a096007c68b5c593af0f8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Feb 2025 18:09:32 +0100 Subject: [PATCH 04/19] Close #32670 --- htdocs/comm/propal/class/propal.class.php | 21 ++++++----- htdocs/commande/card.php | 7 ++-- htdocs/commande/class/commande.class.php | 36 +++++++++++-------- htdocs/compta/facture/class/facture.class.php | 27 ++++++++------ .../class/fournisseur.commande.class.php | 32 ++++++++++------- .../fourn/class/fournisseur.facture.class.php | 28 +++++++++------ 6 files changed, 89 insertions(+), 62 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index cbc2ec2f1d0..a215eece1c4 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -813,17 +813,22 @@ class Propal extends CommonObject $result = $this->line->insert(); if ($result > 0) { - // Reorder if child line - if (!empty($fk_parent_line)) { - $this->line_order(true, 'DESC'); - } elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines - $linecount = count($this->lines); - for ($ii = $ranktouse; $ii <= $linecount; $ii++) { - $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); + if (!isset($this->context['createfromclone'])) { + if (!empty($fk_parent_line)) { + // Always reorder if child line + $this->line_order(true, 'DESC'); + } elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { + // Update all rank of all other lines starting from the same $ranktouse + $linecount = count($this->lines); + for ($ii = $ranktouse; $ii <= $linecount; $ii++) { + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); + } } + + $this->lines[] = $this->line; } - // Mise a jour information denormalisees au niveau de la propale meme + // Update denormalized fields at the order level if (empty($noupdateafterinsertline)) { $result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e60536c9bcb..881ed15a9ee 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -218,10 +218,10 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('IdThirdParty')), null, 'errors'); } else { if ($object->id > 0) { - // Because createFromClone modifies the object, we must clone it so that we can restore it later - $orig = clone $object; + // We clone object to avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. + $objectutil = dol_clone($object, 1); - $result = $object->createFromClone($user, $socid); + $result = $objectutil->createFromClone($user, $socid); if ($result > 0) { $warningMsgLineList = array(); // check all product lines are to sell otherwise add a warning message for each product line is not to sell @@ -243,7 +243,6 @@ if (empty($reshook)) { exit; } else { setEventMessages($object->error, $object->errors, 'errors'); - $object = $orig; $action = ''; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 03359651426..640216e0d4f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1097,6 +1097,7 @@ class Commande extends CommonOrder $line->ref_ext, 1 ); + if ($result < 0) { if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) { $this->error = $this->db->lasterror(); @@ -1536,11 +1537,11 @@ class Commande extends CommonOrder */ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = array(), $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '', $noupdateafterinsertline = 0) { - global $mysoc, $conf, $langs, $user; + global $mysoc, $langs, $user; $logtext = "::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent"; $logtext .= ", info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start"; - $logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise, ref_ext=$ref_ext"; + $logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise, ref_ext=$ref_ext rang=$rang"; dol_syslog(get_class($this).$logtext, LOG_DEBUG); if ($this->statut == self::STATUS_DRAFT) { @@ -1666,6 +1667,7 @@ class Commande extends CommonOrder // Rang to use $ranktouse = $rang; + if ($ranktouse == -1) { $rangmax = $this->line_max($fk_parent_line); $ranktouse = $rangmax + 1; @@ -1738,25 +1740,29 @@ class Commande extends CommonOrder $result = $this->line->insert($user); if ($result > 0) { - // Reorder if child line - if (!empty($fk_parent_line)) { - $this->line_order(true, 'DESC'); - } elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines - $linecount = count($this->lines); - for ($ii = $ranktouse; $ii <= $linecount; $ii++) { - $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); - } - } - - // Mise a jour information denormalisees au niveau de la commande meme + // Update denormalized fields at the order level if (empty($noupdateafterinsertline)) { $result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. } if ($result > 0) { + if (!isset($this->context['createfromclone'])) { + if (!empty($fk_parent_line)) { + // Always reorder if child line + $this->line_order(true, 'DESC'); + } elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { + // Update all rank of all other lines starting from the same $ranktouse + $linecount = count($this->lines); + for ($ii = $ranktouse; $ii <= $linecount; $ii++) { + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); + } + } + + $this->lines[] = $this->line; + } + $this->db->commit(); - $this->lines[] = $this->line; - return $this->line->id; + return $line->id; } else { $this->db->rollback(); return -1; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index cd69a48e657..43859ecab23 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4097,21 +4097,26 @@ class Facture extends CommonInvoice $result = $this->line->insert(); if ($result > 0) { - // Reorder if child line - if (!empty($fk_parent_line)) { - $this->line_order(true, 'DESC'); - } elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines - $linecount = count($this->lines); - for ($ii = $ranktouse; $ii <= $linecount; $ii++) { - $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); - } - } - - // Mise a jour information denormalisees au niveau de la facture meme + // Update denormalized fields at the order level if (empty($noupdateafterinsertline)) { $result = $this->update_price(1, 'auto', 0, $mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode. } + if (!isset($this->context['createfromclone'])) { + if (!empty($fk_parent_line)) { + // Always reorder if child line + $this->line_order(true, 'DESC'); + } elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { + // Update all rank of all other lines starting from the same $ranktouse + $linecount = count($this->lines); + for ($ii = $ranktouse; $ii <= $linecount; $ii++) { + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); + } + } + + $this->lines[] = $this->line; + } + if ($result > 0) { $this->db->commit(); return $this->line->id; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 957cd70fb33..7d87e6dbde6 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1993,7 +1993,7 @@ class CommandeFournisseur extends CommonOrder * @param ?int $date_end Date end of service * @param array $array_options extrafields array * @param ?int $fk_unit Code of the unit to use. Null to use the default one - * @param int|string $pu_ht_devise Amount in currency + * @param int|string $pu_ht_devise Amount in currency * @param string $origin 'order', ... * @param int $origin_id Id of origin object * @param int $rang Rank @@ -2002,7 +2002,7 @@ class CommandeFournisseur extends CommonOrder */ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $fk_prod_fourn_price = 0, $ref_supplier = '', $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $type = 0, $info_bits = 0, $notrigger = 0, $date_start = null, $date_end = null, $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $origin = '', $origin_id = 0, $rang = -1, $special_code = 0) { - global $langs, $mysoc, $conf; + global $langs, $mysoc; dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -2238,19 +2238,25 @@ class CommandeFournisseur extends CommonOrder $result = $this->line->insert($notrigger); if ($result > 0) { - // Reorder if child line - if (!empty($this->line->fk_parent_line)) { - $this->line_order(true, 'DESC'); - } elseif ($rang > 0 && $rang <= count($this->lines)) { // Update all rank of all other lines - $linecount = count($this->lines); - for ($ii = $rang; $ii <= $linecount; $ii++) { - $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); - } - } - - // Mise a jour information denormalisees au niveau de la commande meme + // Update denormalized fields at the order level $result = $this->update_price(1, 'auto', 0, $this->thirdparty); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. + if ($result > 0) { + if (!isset($this->context['createfromclone'])) { + if (!empty($this->line->fk_parent_line)) { + // Always reorder if child line + $this->line_order(true, 'DESC'); + } elseif ($rang > 0 && $rang <= count($this->lines)) { + // Update all rank of all other lines starting from the same $ranktouse + $linecount = count($this->lines); + for ($ii = $rang; $ii <= $linecount; $ii++) { + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); + } + } + + $this->lines[] = $this->line; + } + $this->db->commit(); return $this->line->id; } else { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 88331cf8bbd..d09a98e7429 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2303,19 +2303,25 @@ class FactureFournisseur extends CommonInvoice $result = $supplierinvoiceline->insert($notrigger); if ($result > 0) { - // Reorder if child line - if (!empty($fk_parent_line)) { - $this->line_order(true, 'DESC'); - } elseif ($rang > 0 && $rang <= count($this->lines)) { // Update all rank of all other lines - $linecount = count($this->lines); - for ($ii = $rang; $ii <= $linecount; $ii++) { - $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); - } - } - - // Mise a jour information denormalisees au niveau de la facture meme + // Update denormalized fields at the order level $result = $this->update_price(1, 'auto', 0, $this->thirdparty); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode. + if ($result > 0) { + if (!isset($this->context['createfromclone'])) { + if (!empty($fk_parent_line)) { + // Always reorder if child line + $this->line_order(true, 'DESC'); + } elseif ($rang > 0 && $rang <= count($this->lines)) { + // Update all rank of all other lines starting from the same $ranktouse + $linecount = count($this->lines); + for ($ii = $rang; $ii <= $linecount; $ii++) { + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); + } + } + + $this->lines[] = $supplierinvoiceline; + } + $this->db->commit(); return $supplierinvoiceline->id; } else { From 8703ceaadb42773ca9699f704b00b83145f16d0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Feb 2025 18:09:51 +0100 Subject: [PATCH 05/19] Debug v21 --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7e0da30d5c8..bb68856993e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2387,7 +2387,7 @@ if ($action == 'create') { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); } // Incomplete payment. We ask if reason = discount or other - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250, 600); } if ($action == 'closeas') { From e9a3926c7e617c943d0f893006247006203115f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Feb 2025 19:08:47 +0100 Subject: [PATCH 06/19] Fix regression --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 640216e0d4f..a3fb1c4d3e2 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1762,7 +1762,7 @@ class Commande extends CommonOrder } $this->db->commit(); - return $line->id; + return $this->line->id; } else { $this->db->rollback(); return -1; From 982f6d6dc2a48e5154a9a2c9b455d86da400bf54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Feb 2025 19:10:02 +0100 Subject: [PATCH 07/19] Doc --- htdocs/commande/class/orderline.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/orderline.class.php b/htdocs/commande/class/orderline.class.php index eb3592e7b34..697da522d30 100644 --- a/htdocs/commande/class/orderline.class.php +++ b/htdocs/commande/class/orderline.class.php @@ -335,7 +335,7 @@ class OrderLine extends CommonOrderLine } /** - * Insert line into database + * Insert line into database. This also set $this->id. * * @param User $user User that modify * @param int $notrigger 1 = disable triggers From bc6e3a81dab0d67686f2ad791df79fc1740ef2f3 Mon Sep 17 00:00:00 2001 From: Anthony V <45999044+AnthonyVallenet@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:05:25 +0100 Subject: [PATCH 08/19] Fix: Prevent invalid foreach() on extrafields label in product/price.php - Ensured $extralabels is always an array before looping to prevent warnings. - Fixes "foreach() argument must be of type array|string given" error. - Improves stability when handling extrafields. --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 1b55ff6dda4..006c8710770 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1518,7 +1518,7 @@ if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUS // Extrafields $extrafields->fetch_name_optionals_label("product"); - $extralabels = !empty($extrafields->attributes["product"]['label']) ? $extrafields->attributes["product"]['label'] : ''; + $extralabels = !empty($extrafields->attributes["product"]['label']) ? $extrafields->attributes["product"]['label'] : []; $extrafield_values = $extrafields->getOptionalsFromPost("product"); $sql = "SELECT"; $sql .= " fk_object"; From a019f9fe74fd9b213f996c02f87e26cfd7f3fb29 Mon Sep 17 00:00:00 2001 From: Anthony V <45999044+AnthonyVallenet@users.noreply.github.com> Date: Mon, 10 Feb 2025 15:55:28 +0100 Subject: [PATCH 09/19] Fix: Prevent warnings and fatal error in admin/mrp.php - Fixed "Undefined property: stdClass::$MRP_MO_ADDON_PDF" by checking existence with !empty(). - Fixed "Class 'Product' not found" by adding require_once for product.class.php. - Improves stability and prevents unexpected crashes in MRP module. --- htdocs/admin/mrp.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 0b343459e3d..770c85cd114 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; /** * @var Conf $conf @@ -396,7 +397,7 @@ foreach ($dirmodels as $reldir) { // Default print ''; - if ($conf->global->MRP_MO_ADDON_PDF == $name) { + if (!empty($conf->global->MRP_MO_ADDON_PDF) && $conf->global->MRP_MO_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; From b41205302e242ad02de7db7f3e9f5ae06e0d1c82 Mon Sep 17 00:00:00 2001 From: Anthony V <45999044+AnthonyVallenet@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:09:47 +0100 Subject: [PATCH 10/19] Fix: Use getDolGlobalString --- htdocs/admin/mrp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 770c85cd114..279b4a5cfaa 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -397,7 +397,7 @@ foreach ($dirmodels as $reldir) { // Default print ''; - if (!empty($conf->global->MRP_MO_ADDON_PDF) && $conf->global->MRP_MO_ADDON_PDF == $name) { + if (getDolGlobalString("MRP_MO_ADDON_PDF") == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; From e090f09cedb02a51cd84f85265f3e0c46da5817a Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 11 Feb 2025 11:01:24 +0100 Subject: [PATCH 11/19] Debug v21 --- htdocs/core/lib/functions.lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7f9633a2d8e..b5f9b289561 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12995,7 +12995,7 @@ function getFieldErrorIcon($fieldValidationErrorMsg) */ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array()) { - global $langs, $conf, $user; + global $langs, $user; // Actually this conf is used in css too for external module compatibility and smooth transition to this function if (getDolGlobalString('MAIN_BUTTON_HIDE_UNAUTHORIZED') && (!$user->admin) && $status <= 0) { @@ -13032,9 +13032,9 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u $attr['href'] = ''; if ($status == -1) { // disable - $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled")); + $attr['title'] = $langs->transnoentitiesnoconv("FeatureDisabled"); } elseif ($status == 0) { // Not enough permissions - $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")); + $attr['title'] = $langs->transnoentitiesnoconv("NotEnoughPermissions"); } } @@ -13065,6 +13065,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u // TODO : add a hook + // Generate attributes with escapement $TCompiledAttr = array(); foreach ($attr as $key => $value) { $TCompiledAttr[] = $key.'="'.dol_escape_htmltag($value).'"'; // Do not use dolPrintHTMLForAttribute() here, we must accept "javascript:string" From e76c3961782caa1c70ba454521ffebe2978c01a4 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 11 Feb 2025 11:03:10 +0100 Subject: [PATCH 12/19] Debug v21 --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b5f9b289561..7f9379d1116 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -13018,7 +13018,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u ); if (!empty($helpText)) { - $attr['title'] = dol_escape_htmltag($helpText); + $attr['title'] = $helpText; } elseif ($label) { // empty($attr['title']) && $attr['title'] = $label; $useclassfortooltip = 0; From 6f87dc441e77024826c2a3b1459016fd56d67834 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 11 Feb 2025 15:27:37 +0100 Subject: [PATCH 13/19] Debug v21 --- htdocs/core/lib/admin.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 1bf8f9e06b8..7d9beb89411 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1941,9 +1941,9 @@ function form_constantes($tableau, $strictw3c = 2, $helptext = '', $text = 'Valu */ function showModulesExludedForExternal($modules) { - global $conf, $langs; + global $langs; - $text = $langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers"); + $text = $langs->transnoentitiesnoconv("OnlyFollowingModulesAreOpenedToExternalUsers"); $listofmodules = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); // List of modules qualified for external user management $i = 0; @@ -1967,11 +1967,11 @@ function showModulesExludedForExternal($modules) } $i++; - $tmptext = $langs->trans('Module'.$module->numero.'Name'); + $tmptext = $langs->transnoentitiesnoconv('Module'.$module->numero.'Name'); if ($tmptext != 'Module'.$module->numero.'Name') { - $text .= $langs->trans('Module'.$module->numero.'Name'); + $text .= $langs->transnoentitiesnoconv('Module'.$module->numero.'Name'); } else { - $text .= $langs->trans($module->name); + $text .= $langs->transnoentitiesnoconv($module->name); } } } From 5401791247322cd9ea17af8ffa7e95fc2bd81dfa Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 11 Feb 2025 15:40:47 +0100 Subject: [PATCH 14/19] Debug v21 --- htdocs/core/lib/product.lib.php | 37 +++++++++++++++++++------------- htdocs/product/admin/product.php | 4 +++- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index f13d2df07b8..1c9b0910bc0 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -328,7 +328,7 @@ function productlot_prepare_head($object) */ function product_admin_prepare_head() { - global $langs, $conf, $user, $db; + global $langs, $conf, $db; $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label('product'); @@ -368,24 +368,31 @@ function product_admin_prepare_head() $head[$h][2] = 'attributes'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_price_extrafields.php'; - $head[$h][1] = $langs->trans("ProductLevelExtraFields"); - $nbExtrafields = $extrafields->attributes['product_price']['count']; - if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + // Extrafields for price levels + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_price_extrafields.php'; + $head[$h][1] = $langs->trans("ProductLevelExtraFields"); + $nbExtrafields = $extrafields->attributes['product_price']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } + $head[$h][2] = 'levelAttributes'; + $h++; } - $head[$h][2] = 'levelAttributes'; - $h++; - $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_customer_extrafields.php'; - $head[$h][1] = $langs->trans("ProductCustomerExtraFields"); - $nbExtrafields = $extrafields->attributes['product_customer_price']['count']; - if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + //Extrafields for price per customer + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { + $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_customer_extrafields.php'; + $head[$h][1] = $langs->trans("ProductCustomerExtraFields"); + $nbExtrafields = $extrafields->attributes['product_customer_price']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } + $head[$h][2] = 'customerAttributes'; + $h++; } - $head[$h][2] = 'customerAttributes'; - $h++; + // Supplier prices $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_supplier_extrafields.php'; $head[$h][1] = $langs->trans("ProductSupplierExtraFields"); $nbExtrafields = $extrafields->attributes['product_fournisseur_price']['count']; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index d38409f9eaa..742e4a8de52 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -122,9 +122,11 @@ if ($action == 'other') { if ($tmprule == $princingrules) { // We are on selected rule, we enable it if ($princingrules == 'PRODUCT_PRICE_UNIQ') { // For this case, we disable entries manually $res = dolibarr_set_const($db, 'PRODUIT_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES', 0, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'PRODUCT_PRICE_UNIQ', 1, 'chaine', 0, '', $conf->entity); } else { $multirule = explode('&', $princingrules); From d6aac69d90ecbd711175c9f1a459efbfd6993f7f Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 11 Feb 2025 16:28:37 +0100 Subject: [PATCH 15/19] Debug v21 --- htdocs/commande/class/commande.class.php | 17 +++++++++++------ htdocs/commande/list.php | 14 +++++++++----- htdocs/langs/en_US/errors.lang | 1 + 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a3fb1c4d3e2..b18bcac8aca 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -113,9 +113,16 @@ class Commande extends CommonOrder /** * Status of the order * @var int + * @deprecated Use status */ public $statut; + /** + * Status of the order + * @var int + */ + public $status; + /** * @var int Status Billed or not */ @@ -792,12 +799,10 @@ class Commande extends CommonOrder * * @param User $user Object user that close * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int Return integer <0 if KO, >0 if OK + * @return int Return integer <0 if KO, 0=Nothing done, >0 if OK */ public function cloture($user, $notrigger = 0) { - global $conf; - $error = 0; $usercanclose = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'creer')) @@ -1890,7 +1895,7 @@ class Commande extends CommonOrder return -1; } - $sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_user_modif, c.fk_statut'; + $sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_user_modif, c.fk_statut as status'; $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.deposit_percent, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; $sql .= ', c.fk_account'; $sql .= ', c.date_commande, c.date_valid, c.tms'; @@ -1946,8 +1951,8 @@ class Commande extends CommonOrder $this->fk_project = $obj->fk_project; $this->project = null; // Clear if another value was already set by fetch_projet - $this->statut = $obj->fk_statut; - $this->status = $obj->fk_statut; + $this->statut = $obj->status; + $this->status = $obj->status; $this->user_author_id = $obj->fk_user_author; $this->user_creation_id = $obj->fk_user_author; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 245c4f4072f..b5d9785da63 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -766,14 +766,16 @@ if (empty($reshook)) { } } } + if ($action == 'validate' && $permissiontoadd && $objectclass !== null) { if (GETPOST('confirm') == 'yes') { + /** @var Commande $objecttmp */ $objecttmp = new $objectclass($db); $db->begin(); $error = 0; foreach ($toselect as $checked) { if ($objecttmp->fetch($checked)) { - if ($objecttmp->statut == 0) { + if ($objecttmp->status == $objecttmp::STATUS_DRAFT) { if (!empty($objecttmp->fk_warehouse)) { $idwarehouse = $objecttmp->fk_warehouse; } else { @@ -804,21 +806,23 @@ if ($action == 'validate' && $permissiontoadd && $objectclass !== null) { } if ($action == 'shipped' && $permissiontoadd && $objectclass !== null) { if (GETPOST('confirm') == 'yes') { + /** @var Commande $objecttmp */ $objecttmp = new $objectclass($db); $db->begin(); $error = 0; foreach ($toselect as $checked) { if ($objecttmp->fetch($checked)) { - if ($objecttmp->statut == 1 || $objecttmp->statut == 2) { - if ($objecttmp->cloture($user)) { + if ($objecttmp->status == $objecttmp::STATUS_VALIDATED || $objecttmp->status == $objecttmp::STATUS_SHIPMENTONPROCESS || $objecttmp->status == $objecttmp::STATUS_CLOSED) { + $result = $objecttmp->cloture($user); + if ($result > 0) { setEventMessages($langs->trans('StatusOrderDelivered', $objecttmp->ref), null, 'mesgs'); - } else { + } elseif ($result < 0) { setEventMessages($langs->trans('ErrorOrderStatusCantBeSetToDelivered'), null, 'errors'); $error++; } } else { $langs->load("errors"); - setEventMessages($langs->trans('ErrorIsNotADraft', $objecttmp->ref), null, 'errors'); + setEventMessages($langs->trans('ErrorObjectHasWrongStatus', $objecttmp->ref), null, 'errors'); $error++; } } else { diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index ed6c0f707c8..fc7a83c44e6 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -232,6 +232,7 @@ ErrorBadLinkSourceSetButBadValueForRef=The link you use is not valid. A 'source' ErrorTooManyErrorsProcessStopped=Too many errors. Process was stopped. ErrorMassValidationNotAllowedWhenStockIncreaseOnAction=Mass validation is not possible when option to increase/decrease stock is set on this action (you must validate one by one so you can define the warehouse to increase/decrease) ErrorObjectMustHaveStatusDraftToBeValidated=Object %s must have status 'Draft' to be validated. +ErrorObjectHasWrongStatus=Object %s must have another status for this operation. ErrorObjectMustHaveLinesToBeValidated=Object %s must have lines to be validated. ErrorOnlyInvoiceValidatedCanBeSentInMassAction=Only validated invoices can be sent using the "Send by email" mass action. ErrorChooseBetweenFreeEntryOrPredefinedProduct=You must choose if article is a predefined product or not From dd9655c22cc5fffb57862337a87b18293aec712f Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 11 Feb 2025 18:49:30 +0100 Subject: [PATCH 16/19] Debug v21 --- htdocs/fourn/commande/list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 5fd1c22b0ce..17e43f5f1c5 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -2063,7 +2063,11 @@ if ($resql) { } // Billed if (!empty($arrayfields['cf.billed']['checked'])) { - print ''.yn($obj->billed).''; + print ''; + if ($obj->billed) { + print yn($obj->billed, $langs->trans("Billed")); + } + print ''; if (!$i) { $totalarray['nbfield']++; } From ad8f6f75e634bff886f70da0d8ce16ee8f08af0b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 11 Feb 2025 20:32:05 +0100 Subject: [PATCH 17/19] Debug v21 --- htdocs/projet/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index c606b0d14f1..b905b0e51bf 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1503,7 +1503,7 @@ if (!empty($arrayfields['s.name_alias']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['co.country_code']['checked'])) { - print_liste_field_titre($arrayfields['co.country_code']['label'], $_SERVER["PHP_SELF"], "co.country_code", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['co.country_code']['label'], $_SERVER["PHP_SELF"], "country.code", "", $param, "", $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['commercial']['checked'])) { @@ -1875,7 +1875,7 @@ while ($i < $imaxinloop) { } // Country code if (!empty($arrayfields['co.country_code']['checked'])) { - print ''; + print ''; print $obj->country_code; print ''; if (!$i) { From 37c8f6436644d1f9b431ee70dac6cef3ed75c19b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 11 Feb 2025 20:35:23 +0100 Subject: [PATCH 18/19] Debug v21 --- htdocs/projet/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index b905b0e51bf..9eebe13d211 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1503,7 +1503,7 @@ if (!empty($arrayfields['s.name_alias']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['co.country_code']['checked'])) { - print_liste_field_titre($arrayfields['co.country_code']['label'], $_SERVER["PHP_SELF"], "country.code", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['co.country_code']['label'], $_SERVER["PHP_SELF"], "country.code", "", $param, "", $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['commercial']['checked'])) { From 56f5232358315b3029f55b73ee3df992ca7574c2 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 11 Feb 2025 22:21:59 +0100 Subject: [PATCH 19/19] Debug v21 --- htdocs/core/class/html.formfile.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c95f857a4a9..abb2d604b95 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -73,7 +73,7 @@ class FormFile * @param string $htmlname HTML name * @param string $modulepart Module part * @param string $dirformainimage Main directory of module - * @param string $subdirformainimage Subdirectory into main directory. Often ''. + * @param string $subdirformainimage Subdirectory into main directory. Often '', can be 'logos/'. * @param string $fileformainimage File name of image to show * @return string HTML code to show and edit image */ @@ -103,8 +103,8 @@ class FormFile $maxfilesizearray = getMaxFileSizeArray(); $maxmin = $maxfilesizearray['maxmin']; - $fileformainimagesmall = getImageFileNameForSize($fileformainimage, '_small'); - $fileformainimagemini = getImageFileNameForSize($fileformainimage, '_mini'); + $fileformainimagesmall = getImageFileNameForSize($fileformainimage, '_small'); // This include the "thumbs/..." in path + $fileformainimagemini = getImageFileNameForSize($fileformainimage, '_mini'); // This include the "thumbs/..." in path $out = ''; @@ -118,16 +118,16 @@ class FormFile $out .= ''; - if (file_exists($dirformainimage.'/'.$subdirformainimage.'thumbs/'.$fileformainimagesmall)) { + if (file_exists($dirformainimage.'/'.$subdirformainimage.$fileformainimagesmall)) { $out .= '
'; - $out .= ''; + $out .= ''; $out .= '
'; } elseif (!empty($fileformainimage)) { // Regenerate the thumbs - if (!file_exists($dirformainimage.'/'.$subdirformainimage.'thumbs/'.$fileformainimagemini)) { + if (!file_exists($dirformainimage.'/'.$subdirformainimage.$fileformainimagemini)) { $imgThumbMini = vignette($dirformainimage.'/'.$subdirformainimage.$fileformainimage, $maxwidthmini, $maxheightmini, '_mini', $quality); } - $imgThumbSmall = vignette($dirformainimage.'/'.$subdirformainimage.$fileformainimage, $maxwidthmini, $maxheightmini, '_small', $quality); + $imgThumbSmall = vignette($dirformainimage.'/'.$subdirformainimage.$fileformainimage, $maxwidthsmall, $maxheightsmall, '_small', $quality); $out .= '
'; $out .= ''; $out .= '
';