diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index 6f71492b32d..e33526e270b 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -98,7 +98,7 @@ while ($i < $argc) { } // PHPSTAN setup -$PHPSTANLEVEL = 4; +$PHPSTANLEVEL = 6; // PHAN setup. Configuration is required, otherwise phan is disabled. $PHAN_CONFIG = "{$path}phan/config_extended.php"; diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 94b83291a3d..75c6db13818 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -57,7 +57,6 @@ return [ 'file_suppressions' => [ 'htdocs/accountancy/admin/productaccount.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/accountancy/bookkeeping/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/accountancy/bookkeeping/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/accountancy/bookkeeping/listbyaccount.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/accountancy/class/accountancycategory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], @@ -74,7 +73,7 @@ return [ 'htdocs/accountancy/journal/variousjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/accountancy/supplier/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/accountancy/tpl/export_journal.tpl.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/adherents/admin/member.php' => ['PhanParamTooMany', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredMethod'], + 'htdocs/adherents/admin/member.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredMethod'], 'htdocs/adherents/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/adherents/canvas/actions_adherentcard_common.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeSuspiciousNonTraversableForeach'], 'htdocs/adherents/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], @@ -219,13 +218,13 @@ return [ 'htdocs/bookcal/calendar_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/bookcal/calendar_document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/bookcal/calendar_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/bookcal/class/availabilities.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/bookcal/class/availabilities.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/bookcal/class/calendar.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/bookmarks/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bookmarks/class/bookmark.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/categories/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/categories/class/categorie.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeConversionFromArray', 'PhanTypeMismatchProperty'], + 'htdocs/categories/class/categorie.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchProperty'], 'htdocs/categories/edit.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch'], 'htdocs/categories/index.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/info.php' => ['PhanTypeMismatchDimFetch'], @@ -301,7 +300,7 @@ return [ 'htdocs/compta/facture/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/compta/facture/class/facture.class.php' => ['PhanEmptyForeach', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/facture/class/facturestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeInvalidLeftOperandOfNumericOp'], 'htdocs/compta/facture/class/paymentterm.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/facture/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -321,7 +320,7 @@ return [ 'htdocs/compta/localtax/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetch'], 'htdocs/compta/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/compta/paiement/cheque/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/paiement/cheque/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement/cheque/class/remisecheque.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanUndeclaredMethod'], 'htdocs/compta/paiement/cheque/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement/class/cpaiement.class.php' => ['PhanPluginUnknownPropertyType'], @@ -332,12 +331,11 @@ return [ 'htdocs/compta/paiement_vat.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/payment_vat/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], + 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], 'htdocs/compta/prelevement/class/rejetprelevement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], 'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/demandes.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/factures.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/prelevement/line.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeConversionFromArray'], 'htdocs/compta/prelevement/orders_list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/stats.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/resultat/clientfourn.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -472,7 +470,7 @@ return [ 'htdocs/core/class/canvas.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/ccountry.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/class/cgenericdic.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/commondocgenerator.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], + 'htdocs/core/class/commondocgenerator.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], 'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/class/commonincoterm.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], 'htdocs/core/class/commoninvoice.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], @@ -496,7 +494,7 @@ return [ 'htdocs/core/class/emailsenderprofile.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/class/events.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/class/extrafields.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNull', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], + 'htdocs/core/class/extrafields.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], 'htdocs/core/class/extralanguages.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/class/fileupload.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'], 'htdocs/core/class/fiscalyear.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], @@ -542,7 +540,6 @@ return [ 'htdocs/core/extrafieldsinimport.inc.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionParamType'], 'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/core/get_menudiv.php' => ['PhanRedefinedClassReference'], 'htdocs/core/lib/accounting.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeInvalidLeftOperandOfNumericOp'], 'htdocs/core/lib/admin.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/lib/agenda.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchArgumentProbablyReal'], @@ -583,11 +580,6 @@ return [ 'htdocs/core/lib/usergroups.lib.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/lib/website.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/lib/xcal.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/menus/standard/auguria.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanUndeclaredProperty'], - 'htdocs/core/menus/standard/auguria_menu.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanRedefineClass'], - 'htdocs/core/menus/standard/eldy.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/menus/standard/eldy_menu.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanRedefineClass', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/menus/standard/empty.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanRedefineClass'], 'htdocs/core/modules/DolibarrModules.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/action/doc/pdf_standard_actions.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod'], 'htdocs/core/modules/action/modules_action.php' => ['PhanPluginUnknownArrayMethodReturnType'], @@ -704,7 +696,7 @@ return [ 'htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredMethod'], 'htdocs/core/modules/stock/modules_stock.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod'], + 'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], 'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/stocktransfer/modules_stocktransfer.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], @@ -712,7 +704,7 @@ return [ 'htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/supplier_order/modules_commandefournisseur.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], @@ -720,7 +712,7 @@ return [ 'htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/supplier_payment/modules_supplier_payment.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/syslog/logHandler.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], @@ -748,7 +740,7 @@ return [ 'htdocs/core/tpl/extrafields_list_print_fields.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/extrafields_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredVariableAssignOp'], + 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/login.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/notes.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -778,7 +770,6 @@ return [ 'htdocs/datapolicy/class/datapolicycron.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/debugbar/class/DataCollector/DolConfigCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/debugbar/class/DataCollector/DolLogsCollector.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanRedefinedClassReference'], 'htdocs/debugbar/class/DataCollector/DolMemoryCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolPhpCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolQueryCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], @@ -874,6 +865,7 @@ return [ 'htdocs/fourn/class/fournisseur.facture-rec.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/fourn/class/fournisseur.facture.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/fourn/class/fournisseur.product.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchProperty'], + 'htdocs/fourn/class/paiementfourn.class.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/commande/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/fourn/commande/contact.php' => ['PhanUndeclaredGlobalVariable'], @@ -935,7 +927,6 @@ return [ 'htdocs/install/fileconf.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/install/inc.php' => ['PhanRedefineFunction'], 'htdocs/install/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/install/install.forced.php' => ['PhanPluginWhitespaceTrailing'], 'htdocs/install/repair.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/install/step2.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], 'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], @@ -959,7 +950,6 @@ return [ 'htdocs/loan/note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/loan/schedule.php' => ['PhanTypeInvalidLeftOperandOfNumericOp', 'PhanUndeclaredGlobalVariable'], - 'htdocs/main.inc.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanPossiblyUndeclaredVariable', 'PhanRedefineFunction', 'PhanRedefinedClassReference', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/margin/customerMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/margin/productMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/master.inc.php' => ['PhanUndeclaredGlobalVariable'], @@ -1004,7 +994,7 @@ return [ 'htdocs/product/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/class/api_products.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], 'htdocs/product/class/html.formproduct.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchReturn', 'PhanUndeclaredMethod'], + 'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredMethod'], 'htdocs/product/class/productbatch.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], 'htdocs/product/class/productcustomerprice.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeInvalidLeftOperandOfNumericOp'], 'htdocs/product/class/productfournisseurprice.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], @@ -1020,7 +1010,6 @@ return [ 'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/product/price_suppliers.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/reassortlot.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], @@ -1045,7 +1034,7 @@ return [ 'htdocs/product/stock/movement_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/product.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/product/stock/productlot_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/productlot_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/replenish.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/stats/commande_fournisseur.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -1196,7 +1185,6 @@ return [ 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], 'htdocs/societe/class/companybankaccount.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/societe/class/companypaymentmode.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/societe/class/societe.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/societe/class/societeaccount.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/document.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], @@ -1250,7 +1238,7 @@ return [ 'htdocs/ticket/class/actions_ticket.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/ticket/class/api_tickets.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/ticket/class/ticket.class.php' => ['PhanPluginRedundantReturnComment', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], + 'htdocs/ticket/class/ticket.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/ticket/class/ticketstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/ticket/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ticket/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index f8c95fca83b..5a6a10d4fa3 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -315,7 +315,7 @@ foreach ($arrayofmodules as $file => $modCodeMember) { } print ''; - $s = $modCodeMember->getToolTip($langs, null, -1); + $s = $modCodeMember->getToolTip($langs, null); print $form->textwithpicto('', $s, 1); print ''; diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 2ccb20f51bb..c4937a8a8a8 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -1,9 +1,10 @@ - * Copyright (C) 2006-2015 Laurent Destailleur - * Copyright (C) 2006-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2024 Alexandre Spangaro +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2006-2012 Regis Houssin + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,8 +76,8 @@ if ($action == 'update') { $res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", !$showtable, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show" - $res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", !$showvoteallowed, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show" + $res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", (string) !$showtable, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show" + $res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", (string) !$showvoteallowed, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show" $res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity); if ($forcetype < 0) { $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index be69ba85e35..ef3df0538ad 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1262,7 +1262,7 @@ $title = $langs->trans("DictionarySetup"); llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-admin page-dict'); -if (GETPOST('id') && GETPOST('id') == DICT_SOCIALNETWORKS) { +if (GETPOSTINT('id') == DICT_SOCIALNETWORKS && $from == 'socialnetworksetup') { $head = socialnetwork_prepare_head(); print dol_get_fiche_head($head, 'dict', $langs->trans('MenuDict'), -1, 'user'); } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 208cb94d83e..460232bae14 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -169,7 +169,7 @@ if (!getDolGlobalString('MAIN_MAIL_SENDMODE')) { $conf->global->MAIN_MAIL_SENDMODE = 'mail'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 183c3b9341c..77f5d942497 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -140,7 +140,7 @@ if (preg_match('/^mac/i', PHP_OS)) { if (!getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')) { $conf->global->MAIN_MAIL_SENDMODE_EMAILING = 'default'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_EMAILING', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_EMAILING', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index adcb1ea1fc6..02e0ef24be1 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -138,7 +138,7 @@ if (preg_match('/^mac/i', PHP_OS)) { if (!getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET')) { $conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET = 'default'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_PASSWORDRESET', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_PASSWORDRESET', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 2715f032ed8..29e97f93504 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -138,7 +138,7 @@ if (preg_match('/^mac/i', PHP_OS)) { if (!getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')) { $conf->global->MAIN_MAIL_SENDMODE_TICKET = 'default'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_TICKET', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_TICKET', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 61735702dd1..33f76eaa5c6 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -395,7 +395,8 @@ if (count($listinsetup) > 0) { if ($keyforsupportedoauth2array == 'OAUTH_GENERIC_NAME') { print ''; print ''; - print $form->textwithpicto($langs->trans("URLOfOAuthServiceEndpoints"), $langs->trans("URLOfOAuthServiceEndpointsExample")); + $tooltiphelp = $langs->trans("Example").'
https://mastodon.example.com
https://mastodon.social'; + print $form->textwithpicto($langs->trans("URLOfOAuthServiceEndpoints"), $tooltiphelp); print ''; print ''; print ''; diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 83c20b77116..2ee3bdb6ea4 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -117,7 +117,7 @@ print ""; print ''; print ''.$langs->trans("ApiProductionMode").''; -$production_mode = !(!getDolGlobalString('API_PRODUCTION_MODE')); +$production_mode = getDolGlobalBool('API_PRODUCTION_MODE'); if ($production_mode) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); @@ -132,7 +132,7 @@ print ''; print ''; print ''.$langs->trans("API_DISABLE_COMPRESSION").''; -$disable_compression = !(!getDolGlobalString('API_DISABLE_COMPRESSION')); +$disable_compression = getDolGlobalBool('API_DISABLE_COMPRESSION'); if ($disable_compression) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index e516ed44ba2..c3c74cd9e69 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -55,7 +55,7 @@ class DolibarrApi Defaults::$cacheDirectory = $cachedir; $this->db = $db; - $production_mode = !(!getDolGlobalString('API_PRODUCTION_MODE')); + $production_mode = getDolGlobalBool('API_PRODUCTION_MODE'); $this->r = new Restler($production_mode, $refreshCache); $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php index d3efc65056f..f13d1ffad9c 100644 --- a/htdocs/bookcal/availabilities_card.php +++ b/htdocs/bookcal/availabilities_card.php @@ -1,6 +1,7 @@ - * Copyright (C) 2022 Alice Adminson +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2022 Alice Adminson + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -248,7 +249,7 @@ if ($action == 'create') { exit; } - print load_fiche_titre($langs->trans("NewAvailabilities"), '', '', 'object_'.$object->picto); + print load_fiche_titre($langs->trans("NewAvailabilities"), '', 'object_'.$object->picto); print '
'; print ''; if ($error != 0) { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index b3fabcd497d..4ab4182c0bd 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1827,7 +1827,7 @@ class Categorie extends CommonObject } if (file_exists($dir)) { - if (is_array($file['name']) && count($file['name']) > 0) { + if (is_array($file['name'])) { $nbfile = count($file['name']); for ($i = 0; $i < $nbfile; $i++) { $originImage = $dir.$file['name'][$i]; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f4630cc04b4..3a7b1d18a51 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2707,7 +2707,7 @@ class ActionComm extends CommonObject $errormesg = ''; // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($langs, 0, '', $this); + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); complete_substitutions_array($substitutionarray, $langs, $this); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 15f6b6204ce..9d684db1d0f 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1647,7 +1647,7 @@ if ($object->id > 0) { } if (isModEnabled('intervention') && $user->hasRight('ficheinter', 'creer') && $object->status == 1) { - $langs->load("fichinter"); + $langs->load("interventions"); print ''; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3859944b65f..30e28c432e7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -116,7 +116,9 @@ class Facture extends CommonInvoice */ public $fk_user_modif; - + /** + * @var string + */ public $datem; /** @@ -136,27 +138,58 @@ class Facture extends CommonInvoice */ public $ref_customer; + /** + * @var float + */ public $total_ht; + /** + * @var float + */ public $total_tva; + /** + * @var float + */ public $total_localtax1; + /** + * @var float + */ public $total_localtax2; + /** + * @var float + */ public $total_ttc; + /** + * @var float + */ public $revenuestamp; + /** + * @var float|string + */ public $resteapayer; /** - * 1 if invoice paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code) + * + * @var int<0,1> 1 if invoice paid COMPLETELY, 0 otherwise + * @deprecated * Use statut and close_code) */ public $paye; - //! key of module source when invoice generated from a dedicated module ('cashdesk', 'takepos', ...) + /** + * @var string key of module source when invoice generated from a dedicated module ('cashdesk', 'takepos', ...) + */ public $module_source; - //! key of pos source ('0', '1', ...) + /** + * @var int key of pos source ('0', '1', ...) + */ public $pos_source; - //! id of template invoice when generated from a template invoice + /** + * @var int id of template invoice when generated from a template invoice + */ public $fk_fac_rec_source; - //! id of source invoice if replacement invoice or credit note + /** + * @var int id of source invoice if replacement invoice or credit note + */ public $fk_facture_source; public $linked_objects = array(); @@ -174,6 +207,9 @@ class Facture extends CommonInvoice * @var FactureLigne */ public $line; + /** + * @var array (Encoded as JSON in database) + */ public $extraparams = array(); /** @@ -181,6 +217,9 @@ class Facture extends CommonInvoice */ public $fac_rec; + /** + * @var string + */ public $date_pointoftax; @@ -200,12 +239,12 @@ class Facture extends CommonInvoice public $situation_final; /** - * @var array Table of previous situations + * @var Facture[] Table of previous situations */ public $tab_previous_situation_invoice = array(); /** - * @var array Table of next situations + * @var Facture[] Table of next situations */ public $tab_next_situation_invoice = array(); @@ -215,7 +254,7 @@ class Facture extends CommonInvoice public $oldcopy; /** - * @var double percentage of retainage + * @var float percentage of retainage */ public $retained_warranty; @@ -234,6 +273,9 @@ class Facture extends CommonInvoice */ public $availability_id; + /** + * @var string + */ public $date_closing; /** @@ -280,7 +322,7 @@ class Facture extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-2,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 1), @@ -506,6 +548,8 @@ class Facture extends CommonInvoice $nextdatewhen = null; $previousdaynextdatewhen = null; + $_facrec = null; + // Erase some properties of the invoice to create with the one of the recurring invoice if ($this->fac_rec > 0) { $this->fk_fac_rec_source = $this->fac_rec; @@ -594,8 +638,9 @@ class Facture extends CommonInvoice if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($this->thirdparty->default_lang)) { $newlang = $this->thirdparty->default_lang; // for proposal, order, invoice, ... } + // @phan-suppress-next-line PhanUndeclaredProperty if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($this->default_lang)) { - $newlang = $this->default_lang; // for thirdparty + $newlang = $this->default_lang; // for thirdparty @phan-suppress-current-line PhanUndeclaredProperty } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -789,6 +834,7 @@ class Facture extends CommonInvoice dol_syslog("There is ".count($this->lines)." lines into ->lines that are InvoiceLines"); foreach ($this->lines as $i => $val) { $newinvoiceline = $this->lines[$i]; + '@phan-var-force FactureLigne $newinvoiceline'; $newinvoiceline->context = $this->context; @@ -819,7 +865,7 @@ class Facture extends CommonInvoice $newinvoiceline->fk_parent_line = $fk_parent_line; - if ($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except) { + if ($this->type == Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except) { $discount = new DiscountAbsolute($this->db); $discount->fetch($newinvoiceline->fk_remise_except); @@ -880,6 +926,7 @@ class Facture extends CommonInvoice foreach ($this->lines as $i => $val) { $line = $this->lines[$i]; + '@phan-var-force FactureLigne $line'; // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. @@ -963,7 +1010,7 @@ class Facture extends CommonInvoice /* * Insert lines coming from the template invoice */ - if (!$error && $this->fac_rec > 0) { + if (!$error && $this->fac_rec > 0 && is_object($_facrec)) { dol_syslog("There is ".count($_facrec->lines)." lines from recurring invoice"); $fk_parent_line = 0; @@ -1032,7 +1079,7 @@ class Facture extends CommonInvoice ($_facrec->lines[$i]->date_end_fill == 1 && $previousdaynextdatewhen) ? $previousdaynextdatewhen : '', 0, $tva_npr, - '', + 0, // fk_remise_except 'HT', 0, $_facrec->lines[$i]->product_type, @@ -1046,7 +1093,7 @@ class Facture extends CommonInvoice $_facrec->lines[$i]->label, empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options, 100, // situation percent is undefined on recurring invoice lines - '', + 0, // fk_prev_id $_facrec->lines[$i]->fk_unit, $_facrec->lines[$i]->multicurrency_subprice, $_facrec->lines[$i]->ref_ext, @@ -1115,9 +1162,9 @@ class Facture extends CommonInvoice /** * Create a new invoice in database from current invoice * - * @param User $user Object user that ask creation - * @param int $invertdetail Reverse sign of amounts for lines - * @return int Return integer <0 if KO, >0 if OK + * @param User $user Object user that ask creation + * @param int<0,1> $invertdetail Reverse sign of amounts for lines + * @return int<-1,1> Return integer <0 if KO, >0 if OK */ public function createFromCurrent(User $user, $invertdetail = 0) { @@ -1191,7 +1238,7 @@ class Facture extends CommonInvoice $this->error = $facture->error; $this->errors = $facture->errors; } elseif ($this->type == self::TYPE_SITUATION && getDolGlobalString('INVOICE_USE_SITUATION')) { - $this->fetchObjectLinked('', '', $this->id, 'facture'); + $this->fetchObjectLinked(null, '', $this->id, 'facture'); foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) { foreach ($Tfk_object as $fk_object) { @@ -1267,7 +1314,8 @@ class Facture extends CommonInvoice // Loop on each line of new invoice foreach ($object->lines as $i => $line) { - if (($object->lines[$i]->info_bits & 0x02) == 0x02) { // We do not clone line of discounts + '@phan-var-force FactureLigne $line'; + if (($line->info_bits & 0x02) == 0x02) { // We do not clone line of discounts unset($object->lines[$i]); continue; } @@ -1348,11 +1396,11 @@ class Facture extends CommonInvoice } /** - * Load an object from an order and create a new invoice into database + * Load an object from an order and create a new invoice into database * - * @param Object $object Object source - * @param User $user Object user - * @return int Return integer <0 if KO, 0 if nothing done, 1 if OK + * @param Facture $object Object source + * @param User $user Object user + * @return int<-1,1> Return integer <0 if KO, 0 if nothing done, 1 if OK */ public function createFromOrder($object, User $user) { @@ -1367,48 +1415,49 @@ class Facture extends CommonInvoice $num = count($object->lines); for ($i = 0; $i < $num; $i++) { $line = new FactureLigne($this->db); - - $line->libelle = $object->lines[$i]->libelle; // deprecated - $line->label = $object->lines[$i]->label; - $line->desc = $object->lines[$i]->desc; - $line->subprice = $object->lines[$i]->subprice; - $line->total_ht = $object->lines[$i]->total_ht; - $line->total_tva = $object->lines[$i]->total_tva; - $line->total_localtax1 = $object->lines[$i]->total_localtax1; - $line->total_localtax2 = $object->lines[$i]->total_localtax2; - $line->total_ttc = $object->lines[$i]->total_ttc; - $line->vat_src_code = $object->lines[$i]->vat_src_code; - $line->tva_tx = $object->lines[$i]->tva_tx; - $line->localtax1_tx = $object->lines[$i]->localtax1_tx; - $line->localtax2_tx = $object->lines[$i]->localtax2_tx; - $line->qty = $object->lines[$i]->qty; - $line->fk_remise_except = $object->lines[$i]->fk_remise_except; - $line->remise_percent = $object->lines[$i]->remise_percent; - $line->fk_product = $object->lines[$i]->fk_product; - $line->info_bits = $object->lines[$i]->info_bits; - $line->product_type = $object->lines[$i]->product_type; - $line->rang = $object->lines[$i]->rang; - $line->special_code = $object->lines[$i]->special_code; - $line->fk_parent_line = $object->lines[$i]->fk_parent_line; - $line->fk_unit = $object->lines[$i]->fk_unit; - $line->date_start = $object->lines[$i]->date_start; - $line->date_end = $object->lines[$i]->date_end; + $src_line = $object->lines[$i]; + '@phan-var-force FactureLigne $src_line'; + $line->libelle = $src_line->libelle; // deprecated + $line->label = $src_line->label; + $line->desc = $src_line->desc; + $line->subprice = $src_line->subprice; + $line->total_ht = $src_line->total_ht; + $line->total_tva = $src_line->total_tva; + $line->total_localtax1 = $src_line->total_localtax1; + $line->total_localtax2 = $src_line->total_localtax2; + $line->total_ttc = $src_line->total_ttc; + $line->vat_src_code = $src_line->vat_src_code; + $line->tva_tx = $src_line->tva_tx; + $line->localtax1_tx = $src_line->localtax1_tx; + $line->localtax2_tx = $src_line->localtax2_tx; + $line->qty = $src_line->qty; + $line->fk_remise_except = $src_line->fk_remise_except; + $line->remise_percent = $src_line->remise_percent; + $line->fk_product = $src_line->fk_product; + $line->info_bits = $src_line->info_bits; + $line->product_type = $src_line->product_type; + $line->rang = $src_line->rang; + $line->special_code = $src_line->special_code; + $line->fk_parent_line = $src_line->fk_parent_line; + $line->fk_unit = $src_line->fk_unit; + $line->date_start = $src_line->date_start; + $line->date_end = $src_line->date_end; // Multicurrency - $line->fk_multicurrency = $object->lines[$i]->fk_multicurrency; - $line->multicurrency_code = $object->lines[$i]->multicurrency_code; - $line->multicurrency_subprice = $object->lines[$i]->multicurrency_subprice; - $line->multicurrency_total_ht = $object->lines[$i]->multicurrency_total_ht; - $line->multicurrency_total_tva = $object->lines[$i]->multicurrency_total_tva; - $line->multicurrency_total_ttc = $object->lines[$i]->multicurrency_total_ttc; + $line->fk_multicurrency = $src_line->fk_multicurrency; + $line->multicurrency_code = $src_line->multicurrency_code; + $line->multicurrency_subprice = $src_line->multicurrency_subprice; + $line->multicurrency_total_ht = $src_line->multicurrency_total_ht; + $line->multicurrency_total_tva = $src_line->multicurrency_total_tva; + $line->multicurrency_total_ttc = $src_line->multicurrency_total_ttc; - $line->fk_fournprice = $object->lines[$i]->fk_fournprice; - $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); + $line->fk_fournprice = $src_line->fk_fournprice; + $marginInfos = getMarginInfos($src_line->subprice, $src_line->remise_percent, $src_line->tva_tx, $src_line->localtax1_tx, $src_line->localtax2_tx, $src_line->fk_fournprice, $src_line->pa_ht); $line->pa_ht = $marginInfos[0]; // get extrafields from original line - $object->lines[$i]->fetch_optionals(); - foreach ($object->lines[$i]->array_options as $options_key => $value) { + $src_line->fetch_optionals(); + foreach ($src_line->array_options as $options_key => $value) { $line->array_options[$options_key] = $value; } @@ -1477,11 +1526,11 @@ class Facture extends CommonInvoice } /** - * Load an object from an order and create a new invoice into database + * Load an object from a contract and create a new invoice into database * - * @param Object $object Object source + * @param Facture $object Object source * @param User $user Object user - * @param array $lines Ids of lines to use for invoice. If empty, all lines will be used. + * @param int[] $lines Ids of lines to use for invoice. If empty, all lines will be used. * @return int Return integer <0 if KO, 0 if nothing done, 1 if OK */ public function createFromContract($object, User $user, $lines = array()) @@ -1614,14 +1663,14 @@ class Facture extends CommonInvoice /** * Creates a deposit from a proposal or an order by grouping lines by VAT rates * - * @param Propal|Commande $origin The original proposal or order - * @param int $date Invoice date - * @param int $payment_terms_id Invoice payment terms - * @param User $user Object user - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @param bool $autoValidateDeposit Whether to aumatically validate the deposit created - * @param array $overrideFields Array of fields to force values - * @return Facture|null The deposit created, or null if error (populates $origin->error in this case) + * @param Propal|Commande $origin The original proposal or order + * @param int $date Invoice date + * @param int $payment_terms_id Invoice payment terms + * @param User $user Object user + * @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers + * @param bool $autoValidateDeposit Whether to automatically validate the deposit created + * @param array $overrideFields Array of fields to force values + * @return ?Facture The deposit created, or null if error (populates $origin->error in this case) */ public static function createDepositFromOrigin(CommonObject $origin, $date, $payment_terms_id, User $user, $notrigger = 0, $autoValidateDeposit = false, $overrideFields = array()) { @@ -1735,11 +1784,16 @@ class Facture extends CommonInvoice if (!empty($line->special_code)) { continue; } - $TTotalByTva[$line->tva_tx] += $line->total_ttc; - $descriptions[$line->tva_tx] .= '
  • ' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : ''); - $descriptions[$line->tva_tx] .= (!empty($line->product_label) ? $line->product_label . ' - ' : ''); - $descriptions[$line->tva_tx] .= $langs->trans('Qty') . ' : ' . $line->qty; - $descriptions[$line->tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '
  • '; + $key = $line->tva_tx; + if (!array_key_exists($key, $TTotalByTva)) { + $TTotalByTva[$key] = 0; + $descriptions[$key] = ''; + } + $TTotalByTva[$key] += $line->total_ttc; + $descriptions[$key] .= '
  • ' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : ''); + $descriptions[$key] .= (!empty($line->product_label) ? $line->product_label . ' - ' : ''); + $descriptions[$key] .= $langs->trans('Qty') . ' : ' . $line->qty; + $descriptions[$key] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '
  • '; } foreach ($TTotalByTva as $tva => &$total) { @@ -1762,7 +1816,7 @@ class Facture extends CommonInvoice $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? $tva_tx = $lines[$i]->tva_tx; - $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $origin->deposit_percent) / 100; + $amountdeposit[$tva_tx] += ((float) $lines[$i]->total_ht * (float) $origin->deposit_percent) / 100; $descriptions[$tva_tx] .= '
  • ' . (!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : ''); $descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : ''); $descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty; @@ -1894,9 +1948,9 @@ class Facture extends CommonInvoice /** * getTooltipContentArray * - * @param array $params ex option, infologin + * @param array $params params to construct tooltip data + * @return array Data to show in tooltip * @since v18 - * @return array */ public function getTooltipContentArray($params) { @@ -3160,6 +3214,7 @@ class Facture extends CommonInvoice $productStatic = null; $warehouseStatic = null; + $productbatch = null; if ($batch_rule > 0) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; @@ -3343,9 +3398,11 @@ class Facture extends CommonInvoice } // We check if the invoice was provisional + /* if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref))) { // La verif qu'une remise n'est pas utilisee 2 fois est faite au moment de l'insertion de ligne } + */ if (!$error) { // Define third party as a customer @@ -3378,7 +3435,7 @@ class Facture extends CommonInvoice $is_batch_line = false; if ($batch_rule > 0) { $productStatic->fetch($this->lines[$i]->fk_product); - if ($productStatic->hasbatch()) { + if ($productStatic->hasbatch() && is_object($productbatch)) { $is_batch_line = true; $product_qty_remain = $this->lines[$i]->qty; @@ -3561,13 +3618,15 @@ class Facture extends CommonInvoice $final = true; $nboflines = count($this->lines); while (($i < $nboflines) && $final) { + $line = $this->lines[$i]; + '@phan-var-force FactureLigne $line'; if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { - $previousprogress = $this->lines[$i]->get_allprev_progress($this->lines[$i]->fk_facture); - $current_progress = floatval($this->lines[$i]->situation_percent); + $previousprogress = $line->get_allprev_progress($line->fk_facture); + $current_progress = (float) $line->situation_percent; $full_progress = $previousprogress + $current_progress; $final = ($full_progress == 100); } else { - $final = ($this->lines[$i]->situation_percent == 100); + $final = ($line->situation_percent == 100); } $i++; } @@ -3611,6 +3670,7 @@ class Facture extends CommonInvoice } foreach ($next_invoice->lines as $line) { + '@phan-var-force FactureLigne $line'; $result = $next_invoice->updateline( $line->id, $line->desc, @@ -3743,38 +3803,38 @@ class Facture extends CommonInvoice * par l'appelant par la method get_default_tva(societe_vendeuse,societe_acheteuse,produit) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * - * @param string $desc Description of line - * @param double $pu_ht Unit price without tax (> 0 even for credit note) - * @param double $qty Quantity - * @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') - * @param double $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) - * @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) - * @param int $fk_product Id of predefined product/service - * @param double $remise_percent Percent of discount on line - * @param int|string $date_start Date start of service - * @param int|string $date_end Date end of service - * @param int $fk_code_ventilation Code of dispatching into accountancy - * @param int $info_bits Bits of type of lines - * @param int $fk_remise_except Id discount used - * @param string $price_base_type 'HT' or 'TTC' - * @param double $pu_ttc Unit price with tax (> 0 even for credit note) - * @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used. - * @param int $rang Position of line (-1 means last value + 1) - * @param int $special_code Special code (also used by externals modules!) - * @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'.... - * @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id - * @param int $fk_parent_line Id of parent line - * @param int $fk_fournprice Supplier price id (to calculate margin) or '' - * @param int $pa_ht Buying price of line (to calculate margin) or '' - * @param string $label Label of the line (deprecated, do not use) - * @param array $array_options extrafields array - * @param int $situation_percent Situation advance percentage - * @param int $fk_prev_id Previous situation line id reference - * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param double $pu_ht_devise Unit price in foreign currency - * @param string $ref_ext External reference of the line - * @param int $noupdateafterinsertline No update after insert of line - * @return int Return integer <0 if KO, Id of line if OK + * @param string $desc Description of line + * @param float $pu_ht Unit price without tax (> 0 even for credit note) + * @param float $qty Quantity + * @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') + * @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) + * @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) + * @param int $fk_product Id of predefined product/service + * @param float $remise_percent Percent of discount on line + * @param int|string $date_start Date start of service + * @param int|string $date_end Date end of service + * @param int $fk_code_ventilation Code of dispatching into accountancy + * @param int $info_bits Bits of type of lines + * @param int $fk_remise_except Id discount used + * @param string $price_base_type 'HT' or 'TTC' + * @param float $pu_ttc Unit price with tax (> 0 even for credit note) + * @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used. + * @param int $rang Position of line (-1 means last value + 1) + * @param int $special_code Special code (also used by externals modules!) + * @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'.... + * @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id + * @param int $fk_parent_line Id of parent line + * @param int $fk_fournprice Supplier price id (to calculate margin) or '' + * @param int $pa_ht Buying price of line (to calculate margin) or '' + * @param string $label Label of the line (deprecated, do not use) + * @param array $array_options extrafields array + * @param int $situation_percent Situation advance percentage + * @param int $fk_prev_id Previous situation line id reference + * @param int|null $fk_unit Code of the unit to use. Null to use the default one + * @param float $pu_ht_devise Unit price in foreign currency + * @param string $ref_ext External reference of the line + * @param int $noupdateafterinsertline No update after insert of line + * @return int Return integer <0 if KO, Id of line if OK */ public function addline( $desc, @@ -4044,33 +4104,33 @@ class Facture extends CommonInvoice /** * Update a detail line * - * @param int $rowid Id of line to update - * @param string $desc Description of line - * @param double $pu Prix unitaire (HT ou TTC selon price_base_type) (> 0 even for credit note lines) - * @param double $qty Quantity - * @param double $remise_percent Percentage discount of the line - * @param int $date_start Date de debut de validite du service - * @param int $date_end Date de fin de validite du service - * @param double $txtva VAT Rate (Can be '8.5', '8.5 (ABC)') - * @param double $txlocaltax1 Local tax 1 rate - * @param double $txlocaltax2 Local tax 2 rate - * @param string $price_base_type HT or TTC - * @param int $info_bits Miscellaneous information - * @param int $type Type of line (0=product, 1=service) - * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). - * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) - * @param int $fk_fournprice Id of origin supplier price - * @param int $pa_ht Price (without tax) of product when it was bought - * @param string $label Label of the line (deprecated, do not use) - * @param int $special_code Special code (also used by externals modules!) - * @param array $array_options extrafields array - * @param int $situation_percent Situation advance percentage - * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param double $pu_ht_devise Unit price in currency - * @param int $notrigger disable line update trigger - * @param string $ref_ext External reference of the line - * @param integer $rang rank of line - * @return int Return integer < 0 if KO, > 0 if OK + * @param int $rowid Id of line to update + * @param string $desc Description of line + * @param float $pu Prix unitaire (HT ou TTC selon price_base_type) (> 0 even for credit note lines) + * @param float $qty Quantity + * @param float $remise_percent Percentage discount of the line + * @param int $date_start Date de debut de validite du service + * @param int $date_end Date de fin de validite du service + * @param float $txtva VAT Rate (Can be '8.5', '8.5 (ABC)') + * @param float $txlocaltax1 Local tax 1 rate + * @param float $txlocaltax2 Local tax 2 rate + * @param string $price_base_type HT or TTC + * @param int $info_bits Miscellaneous information + * @param int $type Type of line (0=product, 1=service) + * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). + * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) + * @param int $fk_fournprice Id of origin supplier price + * @param int $pa_ht Price (without tax) of product when it was bought + * @param string $label Label of the line (deprecated, do not use) + * @param int $special_code Special code (also used by externals modules!) + * @param array $array_options extrafields array + * @param int $situation_percent Situation advance percentage + * @param ?int $fk_unit Code of the unit to use. Null to use the default one + * @param float $pu_ht_devise Unit price in currency + * @param int<0,1> $notrigger disable line update trigger + * @param string $ref_ext External reference of the line + * @param integer $rang rank of line + * @return int Return integer < 0 if KO, > 0 if OK */ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = array(), $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0) { @@ -4334,10 +4394,10 @@ class Facture extends CommonInvoice $previous_progress = $line->get_allprev_progress($line->fk_facture); $current_progress = $percent - $previous_progress; $line->situation_percent = $current_progress; - $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, '', $current_progress); + $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, array(), $current_progress); } else { $line->situation_percent = $percent; - $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, '', $percent); + $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, array(), $percent); } $line->total_ht = $tabprice[0]; $line->total_tva = $tabprice[1]; @@ -4649,7 +4709,7 @@ class Facture extends CommonInvoice } $obj = new $classname(); - '@phan-var-force CommonNumRefGenerator $obj'; + '@phan-var-force ModeleNumRefFactures $obj'; $numref = $obj->getNextValue($soc, $this, $mode); @@ -4989,7 +5049,7 @@ class Facture extends CommonInvoice /** * Retourne id des contacts clients de facturation * - * @return array Liste des id contacts facturation + * @return int[] Liste des id contacts facturation */ public function getIdBillingContact() { @@ -4999,7 +5059,7 @@ class Facture extends CommonInvoice /** * Retourne id des contacts clients de livraison * - * @return array Liste des id contacts livraison + * @return int[] Liste des id contacts livraison */ public function getIdShippingContact() { @@ -5206,7 +5266,7 @@ class Facture extends CommonInvoice /** * Create an array of invoice lines * - * @return int >0 if OK, <0 if KO + * @return int<-1,1> >0 if OK, <0 if KO */ public function getLinesArray() { @@ -5218,11 +5278,11 @@ class Facture extends CommonInvoice * * @param string $modele Generator to use. Caller must set it to obj->model_pdf or GETPOST('model','alpha') for example. * @param Translate $outputlangs Object lang to use for translation - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information - * @return int Return integer <0 if KO, >0 if OK + * @param int<0,1> $hidedetails Hide details of lines + * @param int<0,1> $hidedesc Hide description + * @param int<0,1> $hideref Hide ref + * @param ?array $moreparams Array to provide more information + * @return int<-1,1> Return integer <0 if KO, >0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { @@ -5746,7 +5806,7 @@ class Facture extends CommonInvoice $errormesg = ''; // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, '', $tmpinvoice); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $tmpinvoice); complete_substitutions_array($substitutionarray, $outputlangs, $tmpinvoice); @@ -5946,8 +6006,8 @@ class Facture extends CommonInvoice /** * See if current invoice date is posterior to the last invoice date among validated invoices of same type. * - * @param boolean $allow_validated_drafts return true if the invoice has been validated before returning to DRAFT state. - * @return array return array + * @param boolean $allow_validated_drafts return true if the invoice has been validated before returning to DRAFT state. + * @return array{0?:bool,1?:string} return array */ public function willBeLastOfSameType($allow_validated_drafts = false) { @@ -5987,9 +6047,9 @@ class Facture extends CommonInvoice /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { @@ -6062,23 +6122,55 @@ class FactureLigne extends CommonInvoiceLine public $oldline; //! From llx_facturedet - //! Id facture + /** + * @var int Id facture + */ public $fk_facture; - //! Id parent line + /** + * @var int Id parent line + */ public $fk_parent_line; - //! Description ligne + /** + * @var string Description ligne + */ public $desc; - public $ref_ext; // External reference of the line + /** + * @var string External reference of the line + */ + public $ref_ext; + /** + * @var int<0,6> + */ public $localtax1_type; // Local tax 1 type + /** + * @var int<0,6> + */ public $localtax2_type; // Local tax 2 type + /** + * @var int + */ public $fk_remise_except; // Link to line into llx_remise_except + /** + * @var int + */ public $rang = 0; - + /** + * @var int + */ public $fk_fournprice; + /** + * @var string|int|float + */ public $pa_ht; + /** + * @var string + */ public $marge_tx; + /** + * @var string + */ public $marque_tx; /** @@ -6086,6 +6178,9 @@ class FactureLigne extends CommonInvoiceLine */ public $tva_npr; + /** + * @var float + */ public $remise_percent; /** @@ -6093,23 +6188,38 @@ class FactureLigne extends CommonInvoiceLine */ public $batch; /** - * @var string To store the warehouse where to consume stock when using a POS module + * @var int To store the warehouse where to consume stock when using a POS module */ public $fk_warehouse; + /** + * @var string + */ public $origin; + /** + * @var int + */ public $origin_id; /** - * @var integer Id in table llx_accounting_bookeeping to know accounting account for product line + * @var int Id in table llx_accounting_bookeeping to know accounting account for product line */ public $fk_code_ventilation = 0; + /** + * @var string|int + */ public $date_start; + /** + * @var string|int + */ public $date_end; + /** + * @var int<0,1> + */ public $skip_update_total; // Skip update price total for special lines /** diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 468052be7e0..7385c90005c 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -634,7 +634,13 @@ class BonPrelevement extends CommonObject $addbankurl = 'direct-debit'; // = 'directdebit' } - $result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '', 0, '', $addbankurl); + + if ($paiement instanceof PaymentSalary) { + // Only 6 arguments for PaymentSalary + $result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', ''); + } else { + $result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '', 0, '', $addbankurl); + } if ($result < 0) { $error++; diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 805176543cb..0db8f92ffef 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2021 OpenDsi * Copyright (C) 2024 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,20 +48,20 @@ class RejetPrelevement public $date_rejet; /** - * @var array Reason of error + * @var string Reason of error */ public $motif; /** - * @var array Label status of invoicing + * @var string Label status of invoicing */ public $invoicing; /** - * @var array Labels of reason + * @var string[] Labels of reason */ public $motifs; /** - * @var array Labels of invoicing status + * @var string[] Labels of invoicing status */ public $labelsofinvoicing; diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 96d9a2d6b2c..4bf3836cd5f 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -84,6 +85,7 @@ $error = 0; if ($action == 'confirm_rejet' && $permissiontoadd) { if (GETPOST("confirm") == 'yes') { + $datarej = null; if (GETPOSTINT('remonth')) { $daterej = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); } @@ -156,6 +158,7 @@ $h++; if ($id) { $lipre = new LignePrelevement($db); + $bon = null; if ($lipre->fetch($id) >= 0) { $bon = new BonPrelevement($db); @@ -264,7 +267,7 @@ if ($id) { print '
    '; if ($action == '') { - if ($bon->statut == BonPrelevement::STATUS_CREDITED) { + if (is_object($bon) && $bon->statut == BonPrelevement::STATUS_CREDITED) { if ($lipre->statut == 2) { if ($user->hasRight('prelevement', 'bons', 'credit')) { print ''.$langs->trans("StandingOrderReject").''; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 05764ef546e..dfd33b47691 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -112,8 +112,10 @@ class Contrat extends CommonObject */ public $fk_soc; - - public $societe; // Object societe + /** + * @var Societe thirdparty Object + */ + public $societe; /** * Status of the contract @@ -170,6 +172,7 @@ class Contrat extends CommonObject public $fk_commercial_suivi; /** + * @var int * @deprecated Use fk_project instead * @see $fk_project */ @@ -599,7 +602,7 @@ class Contrat extends CommonObject } } - // Set new ref and define current statut + // Set new ref and define current status if (!$error) { $this->ref = $num; $this->status = self::STATUS_VALIDATED; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 776b9c776f1..38060f89b73 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -154,7 +154,7 @@ abstract class CommonDocGenerator public $phpmin = array(7, 1); /** - * @var array Array of columns + * @var array Array of columns */ public $cols; @@ -309,7 +309,8 @@ abstract class CommonDocGenerator $mysoc->country = $outputlangs->transnoentitiesnoconv("Country".$mysoc->country_code); } if (empty($mysoc->state) && !empty($mysoc->state_code)) { - $mysoc->state = getState($mysoc->state_code, '0'); + $state_id = dol_getIdFromCode($this->db, $mysoc->state_code, 'c_departements', 'code_departement', 'rowid'); + $mysoc->state = getState($state_id, '0'); } $logotouse = $conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small; @@ -365,7 +366,8 @@ abstract class CommonDocGenerator $object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code); } if (empty($object->state) && !empty($object->state_code)) { - $object->state = getState($object->state_code, '0'); + $state_id = dol_getIdFromCode($this->db, $object->state_code, 'c_departements', 'code_departement', 'rowid'); + $object->state = getState($state_id, '0'); } $array_thirdparty = array( @@ -431,7 +433,8 @@ abstract class CommonDocGenerator $object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code); } if (empty($object->state) && !empty($object->state_code)) { - $object->state = getState($object->state_code, '0'); + $state_id = dol_getIdFromCode($this->db, $object->state_code, 'c_departements', 'code_departement', 'rowid'); + $object->state = getState($state_id, '0'); } $array_contact = array( diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 45e68e0abd4..29c7a9f6661 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -843,8 +843,8 @@ abstract class CommonObject public $cond_reglement_supplier_id; /** - * @var float Deposit percent for payment terms. - * Populated by setPaymentTerms(). + * @var float|string Deposit percent for payment terms. + * Populated by setPaymentTerms(). * @see setPaymentTerms() */ public $deposit_percent; @@ -2160,13 +2160,13 @@ abstract class CommonObject * Setter generic. Update a specific field into database. * Warning: Trigger is run only if param trigkey is provided. * - * @param string $field Field to update - * @param mixed $value New value - * @param string $table To force other table element or element line (should not be used) - * @param int $id To force other object id (should not be used) - * @param string $format Data format ('text', 'int', 'date'). 'text' is used if not defined - * @param string $id_field To force rowid field name. 'rowid' is used if not defined - * @param User|string $fuser Update the user of last update field with this user. If not provided, current user is used except if value is 'none' + * @param string $field Field to update + * @param mixed $value New value + * @param string $table To force other table element or element line (should not be used) + * @param ?int $id To force other object id (should not be used) + * @param string $format Data format ('text', 'int', 'date'). 'text' is used if not defined + * @param string $id_field To force rowid field name. 'rowid' is used if not defined + * @param User|string|null $fuser Update the user of last update field with this user. If not provided, current user is used except if value is 'none' * @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY') * @param string $fk_user_field Name of field to save user id making change * @return int<-2,1> Return integer <0 if KO, >0 if OK diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index c8dbda9c9bf..6d42c9de5f2 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -205,7 +205,7 @@ abstract class CommonOrderLine extends CommonObjectLine /** * Percent line discount - * @var float + * @var float|string */ public $remise_percent; @@ -217,7 +217,7 @@ abstract class CommonOrderLine extends CommonObjectLine /** * VAT % - * @var float + * @var float|string */ public $tva_tx; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 925263411d0..22cc60a81c7 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2008 Laurent Destailleur * Copyright (C) 2021 Gaëtan MAISON * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -202,7 +203,7 @@ class DolEditor $htmlencode_force = preg_match('/_encoded$/', $this->toolbarname) ? 'true' : 'false'; - $out .= ''."\n"; + $out .= ''."\n"; $out .= '