diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 45b35ff7fec..565cb2ab972 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,34 +9,34 @@ */ return [ // # Issue statistics: - // PhanUndeclaredProperty : 560+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 300+ occurrences - // PhanUndeclaredGlobalVariable : 280+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 200+ occurrences + // PhanUndeclaredProperty : 540+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 260+ occurrences + // PhanUndeclaredGlobalVariable : 250+ occurrences // PhanPluginUnknownArrayMethodReturnType : 180+ occurrences - // PhanTypeMismatchProperty : 130+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 180+ occurrences + // PhanTypeMismatchProperty : 140+ occurrences // PhanPluginUnknownArrayMethodParamType : 120+ occurrences + // PhanPluginUndeclaredVariableIsset : 45+ occurrences // PhanRedefineFunction : 45+ occurrences - // PhanTypeExpectedObjectPropAccess : 45+ occurrences - // PhanPluginUnknownPropertyType : 30+ occurrences - // PhanTypeMismatchArgumentNullableInternal : 30+ occurrences + // PhanTypeExpectedObjectPropAccess : 40+ occurrences // PhanTypeInvalidDimOffset : 25+ occurrences - // PhanPossiblyUndeclaredVariable : 20+ occurrences - // PhanTypeMismatchDimFetch : 20+ occurrences + // PhanTypeMismatchDimFetch : 25+ occurrences + // PhanTypeMismatchArgumentNullableInternal : 20+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanPluginEmptyStatementIf : 10+ occurrences // PhanTypeComparisonFromArray : 10+ occurrences // PhanUndeclaredMethod : 10+ occurrences - // PhanEmptyForeach : 8 occurrences // PhanPluginUnknownObjectMethodCall : 8 occurrences - // PhanPluginBothLiteralsBinaryOp : 7 occurrences + // PhanEmptyForeach : 7 occurrences // PhanPluginSuspiciousParamPosition : 7 occurrences + // PhanPluginBothLiteralsBinaryOp : 6 occurrences // PhanPluginDuplicateExpressionBinaryOp : 6 occurrences // PhanTypeArraySuspiciousNull : 6 occurrences // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences + // PhanPossiblyUndeclaredVariable : 2 occurrences // PhanTypeMismatchDimAssignment : 2 occurrences // PhanTypeMismatchDimFetchNullable : 2 occurrences // PhanTypeMismatchReturn : 2 occurrences @@ -58,7 +58,7 @@ return [ 'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/api/class/api_setup.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/asset/class/asset.class.php' => ['PhanTypeInvalidDimOffset'], + 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'], 'htdocs/asset/tpl/accountancy_codes_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -131,7 +131,7 @@ return [ 'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/core/actions_massactions.inc.php' => ['PhanUndeclaredProperty'], 'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/actions_sendmails.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/ajax/ajaxdirtree.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/class/canvas.class.php' => ['PhanParamTooMany', 'PhanUndeclaredMethod'], 'htdocs/core/class/ccountry.class.php' => ['PhanUndeclaredProperty'], @@ -151,7 +151,6 @@ return [ 'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/core/lib/admin.lib.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/lib/customreports.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/files.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/functions2.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/pdf.lib.php' => ['PhanUndeclaredProperty'], @@ -175,42 +174,22 @@ return [ 'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/project/doc/pdf_timespent.modules.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/supplier_order/modules_commandefournisseur.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchProperty'], + 'htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanPluginDuplicateArrayKey'], - 'htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/search_page.php' => ['PhanEmptyForeach', 'PhanPluginBothLiteralsBinaryOp'], - 'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/commonfields_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/extrafields_view.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/notes.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/core/tpl/onlinepaymentlinks.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/passwordforgotten.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/passwordreset.tpl.php' => ['PhanUndeclaredGlobalVariable'], @@ -226,15 +205,16 @@ return [ 'htdocs/cron/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/debugbar/class/DataCollector/DolMemoryCollector.php' => ['PhanTypeMismatchReturn'], 'htdocs/debugbar/class/DataCollector/DolQueryCollector.php' => ['PhanTypeMismatchReturn'], - 'htdocs/delivery/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/delivery/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/delivery/class/delivery.class.php' => ['PhanUndeclaredProperty'], 'htdocs/delivery/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/document.php' => ['PhanRedefineFunction'], 'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'], - 'htdocs/don/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/class/api_donations.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], 'htdocs/don/document.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/don/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/don/info.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/don/list.php' => ['PhanTypeMismatchProperty'], 'htdocs/don/note.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -259,7 +239,7 @@ return [ 'htdocs/expedition/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expedition/list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/expedition/note.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/expedition/shipment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/expedition/shipment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/expensereport/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/expensereport/payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -270,12 +250,12 @@ return [ 'htdocs/expensereport/tpl/expensereport_linktofile.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/fichinter/card-rec.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/filefunc.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/fourn/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], @@ -289,7 +269,6 @@ return [ 'htdocs/fourn/contact.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/facture/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/fourn/facture/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], - 'htdocs/fourn/facture/list-rec.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/facture/paiement.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], @@ -308,7 +287,7 @@ return [ 'htdocs/hrm/class/skill.class.php' => ['PhanUndeclaredProperty'], 'htdocs/hrm/class/skilldet.class.php' => ['PhanUndeclaredProperty'], 'htdocs/hrm/class/skillrank.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/hrm/core/tpl/objectline_view.tpl.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/hrm/core/tpl/objectline_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/hrm/evaluation_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/hrm/job_agenda.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/hrm/job_card.php' => ['PhanUndeclaredGlobalVariable'], @@ -319,10 +298,12 @@ return [ 'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/imports/import.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/install/fileconf.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/install/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/install/repair.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/install/repair.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/install/step2.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], + 'htdocs/install/step5.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], @@ -347,6 +328,7 @@ return [ 'htdocs/opcachepreload.php' => ['PhanEmptyForeach'], 'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanTypeMismatchProperty'], + 'htdocs/opensurvey/list.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/opensurvey/results.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/choix_date.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/create_survey.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -363,11 +345,12 @@ return [ 'htdocs/product/class/html.formproduct.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/product/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/inventory/class/inventory.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/inventory/inventory.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'], 'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'], @@ -377,8 +360,8 @@ return [ 'htdocs/product/stock/class/entrepot.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/movement_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/product.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/productlot_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -401,7 +384,7 @@ return [ 'htdocs/projet/element.php' => ['PhanUndeclaredProperty'], 'htdocs/projet/ganttchart.inc.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/projet/ganttview.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/graph_opportunities.inc.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/projet/graph_opportunities.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], 'htdocs/projet/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/projet/tasks.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/tasks/comment.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -436,6 +419,7 @@ return [ 'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'], @@ -447,13 +431,13 @@ return [ 'htdocs/reception/class/reception.class.php' => ['PhanUndeclaredProperty'], 'htdocs/reception/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/reception/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/reception/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/reception/note.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach'], 'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach'], 'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/index.php' => ['PhanUndeclaredGlobalVariable'], @@ -466,7 +450,6 @@ return [ 'htdocs/recruitment/recruitmentjobposition_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/salaries/admin/salaries.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/salaries/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/salaries/class/api_salaries.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/salaries/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/salaries/paiement_salary.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -477,7 +460,7 @@ return [ 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/societe/class/societe.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/societe/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], 'htdocs/societe/price.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -491,9 +474,10 @@ return [ 'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/takepos/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/takepos/invoice.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/takepos/pay.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/takepos/split.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/takepos/split.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/theme/eldy/badges.inc.php' => ['PhanRedefineFunction'], 'htdocs/theme/eldy/btn.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/eldy/dropdown.inc.php' => ['PhanUndeclaredGlobalVariable'], @@ -512,7 +496,6 @@ return [ 'htdocs/ticket/class/ticket.class.php' => ['PhanUndeclaredProperty'], 'htdocs/ticket/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/ticket/list.php' => ['PhanTypeComparisonFromArray'], - 'htdocs/user/bank.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/user/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/user/class/api_users.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/user/class/user.class.php' => ['PhanUndeclaredProperty'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index fff6adccf1a..b13c4c1e769 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France */ define('DOL_PROJECT_ROOT', __DIR__.'/../../..'); @@ -367,7 +367,7 @@ return [ // can also be written as 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php' 'DeprecateAliasPlugin', //'EmptyMethodAndFunctionPlugin', - // 'InvalidVariableIssetPlugin', + 'InvalidVariableIssetPlugin', //'MoreSpecificElementTypePlugin', 'NoAssertPlugin', 'NotFullyQualifiedUsagePlugin', @@ -450,8 +450,8 @@ return [ 'PhanPluginRedundantAssignment', // Not essential, useless 'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences - // 'PhanPluginUnknownArrayMethodParamType', // Too many troubles to manage. Is enabled in config_extended only. - // 'PhanPluginUnknownArrayMethodReturnType', // Too many troubles to manage. Is enabled in config_extended only. + // 'PhanPluginUnknownArrayMethodParamType', // All fixed, except in api_* + // 'PhanPluginUnknownArrayMethodReturnType', // All fixed, except in api_* // 'PhanUndeclaredGlobalVariable', // Helps identify variables that are not set/defined - add '@phan-var-force TYPE $varname' in tpl or includes to help type the variable // 'PhanPluginUnknownObjectMethodCall', // False positive for some class. Is enabled in config_extended only. 'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code. diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 0d0abaa19b8..38cd62d20f6 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France */ @@ -95,8 +95,8 @@ $config['suppress_issue_types'] = [ 'PhanPluginRedundantAssignment', // Not essential, useless 'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences - 'PhanPluginUnknownArrayMethodParamType', // this option costs more time to be supported than it solves time - 'PhanPluginUnknownArrayMethodReturnType', // this option costs more time to be supported than it solves time + 'PhanPluginUnknownArrayMethodParamType', // All fixed, except in api_* at this time + 'PhanPluginUnknownArrayMethodReturnType', // All fixed, except in api_* at this time 'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code. ]; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 4c5ee381d51..cdc391e1ee8 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1,4 +1,5 @@ * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin @@ -8,7 +9,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2024 Frédéric France * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -1491,6 +1492,7 @@ class FactureRec extends CommonInvoice 'facturerec' => $facturerec, // it's an object which PHP passes by "reference", so modifiable by hooks. 'this' => $this, // it's an object which PHP passes by "reference", so modifiable by hooks. ); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('afterCreationOfRecurringInvoice', $parameters, $facture); // note: $facture can be modified by hooks (warning: $facture can be null) $i++; diff --git a/htdocs/compta/facture/note-rec.php b/htdocs/compta/facture/note-rec.php index 61da109eb4a..42aa5138c86 100644 --- a/htdocs/compta/facture/note-rec.php +++ b/htdocs/compta/facture/note-rec.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -117,7 +118,7 @@ if (empty($object->id)) { } -if ($id > 0 ) { +if ($id > 0) { $object = new FactureRec($db); $object->fetch($id); @@ -129,7 +130,7 @@ if ($id > 0 ) { print dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'); - // Object card + // Object card // ------------------------------------------------------------ $linkback = ''.$langs->trans("BackToList").''; @@ -152,7 +153,7 @@ if ($id > 0 ) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); @@ -184,18 +185,18 @@ if ($id > 0 ) { $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object); - $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m') . ')'; + $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $dateexample, -1, 'm'), '%m') . ')'; $substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%m') . ')'; - $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m') . ')'; - $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B') . ')'; + $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $dateexample, 1, 'm'), '%m') . ')'; + $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $dateexample, -1, 'm'), '%B') . ')'; $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%B') . ')'; - $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B') . ')'; - $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y') . ')'; + $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $dateexample, 1, 'm'), '%B') . ')'; + $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $dateexample, -1, 'y'), '%Y') . ')'; $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%Y') . ')'; - $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y') . ')'; + $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $dateexample, 1, 'y'), '%Y') . ')'; // Only on template invoices - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour') . ')'; - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour') . ')'; + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(($object->date_when ? (int) $object->date_when : dol_now()), 'dayhour') . ')'; + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree(($object->date_when ? (int) $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour') . ')'; $substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $object->nb_gen_done; $substitutionarray['__INVOICE_COUNTER_MAX__'] = $object->nb_gen_max; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index fd22234a7a9..35a46efd9bc 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -1,4 +1,5 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2016 Laurent Destailleur @@ -6,7 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -931,7 +932,7 @@ if ($object->id > 0) { $tmpuser = new User($db); - $num = $db->num_rows($result); + $num = $db->num_rows($resql); while ($i < $num) { $obj = $db->fetch_object($resql); diff --git a/htdocs/compta/paiement/document.php b/htdocs/compta/paiement/document.php index e4d761b0da3..428ea6d9d10 100644 --- a/htdocs/compta/paiement/document.php +++ b/htdocs/compta/paiement/document.php @@ -8,6 +8,7 @@ * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2021 Jesus Jerez * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -51,7 +52,7 @@ if (isModEnabled('project')) { // Load translation files required by the page $langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers', 'other')); -$id = GETPOST('id', 'int'); +$id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); @@ -105,7 +106,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; * View */ -$form = new Form($db); +$form = new Form($db); $title = $langs->trans('Payment')." - ".$langs->trans('Documents'); llxHeader('', $title); @@ -120,8 +121,8 @@ if ($object->id > 0) { $morehtmlref = '
'; // Date of payment - $morehtmlref .= $form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight('facture', 'creer')), 'datehourpicker', '', 0, 3).': '; - $morehtmlref .= $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight('facture', 'creer')), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded')); + $morehtmlref .= $form->editfieldkey("Date", 'datep', $object->date, $object, (int) ($object->statut == 0 && ($user->hasRight('facture', 'creer'))), 'datehourpicker', '', 0, 3).': '; + $morehtmlref .= $form->editfieldval("Date", 'datep', $object->date, $object, (int) ($object->statut == 0 && ($user->hasRight('facture', 'creer'))), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded')); // Payment mode $morehtmlref .= '
'.$langs->trans('PaymentMode').' : '; @@ -158,7 +159,7 @@ if ($object->id > 0) { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); // Build file list - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); $totalsize = 0; foreach ($filearray as $key => $file) { $totalsize += $file['size']; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 266bae09fc0..e5a191b8135 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1,10 +1,11 @@ * Copyright (C) 2018-2021 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -1941,6 +1942,7 @@ $parameters['uploaddir'] = $uploaddir; $parameters['massaction'] = $massaction; $parameters['diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction : null; +// @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('doMassActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 675a22ae0fe..31e4b64b6aa 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -1,8 +1,9 @@ * Copyright (C) 2011-2023 Laurent Destailleur * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -161,7 +162,7 @@ class FileUpload 'options' => &$options, 'element' => $element ), - $object, + $object, // @phan-suppress-current-line PhanTypeMismatchArgumentNullable $action ); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index fc8fc9ada54..2cdec011d65 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -1,8 +1,9 @@ * Copyright (C) 2010-2014 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 05e38eb57d2..e374296cf13 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1,4 +1,5 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier @@ -100,18 +101,18 @@ class Form /** * Output key field for an editable field * - * @param string $text Text of label or key to translate - * @param string $htmlname Name of select field ('edit' prefix will be added) - * @param string $preselected Value to show/edit (not used in this function) - * @param object $object Object (on the page we show) - * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. - * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) - * @param string $moreparam More param to add on a href URL. - * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. - * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' - * @param string $paramid Key of parameter for id ('id', 'socid') - * @param string $help Tooltip help - * @return string HTML edit field + * @param string $text Text of label or key to translate + * @param string $htmlname Name of select field ('edit' prefix will be added) + * @param string $preselected Value to show/edit (not used in this function) + * @param object $object Object (on the page we show) + * @param int<0,1> $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) + * @param string $moreparam More param to add on a href URL. + * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. + * @param int<0,3> $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' + * @param string $paramid Key of parameter for id ('id', 'socid') + * @param string $help Tooltip help + * @return string HTML edit field */ public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '') { @@ -200,23 +201,23 @@ class Form /** * Output value of a field for an editable field * - * @param string $text Text of label (not used in this function) - * @param string $htmlname Name of select field - * @param string $value Value to show/edit - * @param CommonObject $object Object (that we want to show) - * @param boolean $perm Permission to allow button to edit parameter - * @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'phone', 'amount:99', 'numeric:99', + * @param string $text Text of label (not used in this function) + * @param string $htmlname Name of select field + * @param string|int $value Value to show/edit + * @param CommonObject $object Object (that we want to show) + * @param bool|int<0,1> $perm Permission to allow button to edit parameter + * @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'phone', 'amount:99', 'numeric:99', * 'text' or 'textarea:rows:cols%', 'safehtmlstring', 'restricthtml', * 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') - * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formatted price instead of numeric value, or a select combo). Use '' to use same than $value + * @param ?string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formatted price instead of numeric value, or a select combo). Use '' to use same than $value * @param ?CommonObject $extObject External object ??? - * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') + * @param string|array|null $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @param string $moreparam More param to add on the form on action href URL parameter - * @param int $notabletag Do no output table tags + * @param int<0,1> $notabletag Do no output table tags * @param string $formatfunc Call a specific method of $object->$formatfunc to output field in view mode (For example: 'dol_print_email') * @param string $paramid Key of parameter for id ('id', 'socid') * @param string $gm 'auto' or 'tzuser' or 'tzuserrel' or 'tzserver' (when $typeofdata is a date) - * @param array $moreoptions Array with more options. For example array('addnowlink'=>1), array('valuealreadyhtmlescaped'=>1) + * @param array $moreoptions Array with more options. For example array('addnowlink'=>1), array('valuealreadyhtmlescaped'=>1) * @param string $editaction [=''] use GETPOST default action or set action to edit mode * @return string HTML edit field */ @@ -487,9 +488,9 @@ class Form * @param string $htmlname DIV ID (field name) * @param int $condition Condition to edit * @param string $inputType Type of input ('string', 'numeric', 'datepicker' ('day' do not work, don't know why), 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:loadmethod:savemethod:buttononly') - * @param string $editvalue When in edit mode, use this value as $value instead of value + * @param ?string $editvalue When in edit mode, use this value as $value instead of value * @param ?CommonObject $extObject External object - * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') + * @param string|array|null $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @return string HTML edit in place */ protected function editInPlace($object, $value, $htmlname, $condition, $inputType = 'textarea', $editvalue = null, $extObject = null, $custommsg = null) @@ -2132,7 +2133,7 @@ class Form * @param int $disabled If select list must be disabled * @param int[]|''|'hierarchy'|'hierarchyme' $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me * @param int[]|'' $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled - * @param string $force_entity '0' or list of Ids of environment to force, separated by a coma, or 'default' = do no extend to all entities allowed to superadmin. + * @param string $force_entity '0' or list of Ids of environment to force, separated by a comma, or 'default' = do no extend to all entities allowed to superadmin. * @param int $maxlength Maximum length of string into list (0=no limit) * @param int<-1,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param string $morefilter Add more filters into sql request (Example: '(employee:=:1)'). This value must not come from user input. @@ -6060,11 +6061,11 @@ class Form /** * Show a form to select a project * - * @param int $page Page + * @param string $page Page * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) * @param string $selected Id preselected project * @param string $htmlname Name of select field - * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable) + * @param int<0,2> $discard_closed Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable) * @param int $maxlength Max length * @param int $forcefocus Force focus on field (works with javascript only) * @param int<0,1> $nooutput No print is done. String is returned. @@ -6116,7 +6117,7 @@ class Form /** * Show a form to select payment conditions * - * @param int $page Page + * @param string $page Page * @param string $selected Id condition pre-selectionne * @param string $htmlname Name of select html field * @param int $addempty Add empty entry @@ -6177,7 +6178,7 @@ class Form /** * Show a form to select a delivery delay * - * @param int $page Page + * @param string $page Page * @param string $selected Id condition pre-selectionne * @param string $htmlname Name of select html field * @param int $addempty Add an empty entry @@ -9066,7 +9067,7 @@ class Form * @param string $morecss Add more class to css styles * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. * @param string $placeholder String to use as placeholder - * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) + * @param int<0,1> $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return string HTML select string * @see selectArrayFilter(), ajax_combobox() in ajax.lib.php */ @@ -11721,10 +11722,10 @@ class Form // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Load into cache list of invoice subtypes - * - * @return int Nb of lines loaded, <0 if KO - */ + * Load into cache list of invoice subtypes + * + * @return int Nb of lines loaded, <0 if KO + */ public function load_cache_invoice_subtype() { // phpcs:enable @@ -11767,15 +11768,15 @@ class Form /** - * Return list of invoice subtypes. - * - * @param int $selected Id of invoice subtype to preselect by default - * @param string $htmlname Select field name - * @param int<0,1> $addempty Add an empty entry - * @param int<0,1> $noinfoadmin 0=Add admin info, 1=Disable admin info - * @param string $morecss Add more CSS on select tag - * @return string String for the HTML select component - */ + * Return list of invoice subtypes. + * + * @param int $selected Id of invoice subtype to preselect by default + * @param string $htmlname Select field name + * @param int<0,1> $addempty Add an empty entry + * @param int<0,1> $noinfoadmin 0=Add admin info, 1=Disable admin info + * @param string $morecss Add more CSS on select tag + * @return string String for the HTML select component + */ public function getSelectInvoiceSubtype($selected = 0, $htmlname = 'subtypeid', $addempty = 0, $noinfoadmin = 0, $morecss = '') { global $langs, $user; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 39c0ff94ec2..948907ff469 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -810,7 +810,7 @@ class FormCompany extends Form /** * Return a select list with types of contacts * - * @param Object $object Object to use to find type of contact + * @param ?Object $object Object to use to find type of contact * @param string $selected Default selected value * @param string $htmlname HTML select name * @param string $source Source ('internal' or 'external') diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c95f857a4a9..54b63b884d3 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1,4 +1,5 @@ * Copyright (C) 2010-2014 Regis Houssin * Copyright (C) 2010-2016 Juanjo Menent @@ -8,7 +9,7 @@ * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2016-2017 Ferran Marcet * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -310,6 +311,7 @@ class FormFile } $parameters = array('socid' => (isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id' => (isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url' => $url, 'perm' => $perm, 'options' => $options); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $res = $hookmanager->executeHooks('formattachOptionsUpload', $parameters, $object); if (empty($res)) { $out = '
'.$out.'
'; @@ -1349,6 +1351,7 @@ class FormFile 'title' => $title, 'url' => $url ); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('showFilesList', $parameters, $object); if (!empty($reshook)) { // null or '' for bypass diff --git a/htdocs/core/lib/customreports.lib.php b/htdocs/core/lib/customreports.lib.php index 621b0dfd093..61e2bc17694 100644 --- a/htdocs/core/lib/customreports.lib.php +++ b/htdocs/core/lib/customreports.lib.php @@ -1,4 +1,5 @@ * Copyright (C) 2024 Frédéric France * Copyright (C) 2024-2025 MDW @@ -409,21 +410,21 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { $position = (empty($val['position']) ? 0 : intval($val['position'])); $arrayofgroupby[$tablealias.'.'.$key.'-year'] = array( - 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', + 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', // @phan-suppress-current-line PhanUndeclaredProperty 'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']), 'position' => ($position + ($count * 100000)).'.1', 'table' => $object->table_element, 'tablefromt' => $tablepath ); $arrayofgroupby[$tablealias.'.'.$key.'-month'] = array( - 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', + 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', // @phan-suppress-current-line PhanUndeclaredProperty 'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']), 'position' => ($position + ($count * 100000)).'.2', 'table' => $object->table_element, 'tablefromt' => $tablepath ); $arrayofgroupby[$tablealias.'.'.$key.'-day'] = array( - 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', + 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', // @phan-suppress-current-line PhanUndeclaredProperty 'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']), 'position' => ($position + ($count * 100000)).'.3', 'table' => $object->table_element, @@ -432,7 +433,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup } else { $position = (empty($val['position']) ? 0 : intval($val['position'])); $arrayofgroupby[$tablealias.'.'.$key] = array( - 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), + 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), // @phan-suppress-current-line PhanUndeclaredProperty 'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']), 'position' => ($position + ($count * 100000)), 'table' => $object->table_element, @@ -455,14 +456,14 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('timestamp', 'date', 'datetime'))) { $position = (empty($extrafields->attributes[$object->table_element]['pos'][$key]) ? 0 : intval($extrafields->attributes[$object->table_element]['pos'][$key])); $arrayofgroupby[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-year'] = array( - 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' ('.$YYYY.')', + 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' ('.$YYYY.')', // @phan-suppress-current-line PhanUndeclaredProperty 'labelnohtml' => $labelofobject.': '.$langs->trans($val), 'position' => ($position + ($count * 100000)).'.1', 'table' => $object->table_element, 'tablefromt' => $tablepath ); $arrayofgroupby[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-month'] = array( - 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' ('.$YYYY.'-'.$MM.')', + 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' ('.$YYYY.'-'.$MM.')', // @phan-suppress-current-line PhanUndeclaredProperty 'labelnohtml' => $labelofobject.': '.$langs->trans($val), 'position' => ($position + ($count * 100000)).'.2', 'table' => $object->table_element, @@ -570,7 +571,7 @@ function fillArrayOfFilterFields($object, $tablealias, $labelofobject, &$arrayof $position = (empty($val['position']) ? 0 : intval($val['position'])); $arrayoffields[$tablealias.'.'.$key] = array( - 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), + 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), // @phan-suppress-current-line PhanUndeclaredProperty 'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']), 'position' => ($position + ($count * 100000)), 'table' => $object->table_element, diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 865d3f438c9..9a37d1404bf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -495,6 +495,7 @@ function getEntity($element, $shared = 1, $currentobject = null) 'currentobject' => $currentobject, 'out' => $out ); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('hookGetEntity', $parameters, $currentobject, $action); // Note that $action and $object may have been modified by some hooks if (is_numeric($reshook)) { @@ -3426,7 +3427,7 @@ function dol_strftime($fmt, $ts = false, $is_gmt = false) * Output date in a string format according to outputlangs (or langs if not defined). * Return charset is always UTF-8, except if encodetoouput is defined. In this case charset is output charset * - * @param int|string $time GM Timestamps date + * @param null|int|string $time GM Timestamps date * @param string $format Output date format (tag of strftime function) * "%d %b %Y", * "%d/%m/%Y %H:%M", @@ -3448,7 +3449,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = global $conf, $langs; // If date undefined or "", we return "" - if (dol_strlen($time) == 0) { + if (dol_strlen((string) $time) == 0) { return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) } @@ -5787,7 +5788,7 @@ function img_error($titlealt = 'default') * Show next logo * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. -* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') + * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ function img_next($titlealt = 'default', $moreatt = '') @@ -6263,16 +6264,16 @@ function dol_print_error_email($prefixcode, $errormessage = '', $errormessages = /** * Show title line of an array * - * @param string $name Label of field + * @param ?string $name Label of field * @param string $file Url used when we click on sort picto * @param string $field Field to use for new sorting * @param string $begin ("" by default) * @param string $moreparam Add more parameters on sort url links ("" by default) * @param string $moreattrib Options of attribute td ("" by default) - * @param string $sortfield Current field used to sort - * @param string $sortorder Current sort order + * @param ?string $sortfield Current field used to sort + * @param ?string $sortorder Current sort order * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag, for example 'mycss '. - * @param string $tooltip Tooltip + * @param ?string $tooltip Tooltip * @param int $forcenowrapcolumntitle No need for use 'wrapcolumntitle' css style * @return void */ @@ -6284,19 +6285,19 @@ function print_liste_field_titre($name, $file = "", $field = "", $begin = "", $m /** * Get title line of an array * - * @param string $name Translation key of field to show or complete HTML string to show - * @param int $thead 0=To use with standard table format, 1=To use inside , 2=To use with
- * @param string $file Url used when we click on sort picto - * @param string $field Field to use for new sorting. Empty if this field is not sortable. Example "t.abc" or "t.abc,t.def" - * @param string $begin ("" by default) - * @param string $moreparam Add more parameters on sort url links ("" by default) - * @param string $moreattrib Add more attributes on th ("" by default). To add more css class, use param $prefix. - * @param string $sortfield Current field used to sort (Ex: 'd.datep,d.id') - * @param string $sortorder Current sort order (Ex: 'asc,desc') - * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag, for example 'mycss '. - * @param int $disablesortlink 1=Disable sort link - * @param string $tooltip Tooltip - * @param int $forcenowrapcolumntitle No need for use 'wrapcolumntitle' css style + * @param ?string $name Translation key of field to show or complete HTML string to show + * @param int<0,2> $thead 0=To use with standard table format, 1=To use inside , 2=To use with
+ * @param string $file Url used when we click on sort picto + * @param string $field Field to use for new sorting. Empty if this field is not sortable. Example "t.abc" or "t.abc,t.def" + * @param string $begin ("" by default) + * @param string $moreparam Add more parameters on sort url links ("" by default) + * @param string $moreattrib Add more attributes on th ("" by default). To add more css class, use param $prefix. + * @param ?string $sortfield Current field used to sort (Ex: 'd.datep,d.id') + * @param ?string $sortorder Current sort order (Ex: 'asc,desc') + * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag, for example 'mycss '. + * @param int<0,1> $disablesortlink 1=Disable sort link + * @param ?string $tooltip Tooltip + * @param int<0,1> $forcenowrapcolumntitle No need to use 'wrapcolumntitle' css style * @return string */ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin = "", $moreparam = "", $moreattrib = "", $sortfield = "", $sortorder = "", $prefix = "", $disablesortlink = 0, $tooltip = '', $forcenowrapcolumntitle = 0) @@ -6308,7 +6309,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin $prefix .= 'right '; // For backward compatibility } - $sortorder = strtoupper($sortorder); + $sortorder = strtoupper((string) $sortorder); $out = ''; $sortimg = ''; @@ -6317,7 +6318,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin $tag = 'div'; } - $tmpsortfield = explode(',', $sortfield); + $tmpsortfield = explode(',', (string) $sortfield); $sortfield1 = trim($tmpsortfield[0]); // If $sortfield is 'd.datep,d.id', it becomes 'd.datep' $tmpfield = explode(',', $field); $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' @@ -6495,8 +6496,8 @@ function load_fiche_titre($title, $morehtmlright = '', $picto = 'generic', $pict * @param int|null $page Numero of page to show in navigation links (required) * @param string $file Url of page (required) * @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder). Value must be 'urlencoded' before calling function. - * @param string $sortfield Field to sort on ('' by default) - * @param string $sortorder Order to sort ('' by default) + * @param ?string $sortfield Field to sort on ('' by default) + * @param ?string $sortorder Order to sort ('' by default) * @param string $morehtmlcenter String in the middle ('' by default). We often find here string $massaction coming from $form->selectMassAction() * @param int $num Number of records found by select with limit+1 * @param int|string $totalnboflines Total number of records/lines for all pages (if known). Use a negative value of number to not show number. Use '' if unknown. @@ -7147,8 +7148,8 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round * * @param float|string $vatrate Vat rate. Can be '8.5' or '8.5 (VATCODEX)' for example * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) - * @param Societe $thirdparty_buyer Object of buying third party - * @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined) + * @param ?Societe $thirdparty_buyer Object of buying third party + * @param ?Societe $thirdparty_seller Object of selling third party ($mysoc if not defined) * @param int $vatnpr If vat rate is NPR or not * @return int<0,0>|string 0 if not found, localtax rate if found (Can be '20', '-19:-15:-9') * @see get_default_tva() @@ -7416,8 +7417,8 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid * * @param int|string $vatrate VAT ID or Rate+Code. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123. * @param int<0,2> $local Number of localtax (1 or 2, or 0 to return 1 & 2) - * @param Societe $buyer Company object - * @param Societe $seller Company object + * @param ?Societe $buyer Company object + * @param ?Societe $seller Company object * @param int<0,1> $firstparamisid 1 if first param is ID into table instead of Rate+code (use this if you can) * @return array{}|array{0:string,1:int|string,2:string,3:string}|array{0:string,1:int|string,2:string,3:int|string,4:string,5:string} array(localtax_type1('1-6' or '0' if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp) * @see getTaxesFromId() @@ -11309,6 +11310,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, // No need to make a return $head. Var is modified as a reference if (!empty($hookmanager)) { $parameters = array('object' => $object, 'mode' => $mode, 'head' => &$head, 'filterorigmodule' => $filterorigmodule); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('completeTabsHead', $parameters, $object); if ($reshook > 0) { // Hook ask to replace completely the array $head = $hookmanager->resArray; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index fd51a9a474b..010d5f87eed 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1,4 +1,5 @@ * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007 Patrick Raguin @@ -14,7 +15,7 @@ * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2021-2022 Anthony Berton * Copyright (C) 2023-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -454,6 +455,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t if (is_object($hookmanager)) { $parameters = array('sourcecompany' => &$sourcecompany, 'targetcompany' => &$targetcompany, 'targetcontact' => &$targetcontact, 'outputlangs' => $outputlangs, 'mode' => $mode, 'usecontact' => $usecontact); $action = ''; + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('pdf_build_address', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $stringaddress .= $hookmanager->resPrint; } @@ -2678,7 +2680,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $reshook = $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { $linkedobjects = array_replace($linkedobjects, $hookmanager->resArray); // array_replace is used to preserve keys - } elseif ($reshook>0) { + } elseif ($reshook > 0) { // The array must be reinserted even if it is empty because clearing the array could be one of the actions performed by the hook. $linkedobjects = $hookmanager->resArray; } diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 259e2e02353..11df59e893a 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -47,8 +47,8 @@ * @param float $remise_percent_global 0 * @param string $price_base_type 'HT'=Unit price parameter $pu is HT, 'TTC'=Unit price parameter $pu is TTC (HT+VAT but not Localtax. TODO Add also mode 'INCT' when pu is price HT+VAT+LT1+LT2) * @param int $info_bits Miscellaneous information on line - * @param int<0,1> $type 0/1=Product/service - * @param Societe|string $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc. + * @param int<0,1> $type 0/1=Product/service + * @param string|Societe|string $seller Third party seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc. * @param array{0:string,1:int|string,2:string,3:string}|array{0:string,1:int|string,2:string,3:int|string,4:string,5:string} $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). * @param float $progress Situation invoices progress (value from 0 to 100, 100 by default) * @param float $multicurrency_tx Currency rate (1 by default) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 705f32894e5..30771eba7b0 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -1,11 +1,12 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 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 @@ -617,11 +618,11 @@ class doc_generic_task_odt extends ModelePDFTask // Replace tags of lines for contacts task $sourcearray = array('internal', 'external'); - $contact_arrray = array(); + $contact_array = array(); foreach ($sourcearray as $source) { $contact_temp = $object->liste_contact(-1, $source); if ((is_array($contact_temp) && count($contact_temp) > 0)) { - $contact_arrray = array_merge($contact_arrray, $contact_temp); + $contact_array = array_merge($contact_array, $contact_temp); } } // Check for segment @@ -633,8 +634,8 @@ class doc_generic_task_odt extends ModelePDFTask $foundtagforlines = 0; dol_syslog($e->getMessage(), LOG_INFO); } - if ($foundtagforlines && (is_array($contact_arrray) && count($contact_arrray) > 0)) { - foreach ($contact_arrray as $contact) { + if ($foundtagforlines && (is_array($contact_array) && count($contact_array) > 0)) { + foreach ($contact_array as $contact) { if ($contact['source'] == 'internal') { $objectdetail = new User($this->db); $objectdetail->fetch($contact['id']); @@ -646,6 +647,9 @@ class doc_generic_task_odt extends ModelePDFTask $soc = new Societe($this->db); $soc->fetch($contact['socid']); $contact['socname'] = $soc->name; + } else { + dol_syslog(get_class().'::'.__METHOD__.' Unexpected contact source:'.$contact['source'], LOG_WARNING); + $objectdetail = null; } $contact['fullname'] = is_object($objectdetail) ? $objectdetail->getFullName($outputlangs, 1) : null; @@ -793,11 +797,11 @@ class doc_generic_task_odt extends ModelePDFTask // Replace tags of lines for contacts $sourcearray = array('internal', 'external'); - $contact_arrray = array(); + $contact_array = array(); foreach ($sourcearray as $source) { $contact_temp = $project->liste_contact(-1, $source); if ((is_array($contact_temp) && count($contact_temp) > 0)) { - $contact_arrray = array_merge($contact_arrray, $contact_temp); + $contact_array = array_merge($contact_array, $contact_temp); } } // Check for segment @@ -809,9 +813,9 @@ class doc_generic_task_odt extends ModelePDFTask $foundtagforlines = 0; dol_syslog($e->getMessage(), LOG_INFO); } - if ($foundtagforlines && (is_array($contact_arrray) && count($contact_arrray) > 0)) { + if ($foundtagforlines && (is_array($contact_array) && count($contact_array) > 0)) { try { - foreach ($contact_arrray as $contact) { + foreach ($contact_array as $contact) { if ($contact['source'] == 'internal') { $objectdetail = new User($this->db); $objectdetail->fetch($contact['id']); @@ -823,6 +827,9 @@ class doc_generic_task_odt extends ModelePDFTask $soc = new Societe($this->db); $soc->fetch($contact['socid']); $contact['socname'] = $soc->name; + } else { + dol_syslog(get_class().'::'.__METHOD__.' Unexpected contact source:'.$contact['source'], LOG_ERR); + continue; } $contact['fullname'] = $objectdetail->getFullName($outputlangs, 1); diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index 07ad702dd36..ce5cfb5466b 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -1,8 +1,9 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -49,10 +50,19 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + /** + * @var string Prefix customer accountancy code + */ public $prefixcustomeraccountancycode; + /** + * @var string Prefix supplier accountancy code + */ public $prefixsupplieraccountancycode; + /** + * @var int + */ public $position = 20; diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index 857cb2d9521..4ccb0c151a4 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -1,9 +1,10 @@ * Copyright (C) 2010 Laurent Destailleur * Copyright (C) 2019 Alexandre Spangaro * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -45,24 +46,31 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' /** - * Prefix customer accountancy code - * @var string + * @var string Prefix customer accountancy code */ public $prefixcustomeraccountancycode; /** - * Prefix supplier accountancy code - * @var string + * @var string Prefix supplier accountancy code */ public $prefixsupplieraccountancycode; + /** + * @var int + */ public $position = 30; /** * @var string */ public $code; + /** + * @var string + */ public $customeraccountancycodecharacternumber; + /** + * @var string + */ public $supplieraccountancycodecharacternumber; @@ -178,7 +186,9 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode $s .= "
\n"; if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) { - $thirdpartylabelexample = preg_replace('/([^a-z0-9])/i', '', $mysoc->name); + $thirdpartylabelexample = (string) preg_replace('/([^a-z0-9])/i', '', $mysoc->name); + } else { + $thirdpartylabelexample = ''; } $s .= "
\n"; $s .= $this->prefixcustomeraccountancycode.strtoupper(substr($thirdpartylabelexample, 0, (int) $this->customeraccountancycodecharacternumber)); @@ -191,8 +201,8 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode /** * Set accountancy account code for a third party into this->code * - * @param DoliDB $db Database handler - * @param Societe $societe Third party object + * @param DoliDB $db Database handler + * @param Societe $societe Third party object * @param string $type 'customer' or 'supplier' * @return int >=0 if OK, <0 if KO */ @@ -209,11 +219,11 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode dol_syslog("mod_codecompta_digitaria::get_code search code for type=".$type." & company=".(!empty($societe->name) ? $societe->name : '')); if ($type == 'supplier') { - $codetouse = $societe->name; + $codetouse = (string) $societe->name; $prefix = $this->prefixsupplieraccountancycode; $width = $this->supplieraccountancycodecharacternumber; } elseif ($type == 'customer') { - $codetouse = $societe->name; + $codetouse = (string) $societe->name; $prefix = $this->prefixcustomeraccountancycode; $width = $this->customeraccountancycodecharacternumber; } else { @@ -228,11 +238,11 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode } // Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default) if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || getDolGlobalString('COMPANY_DIGITARIA_REMOVE_SPECIAL')) { - $codetouse = preg_replace('/([^a-z0-9])/i', '', $codetouse); + $codetouse = (string) preg_replace('/([^a-z0-9])/i', '', $codetouse); } // Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed. if (getDolGlobalString('COMPANY_DIGITARIA_CLEAN_REGEX')) { // Example: $conf->global->COMPANY_DIGITARIA_CLEAN_REGEX='^..(..)..'; - $codetouse = preg_replace('/' . getDolGlobalString('COMPANY_DIGITARIA_CLEAN_REGEX').'/', '\1\2\3', $codetouse); + $codetouse = (string) preg_replace('/' . getDolGlobalString('COMPANY_DIGITARIA_CLEAN_REGEX').'/', '\1\2\3', $codetouse); } $this->code = $prefix.strtoupper(substr($codetouse, 0, (int) $width)); @@ -248,11 +258,9 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode if ($i <= 9) { $a = 1; - } - if ($i >= 10 && $i <= 99) { + } elseif ($i <= 99) { // Also >= 10 $a = 2; - } - if ($i >= 100 && $i <= 999) { + } else { // ($i >= 100 && $i <= 999) { $a = 3; } diff --git a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php index b30d54d86b4..9b1d95ab7bd 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php @@ -1,8 +1,9 @@ * Copyright (C) 2022 Ferran Marcet * Copyright (C) 2022 Nicolas Silobre - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Nick Fragoulis * @@ -41,16 +42,46 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_standard_stock extends ModelePDFStock { + /** + * @var int + */ public $wref; + /** + * @var float + */ public $posxdesc; + /** + * @var float + */ public $posxlabel; + /** + * @var float + */ public $posxtva; + /** + * @var float + */ public $posxqty; + /** + * @var float + */ public $posxup; + /** + * @var float + */ public $posxunit; + /** + * @var float + */ public $posxdiscount; + /** + * @var float + */ public $postotalht; + /** + * @var int + */ public $tabTitleHeight; @@ -390,6 +421,7 @@ class pdf_standard_stock extends ModelePDFStock $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3, price(price2num($objp->ppmp * $objp->value, 'MT'), 0, $outputlangs), 0, 'R'); $totalvalue += price2num($objp->ppmp * $objp->value, 'MT'); + $pricemin = 0; // Price sell min if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { $pricemin = $objp->price; @@ -806,6 +838,7 @@ class pdf_standard_stock extends ModelePDFStock $sql = "SELECT max(m.datem) as datem"; $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; $sql .= " WHERE m.fk_entrepot = ".((int) $object->id); + $lastmovementdate = 0; $resqlbis = $this->db->query($sql); if ($resqlbis) { $obj = $this->db->fetch_object($resqlbis); diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index b9db4237bf7..2a6b0cc2676 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -1,11 +1,12 @@ * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -1167,6 +1168,8 @@ class pdf_eagle extends ModelePDFStockTransfer if (!empty($thirdparty)) { $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + } else { + $carac_emetteur_name = ''; } if ($usecontact) { 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 e2c3747356a..d9375e93809 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -1,4 +1,5 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand @@ -9,7 +10,7 @@ * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -208,6 +209,7 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer } $arephoto = false; + $realpath = null; foreach ($pdir as $midir) { if (!$arephoto) { $dir = $conf->product->dir_output.'/'.$midir; @@ -640,6 +642,8 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer $pmp = $object->lines[$i]->pmp; $this->printStdColumnContent($pdf, $curY, 'subprice', price($pmp)); $nexY = max($pdf->GetY(), $nexY); + } else { + $pmp = 0; } // Quantity @@ -1158,7 +1162,7 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } @@ -1376,6 +1380,8 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer if (!empty($thirdparty)) { $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + } else { + $carac_emetteur_name = ''; } if ($usecontact) { diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index cd4fbe8617b..d59451d9be9 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -1,4 +1,5 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García @@ -6,7 +7,7 @@ * Copyright (C) 2018-2019 Philippe Grand * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019 Tim Otte - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -244,6 +245,7 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices if ($object->specimen) { $dir = $conf->fournisseur->facture->dir_output; $file = $dir."/SPECIMEN.pdf"; + $objectref = 'SPECIMEN_REF'; } else { $objectref = dol_sanitizeFileName($object->ref); $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index a7a636f772b..3e8769e6c01 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -1,9 +1,10 @@ * Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -872,7 +873,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index f6407073b83..fcfa4212862 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -1,4 +1,5 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García @@ -6,7 +7,7 @@ * Copyright (C) 2018-2019 Philippe Grand * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019 Tim Otte - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -241,6 +242,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders if ($object->specimen) { $dir = $conf->fournisseur->commande->dir_output; $file = $dir."/SPECIMEN.pdf"; + $objectref = "SPECIMEN_REF"; } else { $objectref = dol_sanitizeFileName($object->ref); $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 473940db31d..aa68bdd09e7 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1,4 +1,5 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke @@ -7,7 +8,7 @@ * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2023 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -313,7 +314,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Does we have at least one line with discount $this->atleastonediscount foreach ($object->lines as $line) { if ($line->remise_percent) { - $this->atleastonediscount = true; + $this->atleastonediscount = 1; break; } } @@ -1176,7 +1177,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } 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 57d7a1b521b..384dd3fdd68 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1,4 +1,5 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke @@ -6,7 +7,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -1030,7 +1031,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index 1599ca8e222..21fe26a01f2 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -1,8 +1,9 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -150,6 +151,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql .= " AND entity = ".$conf->entity; + $max = 0; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index 01b04b0a338..00c5ae97dac 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -1,4 +1,5 @@ * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2004 Eric Seigne @@ -6,7 +7,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2011-2016 Philippe Grand * Copyright (C) 2014 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -40,21 +41,67 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator { + /** + * @var float + */ public $posxpicture; + /** + * @var float + */ public $posxtva; + /** + * @var float + */ public $posxup; + /** + * @var float + */ public $posxqty; + /** + * @var float + */ public $posxunit; + /** + * @var float + */ public $posxdesc; + /** + * @var float + */ public $posxdiscount; + /** + * @var float + */ public $postotalht; + /** + * @var array + */ public $tva; + /** + * @var array + */ public $tva_array; + /** + * Local tax rates Array[tax_type][tax_rate] + * + * @var array> + */ public $localtax1; + /** + * Local tax rates Array[tax_type][tax_rate] + * + * @var array> + */ public $localtax2; + /** + * @var int<0,1> + */ public $atleastoneratenotnull = 0; + /** + * @var int<0,1> + */ public $atleastonediscount = 0; // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps 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 17437d579de..29d582b9b7b 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 @@ -1,10 +1,11 @@ * Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García * Copyright (C) 2022 Ferran Marcet * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -73,12 +74,33 @@ class pdf_standard_supplierpayment extends ModelePDFSuppliersPayments */ public $version = 'dolibarr'; + /** + * @var float + */ public $posxdate; + /** + * @var float + */ public $posxreffacturefourn; + /** + * @var float + */ public $posxreffacture; + /** + * @var float + */ public $posxtype; + /** + * @var float + */ public $posxtotalht; + /** + * @var float + */ public $posxtva; + /** + * @var float + */ public $posxtotalttc; diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index c1046c3885a..9dd7398e304 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -1,8 +1,9 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -293,6 +294,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket $result = $object->fetch_contact($arrayidcontact[0]); } + $contactobject = null; // Recipient name if (!empty($usecontact)) { // We can use the company of contact instead of thirdparty company diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 78f9e00ca36..07c40904605 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -1,8 +1,9 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -327,6 +328,7 @@ class doc_generic_user_odt extends ModelePDFUser $result = $object->fetch_contact($arrayidcontact[0]); } + $contactobject = null; // Recipient name if (!empty($usecontact)) { if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT'))) { diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 28613252aa7..f4b674f8663 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -1,6 +1,8 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This file is a modified version of datepicker.php from phpBSM to fix some * bugs, to add new features and to dramatically increase speed. @@ -128,7 +130,7 @@ $hookmanager->initHooks(array('searchform')); // Define $searchform $searchform = ''; -if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartphone +if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartphone @phan-suppress-current-line PhanPluginBothLiteralsBinaryOp if (!is_object($form)) { $form = new Form($db); } @@ -142,7 +144,7 @@ if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartp $i = 0; $accesskeyalreadyassigned = array(); - foreach ($arrayresult as $key => $val) { + foreach ($arrayresult as $key => $val) { // @phan-suppress-current-line PhanEmptyForeach $tmp = explode('?', $val['url']); $urlaction = $tmp[0]; $keysearch = 'search_all'; @@ -162,7 +164,7 @@ if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartp // Execute hook printSearchForm -$parameters = array('searchform'=>$searchform); +$parameters = array('searchform' => $searchform); $reshook = $hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { $searchform .= $hookmanager->resPrint; diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index 1caee516fb9..86506de45d0 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010-2016 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -41,6 +42,10 @@ if (empty($object) || !is_object($object)) { print "Error, template page ".basename(__FILE__)." can't be called with no object defined."; exit; } +' +@phan-var-force ?string $fk_element +@phan-var-force ?Task[] $tasksarray +'; ?> diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index b96eaafb67b..5122a2e7944 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -39,6 +40,10 @@ if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit(1); } + +' +@phan-var-force ?string $keyforbreak +'; if (!is_object($form)) { $form = new Form($db); } @@ -50,7 +55,7 @@ if (!is_object($form)) { $object->fields = dol_sort_array($object->fields, 'position'); foreach ($object->fields as $key => $val) { - if (!empty($keyforbreak) && $key == $keyforbreak) { + if (isset($keyforbreak) && !empty($keyforbreak) && $key == $keyforbreak) { break; // key used for break on second column } @@ -139,7 +144,7 @@ $rightpart = ''; $alreadyoutput = 1; foreach ($object->fields as $key => $val) { if ($alreadyoutput) { - if (!empty($keyforbreak) && $key == $keyforbreak) { + if (isset($keyforbreak) && !empty($keyforbreak) && $key == $keyforbreak) { $alreadyoutput = 0; // key used for break on second column } else { continue; @@ -166,7 +171,7 @@ foreach ($object->fields as $key => $val) { if ($val['type'] == 'text' || $val['type'] == 'html') { $rightpart .= ' tdtop'; } - $rightpart.= '">'; + $rightpart .= '">'; $labeltoshow = ''; if (!empty($val['help'])) { $labeltoshow .= $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); @@ -206,7 +211,7 @@ foreach ($object->fields as $key => $val) { $out = $object->showOutputField($val, $key, $value, '', '', '', 0); $rightpart .= showValueWithClipboardCPButton($out, 0, $out); } else { - $rightpart.= $object->showOutputField($val, $key, $value, '', '', '', 0); + $rightpart .= $object->showOutputField($val, $key, $value, '', '', '', 0); } } if (preg_match('/^(text|html)/', $val['type'])) { diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 77251d73be8..a5a3b64cf32 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2015-2016 Charlie BENKE * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -32,6 +32,12 @@ * @var User $user * @var ?string $permission */ +' +@phan-var-force ?CommonObject $object +@phan-var-force ?CommonObject $objectsrc +@phan-var-force ?string $permission +'; + // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; @@ -39,11 +45,6 @@ if (empty($object) || !is_object($object)) { } -' -@phan-var-force ?CommonObject $object -@phan-var-force ?CommonObject $objectsrc -@phan-var-force ?string $permission -'; if (empty($preselectedtypeofcontact)) { $preselectedtypeofcontact = 0; } @@ -128,7 +129,7 @@ if ($permission) {
- select_dolusers($user->id, 'userid', 1, (!empty($userAlreadySelected) ? $userAlreadySelected : null), 0, '', '', 0, 56, 0, '', 0, '', 'minwidth100imp widthcentpercentminusxx maxwidth400 userselectcontact'); + select_dolusers($user->id, 'userid', 1, (!empty($userAlreadySelected) ? $userAlreadySelected : null), 0, '', '', '0', 56, 0, '', 0, '', 'minwidth100imp widthcentpercentminusxx maxwidth400 userselectcontact'); if (empty($hideaddcontactforgroups) && $module == 'project') { print ' '.$langs->trans("or").' '; echo img_object('', 'group', 'class="pictofixedwidth"').$form->select_dolgroups(0, 'groupid', 1, '', 0, '', array(), '0', false, 'minwidth100imp widthcentpercentminusxx maxwidth400 groupselectcontact'); @@ -384,6 +385,7 @@ print "\n"; if (is_object($hookmanager)) { $hookmanager->initHooks(array('contacttpl')); $parameters = array(); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action); } print "\n"; diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 31c19e08a7c..30d32ca1f6f 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -1,9 +1,11 @@ * Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -40,6 +42,14 @@ if (empty($langs) || !is_object($langs)) { print "Error, template page can't be called as URL"; exit(1); } +' +@phan-var-force array $filearray +@phan-var-force ?int<0,1> $permtoedit +@phan-var-force ?int<0,1> $permission +@phan-var-force int<0,1> $permissiontoadd +@phan-var-force ?string $savingdocmask +@phan-var-force ?string $param +'; $langs->load("link"); @@ -67,7 +77,7 @@ if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket $disablemove = 0; } $parameters = array(); -$reshook = $hookmanager->executeHooks('isLinkedDocumentObjectNotMovable', $parameters, $object); +$reshook = $hookmanager->executeHooks('isLinkedDocumentObjectNotMovable', $parameters, $object); // @phan-suppress-current-line PhanTypeMismatchArgumentNullable if ($reshook) { $disablemove = $hookmanager->resArray['disablemove']; } @@ -191,7 +201,7 @@ $formfile->listOfLinks( $object, $permission, $action, - GETPOSTINT('linkid'), + (string) GETPOSTINT('linkid'), $param, 'formaddlink', array('afterlinktitle' => $formToAddALink, 'showhideaddbutton' => 1) diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php index 7d72a0cae3b..e2d6f68df44 100644 --- a/htdocs/core/tpl/extrafields_edit.tpl.php +++ b/htdocs/core/tpl/extrafields_edit.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2014 Maxime Kohlhaas * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -24,15 +25,15 @@ * $parameters */ - /** - * @var CommonObject $object - * @var Conf $conf - * @var ExtraFields $extrafields - * @var HookManager $hookmanager - * @var Translate $langs - * @var string $action - * @var array $parameters - */ +/** +* @var CommonObject $object +* @var Conf $conf +* @var ExtraFields $extrafields +* @var HookManager $hookmanager +* @var Translate $langs +* @var string $action +* @var array $parameters +*/ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { @@ -62,6 +63,7 @@ if (!isset($parameters)) { @phan-var-force Conf $conf @phan-var-force Translate $conf @phan-var-force array $parameters +@phan-var-force ?string $tpl_context '; $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index 372e4341b90..d5b4979dcce 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php @@ -1,10 +1,16 @@ + */ + // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit(1); } +' +@phan-var-force ?int<0,1> $disablesortlink +'; if (empty($extrafieldsobjectkey) && is_object($object)) { $extrafieldsobjectkey = $object->table_element; diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 7f46d5e76cc..63318ea609e 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -35,6 +35,14 @@ if (empty($conf) || !is_object($conf)) { exit; } +' +@phan-var-force Website $website +@phan-var-force string $filepathnoext +@phan-var-force string $pageid +@phan-var-force EcmDirectory $ecmdir +@phan-var-force int $section +'; + ?> @@ -50,8 +58,6 @@ if (empty($module)) { $module = 'ecm'; } -'@phan-var-force Website $website'; - $permtoadd = 0; $permtoupload = 0; $showroot = 0; @@ -106,6 +112,7 @@ if ($module == 'ecm') { print ''; } if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage medias of a web site + // @phan-suppress-next-line PhanTypeExpectedObjectPropAccess print 'ref).'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; print img_picto('', 'images', '', 0, 0, 0, '', 'size15x flip marginrightonly'); print ''; @@ -218,7 +225,7 @@ if ($action == 'confirmconvertimgwebp') { $formquestion['section'] = array('type' => 'hidden', 'value' => $section, 'name' => 'section'); $formquestion['filetoregenerate'] = array('type' => 'hidden', 'value' => $file, 'name' => 'filetoregenerate'); if ($module == 'medias') { - $formquestion['website'] = array('type' => 'hidden', 'value' => $website->ref, 'name' => 'website'); + $formquestion['website'] = array('type' => 'hidden', 'value' => $website->ref, 'name' => 'website'); // @phan-suppress-current-line PhanTypeExpectedObjectPropAccess } $param = ''; if (!empty($sortfield)) { diff --git a/htdocs/core/tpl/formlayoutai.tpl.php b/htdocs/core/tpl/formlayoutai.tpl.php index 4bae7f2551d..79e6db0ba9c 100644 --- a/htdocs/core/tpl/formlayoutai.tpl.php +++ b/htdocs/core/tpl/formlayoutai.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -54,6 +54,9 @@ if (empty($htmlname)) { @phan-var-force ?FormMail $formmail @phan-var-force string $showlinktolayout @phan-var-force string $showlinktolayoutlabel +@phan-var-force string $showlinktoai +@phan-var-force string $showlinktoailabel +@phan-var-force ?string $out '; if (!isset($out)) { diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index d79d844484c..397328e146a 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -1,5 +1,7 @@ + * Copyright (C) 2025 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 @@ -21,7 +23,10 @@ * @var Form $form * @var Translate $langs */ -'@phan-var-force array{nbfield:int,type?:array,pos?:array,val?:array} $totalarray'; +' +@phan-var-force array{nbfield:int,type?:array,pos?:array,val?:array} $totalarray +@phan-var-force ?string $sqlfields +'; if (!function_exists('printTotalValCell')) { // allow two list with total on same screen diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 996bf17dcef..5b6da9dc1de 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -1,8 +1,9 @@ * Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -55,8 +56,12 @@ * @var int[] $arrayofselected */ ' +@phan-var-force string $string @phan-var-force CommonObject $objecttmp @phan-var-force int[] $toselect +@phan-var-force ?string $uploaddir +@phan-var-force int<0,1> $withmaindocfilemail +@phan-var-force string $sendto '; if (!empty($sall) || !empty($search_all)) { @@ -81,7 +86,7 @@ if ($massaction == 'preclonetasks') { $formquestion = array( // TODO If list of project is long and project is not on a thirdparty, the combo may be very long. // Solution: Allow only sameproject for cloning tasks ? - array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects($object->id, 'projectid', '', 0, 1, '', 0, array(), $object->socid, '1', 1, '', null, 1)), + array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects($object->id, 'projectid', '', 0, 1, '', 0, array(), $object->socid, '1', 1, '', array(), 1)), ); print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . $selected, $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590); } @@ -113,7 +118,7 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) { 'type' => 'other', 'name' => 'affecttag_'.$categ_type['code'], 'label' => '', - 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $categ_arbo_tmp, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, '', 0, '60%', '', '', $langs->transnoentitiesnoconv("SelectTheTagsToAssign")) + 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $categ_arbo_tmp, GETPOST('contcats_'.$categ_type['code'], 'array'), 0, 0, '', 0, '60%', '', '', $langs->transnoentitiesnoconv("SelectTheTagsToAssign")) ); } $formquestion[] = array( @@ -418,7 +423,7 @@ if ($massaction == 'presetcommercial') { $formquestion[] = array('type' => 'other', 'name' => 'affectedcommercial', 'label' => $form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0), - 'value' => $form->multiselectarray('commercial', $userlist, null, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)); + 'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAllocateCommercial"), $langs->trans("ConfirmAllocateCommercialQuestion", count($toselect)), "affectcommercial", $formquestion, 1, 0, 200, 500, 1); } if ($massaction == 'unsetcommercial') { @@ -427,7 +432,7 @@ if ($massaction == 'unsetcommercial') { $formquestion[] = array('type' => 'other', 'name' => 'unassigncommercial', 'label' => $form->editfieldkey('UnallocateCommercial', 'commercial_id', '', $object, 0), - 'value' => $form->multiselectarray('commercial', $userlist, null, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)); + 'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmUnallocateCommercial"), $langs->trans("ConfirmUnallocateCommercialQuestion", count($toselect)), "unassigncommercial", $formquestion, 1, 0, 200, 500, 1); } @@ -437,7 +442,7 @@ if ($massaction == 'preapproveleave') { // Allow Pre-Mass-Action hook (eg for confirmation dialog) if (empty($toselect)) { - $toselect=[]; + $toselect = []; } $parameters = array( 'toselect' => &$toselect, @@ -445,6 +450,7 @@ $parameters = array( 'massaction' => $massaction ); +// @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('doPreMassActions', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 00a07c89b85..c78acbae1e0 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -3,6 +3,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2020 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -31,6 +32,11 @@ if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; exit(1); } +' +@phan-var-force ?int<0,1> $permissionnote +@phan-var-force string $moreparam +@phan-var-force ?int $colwidth +'; // $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create // $cssclass must be defined by caller. For example $cssclass='fieldtitle' @@ -126,7 +132,7 @@ print '
'."\n print '
'."\n"; $editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_public); print '
'."\n"; -print $form->editfieldkey((empty($textNotePub) ? "NotePublic" : $textNotePub), $note_public, $value_public, $object, $permission, $typeofdatapub, $moreparam, '', 0); +print $form->editfieldkey((empty($textNotePub) ? "NotePublic" : $textNotePub), $note_public, $value_public, $object, $permission, $typeofdatapub, $moreparam, 0, 0); print '
'."\n"; print '
'."\n"; print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdatapub, '', null, null, $moreparam, 1)."\n"; @@ -137,7 +143,7 @@ if (empty($user->socid)) { print '
'."\n"; $editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_private); print '
'."\n"; - print $form->editfieldkey((empty($textNotePrive) ? "NotePrivate" : $textNotePrive), $note_private, $value_private, $object, $permission, $typeofdatapriv, $moreparam, '', 0); + print $form->editfieldkey((empty($textNotePrive) ? "NotePrivate" : $textNotePrive), $note_private, $value_private, $object, $permission, $typeofdatapriv, $moreparam, 0, 0); print '
'."\n"; print '
'."\n"; print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdatapriv, '', null, null, $moreparam, 1); diff --git a/htdocs/core/tpl/object_discounts.tpl.php b/htdocs/core/tpl/object_discounts.tpl.php index f1cd115e531..d768eb3e92e 100644 --- a/htdocs/core/tpl/object_discounts.tpl.php +++ b/htdocs/core/tpl/object_discounts.tpl.php @@ -1,6 +1,8 @@ * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2025 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 @@ -17,7 +19,7 @@ * * Needs the following variables defined: * $object Proposal, order, invoice (including supplier versions) - * $thirdparty Thirdparty of object + * $thirdparty Third party of object * $absolute_discount Amount of fixed discounts available * $absolute_creditnote Amount of credit notes available * $discount_type 0 => Customer discounts, 1 => Supplier discounts @@ -30,6 +32,16 @@ */ print ''."\n"; +' +@phan-var-force Propal|Commande|CommandeFournisseur|Facture|FactureFournisseur $object +@phan-var-force Societe $thirdparty +@phan-var-force string $backtopage +@phan-var-force string $filtercreditnote +@phan-var-force string $filterabsolutediscount +@phan-var-force int<0,1> $discount_type +@phan-var-force int $resteapayer +'; + $objclassname = get_class($object); $isInvoice = in_array($object->element, array('facture', 'invoice', 'facture_fourn', 'invoice_supplier')); $isNewObject = empty($object->id) && empty($object->rowid); @@ -91,6 +103,7 @@ if ($absolute_discount > 0) { } else { // Discount available of type fixed amount (not credit note) $more = $addabsolutediscount; + // TODO: Check $resteapayer - is '$maxvalue' in form_remise_dispo() $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type); } } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 96cfc189c13..eca7e1a0c16 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -12,6 +12,7 @@ * Copyright (C) 2022 OpenDSI * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2025 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 @@ -50,8 +51,13 @@ if (empty($object) || !is_object($object)) { exit; } -'@phan-var-force CommonObject $this - @phan-var-force CommonObject $object'; +' +@phan-var-force CommonObject $this +@phan-var-force CommonObject $object +@phan-var-force Societe $buyer +@phan-var-force Societe $seller +@phan-var-force int<0,1> $usehm +'; $usemargins = 0; if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { @@ -457,6 +463,7 @@ if ($nolinesbefore) { } print ''; $coldisplay++; + $type_tva = 0; if ($object->element == 'propal' || $object->element == 'commande' || $object->element == 'facture' || $object->element == 'facturerec') { $type_tva = 1; } elseif ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { @@ -487,7 +494,7 @@ if ($nolinesbefore) { "> - @@ -526,21 +533,21 @@ if ($nolinesbefore) { $coldisplay++; ?> - + - + "> - %'; - $coldisplay++; - } - if (getDolGlobalString('DISPLAY_MARK_RATES')) { - echo '%'; - $coldisplay++; - } + %'; + $coldisplay++; + } + if (getDolGlobalString('DISPLAY_MARK_RATES')) { + echo '%'; + $coldisplay++; + } } } $coldisplay += $colspan; @@ -561,6 +568,8 @@ if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelecto $date_end = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); $prefillDates = false; + $date_start_prefill = 0; + $date_end_prefill = 0; if (getDolGlobalString('MAIN_FILL_SERVICE_DATES_FROM_LAST_SERVICE_LINE') && !empty($object->lines)) { for ($i = count($object->lines) - 1; $i >= 0; $i--) { @@ -815,7 +824,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { } } }); - /* When changing predefined product, we reload list of supplier prices required for margin combo */ @@ -932,7 +941,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) { if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { ?> var proddesc = data.desc_trans; - var proddesc = data.desc; hasRight('margins', 'creer')) { editor.setData(proddesc); } } - jQuery('#dp_desc').text(proddesc); hasRight('margins', 'creer')) { jQuery.each(data.array_options, function( key, value ) { jQuery('div[class*="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value); }); - }, 'json' ); } - hasRight('margins', 'creer')) { diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 58ccc4e50ff..b34c3e3a33f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Juanjo Menent * Copyright (C) 2022 OpenDSI - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France * @@ -75,6 +75,7 @@ if (empty($object) || !is_object($object)) { @phan-var-force ?Product $product_static @phan-var-force string $text @phan-var-force string $description +@phan-var-force Object $objp '; global $mysoc; @@ -128,7 +129,7 @@ $coldisplay = 0; $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay]; +$parameters = ['line' => $line, 'i' => & $i, 'coldisplay' => & $coldisplay]; $reshook = $hookmanager->executeHooks('objectLineView_BeforeProduct', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -274,7 +275,7 @@ if (($line->info_bits & 2) == 2) { } - $parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay]; + $parameters = ['line' => $line, 'i' => & $i, 'coldisplay' => & $coldisplay]; $reshook = $hookmanager->executeHooks('objectLineView_BeforeProductExtrafield', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Line extrafield @@ -288,7 +289,7 @@ if (($line->info_bits & 2) == 2) { } } -$parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay]; +$parameters = ['line' => $line, 'i' => & $i, 'coldisplay' => & $coldisplay]; $reshook = $hookmanager->executeHooks('objectLineView_ProductSupplier', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 9853bffe6c5..5b5b2dbb025 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1,4 +1,5 @@ * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin @@ -7,7 +8,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2023-2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -1486,6 +1487,7 @@ class FactureFournisseurRec extends CommonInvoice 'facturerec' => $facturerec, // it's an object which PHP passes by "reference", so modifiable by hooks. 'this' => $this, // it's an object which PHP passes by "reference", so modifiable by hooks. ); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('afterCreationOfRecurringInvoice', $parameters, $new_fac_fourn); // note: $facture can be modified by hooks (warning: $facture can be null) $i++; diff --git a/htdocs/fourn/facture/note-rec.php b/htdocs/fourn/facture/note-rec.php index c9556d5cab9..12e4782886d 100644 --- a/htdocs/fourn/facture/note-rec.php +++ b/htdocs/fourn/facture/note-rec.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -118,7 +119,7 @@ if (empty($object->id)) { } -if ($id > 0 ) { +if ($id > 0) { $object = new FactureFournisseurRec($db); $object->fetch($id); @@ -130,7 +131,7 @@ if ($id > 0 ) { print dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'); - // Object card + // Object card // ------------------------------------------------------------ $linkback = ''.$langs->trans("BackToList").''; @@ -142,7 +143,7 @@ if ($id > 0 ) { } $morehtmlref .= '
'; //Ref supplier - $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, '', 'string', '', 0, 1); + $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref .= '
' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); diff --git a/htdocs/hrm/core/tpl/objectline_view.tpl.php b/htdocs/hrm/core/tpl/objectline_view.tpl.php index 937a359ce94..2fb438a9f55 100644 --- a/htdocs/hrm/core/tpl/objectline_view.tpl.php +++ b/htdocs/hrm/core/tpl/objectline_view.tpl.php @@ -10,7 +10,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -72,6 +72,7 @@ $coldisplay = 0;
fk_skill > 0) { $skill = new Skill($this->db); $resSkill = $skill->fetch($line->fk_skill); @@ -93,9 +94,9 @@ if ($line->fk_skill > 0) { fk_skill > 0 && $resSkill > 0) { - //print $skill->description; -} +//if ($line->fk_skill > 0 && $resSkill > 0) { +//print $skill->description; +//} ?> diff --git a/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php b/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php index 5284c0b132a..292d4038f31 100644 --- a/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php +++ b/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -41,7 +41,7 @@ if (!empty($object->table_element_line)) { @phan-var-force string $note_private @phan-var-force int $colwidth @phan-var-force string $moreparam -@phan-var-force bool $permission +@phan-var-force int $permission @phan-var-force string $typeofdata @phan-var-force string $value_public @phan-var-force string $value_private diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index e72ccc48706..13e953b0fb1 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1,4 +1,5 @@ * Copyright (C) 2006-2023 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin @@ -7,7 +8,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019-2021 Christophe Battarel * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Vincent de Grandpré * Copyright (C) 2024 Solution Libre SAS * @@ -50,6 +51,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formintervention.class.php'; * @var Translate $langs * @var User $user */ +' +@phan-var-force ?string $uploaddir +'; // Load translation files required by the page $langsLoad = array('projects', 'bills', 'orders', 'companies'); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 3010abe863e..2eca6baf62a 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -7,7 +7,7 @@ * Copyright (C) 2021 Waël Almoman * Copyright (C) 2021 Dorian Vabre * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -52,7 +52,7 @@ if (!defined('NOBROWSERNOTIF')) { } if (!defined('XFRAMEOPTIONS_ALLOWALL')) { - define('XFRAMEOPTIONS_ALLOWALL', '1'); + define('XFRAMEOPTIONS_ALLOWALL', '1'); } // For MultiCompany module. @@ -2153,6 +2153,7 @@ if ($action != 'dopayment') { 'source' => $source, 'object' => $object ]; + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('doCheckStatus', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -2816,6 +2817,7 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme 'tag' => GETPOST("tag", 'alpha'), 'dopayment' => GETPOST('dopayment', 'alpha') ]; + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('doPayment', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index e50ffb1e687..ac7f9eec351 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -1,10 +1,11 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2023-2024 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Benjamin Falière * Copyright (C) 2024 Frédéric France * @@ -642,6 +643,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_s $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target"; // Add table from hooks $parameters = array(); +// @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " WHERE e.entity IN (".getEntity('reception').")"; diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 64983e640de..165f96b6ad3 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -1,4 +1,5 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand @@ -9,7 +10,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -696,7 +697,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio if (empty($hidetop)) { //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index de001535e3f..ed686d356ca 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -1,9 +1,10 @@ * Copyright (C) 2015 Charlie BENKE * Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -367,6 +368,7 @@ $sql .= " AND p.fk_salary = s.rowid"; $sql .= " AND s.entity IN (".getEntity('tax').")"; $sql .= " ORDER BY dp DESC"; +$resteapayer = 0; //print $sql; $resql = $db->query($sql); if ($resql) { @@ -560,7 +562,7 @@ if ($resql) { $tmpuser = new User($db); - $num = $db->num_rows($result); + $num = $db->num_rows($resql); if ($num > 0) { while ($i < $num) { $obj = $db->fetch_object($resql); diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 026e4723736..64a4ff39cd3 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -1,4 +1,5 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2015 Laurent Destailleur @@ -7,7 +8,7 @@ * Copyright (C) 2015-2016 Marcos García * Copyright (C) 2015-2024 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -114,8 +115,8 @@ if (empty($account->userid)) { // Define value to know what current user can do on users $selfpermission = ($user->id == $id && $user->hasRight('user', 'self', 'creer')); -$usercanadd = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write') ); -$usercanread = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read') ); +$usercanadd = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); +$usercanread = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read')); $permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $selfpermission); $permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write'); $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write'); @@ -1035,6 +1036,10 @@ if ($id && ($action == 'edit' || $action == 'create') && $permissiontoaddbankacc foreach ($bankaccount->getFieldsToShow(1) as $val) { $require = false; $tooltip = ''; + $name = 'UNKNOWN'; + $size = '8'; + $content = 'UNKNOWN'; + if ($val == 'BankCode') { $name = 'code_banque'; $size = 8;