Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2024-08-14 14:12:19 +02:00
94 changed files with 1333 additions and 764 deletions

View File

@@ -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";

View File

@@ -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'],

View File

@@ -315,7 +315,7 @@ foreach ($arrayofmodules as $file => $modCodeMember) {
}
print '<td class="center">';
$s = $modCodeMember->getToolTip($langs, null, -1);
$s = $modCodeMember->getToolTip($langs, null);
print $form->textwithpicto('', $s, 1);
print '</td>';

View File

@@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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);

View File

@@ -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');
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -395,7 +395,8 @@ if (count($listinsetup) > 0) {
if ($keyforsupportedoauth2array == 'OAUTH_GENERIC_NAME') {
print '<tr class="oddeven value">';
print '<td>';
print $form->textwithpicto($langs->trans("URLOfOAuthServiceEndpoints"), $langs->trans("URLOfOAuthServiceEndpointsExample"));
$tooltiphelp = $langs->trans("Example").'<br>https://mastodon.example.com<br>https://mastodon.social';
print $form->textwithpicto($langs->trans("URLOfOAuthServiceEndpoints"), $tooltiphelp);
print '</td>';
print '<td><input style="width: 80%" type="text" name="'.$key[3].'" value="'.getDolGlobalString($key[3]).'" >';
print '</td>';

View File

@@ -117,7 +117,7 @@ print "</tr>";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ApiProductionMode").'</td>';
$production_mode = !(!getDolGlobalString('API_PRODUCTION_MODE'));
$production_mode = getDolGlobalBool('API_PRODUCTION_MODE');
if ($production_mode) {
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&token='.newToken().'&status=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
@@ -132,7 +132,7 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("API_DISABLE_COMPRESSION").'</td>';
$disable_compression = !(!getDolGlobalString('API_DISABLE_COMPRESSION'));
$disable_compression = getDolGlobalBool('API_DISABLE_COMPRESSION');
if ($disable_compression) {
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablecompression&token='.newToken().'&status=0">';
print img_picto($langs->trans("Activated"), 'switch_on');

View File

@@ -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));

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alice Adminson <aadminson@example.com>
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alice Adminson <aadminson@example.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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 '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
if ($error != 0) {

View File

@@ -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];

View File

@@ -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);

View File

@@ -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 '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddIntervention").'</a></div>';
}

View File

@@ -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<string,string> (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,array{type:string,label:string,enabled:int<0,2>|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<int,string>,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,array{type:string,label:string,enabled:int<0,2>|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<int,string>,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<string,int|float|string> $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] .= '<li>' . (!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) . '</li>';
$key = $line->tva_tx;
if (!array_key_exists($key, $TTotalByTva)) {
$TTotalByTva[$key] = 0;
$descriptions[$key] = '';
}
$TTotalByTva[$key] += $line->total_ttc;
$descriptions[$key] .= '<li>' . (!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) . '</li>';
}
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] .= '<li>' . (!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<string,mixed> $params params to construct tooltip data
* @return array<string,string> 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<string,mixed> $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<string,mixed> $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<string,mixed> $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<string,mixed> $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
/**

View File

@@ -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++;

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2021 OpenDsi <support@open-dsi.fr>
* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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;

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 '<div class="tabsAction">';
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 '<a class="butActionDelete" href="line.php?action=rejet&type='.$type.'&id='.$lipre->id.'">'.$langs->trans("StandingOrderReject").'</a>';

View File

@@ -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;

View File

@@ -154,7 +154,7 @@ abstract class CommonDocGenerator
public $phpmin = array(7, 1);
/**
* @var array<string,array{rank:int,width:float|int,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of columns
* @var array<string,array{rank:int,width:float|int,status:bool,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> 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(

View File

@@ -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

View File

@@ -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;

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Gaëtan MAISON <gm@ilad.org>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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 .= '<!-- Output ckeditor disallowAnyContent='.dol_escape_htmltag($disallowAnyContent).' toolbarname='.dol_escape_htmltag($this->toolbarname).' -->'."\n";
$out .= '<!-- Output ckeditor disallowAnyContent='.dol_escape_htmltag((string) $disallowAnyContent).' toolbarname='.dol_escape_htmltag($this->toolbarname).' -->'."\n";
$out .= '<script nonce="'.getNonce().'" type="text/javascript">
$(document).ready(function () {
/* console.log("Run ckeditor"); */

View File

@@ -45,7 +45,7 @@ class ExtraFields
public $db;
/**
* @var array<string,array{label:array<string,string>,type:array<string,string>,size:array<string,string>,default:array<string,string>,computed:array<string,string>,unique:array<string,int>,required:array<string,int>,param:array<string,mixed>,perms:array<string,mixed[]>,list:array<string,int|string>,pos:array<string,int>,totalizable:array<string,int>,help:array<string,string>,printable:array<string,int>,enabled:array<string,int>,langfile:array<string,string>,css:array<string,string>,csslist:array<string,string>,hidden:array<string,int>,mandatoryfieldsofotherentities:array<string,string>,loaded?:int,count:int}> New array to store extrafields definition Note: count set as present to avoid static analysis notices
* @var array<string,array{label:array<string,string>,type:array<string,string>,size:array<string,string>,default:array<string,string>,computed:array<string,string>,unique:array<string,int>,required:array<string,int>,param:array<string,mixed>,perms:array<string,mixed[]>,list:array<string,int|string>,pos:array<string,int>,totalizable:array<string,int>,help:array<string,string>,printable:array<string,int>,enabled:array<string,int>,langfile:array<string,string>,css:array<string,string>,csslist:array<string,string>,cssview:array<string,string>,hidden:array<string,int>,mandatoryfieldsofotherentities:array<string,string>,loaded?:int,count:int}> New array to store extrafields definition Note: count set as present to avoid static analysis notices
*/
public $attributes = array();

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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 @@ class SocialNetworkManager
/**
* @var int
*/
private $lastFetchDate;
private $lastFetchDate; // @phpstan-ignore-line
/**
* Constructor

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2020-2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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

View File

@@ -285,9 +285,12 @@ if (!class_exists('MenuManager')) {
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
}
}
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->loadMenu('all', 'all'); // Load this->tabMenu with sql menu entries
//var_dump($menumanager);exit;
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->showmenu('jmobile');
print '</body>';

View File

@@ -41,7 +41,7 @@
* @param int $pid Product id
* @param int $socid Third party id
* @param string $action Action string
* @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
* @param array|int $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
* @param string|array $actioncode Preselected value(s) of actioncode for filter on event type
* @param int $usergroupid Id of group to filter on users
* @param string $excludetype A type to exclude ('systemauto', 'system', '')

View File

@@ -1,11 +1,11 @@
<?php
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
* Copyright (C) 2018-2024 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
* Copyright (C) 2018-2024 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -37,7 +37,7 @@
function fichinter_prepare_head($object)
{
global $db, $langs, $conf, $user;
$langs->load("fichinter");
$langs->load("interventions");
$h = 0;
$head = array();

View File

@@ -205,7 +205,7 @@ function getMultidirVersion($object, $module = '', $forobject = 0)
/**
* Return dolibarr global constant string value
* Return a Dolibarr global constant string value
*
* @param string $key Key to return value, return $default if not set
* @param string|int|float $default Value to return if not defined
@@ -222,9 +222,9 @@ function getDolGlobalString($key, $default = '')
* Return a Dolibarr global constant int value.
* The constants $conf->global->xxx are loaded by the script master.inc.php included at begin of any PHP page.
*
* @param string $key key to return value, return 0 if not set
* @param int $default value to return
* @return int
* @param string $key Key to return value, return $default if not set
* @param int $default Value to return if not defined
* @return int Value returned
* @see getDolUserInt()
*/
function getDolGlobalInt($key, $default = 0)
@@ -233,6 +233,20 @@ function getDolGlobalInt($key, $default = 0)
return (int) (isset($conf->global->$key) ? $conf->global->$key : $default);
}
/**
* Return a Dolibarr global constant boolean value.
* The constants $conf->global->xxx are loaded by the script master.inc.php included at begin of any PHP page.
*
* @param string $key Key to return value, return $default if not set
* @param bool $default Value to return if not defined
* @return bool Value returned
*/
function getDolGlobalBool($key, $default = false)
{
global $conf;
return (bool) ($conf->global->$key ?? $default);
}
/**
* Return Dolibarr user constant string value
*

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
@@ -2385,7 +2385,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
// Fields to show current time
$tableCell = '';
$modeinput = 'hours';
$TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow));
$TFirstDay = getFirstDayOfEachWeek($TWeek, (int) date('Y', $firstdaytoshow));
$TFirstDay[reset($TWeek)] = 1;
$firstdaytoshowarray = dol_getdate($firstdaytoshow);

View File

@@ -31,7 +31,7 @@ function socialnetwork_prepare_head()
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/admin/dict.php?id=38';
$head[$h][0] = DOL_URL_ROOT.'/admin/dict.php?id=38&from=socialnetworksetup';
$head[$h][1] = $langs->trans("Dictionary").' - '.$langs->trans("SocialNetworks");
$head[$h][2] = 'dict';
$h++;

View File

@@ -29,13 +29,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
/**
* Core function to output top menu auguria
*
* @param DoliDB $db Database handler
* @param string $atarget Target (Example: '' or '_top')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param DoliDB $db Database handler
* @param string $atarget Target (Example: '' or '_top')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout 1=Disable output (Initialise &$menu only).
* @param string $mode 'top', 'topnb', 'left', 'jmobile'
* @param Menu $menu Object Menu to return back list of menu entries
* @param int<0,1> $noout 1=Disable output (Initialise &$menu only).
* @param string $mode 'top', 'topnb', 'left', 'jmobile'
* @return int 0
*/
function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 0, $mode = '')
@@ -220,14 +220,14 @@ function print_start_menu_entry_auguria($idsel, $classname, $showmode)
/**
* Output menu entry
*
* @param string $text Text
* @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
* @param string $url Url
* @param string $id Id
* @param string $idsel Id sel
* @param string $classname Class name
* @param string $atarget Target
* @param array $menuval All the $menuval array
* @param string $text Text
* @param int<0,2> $showmode 0 = hide, 1 = allowed or 2 = not allowed
* @param string $url Url
* @param string $id Id
* @param string $idsel Id sel
* @param string $classname Class name
* @param string $atarget Target
* @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}|array{} $menuval The full $menuval array
* @return void
*/
function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array())
@@ -314,11 +314,11 @@ function print_end_menu_array_auguria()
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param int<0,1> $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session.
* @param array $moredata An array with more data to output
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param ?array<string,string> $moredata An array with more data to output
* @param int<0,1> $type_user 0=Menu for backoffice, 1=Menu for front office
* @return int Nb of menu entries
*/
function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
@@ -500,10 +500,10 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
$reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks
if (is_numeric($reshook)) {
if ($reshook == 0 && !empty($hookmanager->results)) {
$menu_array[] = $hookmanager->results; // add
if ($reshook == 0 && !empty($hookmanager->resArray)) {
$menu_array[] = $hookmanager->resArray; // add
} elseif ($reshook == 1) {
$menu_array = $hookmanager->results; // replace
$menu_array = $hookmanager->resArray; // replace
}
// @todo Sort menu items by 'position' value
@@ -689,9 +689,9 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
* Function to test if an entry is enabled or not
*
* @param string $type_user 0=We need backoffice menu, 1=We need frontoffice menu
* @param array $menuentry Array for menu entry
* @param array $listofmodulesforexternal Array with list of modules allowed to external users
* @return int 0=Hide, 1=Show, 2=Show gray
* @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string} $menuentry Array for menu entry
* @param string[] $listofmodulesforexternal Array with list of modules allowed to external users
* @return int<0,2> 0=Hide, 1=Show, 2=Show gray
*/
function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
{
@@ -703,7 +703,7 @@ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexterna
return 0; // Entry disabled by condition
}
if ($type_user && $menuentry['module']) {
$tmploops = explode('|', $menuentry['module']);
$tmploops = explode('|', (string) $menuentry['module']);
$found = 0;
foreach ($tmploops as $tmploop) {
if (in_array($tmploop, $listofmodulesforexternal)) {

View File

@@ -27,6 +27,8 @@
/**
* Class to manage menu Auguria
*
* @phan-suppress PhanRedefineClass
*/
class MenuManager
{
@@ -36,12 +38,12 @@ class MenuManager
public $db;
/**
* @var int Put 0 for internal users, 1 for external users
* @var int<0,1> 0 for internal users, 1 for external users
*/
public $type_user;
/**
* @var string To store default target to use onto links
* @var string Default target to use for links
*/
public $atarget = "";
@@ -55,9 +57,18 @@ class MenuManager
*/
public $menu;
/**
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
*/
public $menu_array;
/**
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
*/
public $menu_array_after;
/**
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
*/
public $tabMenu;
@@ -65,7 +76,7 @@ class MenuManager
* Constructor
*
* @param DoliDB $db Database handler
* @param int $type_user Type of user
* @param int<0,1> $type_user Type of user
*/
public function __construct($db, $type_user)
{
@@ -141,9 +152,9 @@ class MenuManager
* Show menu.
* Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called.
*
* @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu)
* @param array $moredata An array with more data to output
* @return int 0 or nb of top menu entries if $mode = 'topnb'
* @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu)
* @param ?array<string,string> $moredata An array with more data to output
* @return int<0,max> 0 or nb of top menu entries if $mode = 'topnb'
*/
public function showmenu($mode, $moredata = null)
{

View File

@@ -726,11 +726,11 @@ function print_end_menu_array()
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param int<0,1> $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session.
* @param array $moredata An array with more data to output
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param ?array<string,string> $moredata An array with more data to output
* @param int<0,1> $type_user 0=Menu for backoffice, 1=Menu for front office
* @return int Nb of menu entries
*/
function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
@@ -744,7 +744,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"] ?? '');
$leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"] ?? ''));
if (is_null($mainmenu)) {
if (empty($mainmenu)) {
$mainmenu = 'home';
}
@@ -1777,6 +1777,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
if ($nature) {
$langs->load('accountancy');
$journallabel = '';
$journallabelwithoutspan = '';
if ($objp->label) {
$journallabelwithoutspan = $langs->trans($objp->label);
$journallabel = '<span class="opacitymedium">('.$langs->trans($objp->label).')</span>'; // Label of bank account in llx_accounting_journal

View File

@@ -26,6 +26,8 @@
/**
* Class to manage menu Eldy
*
* @phan-suppress PhanRedefineClass
*/
class MenuManager
{
@@ -54,9 +56,18 @@ class MenuManager
*/
public $menu;
/**
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
*/
public $menu_array;
/**
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
*/
public $menu_array_after;
/**
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
*/
public $tabMenu;
@@ -64,7 +75,7 @@ class MenuManager
* Constructor
*
* @param DoliDB $db Database handler
* @param int $type_user Type of user
* @param int<0,1> $type_user Type of user
*/
public function __construct($db, $type_user)
{
@@ -137,9 +148,9 @@ class MenuManager
* Show menu.
* Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called.
*
* @param string $mode 'top', 'topnb', 'left', 'leftdropdown', 'jmobile' (used to get full xml ul/li menu)
* @param array $moredata An array with more data to output
* @return int 0 or nb of top menu entries if $mode = 'topnb'
* @param string $mode 'top', 'topnb', 'left', 'leftdropdown', 'jmobile' (used to get full xml ul/li menu)
* @param ?array<string,mixed> $moredata An array with more data to output
* @return int 0 or nb of top menu entries if $mode = 'topnb'
*/
public function showmenu($mode, $moredata = null)
{

View File

@@ -23,6 +23,8 @@
/**
* Class to manage empty menu
*
* @phan-suppress PhanRedefineClass
*/
class MenuManager
{
@@ -31,26 +33,47 @@ class MenuManager
*/
public $db;
public $type_user = 0; // Put 0 for internal users, 1 for external users
public $atarget = ""; // To store default target to use onto links
/**
* @var int<0,1> 0 for internal users, 1 for external users
*/
public $type_user = 0;
/**
* @var string Default target to use in links
*/
public $atarget = "";
/**
* @var string
*/
public $name = "empty";
/**
* @var Menu
*/
public $menu;
/**
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
*/
public $menu_array_after;
/**
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
*/
public $tabMenu;
/**
* @var Menu
*/
public $topmenu;
/**
* @var Menu
*/
public $leftmenu;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param int $type_user Type of user
* @param int<0,1> $type_user Type of user
*/
public function __construct($db, $type_user)
{
@@ -76,9 +99,9 @@ class MenuManager
/**
* Show menu
*
* @param string $mode 'top', 'left', 'jmobile'
* @param array $moredata An array with more data to output
* @return int|string 0 or nb of top menu entries if $mode = 'topnb', string inc ase of bad parameter
* @param string $mode 'top', 'left', 'jmobile'
* @param ?array<string,mixed> $moredata An array with more data to output
* @return int<0,max>|string 0 or nb of top menu entries if $mode = 'topnb', string inc ase of bad parameter
*/
public function showmenu($mode, $moredata = null)
{
@@ -508,7 +531,7 @@ function print_start_menu_entry_empty($idsel, $classname, $showmode)
* @param string $idsel Id sel
* @param string $classname Class name
* @param string $atarget Target
* @param array $menuval All the $menuval array
* @param array{}|array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string} $menuval All the $menuval array
* @return void
*/
function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array())

View File

@@ -81,7 +81,7 @@ class pdf_standard_asset extends ModelePDFAsset
public $situationinvoice;
/**
* @var array<string,array{rank:int,width:float|int,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document table columns
* @var array<string,array{rank:int,width:float|int,status:bool,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document table columns
*/
public $cols;

View File

@@ -224,18 +224,22 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
*
* @param DoliDB $db Database handler
* @param string $code Code to check/correct
* @param Product $product Object product
* @param int $thirdparty_type 0 = customer/prospect , 1 = supplier
* @param Product|Societe $product Object product
* @param int<0,1> $thirdparty_type 0 = customer/prospect , 1 = supplier
* @param string $type type of barcode (EAN, ISBN, ...)
* @return int 0 if OK
* @return int<-7,0> 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
* -7 ErrorBadClass
*/
public function verif($db, &$code, $product, $thirdparty_type, $type)
{
global $conf;
if (!$product instanceof Product) {
dol_syslog(get_class($this)."::verif called with ".get_class($product)." Expected Product", LOG_ERR);
return -7;
}
//var_dump($code.' '.$product->ref.' '.$thirdparty_type);exit;

View File

@@ -231,17 +231,22 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
*
* @param DoliDB $db Database handler
* @param string $code Code to check/correct
* @param Societe $thirdparty Object third-party
* @param int $thirdparty_type 0 = customer/prospect , 1 = supplier
* @param Societe|Product $thirdparty Object third party
* @param int<0,1> $thirdparty_type 0 = customer/prospect , 1 = supplier
* @param string $type type of barcode (EAN, ISBN, ...)
* @return int 0 if OK
* @return int<-7,0> 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
* -7 ErrorBadClass
*/
public function verif($db, &$code, $thirdparty, $thirdparty_type, $type)
{
if (!$thirdparty instanceof Societe) {
dol_syslog(get_class($this)."::verif called with ".get_class($thirdparty)." Expected Societe", LOG_ERR);
return -7;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$result = 0;

View File

@@ -156,4 +156,22 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator
return $s;
}
/**
* Check validity of code according to its rules
*
* @param DoliDB $db Database handler
* @param string $code Code to check/correct
* @param Product|Societe $object Object product or ThirdParty
* @param int<0,1> $thirdparty_type 0 = customer/prospect , 1 = supplier
* @param string $type type of barcode (EAN, ISBN, ...)
* @return int<-7,0> 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
* -7 ErrorBadClass
*/
abstract public function verif($db, &$code, $object, $thirdparty_type, $type);
}

View File

@@ -80,7 +80,7 @@ class pdf_eratosthene extends ModelePDFCommandes
public $version = 'dolibarr';
/**
* @var array<string,array{rank:int,width:float|int,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document table columns
* @var array<string,array{rank:int,width:float|int,status:bool,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document table columns
*/
public $cols;
@@ -1926,7 +1926,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->cols['totalincltax'] = array(
'rank' => $rank,
'width' => 26, // in mm
'status' => !(!getDolGlobalString('PDF_ORDER_SHOW_PRICE_INCL_TAX')),
'status' => getDolGlobalBool('PDF_ORDER_SHOW_PRICE_INCL_TAX'),
'title' => array(
'textkey' => 'TotalTTCShort'
),

View File

@@ -1260,7 +1260,7 @@ class pdf_crabe extends ModelePDFFactures
$langs->loadLangs(array('payment', 'paybox', 'stripe'));
$servicename = $langs->transnoentities('Online');
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', '');
$paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0);
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -117,7 +117,7 @@ class pdf_octopus extends ModelePDFFactures
/**
* @var array<string,array{rank:int,width:float|int,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of columns
* @var array<string,array{rank:int,width:float|int,status:bool,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document table columns
*/
public $cols;
@@ -1462,7 +1462,7 @@ class pdf_octopus extends ModelePDFFactures
$langs->loadLangs(array('payment', 'paybox', 'stripe'));
$servicename = $langs->transnoentities('Online');
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', '');
$paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0);
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
$pdf->SetXY($this->marge_gauche, $posy);

View File

@@ -109,7 +109,7 @@ class pdf_sponge extends ModelePDFFactures
/**
* @var array<string,array{rank:int,width:float|int,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of columns
* @var array<string,array{rank:int,width:float|int,status:bool,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document table columns
*/
public $cols;
@@ -1360,7 +1360,7 @@ class pdf_sponge extends ModelePDFFactures
$langs->loadLangs(array('payment', 'paybox', 'stripe'));
$servicename = $langs->transnoentities('Online');
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', '');
$paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0);
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
$pdf->SetXY($this->marge_gauche, $posy);
@@ -2708,7 +2708,7 @@ class pdf_sponge extends ModelePDFFactures
$this->cols['totalincltax'] = array(
'rank' => $rank,
'width' => 26, // in mm
'status' => !(!getDolGlobalString('PDF_PROPAL_SHOW_PRICE_INCL_TAX')),
'status' => getDolGlobalBool('PDF_PROPAL_SHOW_PRICE_INCL_TAX'),
'title' => array(
'textkey' => 'TotalTTCShort'
),

View File

@@ -160,9 +160,9 @@ class mod_facture_mars extends ModeleNumRefFactures
* Return next value not used or last value used
*
* @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string|int Value if OK, 0 if KO
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string|int<-1,0> Value if OK, <=0 if KO
*/
public function getNextValue($objsoc, $invoice, $mode = 'next')
{

View File

@@ -6,6 +6,7 @@
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@@ -135,12 +136,12 @@ class mod_facture_mercure extends ModeleNumRefFactures
}
/**
* Return next value
* Return next value not used or last value used
*
* @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string|int Value if OK, 0 if KO
* @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string|int<-1,0> Value if OK, <=0 if KO
*/
public function getNextValue($objsoc, $invoice, $mode = 'next')
{

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@@ -250,5 +251,13 @@ abstract class ModelePDFFactures extends CommonDocGenerator
*/
abstract class ModeleNumRefFactures extends CommonNumRefGenerator
{
// No overload code
/**
* Return next value not used or last value used
*
* @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string|int<-1,0> Value if OK, <=0 if KO
*/
abstract public function getNextValue($objsoc, $invoice, $mode = 'next');
}

View File

@@ -59,7 +59,7 @@ class modSocialNetworks extends DolibarrModules
$this->dirs = array();
// Config pages
$this->config_page_url = array(DOL_URL_ROOT.'/admin/dict.php?id=38');
$this->config_page_url = array(DOL_URL_ROOT.'/admin/dict.php?id=38&from=socialnetworksetup');
// Dependencies
$this->hidden = getDolGlobalInt('MODULE_SOCIALNETWORKS_DISABLED'); // A condition to hide module

View File

@@ -531,8 +531,8 @@ class doc_generic_task_odt extends ModelePDFTask
// Make substitution
$substitutionarray = array(
'__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email,
'__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email,
);
complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook
@@ -547,10 +547,10 @@ class doc_generic_task_odt extends ModelePDFTask
$odfHandler = new Odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->project->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
'PATH_TO_TMP' => $conf->project->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
)
);
} catch (Exception $e) {
@@ -607,8 +607,6 @@ class doc_generic_task_odt extends ModelePDFTask
$odfHandler->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
}
@@ -621,9 +619,16 @@ class doc_generic_task_odt extends ModelePDFTask
$contact_arrray = array_merge($contact_arrray, $contact_temp);
}
}
if ((is_array($contact_arrray) && count($contact_arrray) > 0)) {
// Check for segment
$foundtagforlines = 1;
try {
$listlinestaskres = $odfHandler->setSegment('tasksressources');
} catch (OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template
$foundtagforlines = 0;
dol_syslog($e->getMessage(), LOG_INFO);
}
if ($foundtagforlines && (is_array($contact_arrray) && count($contact_arrray) > 0)) {
foreach ($contact_arrray as $contact) {
if ($contact['source'] == 'internal') {
$objectdetail = new User($this->db);
@@ -644,8 +649,6 @@ class doc_generic_task_odt extends ModelePDFTask
foreach ($tmparray as $key => $val) {
try {
$listlinestaskres->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
@@ -655,6 +658,16 @@ class doc_generic_task_odt extends ModelePDFTask
$odfHandler->mergeSegment($listlinestaskres);
}
// Check for segment
$foundtagforlines = 1;
try {
$listlinestasktime = $odfHandler->setSegment('taskstimes');
} catch (OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template
$foundtagforlines = 0;
dol_syslog($e->getMessage(), LOG_INFO);
}
// Time resources
$sql = "SELECT t.rowid, t.element_date as task_date, t.element_duration as task_duration, t.fk_user, t.note";
$sql .= ", u.lastname, u.firstname";
@@ -666,17 +679,17 @@ class doc_generic_task_odt extends ModelePDFTask
$sql .= " ORDER BY t.element_date DESC";
$resql = $this->db->query($sql);
if ($resql) {
if ($foundtagforlines && $resql) {
$num = $this->db->num_rows($resql);
$i = 0;
$tasks = array();
$listlinestasktime = $odfHandler->setSegment('taskstimes');
while ($i < $num) {
$row = $this->db->fetch_array($resql);
if (!empty($row['fk_user'])) {
$objectdetail = new User($this->db);
$objectdetail->fetch($row['fk_user']);
// TODO Use a cache to aoid fetch for same user
// TODO Use a cache to avoid fetch for same user
$row['fullcivname'] = $objectdetail->getFullName($outputlangs, 1);
} else {
$row['fullcivname'] = '';
@@ -687,8 +700,6 @@ class doc_generic_task_odt extends ModelePDFTask
foreach ($tmparray as $key => $val) {
try {
$listlinestasktime->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
@@ -703,29 +714,35 @@ class doc_generic_task_odt extends ModelePDFTask
// Replace tags of project files
$listtasksfiles = $odfHandler->setSegment('tasksfiles');
$upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
foreach ($filearray as $filedetail) {
$tmparray = $this->get_substitutionarray_task_file($filedetail, $outputlangs);
//dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true));
foreach ($tmparray as $key => $val) {
try {
$listtasksfiles->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
}
$listtasksfiles->merge();
// Check for segment
$foundtagforlines = 1;
try {
$listtasksfiles = $odfHandler->setSegment('tasksfiles');
} catch (OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template
$foundtagforlines = 0;
dol_syslog($e->getMessage(), LOG_INFO);
}
//$listlines->merge();
if ($foundtagforlines) {
$upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
$odfHandler->mergeSegment($listtasksfiles);
foreach ($filearray as $filedetail) {
$tmparray = $this->get_substitutionarray_task_file($filedetail, $outputlangs);
//dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true));
foreach ($tmparray as $key => $val) {
try {
$listtasksfiles->setVars($key, $val, true, 'UTF-8');
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
}
$listtasksfiles->merge();
}
//$listlines->merge();
$odfHandler->mergeSegment($listtasksfiles);
}
} catch (OdfException $e) {
$this->error = $e->getMessage();
dol_syslog($this->error, LOG_WARNING);
@@ -733,35 +750,40 @@ class doc_generic_task_odt extends ModelePDFTask
}
// Replace tags of project files
// Check for segment
$foundtagforlines = 1;
try {
$listlines = $odfHandler->setSegment('projectfiles');
} catch (OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template
$foundtagforlines = 0;
dol_syslog($e->getMessage(), LOG_INFO);
}
if ($foundtagforlines) {
try {
$upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($object->ref);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
$upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($object->ref);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
foreach ($filearray as $filedetail) {
//dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true));
$tmparray = $this->get_substitutionarray_project_file($filedetail, $outputlangs);
foreach ($filearray as $filedetail) {
//dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true));
$tmparray = $this->get_substitutionarray_project_file($filedetail, $outputlangs);
foreach ($tmparray as $key => $val) {
try {
$listlines->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
foreach ($tmparray as $key => $val) {
try {
$listlines->setVars($key, $val, true, 'UTF-8');
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
}
$listlines->merge();
}
$listlines->merge();
$odfHandler->mergeSegment($listlines);
} catch (OdfException $e) {
$this->error = $e->getMessage();
dol_syslog($this->error, LOG_WARNING);
return -1;
}
$odfHandler->mergeSegment($listlines);
} catch (OdfException $e) {
$this->error = $e->getMessage();
dol_syslog($this->error, LOG_WARNING);
return -1;
}
// Replace tags of lines for contacts
@@ -773,10 +795,17 @@ class doc_generic_task_odt extends ModelePDFTask
$contact_arrray = array_merge($contact_arrray, $contact_temp);
}
}
if ((is_array($contact_arrray) && count($contact_arrray) > 0)) {
// Check for segment
$foundtagforlines = 1;
try {
$listlines = $odfHandler->setSegment('projectcontacts');
} catch (OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template
$foundtagforlines = 0;
dol_syslog($e->getMessage(), LOG_INFO);
}
if ($foundtagforlines && (is_array($contact_arrray) && count($contact_arrray) > 0)) {
try {
$listlines = $odfHandler->setSegment('projectcontacts');
foreach ($contact_arrray as $contact) {
if ($contact['source'] == 'internal') {
$objectdetail = new User($this->db);
@@ -797,8 +826,6 @@ class doc_generic_task_odt extends ModelePDFTask
foreach ($tmparray as $key => $val) {
try {
$listlines->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}

View File

@@ -74,7 +74,7 @@ class pdf_cyan extends ModelePDFPropales
public $version = 'dolibarr';
/**
* @var array<string,array{rank:int,width:float|int,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of columns
* @var array<string,array{rank:int,width:float|int,status:bool,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document table columns
*/
public $cols;
@@ -2050,7 +2050,7 @@ class pdf_cyan extends ModelePDFPropales
$this->cols['totalincltax'] = array(
'rank' => $rank,
'width' => 26, // in mm
'status' => !(!getDolGlobalString('PDF_PROPAL_SHOW_PRICE_INCL_TAX')),
'status' => getDolGlobalBool('PDF_PROPAL_SHOW_PRICE_INCL_TAX'),
'title' => array(
'textkey' => 'TotalTTCShort'
),

View File

@@ -289,8 +289,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* @param DoliDB $db Database handler
* @param string $code Code to check/correct
* @param Societe $soc Object third party
* @param int $type 0 = customer/prospect , 1 = supplier
* @return int 0 if OK
* @param int<0,1> $type 0 = customer/prospect , 1 = supplier
* @return int<-6,0> 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed

View File

@@ -106,12 +106,14 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
* @param DoliDB $db Database handler
* @param string $code Code to check/correct
* @param Societe $soc Object third party
* @param int $type 0 = customer/prospect , 1 = supplier
* @return int 0 if OK
* @param int<0,1> $type 0 = customer/prospect , 1 = supplier
* @return int<-6,0> 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
* -5 NotConfigured - Setup empty so any value may be ok or not
* -6 Other (see this->error)
*/
public function verif($db, &$code, $soc, $type)
{

View File

@@ -151,12 +151,14 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
* @param DoliDB $db Database handler
* @param string $code Code to check/correct
* @param Societe $soc Object third party
* @param int $type 0 = customer/prospect , 1 = supplier
* @return int 0 if OK
* @param int<0,1> $type 0 = customer/prospect , 1 = supplier
* @return int<-6,0> 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
* -5 NotConfigured - Setup empty so any value may be ok or not
* -6 Other (see this->error)
*/
public function verif($db, &$code, $soc, $type)
{

View File

@@ -194,6 +194,23 @@ abstract class ModeleThirdPartyCode extends CommonNumRefGenerator
// phpcs:enable
return 0;
}
/**
* Check validity of code according to its rules
*
* @param DoliDB $db Database handler
* @param string $code Code to check/correct
* @param Societe $soc Object third party
* @param int<0,1> $type 0 = customer/prospect , 1 = supplier
* @return int<-6,0> 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
* -5 NotConfigured - Setup empty so any value may be ok or not
* -6 Other (see this->error)
*/
abstract public function verif($db, &$code, $soc, $type);
}

View File

@@ -6,6 +6,7 @@
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@@ -142,7 +143,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
$date = (empty($invoice->date) ? dol_now() : $invoice->date);
$pos_source = is_object($invoice) && $invoice->pos_source > 0 ? $invoice->pos_source : 0;
$mask = str_replace('{TN}', $pos_source, $mask);
$mask = str_replace('{TN}', (string) $pos_source, $mask);
$numFinal = get_next_value($db, $mask, 'facture', 'ref', '', $objsoc, $date, $mode, false, null, $entity);
return $numFinal;

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 +41,9 @@ if (empty($htmlname)) {
<!-- BEGIN PHP TEMPLATE formlayoutai.tpl.php -->
<?php
if (!isset($out)) {
$out = '';
}
// Add link to add layout
if ($showlinktolayout) {
$out .= '<a href="#" id="linkforlayouttemplates" class="reposition notasortlink inline-block alink marginrightonly">';

View File

@@ -106,6 +106,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (isModEnabled('invoice') && getDolGlobalString('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
'@phan-var-force Facture $object';
$newobject = new Facture($this->db);
$newobject->context['createfromorder'] = 'createfromorder';

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@@ -65,7 +66,7 @@ class DolLogsCollector extends MessagesCollector
/**
* Return widget settings
*
* @return array Array
* @return array<string,array{icon?:string,widget?:string,map:string,default:string}> Array
*/
public function getWidgets()
{
@@ -91,7 +92,7 @@ class DolLogsCollector extends MessagesCollector
/**
* Return collected data
*
* @return array Array of collected data
* @return array{count:int,messages:string[]} Array of collected data
*/
public function collect()
{
@@ -111,6 +112,7 @@ class DolLogsCollector extends MessagesCollector
foreach ($log_levels as $level_key => $level) {
if (strpos(strtolower($line), strtolower($level_key)) == 20) {
$this->nboflines++;
// Use parent method to add the message
$this->addMessage($line, $level, false);
}
}
@@ -155,9 +157,9 @@ class DolLogsCollector extends MessagesCollector
/**
* Get latest file lines
*
* @param string $file File
* @param int $lines Lines
* @return array Array
* @param string $file File
* @param int $lines Lines
* @return string[] Array
*/
protected function tailFile($file, $lines)
{
@@ -192,8 +194,8 @@ class DolLogsCollector extends MessagesCollector
/**
* Search a string for log entries into the log file. Used when debug bar scan log file (very slow).
*
* @param string $file File
* @return array Lines of logs
* @param string $file File
* @return list<array{level:string,line:string}> Lines of log entries
*/
public function getLogs($file)
{
@@ -218,10 +220,11 @@ class DolLogsCollector extends MessagesCollector
/**
* Get the log levels from psr/log.
*
* @return array Array of log level
* @return array<string,string> Array of log level
*/
public function getLevels()
{
// @phan-suppress-next-line PhanRedefinedClassReference // Psr/LogLevel also provided by Sabre setup
$class = new ReflectionClass(new LogLevel());
$levels = $class->getConstants();
$levels['ERR'] = 'error';

View File

@@ -113,7 +113,7 @@ function getDParameters($part)
*
* @param integer $jk Number of email
* @param object $mbox object connection imap
* @return array<array{type:string,filename:string,pos:int}> type, filename, pos
* @return array<array{type:int,filename:string,pos:int}> type, filename, pos
*/
function getAttachments($jk, $mbox)
{

View File

@@ -709,7 +709,7 @@ class Fichinter 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;
@@ -860,7 +860,7 @@ class Fichinter extends CommonObject
// Init/load array of translation of status
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs;
$langs->load("fichinter");
$langs->load("interventions");
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
@@ -890,7 +890,7 @@ class Fichinter extends CommonObject
{
global $conf, $langs;
$langs->load('fichinter');
$langs->load('interventions');
$datas = [];
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Intervention").'</u>';

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -195,7 +196,7 @@ if (isModEnabled('intervention')) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("DraftFichinter").'</th></tr>';
$langs->load("fichinter");
$langs->load("interventions");
$num = $db->num_rows($resql);
if ($num) {
$i = 0;

View File

@@ -1948,7 +1948,7 @@ class FactureFournisseur extends CommonInvoice
}
}
// Set new ref and define current statut
// Set new ref and define current status
if (!$error) {
$this->ref = $this->newref;
$this->statut = self::STATUS_VALIDATED;
@@ -3885,7 +3885,7 @@ class SupplierInvoiceLine extends CommonObjectLine
/**
* Percent of discount
* @var float
* @var float|string
*/
public $remise_percent;

View File

@@ -61,6 +61,7 @@ class ProductFournisseur extends Product
public $id;
/**
* @var string
* @deprecated
* @see $ref_supplier
*/
@@ -82,11 +83,12 @@ class ProductFournisseur extends Product
public $desc_supplier;
/**
* @var float The VAT rate by default for this {supplier, qty, product}. Can be set by get_buyprice().
* @var string The VAT rate by default for this {supplier, qty, product}. Can be set by get_buyprice().
*/
public $vatrate_supplier;
/**
* @var int
* @deprecated
* @see $product_id
*/
@@ -772,7 +774,7 @@ class ProductFournisseur extends Product
* @param int $limit Limit
* @param int $offset Offset
* @param int $socid Filter on a third party id
* @return array|int Array of ProductFournisseur with new properties to define supplier price
* @return ProductFournisseur[]|int<-1,-1> Array of ProductFournisseur with new properties to define supplier price
* @see find_min_price_product_fournisseur()
*/
public function list_product_fournisseur_price($prodid, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0, $socid = 0)

View File

@@ -560,7 +560,7 @@ if (empty($reshook)) {
$tva_tx = $datapriceofproduct['tva_tx'];
$tva_npr = $datapriceofproduct['tva_npr'];
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', (string) $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', (string) $prod->tva_tx));
// if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ?

View File

@@ -332,7 +332,7 @@ class Import
}
/**
* Save an export model in database
* Save an import model in database
*
* @param User $user Object user that save
* @return int Return integer <0 if KO, >0 if OK

View File

@@ -820,6 +820,7 @@ if ($step == 4 && $datatoimport) {
$fieldssource[$i]['example1'] = $langs->trans('Empty');
$i++;
}
$fieldssource[$i]['imported'] = 0;
}
$obj->import_close_file();
}
@@ -1085,20 +1086,22 @@ if ($step == 4 && $datatoimport) {
$optionsall = array();
foreach ($fieldstarget as $code => $line) {
//var_dump($line);
$tmparray = explode('|', $line["label"]); // If label of field is several translation keys separated with |
$labeltoshow = '';
foreach ($tmparray as $tmpkey => $tmpval) {
$labeltoshow .= ($labeltoshow ? ' '.$langs->trans('or').' ' : '').$langs->transnoentities($tmpval);
}
$optionsall[$code] = array('labelkey' => $line['label'], 'labelkeyarray' => $tmparray, 'label' => $labeltoshow, 'required' => (empty($line["required"]) ? 0 : 1), 'position' => !empty($line['position']) ? $line['position'] : 0);
// TODO Get type from a new array into module descriptor.
//$picto = 'email';
// $picto = 'email';
$picto = '';
if ($picto) {
$optionsall[$code]['picto'] = $picto;
}
$optionsall[$code] = array(
'labelkey' => $line['label'],
'labelkeyarray' => $tmparray,
'label' => $labeltoshow,
'required' => (empty($line["required"]) ? 0 : 1),
'position' => (!empty($line['position']) ? $line['position'] : 0),
'picto' => $picto,
);
}
// $optionsall is an array of all possible target fields. key=>array('label'=>..., 'xxx')
@@ -1137,9 +1140,6 @@ if ($step == 4 && $datatoimport) {
print '<td class="nowraponall hideonsmartphone" style="font-weight: normal">=> </td>';
print '<td class="nowraponall" style="font-weight: normal">';
//var_dump($_SESSION['dol_array_match_file_to_database_select']);
//var_dump($_SESSION['dol_array_match_file_to_database']);
$selectforline = '';
$selectforline .= '<select id="selectorderimport_'.($i + 1).'" class="targetselectchange minwidth300" name="select_'.($i + 1).'">';
if (!empty($line["imported"])) {

View File

@@ -485,6 +485,7 @@ if (isModEnabled('debugbar') && !GETPOST('dol_use_jmobile') && empty($_SESSION['
}
$conf->global->MAIN_HTML_HEADER .= $renderer->renderHead();
'@phan-var-force array{time:DebugBar\DataCollector\TimeDataCollector} $debugbar';
$debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)');
}
@@ -791,6 +792,8 @@ if (!defined('NOLOGIN')) {
// At the end of this phase, the variable $login is defined.
$resultFetchUser = '';
$test = true;
$dol_authmode = null;
if (!isset($_SESSION["dol_login"])) {
// It is not already authenticated and it requests the login / password
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
@@ -939,10 +942,8 @@ if (!defined('NOLOGIN')) {
$login = '';
}
$dol_authmode = '';
if ($login) {
$dol_authmode = $conf->authmode; // This properties is defined only when logged, to say what mode was successfully used
$dol_authmode = $conf->authmode; // This property is defined only when logged, to say what mode was successfully used
$dol_tz = empty($_POST["tz"]) ? (empty($_SESSION["tz"]) ? '' : $_SESSION["tz"]) : $_POST["tz"];
$dol_tz_string = empty($_POST["tz_string"]) ? (empty($_SESSION["tz_string"]) ? '' : $_SESSION["tz_string"]) : $_POST["tz_string"];
$dol_tz_string = preg_replace('/\s*\(.+\)$/', '', $dol_tz_string);
@@ -1019,7 +1020,7 @@ if (!defined('NOLOGIN')) {
exit;
}
$resultFetchUser = $user->fetch('', $login, '', 1, ($entitytotest > 0 ? $entitytotest : -1)); // value for $login was retrieved previously when checking password.
$resultFetchUser = $user->fetch(0, $login, '', 1, ($entitytotest > 0 ? $entitytotest : -1)); // value for $login was retrieved previously when checking password.
if ($resultFetchUser <= 0 || $user->isNotIntoValidityDateRange()) {
dol_syslog('User not found or not valid, connection refused');
session_destroy();
@@ -1088,7 +1089,7 @@ if (!defined('NOLOGIN')) {
$entity = isset($_SESSION["dol_entity"]) ? $_SESSION["dol_entity"] : 0;
dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG);
$resultFetchUser = $user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1));
$resultFetchUser = $user->fetch(0, $login, '', 1, ($entity > 0 ? $entity : -1));
//var_dump(dol_print_date($user->flagdelsessionsbefore, 'dayhour', 'gmt')." ".dol_print_date($_SESSION["dol_logindate"], 'dayhour', 'gmt'));
@@ -1142,7 +1143,7 @@ if (!defined('NOLOGIN')) {
// Hooks on failed login
$action = '';
$hookmanager->initHooks(array('login'));
$parameters = array('dol_authmode' => (isset($dol_authmode) ? $dol_authmode : ''), 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
$parameters = array('dol_authmode' => (string) $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
$reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$error++;
@@ -1538,6 +1539,7 @@ if (!defined('NOREQUIREMENU')) {
if (GETPOST('menu', 'alpha')) {
$file_menu = GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php
}
if (!class_exists('MenuManager')) {
$menufound = 0;
$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
@@ -1553,7 +1555,9 @@ if (!defined('NOREQUIREMENU')) {
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
}
}
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->loadMenu();
}
@@ -1580,14 +1584,15 @@ if (!function_exists("llxHeader")) {
* @param string $target Target to use on links
* @param int<0,1> $disablejs More content into html header
* @param int<0,1> $disablehead More content into html header
* @param array|string $arrayofjs Array of complementary js files
* @param array|string $arrayofcss Array of complementary css files
* @param string[]|string $arrayofjs Array of complementary js files
* @param string[]|string $arrayofcss Array of complementary css files
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
* @param string $morecssonbody More CSS on body tag. For example 'classforhorizontalscrolloftabs'.
* @param string $replacemainareaby Replace call to main_area() by a print of this string
* @param int $disablenofollow Disable the "nofollow" on meta robot header
* @param int $disablenoindex Disable the "noindex" on meta robot header
* @return void
* @phan-suppress PhanRedefineFunction (Also defined in htdocs/asterisk/wrapper)
*/
function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0)
{
@@ -1639,7 +1644,7 @@ if (!function_exists("llxHeader")) {
}
if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) {
left_menu(array(), $help_url, '', array(), 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function
left_menu('', $help_url, '', array(), 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function
}
// main area
@@ -2262,7 +2267,9 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
// Show menu entries
print '<div id="tmenu_tooltip'.(!getDolGlobalString('MAIN_MENU_INVERT') ? '' : 'invert').'" class="tmenu">'."\n";
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->atarget = $target;
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->showmenu('top', array('searchform' => $searchform)); // This contains a \n
print "</div>\n";
@@ -2556,7 +2563,8 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
if (!empty($user->admin)) {
$dropdownBody .= '<br><b>'.$langs->trans("Administrator").'</b>: '.yn($user->admin);
}
if (!empty($user->socid)) { // Add thirdparty for external users
$company = '';
if (!empty($user->socid)) { // Add third party for external users
$thirdpartystatic = new Societe($db);
$thirdpartystatic->fetch($user->socid);
$companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company
@@ -2576,6 +2584,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$dropdownBody .= '<br><b>'.$langs->trans("ConnectedSince").':</b> '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser');
$dropdownBody .= '<br><b>'.$langs->trans("PreviousConnexion").':</b> '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser');
$dropdownBody .= '<br><b>'.$langs->trans("CurrentTheme").':</b> '.$conf->theme;
// @phan-suppress-next-line PhanRedefinedClassReference
$dropdownBody .= '<br><b>'.$langs->trans("CurrentMenuManager").':</b> '.(isset($menumanager) ? $menumanager->name : 'unknown');
$langFlag = picto_from_langcode($langs->getDefaultLang());
$dropdownBody .= '<br><b>'.$langs->trans("CurrentUserLanguage").':</b> '.($langFlag ? $langFlag.' ' : '').$langs->getDefaultLang();
@@ -2662,6 +2671,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
'.$userDropDownImage.'
<p>
'.$profilName.'<br>';
$title = '';
if ($user->datelastlogin) {
$title = $langs->trans("ConnectedSince").' : '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser');
if ($user->datepreviouslogin) {
@@ -3141,6 +3151,7 @@ function top_menu_search()
$defaultAction = '';
$buttonList = '<div class="dropdown-global-search-button-list" >';
// Menu with all searchable items
// @phan-suppress-next-line PhanEmptyForeach // array is really empty
foreach ($arrayresult as $keyItem => $item) {
if (empty($defaultAction)) {
$defaultAction = $item['url'];
@@ -3280,12 +3291,12 @@ function top_menu_search()
/**
* Show left menu bar
*
* @param string $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprecated and must be provided to ''.
* @param '' $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprecated and must be provided to ''.
* @param string $helppagename Name of wiki page for help ('' by default).
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage
* For other external page: http://server/url
* @param string $notused Deprecated. Used in past to add content into left menu. Hooks can be used now.
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler
* @param int $leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules.
* @param string $title Title of web page
* @param int<0,1> $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
@@ -3340,6 +3351,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
$searchform .= $form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, 'accesskey="s"', 1, 0, (!getDolGlobalString('MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY') ? 1 : 0), 'vmenusearchselectcombo', 1, $textsearch, 1, $stringforfirstkey.' s');
} else {
if (is_array($arrayresult)) {
// @phan-suppress-next-line PhanEmptyForeach // array is really empty in else case.
foreach ($arrayresult as $key => $val) {
$searchform .= printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth125', 'search_all', (empty($val['shortcut']) ? '' : $val['shortcut']), 'searchleft'.$key, $val['img']);
}
@@ -3396,11 +3408,15 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
print '<div class="vmenu"'.(getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ' alt="Left menu"' : '').'>'."\n\n";
// Show left menu with other forms
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->menu_array = $menu_array_before;
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->menu_array_after = $menu_array_after;
if (getDolGlobalInt('MAIN_MENU_LEFT_DROPDOWN')) {
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->showmenu('leftdropdown', array('searchform' => $searchform)); // output menu_array and menu found in database
} else {
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->showmenu('left', array('searchform' => $searchform)); // output menu_array and menu found in database
}
@@ -3708,6 +3724,7 @@ if (!function_exists("llxFooter")) {
* @param string $zone 'private' (for private pages) or 'public' (for public pages)
* @param int $disabledoutputofmessages Clear all messages stored into session without displaying them
* @return void
* @phan-suppress PhanRedefineFunction // Also defined at asterisk/wrapper.php
*/
function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0)
{

View File

@@ -93,7 +93,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
public $emetteur;
/**
* @var array<string,array{rank:int,width:float|int,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of columns
* @var array<string,array{rank:int,width:float|int,status:bool,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document table columns
*/
public $cols;

View File

@@ -49,7 +49,7 @@ external documents stored in the *Appendices* directory accompanying this docume
*Log of versions*
[options="header",format="csv"]
|===
|===
Author, Date, Version
--- __USER_FULLNAME__ __USER_EMAIL__ ---, __YYYY-MM-DD__, Version 1.0
|===
@@ -64,13 +64,13 @@ Author, Date, Version
=== List of actors [[actors]]
Actors are physical people or moral entities working on at least one process.
The following chart prensts list of actors or partners identified by the project for the defined scope of project. We will use then the name defined into first column to speak about roles in the rest of documents.
The following chart presents a list of actors or partners identified by the project within it defined scope. We will use then the name defined into first column to speak about roles in the rest of documents.
[options="header",format="csv"]
|===
Actor/profil/role, Description of role, Access to system or not, Example of actor
Customer Service, Receive and create Sales orders (SO), Yes, Mr Smith
Purchase, Make puchase order (PO), Yes, 5 people
Purchase, Make purchase order (PO), Yes, 5 people
Administrator - IT, Administration of users/groups and IT services, Yes, John Doe
Automaton, Execute automatic data processing, Yes, NA
|===
@@ -79,7 +79,7 @@ Automaton, Execute automatic data processing, Yes, NA
=== Definitions [[definitions]]
To understand the descriptions of the target process, it was necessary to define or redefine some vocabulary concepts. We must see these definitions as defined in the
new system. Indeed, some terms are already being used but have either not a definition in line with standards, or even differs between services. To bring everyone,
new system. Indeed, some terms are already being used but have either not a definition in line with standards, or even differs between services. To bring everyone,
and to consolidate the process, these terms are redefined here, and with their definition in the target objective.
*Definition ABC*
@@ -134,5 +134,3 @@ _Each process/use case is described into a separate chapter._
* Business rule 1
* Business rule 2

View File

@@ -79,4 +79,4 @@ $PROXY_HOST = getDolGlobalString('MAIN_PROXY_HOST');
$PROXY_PORT = getDolGlobalString('MAIN_PROXY_PORT');
$PROXY_USER = getDolGlobalString('MAIN_PROXY_USER');
$PROXY_PASS = getDolGlobalString('MAIN_PROXY_PASS');
$USE_PROXY = !(!getDolGlobalString('MAIN_PROXY_USE'));
$USE_PROXY = getDolGlobalBool('MAIN_PROXY_USE');

View File

@@ -1972,7 +1972,7 @@ class Products extends DolibarrApi
*
* @param int $id ID of Product
* @param int $selected_warehouse_id ID of warehouse
* @return array
* @return array|mixed Data without useless information
*
* @throws RestException 500 System error
* @throws RestException 403
@@ -1995,6 +1995,7 @@ class Products extends DolibarrApi
$product_model->load_stock();
$stockData = $this->_cleanObjectDatas($product_model)->stock_warehouse;
if ($selected_warehouse_id) {
foreach ($stockData as $warehouse_id => $warehouse) {
if ($warehouse_id != $selected_warehouse_id) {
@@ -2002,8 +2003,10 @@ class Products extends DolibarrApi
}
}
}
$obj_ret = $this->_filterObjectProperties($this->_cleanObjectDatas($product_model), 'stock_warehouses,stock_reel,stock_theorique');
$obj_ret->stock_warehouses = $stockData;
return array('stock_warehouses'=>$stockData);
return $obj_ret;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
@@ -2155,7 +2158,7 @@ class Products extends DolibarrApi
$children[] = array_combine($keys, $values);
}
$this->product->sousprods = $children;
$this->product->sousprods = $children; // @phpstan-ignore-line
}
if ($includeparentid) {

View File

@@ -104,9 +104,14 @@ class Product extends CommonObject
*/
protected $table_ref_field = 'ref';
public $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into images.lib.php
/**
* @var string
* @see images.lib.php
*/
public $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm';
/**
* @var string
* @deprecated Use $label instead
* @see $label
*/
@@ -147,6 +152,9 @@ class Product extends CommonObject
*/
public $price;
/**
* @var string
*/
public $price_formated; // used by takepos/ajax/ajax.php
/**
@@ -156,6 +164,9 @@ class Product extends CommonObject
*/
public $price_ttc;
/**
* @var string
*/
public $price_ttc_formated; // used by takepos/ajax/ajax.php
/**
@@ -177,22 +188,64 @@ class Product extends CommonObject
* @var string
*/
public $price_base_type;
/**
* @var string
*/
public $price_label;
//! Arrays for multiprices
/**
* @var array<int,string>
*/
public $multiprices = array();
/**
* @var array<int,string>
*/
public $multiprices_ttc = array();
/**
* @var array<int,string>
*/
public $multiprices_base_type = array();
/**
* @var array<int,string>
*/
public $multiprices_default_vat_code = array();
/**
* @var array<int,string>
*/
public $multiprices_min = array();
/**
* @var array<int,string>
*/
public $multiprices_min_ttc = array();
/**
* @var array<int,null|int|float|string>
*/
public $multiprices_tva_tx = array();
/**
* @var array<int,int>
*/
public $multiprices_recuperableonly = array();
/**
* @var array<int,string>
*/
//! Price by quantity arrays
/**
* @var int<0,0>|float
*/
public $price_by_qty;
/**
* @var array<int,float>
*/
public $prices_by_qty = array();
/**
* @var array<int,float>
*/
public $prices_by_qty_id = array();
/**
* @var array<int,array<array{rowid:int,price_base_type:string,unitprice:string}>>
*/
public $prices_by_qty_list = array();
/**
@@ -200,13 +253,19 @@ class Product extends CommonObject
*/
public $level;
//! Array for multilangs
/**
* @var ?array<string,array{label:string,description:string,note?:string}> Array for multilangs
*/
public $multilangs = array();
//! Default VAT code for product (link to code into llx_c_tva but without foreign keys)
/**
* @var string Default VAT code for product (link to code into llx_c_tva but without foreign keys)
*/
public $default_vat_code;
//! Default VAT rate of product
/**
* @var string|int Default VAT rate of product
*/
public $tva_tx;
/**
@@ -214,25 +273,65 @@ class Product extends CommonObject
*/
public $tva_npr = 0;
//! Default discount percent
/**
* @var string Default discount percent
*/
public $remise_percent;
//! Other local taxes
/**
* @var string|int|float Other local taxes
*/
public $localtax1_tx;
/**
* @var string|int|float
*/
public $localtax2_tx;
/**
* @var string
*/
public $localtax1_type;
/**
* @var string
*/
public $localtax2_type;
// Properties set by get_buyprice() for return
/**
* @var string
*/
public $desc_supplier;
/**
* @var string
*/
public $vatrate_supplier;
/**
* @var string
*/
public $default_vat_code_supplier;
/**
* @var string|int
*/
public $fourn_multicurrency_price;
/**
* @var string|int
*/
public $fourn_multicurrency_unitprice;
/**
* @var string|int
*/
public $fourn_multicurrency_tx;
/**
* @var string
*/
public $fourn_multicurrency_id;
/**
* @var string
*/
public $fourn_multicurrency_code;
/**
* @var float
*/
public $packaging;
@@ -273,7 +372,9 @@ class Product extends CommonObject
*/
public $cost_price;
//! Average price value for product entry into stock (PMP)
/**
* @var float Average price value for product entry in stock (PMP)
*/
public $pmp;
/**
@@ -284,20 +385,20 @@ class Product extends CommonObject
public $seuil_stock_alerte = 0;
/**
* Ask for replenishment when $desiredstock < $stock_reel
* @var float Ask for replenishment when $desiredstock < $stock_reel
*/
public $desiredstock = 0;
/**
* Service expiration
* @var ?int Service expiration
*/
public $duration_value;
/**
* Service expiration unit
* @var string Service expiration unit
*/
public $duration_unit;
/**
* Service expiration label (value + unit)
* @var string Service expiration label (value + unit)
*/
public $duration;
@@ -407,28 +508,88 @@ class Product extends CommonObject
*/
public $url;
//! Metric of products
//! Metrics of products
/**
* @var float|string
*/
public $weight;
/**
* @var int|string
*/
public $weight_units; // scale -3, 0, 3, 6
/**
* @var float|string
*/
public $length;
/**
* @var int|string
*/
public $length_units; // scale -3, 0, 3, 6
/**
* @var float|string
*/
public $width;
/**
* @var int|string
*/
public $width_units; // scale -3, 0, 3, 6
/**
* @var float|string|null
*/
public $height;
/**
* @var int|string|null
*/
public $height_units; // scale -3, 0, 3, 6
/**
* @var float|string|null
*/
public $surface;
/**
* @var int|string|null
*/
public $surface_units; // scale -3, 0, 3, 6
/**
* @var float|string|null
*/
public $volume;
/**
* @var int|string|null
*/
public $volume_units; // scale -3, 0, 3, 6
/**
* @var float|string|null
*/
public $net_measure;
/**
* @var ?string
*/
public $net_measure_units; // scale -3, 0, 3, 6
/**
* @var string
*/
public $accountancy_code_sell;
/**
* @var string
*/
public $accountancy_code_sell_intra;
/**
* @var string
*/
public $accountancy_code_sell_export;
/**
* @var string
*/
public $accountancy_code_buy;
/**
* @var string
*/
public $accountancy_code_buy_intra;
/**
* @var string
*/
public $accountancy_code_buy_export;
/**
@@ -461,8 +622,13 @@ class Product extends CommonObject
public $stats_facturerec = array();
public $stats_facture_fournisseur = array();
//! Size of image
/**
* @var int|string Size of image / height
*/
public $imgWidth;
/**
* @var int|string Size of image / height
*/
public $imgHeight;
/**
@@ -520,6 +686,7 @@ class Product extends CommonObject
public $fourn_socid;
/**
* @var string
* @deprecated
* @see $ref_supplier
*/
@@ -547,19 +714,19 @@ class Product extends CommonObject
/**
* Array with list of supplier prices of product
*
* @var array
* @var ProductFournisseur[]
*/
public $supplierprices;
/**
* Array with list of sub-products for Kits
*
* @var array
* @var array<string,array<int,array{0:int,1:float,2:int,3:string,4:int,5:string}>>
*/
public $sousprods;
/**
* @var array Path of subproducts. Build from ->sousprods with get_arbo_each_prod()
* @var array<int,array{id:int,id_parent:int,ref:string,nb:int,nb_total:int,stock:float,stock_alert:float,label:string,fullpath:string,type:int,desiredstick:float,level:int,incdec:int<0,1>,entity:CommonObject}> Path of subproducts. Build from ->sousprods with get_arbo_each_prod()
*/
public $res;
@@ -594,6 +761,9 @@ class Product extends CommonObject
*/
public $is_sousproduit_incdec;
/**
* @var int
*/
public $mandatory_period;
@@ -623,7 +793,7 @@ class Product extends CommonObject
*/
/**
* @var array<string,array{type:string,label:string,enabled:int<0,2>|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<int,string>,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,array{type:string,label:string,enabled:int<0,2>|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<int,string>,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' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'),
@@ -1141,19 +1311,19 @@ class Product extends CommonObject
$this->note_private = (isset($this->note_private) ? trim($this->note_private) : null);
$this->note_public = (isset($this->note_public) ? trim($this->note_public) : null);
$this->net_measure = price2num($this->net_measure);
$this->net_measure_units = (empty($this->net_measure_units) ? '' : trim($this->net_measure_units));
$this->net_measure_units = (empty($this->net_measure_units) ? '' : trim((string) $this->net_measure_units));
$this->weight = price2num($this->weight);
$this->weight_units = (empty($this->weight_units) ? '' : trim($this->weight_units));
$this->weight_units = (empty($this->weight_units) ? '' : trim((string) $this->weight_units));
$this->length = price2num($this->length);
$this->length_units = (empty($this->length_units) ? '' : trim($this->length_units));
$this->length_units = (empty($this->length_units) ? '' : trim((string) $this->length_units));
$this->width = price2num($this->width);
$this->width_units = (empty($this->width_units) ? '' : trim($this->width_units));
$this->width_units = (empty($this->width_units) ? '' : trim((string) $this->width_units));
$this->height = price2num($this->height);
$this->height_units = (empty($this->height_units) ? '' : trim($this->height_units));
$this->height_units = (empty($this->height_units) ? '' : trim((string) $this->height_units));
$this->surface = price2num($this->surface);
$this->surface_units = (empty($this->surface_units) ? '' : trim($this->surface_units));
$this->surface_units = (empty($this->surface_units) ? '' : trim((string) $this->surface_units));
$this->volume = price2num($this->volume);
$this->volume_units = (empty($this->volume_units) ? '' : trim($this->volume_units));
$this->volume_units = (empty($this->volume_units) ? '' : trim((string) $this->volume_units));
// set unit not defined
if (is_numeric($this->length_units)) {
@@ -1699,7 +1869,7 @@ class Product extends CommonObject
/**
* Get sell or eat by mandatory list
*
* @return array Sell or eat by mandatory list
* @return array{0:string,1:string,2:string,3:string} Sell or eat by mandatory list
*/
public static function getSellOrEatByMandatoryList()
{
@@ -1782,7 +1952,7 @@ class Product extends CommonObject
return -1;
}
} elseif (isset($this->multilangs[$key])) {
if (empty($this->multilangs["$key"]["label"])) {
if (empty($this->multilangs[$key]["label"])) {
$this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
return -1;
}
@@ -1974,7 +2144,7 @@ class Product extends CommonObject
* used to check if price have really change to avoid log pollution
*
* @param int $level price level to change
* @return array
* @return array{level:int,multiprices:float,multiprices_ttc:float,multiprices_base_type:string,multiprices_min:float,multiprices_min_ttc:float,multiprices_tva_tx:float,multiprices_recuperableonly:float}|array{}
*/
private function getArrayForPriceCompare($level = 0)
{
@@ -2048,9 +2218,9 @@ class Product extends CommonObject
/**
* Delete a price line
*
* @param User $user Object user
* @param int $rowid Line id to delete
* @return int Return integer <0 if KO, >0 if OK
* @param User $user Object user
* @param int $rowid Line id to delete
* @return int Return integer <0 if KO, >0 if OK
*/
public function log_price_delete($user, $rowid)
{
@@ -2077,7 +2247,7 @@ class Product extends CommonObject
* @param Societe $thirdparty_seller Seller
* @param Societe $thirdparty_buyer Buyer
* @param int $pqp Id of product price per quantity if a selection was done of such a price
* @return array Array of price information array('pu_ht'=> , 'pu_ttc'=> , 'tva_tx'=>'X.Y (code)', ...), 'tva_npr'=>0, ...)
* @return array{pu_ht:float|int|string,pu_ttc:float|int|string,price_min:float|int|string,price_base_type:string,tva_tx:float|string|null|int,tva_npr:float|int}
* @see get_buyprice(), find_min_price_product_fournisseur()
*/
public function getSellPrice($thirdparty_seller, $thirdparty_buyer, $pqp = 0)
@@ -2195,12 +2365,12 @@ class Product extends CommonObject
* We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref.
* This also set some properties on product like ->buyprice, ->fourn_pu, ...
*
* @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price
* @param double $qty Quantity asked or -1 to get first entry found
* @param int $product_id Filter on a particular product id
* @param string $fourn_ref Filter on a supplier price ref. 'none' to exclude ref in search.
* @param int $fk_soc If of supplier
* @return int|string Return integer <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...), or printable result of hook
* @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price
* @param float|int<-1,-1> $qty Quantity asked or -1 to get first entry found
* @param int $product_id Filter on a particular product id
* @param string $fourn_ref Filter on a supplier price ref. 'none' to exclude ref in search.
* @param int $fk_soc If of supplier
* @return int|string|mixed[] Return integer <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...), or printable result of hook
* @see getSellPrice(), find_min_price_product_fournisseur()
*/
public function get_buyprice($prodfournprice, $qty, $product_id = 0, $fourn_ref = '', $fk_soc = 0)
@@ -2362,20 +2532,20 @@ class Product extends CommonObject
/**
* Modify customer price of a product/Service for a given level
*
* @param double $newprice New price
* @param string $newpricebase HT or TTC
* @param User $user Object user that make change
* @param ?double $newvat New VAT Rate (For example 8.5. Should not be a string)
* @param double|int $newminprice New price min
* @param int $level 0=standard, >0 = level if multilevel prices
* @param int $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT
* @param int $newpbq 1 if it has price by quantity
* @param int $ignore_autogen Used to avoid infinite loops
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @param string $newdefaultvatcode Default vat code
* @param string $price_label Price Label
* @param int $notrigger Disable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param double $newprice New price
* @param string $newpricebase HT or TTC
* @param User $user Object user that make change
* @param ?float $newvat New VAT Rate (For example 8.5. Should not be a string)
* @param float|int $newminprice New price min
* @param int $level 0=standard, >0 = level if multilevel prices
* @param int<0,1> $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT
* @param int<0,1> $newpbq 1 if it has price by quantity
* @param int<0,1> $ignore_autogen Used to avoid infinite loops
* @param 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} $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @param string $newdefaultvatcode Default vat code
* @param string $price_label Price Label
* @param int $notrigger Disable triggers
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function updatePrice($newprice, $newpricebase, $user, $newvat = null, $newminprice = 0, $level = 0, $newnpr = 0, $newpbq = 0, $ignore_autogen = 0, $localtaxes_array = array(), $newdefaultvatcode = '', $price_label = '', $notrigger = 0)
{
@@ -2401,6 +2571,9 @@ class Product extends CommonObject
$newvat = $this->tva_tx;
}
$localtaxtype1 = '';
$localtaxtype2 = '';
// If multiprices are enabled, then we check if the current product is subject to price autogeneration
// Price will be modified ONLY when the first one is the one that is being modified
if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !$ignore_autogen && $this->price_autogen && ($level == 1)) {
@@ -2442,7 +2615,6 @@ class Product extends CommonObject
}
}
//print 'x'.$id.'-'.$newprice.'-'.$newpricebase.'-'.$price.'-'.$price_ttc.'-'.$price_min.'-'.$price_min_ttc;
if (count($localtaxes_array) > 0) {
$localtaxtype1 = $localtaxes_array['0'];
$localtax1 = $localtaxes_array['1'];
@@ -3880,8 +4052,8 @@ class Product extends CommonObject
/**
* Charge tableau des stats facture recurrentes pour le produit/service
*
* @param int $socid Id societe
* @return int Array of stats in $this->stats_facture, <0 if ko or >0 if ok
* @param int $socid Id societe
* @return int Array of stats in $this->stats_facture, <0 if ko or >0 if ok
*/
public function load_stats_facturerec($socid = 0)
{
@@ -4007,10 +4179,10 @@ class Product extends CommonObject
/**
* Return an array formatted for showing graphs
*
* @param string $sql Request to execute
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $year Year (0=current year, -1=all years)
* @return array|int Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @param string $sql Request to execute
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $year Year (0=current year, -1=all years)
* @return array<int<0,11>,array<int,int|float>>|int<-1,-1> Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
private function _get_stats($sql, $mode, $year = 0)
{
@@ -4090,7 +4262,7 @@ class Product extends CommonObject
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @return array<int<0,11>,array<int,int|float>>|int<-1,-1> Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
public function get_nb_vente($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
@@ -4143,7 +4315,7 @@ class Product extends CommonObject
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @return array<int<0,11>,array<int,int|float>>|int<-1,-1> Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
public function get_nb_achat($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
@@ -4195,7 +4367,7 @@ class Product extends CommonObject
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @return array<int<0,11>,array<int,int|float>>|int<-1,-1> Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
public function get_nb_propal($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
@@ -4247,7 +4419,7 @@ class Product extends CommonObject
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @return array<int<0,11>,array<int,int|float>>|int<-1,-1> Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
public function get_nb_propalsupplier($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
@@ -4299,7 +4471,7 @@ class Product extends CommonObject
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @return array<int<0,11>,array<int,int|float>>|int<-1,-1> Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
public function get_nb_order($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
@@ -4346,12 +4518,12 @@ class Product extends CommonObject
/**
* Return nb of units in orders in which product is included
*
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array<int<0,11>,array<int,int|float>>|int<-1,-1> Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
public function get_nb_ordersupplier($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
@@ -4403,7 +4575,7 @@ class Product extends CommonObject
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @return array<int<0,11>,array<int,int|float>>|int<-1,-1> Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
public function get_nb_contract($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
@@ -4452,12 +4624,12 @@ class Product extends CommonObject
/**
* Return nb of units in orders in which product is included
*
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @param int $year Year (0=last 12 month, -1=all years)
* @param string $morefilter More sql filters
* @return array<int<0,11>,array<int,int|float>>|int<-1,-1> Return integer <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
public function get_nb_mos($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
@@ -4696,9 +4868,9 @@ class Product extends CommonObject
/**
* Check if it is a sub-product into a kit
*
* @param int $fk_parent Id of parent kit product
* @param int $fk_child Id of child product
* @return int Return 1 or 0; -1 if error
* @param int $fk_parent Id of parent kit product
* @param int $fk_child Id of child product
* @return int<-1,1> Return 1 or 0; -1 if error
*/
public function is_sousproduit($fk_parent, $fk_child)
{
@@ -4734,11 +4906,11 @@ class Product extends CommonObject
* Add a supplier price for the product.
* Note: Duplicate ref is accepted for different quantity only, or for different companies.
*
* @param User $user User that make link
* @param int $id_fourn Supplier id
* @param string $ref_fourn Supplier ref
* @param float $quantity Quantity minimum for price
* @return int Return integer < 0 if KO, 0 if link already exists for this product, > 0 if OK
* @param User $user User that make link
* @param int $id_fourn Supplier id
* @param string $ref_fourn Supplier ref
* @param float $quantity Quantity minimum for price
* @return int<-3,1> Return integer < 0 if KO, 0 if link already exists for this product, > 0 if OK
*/
public function add_fournisseur($user, $id_fourn, $ref_fourn, $quantity)
{
@@ -4834,7 +5006,7 @@ class Product extends CommonObject
/**
* Return list of suppliers providing the product or service
*
* @return array Array of vendor ids
* @return int[] Array of vendor ids
*/
public function list_suppliers()
{
@@ -5095,9 +5267,9 @@ class Product extends CommonObject
* Build the tree of subproducts and return it.
* this->sousprods must have been loaded by this->get_sousproduits_arbo()
*
* @param int $multiply Because each sublevel must be multiplicated by parent nb
* @param int $ignore_stock_load Ignore stock load
* @return array Array with tree
* @param int $multiply Because each sublevel must be multiplicated by parent nb
* @param int $ignore_stock_load Ignore stock load
* @return array<int,array{id:int,id_parent:int,ref:string,nb:int,nb_total:int,stock:float,stock_alert:float,label:string,fullpath:string,type:int,desiredstick:float,level:int,incdec:int<0,1>,entity:CommonObject}> Array with tree
*/
public function get_arbo_each_prod($multiply = 1, $ignore_stock_load = 0)
{
@@ -5238,11 +5410,11 @@ class Product extends CommonObject
/**
* Return children of product $id
*
* @param int $id Id of product to search children of
* @param int $firstlevelonly Return only direct child
* @param int $level Level of recursing call (start to 1)
* @param array $parents Array of all parents of $id
* @return array|int Return array(prodid=>array(0=prodid, 1=>qty, 2=>product type, 3=>label, 4=>incdec, 5=>product ref)
* @param int $id Id of product to search children of
* @param int $firstlevelonly Return only direct child
* @param int $level Level of recursing call (start to 1)
* @param int[] $parents Array of all parents of $id
* @return array<int,array{0:int,1:float,2:int,3:string,4:int,5:string}>|array{}|int<-1,-1> Return array(prodid=>array(0=prodid, 1=>qty, 2=>product type, 3=>label, 4=>incdec, 5=>product ref,6:int,7:int)
*/
public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array())
{
@@ -5327,15 +5499,16 @@ class Product extends CommonObject
$parent[$this->label][$keyChild] = $valueChild;
}
foreach ($parent as $key => $value) { // key=label, value is array of children
$this->sousprods[$key] = $value;
$this->sousprods[$key] = $value; // @phan-suppress-current-line PhanTypeMismatchProperty
}
}
/**
* getTooltipContentArray
* @param array $params params to construct tooltip data
*
* @param array<string,mixed> $params params to construct tooltip data
* @return array<string,string> Data to show in tooltip
* @since v18
* @return array
*/
public function getTooltipContentArray($params)
{
@@ -5731,18 +5904,18 @@ class Product extends CommonObject
/**
* Adjust stock in a warehouse for product
*
* @param User $user user asking change
* @param int $id_entrepot id of warehouse
* @param double $nbpiece nb of units (should be always positive, use $movement to decide if we add or remove)
* @param int $movement 0 = add, 1 = remove
* @param string $label Label of stock movement
* @param double $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed.
* @param string $inventorycode Inventory code
* @param string $origin_element Origin element type
* @param int $origin_id Origin id of element
* @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (useful only if product is a subproduct)
* @param Extrafields $extrafields Array of extrafields
* @return int Return integer <0 if KO, >0 if OK
* @param User $user user asking change
* @param int $id_entrepot id of warehouse
* @param float $nbpiece nb of units (should be always positive, use $movement to decide if we add or remove)
* @param int<0,1> $movement 0 = add, 1 = remove
* @param string $label Label of stock movement
* @param float $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed.
* @param string $inventorycode Inventory code
* @param string $origin_element Origin element type
* @param ?int $origin_id Origin id of element
* @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (useful only if product is a subproduct)
* @param ?ExtraFields $extrafields Array of extrafields
* @return int Return integer <0 if KO, >0 if OK
*/
public function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0, $extrafields = null)
{
@@ -5790,21 +5963,21 @@ class Product extends CommonObject
/**
* Adjust stock in a warehouse for product with batch number
*
* @param User $user user asking change
* @param int $id_entrepot id of warehouse
* @param double $nbpiece nb of units (should be always positive, use $movement to decide if we add or remove)
* @param int $movement 0 = add, 1 = remove
* @param string $label Label of stock movement
* @param double $price Price to use for stock eval
* @param int|string $dlc eat-by date
* @param int|string $dluo sell-by date
* @param string $lot Lot number
* @param string $inventorycode Inventory code
* @param string $origin_element Origin element type
* @param int $origin_id Origin id of element
* @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (useful only if product is a subproduct)
* @param Extrafields $extrafields Array of extrafields
* @param boolean $force_update_batch Force update batch
* @param User $user user asking change
* @param int $id_entrepot id of warehouse
* @param float $nbpiece nb of units (should be always positive, use $movement to decide if we add or remove)
* @param int<0,1> $movement 0 = add, 1 = remove
* @param string $label Label of stock movement
* @param float $price Price to use for stock eval
* @param int|string $dlc eat-by date
* @param int|string $dluo sell-by date
* @param string $lot Lot number
* @param string $inventorycode Inventory code
* @param string $origin_element Origin element type
* @param ?int $origin_id Origin id of element
* @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (useful only if product is a subproduct)
* @param ?ExtraFields $extrafields Array of extrafields
* @param boolean $force_update_batch Force update batch
* @return int Return integer <0 if KO, >0 if OK
*/
public function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $dlc = '', $dluo = '', $lot = '', $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0, $extrafields = null, $force_update_batch = false)
@@ -6061,9 +6234,9 @@ class Product extends CommonObject
/**
* Load existing information about a serial
*
* @param string $batch Lot/serial number
* @return array Array with record into product_batch
* @see load_stock(), load_virtual_stock()
* @param string $batch Lot/serial number
* @return array<array{batch:string,eatby:string,sellby:string,qty:float}> Array with record into product_batch
* @see load_stock(), load_virtual_stock()
*/
public function loadBatchInfo($batch)
{
@@ -6094,9 +6267,10 @@ class Product extends CommonObject
/**
* Move an uploaded file described into $file array into target directory $sdir.
*
* @param string $sdir Target directory
* @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...)
* @return int Return integer <0 if KO, >0 if OK
* @param string $sdir Target directory
* @param array{name:string,tmp_name:string} $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...)
* @return int Return integer <0 if KO, >0 if OK
*/
public function add_photo($sdir, $file)
{
@@ -6179,7 +6353,7 @@ class Product extends CommonObject
*
* @param string $dir Directory to scan
* @param int $nbmax Number maximum of photos (0=no maximum)
* @return array Array of photos
* @return array<array{photo:string,photo_vignette:string}> Array of photos
*/
public function liste_photos($dir, $nbmax = 0)
{
@@ -6400,7 +6574,7 @@ class Product extends CommonObject
}
$var = getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM');
$mod = new $var();
'@phan-var-force ModeleNumRefBarCode $module';
'@phan-var-force ModeleNumRefBarCode $mod';
$result = $mod->getNextValue($object, $type);
@@ -6709,9 +6883,9 @@ class Product extends CommonObject
/**
* 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{string,mixed} $arraydata Array of data
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '', $arraydata = null)
{
@@ -6773,7 +6947,7 @@ class Product extends CommonObject
/**
* Class to manage products or services.
* Do not use 'Service' as class name since it is already used by APIs.
* Do not use 'Service' as class name since it is already used by APIs (Note: in namespace Stripe\Service)
*/
class ProductService extends Product
{

View File

@@ -68,8 +68,8 @@ $cancel = GETPOST('cancel', 'alpha');
$id = GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha');
$stocklimit = (float) GETPOST('seuil_stock_alerte');
$desiredstock = GETPOST('desiredstock');
$stocklimit = GETPOSTFLOAT('seuil_stock_alerte');
$desiredstock = GETPOSTFLOAT('desiredstock');
$cancel = GETPOST('cancel', 'alpha');
$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid';
$d_eatby = dol_mktime(0, 0, 0, GETPOSTINT('eatbymonth'), GETPOSTINT('eatbyday'), GETPOSTINT('eatbyyear'));
@@ -175,11 +175,13 @@ if ($action == 'addlimitstockwarehouse' && $user->hasRight('produit', 'creer'))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("StockLimit")), null, 'errors');
$maj_ok = false;
}
if ($desiredstock == '') {
if ($desiredstock == '' || is_array($desiredstock)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DesiredStock")), null, 'errors');
$maj_ok = false;
}
$desiredstock = (float) $desiredstock;
if ($maj_ok) {
$pse = new ProductStockEntrepot($db);
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
@@ -195,7 +197,7 @@ if ($action == 'addlimitstockwarehouse' && $user->hasRight('produit', 'creer'))
$pse->fk_entrepot = GETPOSTINT('fk_entrepot');
$pse->fk_product = $id;
$pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
$pse->desiredstock = GETPOST('desiredstock');
$pse->desiredstock = GETPOSTFLOAT('desiredstock');
if ($pse->create($user) > 0) {
setEventMessages($langs->trans('ProductStockWarehouseCreated'), null, 'mesgs');
}

View File

@@ -7,6 +7,7 @@
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021 Antonin MARCHAL <antonin@letempledujeu.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 @@ if ($action == 'order' && GETPOST('valid')) {
$tva = $line->tva_tx / 100;
$line->total_tva = $line->total_ht * $tva;
$line->total_ttc = $line->total_ht + $line->total_tva;
$line->remise_percent = $productsupplier->remise_percent;
$line->remise_percent = (float) $productsupplier->remise_percent;
$line->ref_fourn = $productsupplier->ref_supplier;
$line->type = $productsupplier->type;
$line->fk_unit = $productsupplier->fk_unit;
@@ -243,7 +244,7 @@ if ($action == 'order' && GETPOST('valid')) {
foreach ($supplier['lines'] as $line) {
if (empty($line->remise_percent)) {
$line->remise_percent = $order->thirdparty->remise_supplier_percent;
$line->remise_percent = (float) $order->thirdparty->remise_supplier_percent;
}
$result = $order->addline(
$line->desc,
@@ -285,12 +286,12 @@ if ($action == 'order' && GETPOST('valid')) {
foreach ($supplier['lines'] as $line) {
if (empty($line->remise_percent)) {
$line->remise_percent = $order->thirdparty->remise_supplier_percent;
$line->remise_percent = (float) $order->thirdparty->remise_supplier_percent;
}
$order->lines[] = $line;
}
$order->cond_reglement_id = $order->thirdparty->cond_reglement_supplier_id;
$order->mode_reglement_id = $order->thirdparty->mode_reglement_supplier_id;
$order->cond_reglement_id = (int) $order->thirdparty->cond_reglement_supplier_id;
$order->mode_reglement_id = (int) $order->thirdparty->mode_reglement_supplier_id;
$id = $order->create($user);
if ($id < 0) {

View File

@@ -2224,7 +2224,7 @@ class Project extends CommonObject
$obj = $this->db->fetch_object($resql);
if (!empty($obj->element_date)) {
$date = explode('-', $obj->element_date);
$week_number = getWeekNumber($date[2], $date[1], $date[0]);
$week_number = getWeekNumber((int) $date[2], (int) $date[1], (int) $date[0]);
}
'@phan-var-force int $week_number'; // Needed because phan considers it might be null
if (empty($weekalreadyfound[$week_number])) {

View File

@@ -910,7 +910,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
$linktotasks .= dolGetButtonTitle($langs->trans('ViewGantt'), '', 'fa fa-stream imgforviewmode', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1', '', 1, array('morecss' => 'reposition marginleftonly'));
//print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'generic', 0, '', '', 0, 1);
print load_fiche_titre($title, $linktotasks.' &nbsp; '.$linktocreatetask, 'projecttask', '', '', '', $massactionbutton);
print load_fiche_titre($title, $linktotasks.' &nbsp; '.$linktocreatetask, 'projecttask', 0, '', '', $massactionbutton);
$objecttmp = new Task($db);
$trackid = 'task'.$taskstatic->id;

View File

@@ -497,7 +497,7 @@ if ($source == 'proposal') {
} elseif ($source == 'fichinter') {
// Signature on fichinter
$found = true;
$langs->load("fichinter");
$langs->load("interventions");
$result = $object->fetch_thirdparty($object->socid);
@@ -602,7 +602,7 @@ if ($source == 'proposal') {
} elseif ($source == 'expedition') {
// Signature on expedition
$found = true;
$langs->load("fichinter");
$langs->load("interventions");
$result = $object->fetch_thirdparty($object->socid);

View File

@@ -1,5 +1,22 @@
<!-- file menu.tpl.php -->
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
// Protection to avoid direct call of template
if (empty($context) || !is_object($context)) {
print "Error, template page can't be called as URL";
@@ -140,7 +157,7 @@ if (empty($reshook)) {
// apply rank
if (!empty($navGroupMenu[$goupId]['rank']) && $navGroupMenu[$goupId]['rank'] > 0) {
// minimum rank of group determine rank of group
$navGroupMenu[$goupId]['rank'] = min(abs($navGroupMenu[$goupId]['rank']), abs($menuItem['rank']));
$navGroupMenu[$goupId]['rank'] = min(abs($navGroupMenu[$goupId]['rank']), abs($menuItem['rank'])); // @phpstan-ignore-line
}
}
}

View File

@@ -108,7 +108,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
public $defaultTitlesFieldsStyle = array();
/**
* @var array<string,array{rank:int,width:float|int,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document tablecolumns
* @var array<string,array{rank:int,width:float|int,status:bool,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of document table columns
*/
public $cols = array();

View File

@@ -1213,7 +1213,7 @@ class Thirdparties extends DolibarrApi
$exists_sql .= " AND fk_contact = '".$this->db->escape($contact_id)."'";
$exists_result = $this->db->query($exists_sql);
if ($this->db->num_rows($exists_sql) > 0) {
if ($this->db->num_rows($exists_result) > 0) {
throw new RestException(403, 'Notification already exists');
}
@@ -1235,6 +1235,7 @@ class Thirdparties extends DolibarrApi
* @param array $request_data Request data
*
* @return array|mixed Notification of thirdparty
* @phan-return Notify
*
* @url POST {id}/notificationsbycode/{code}
*/
@@ -1279,7 +1280,7 @@ class Thirdparties extends DolibarrApi
$exists_sql .= " AND fk_contact = '".$this->db->escape($contact_id)."'";
$exists_result = $this->db->query($exists_sql);
if ($this->db->num_rows($exists_sql) > 0) {
if ($this->db->num_rows($exists_result) > 0) {
throw new RestException(403, 'Notification already exists');
}

View File

@@ -129,7 +129,7 @@ class Societe extends CommonObject
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* @var integer
* @var int<0,1>
*/
public $restrictiononfksoc = 1;
@@ -140,7 +140,7 @@ class Societe extends CommonObject
/**
* array of supplier categories
* @var array
* @var string[]
*/
public $SupplierCategories = array();
@@ -511,14 +511,26 @@ class Societe extends CommonObject
public $tva_intra;
/**
* @var int Vat reverse-charge concerned
* @var int<0,1> Vat reverse-charge concerned
*/
public $vat_reverse_charge = 0;
// Local taxes
/**
* @var int
*/
public $localtax1_assuj;
/**
* @var string
*/
public $localtax1_value;
/**
* @var int
*/
public $localtax2_assuj;
/**
* @var string
*/
public $localtax2_value;
/**
@@ -535,20 +547,60 @@ class Societe extends CommonObject
* @var int Type thirdparty
*/
public $typent_id = 0;
/**
* @var string
*/
public $typent_code;
/**
* @var int
*/
public $effectif;
/**
* @var int
*/
public $effectif_id = 0;
public $forme_juridique_code;
public $forme_juridique = 0;
/**
* @var int
*/
public $forme_juridique_code = 0;
/**
* @var string Label for Legal Form (of company)
* @see CommonDocGenerator::get_substitutionarray_mysoc()
*/
public $forme_juridique;
/**
* @var string
*/
public $remise_percent;
/**
* @var string
*/
public $remise_supplier_percent;
/**
* @var int
*/
public $mode_reglement_id;
/**
* @var int
*/
public $cond_reglement_id;
/**
* @var string|float
*/
public $deposit_percent;
/**
* @var int
*/
public $mode_reglement_supplier_id;
/**
* @var int
*/
public $cond_reglement_supplier_id;
/**
* @var int
*/
public $transport_mode_supplier_id;
/**
@@ -1084,11 +1136,11 @@ class Societe extends CommonObject
/**
* Create a contact/address from thirdparty
*
* @param User $user Object user
* @param int $no_email 1=Do not send mailing, 0=Ok to receive mailing
* @param array $tags Array of tag to affect to contact
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int Return integer <0 if KO, >0 if OK
* @param User $user Object user
* @param int<0,1> $no_email 1=Do not send mailing, 0=Ok to receive mailing
* @param string[] $tags Array of tag to affect to contact
* @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function create_individual(User $user, $no_email = 0, $tags = array(), $notrigger = 0)
{
@@ -1401,16 +1453,16 @@ class Societe extends CommonObject
}
// Local taxes
$this->localtax1_assuj = trim($this->localtax1_assuj);
$this->localtax2_assuj = trim($this->localtax2_assuj);
$this->localtax1_assuj = (int) trim((string) $this->localtax1_assuj);
$this->localtax2_assuj = (int) trim((string) $this->localtax2_assuj);
$this->localtax1_value = trim($this->localtax1_value);
$this->localtax2_value = trim($this->localtax2_value);
$this->capital = ($this->capital != '') ? (float) price2num(trim((string) $this->capital)) : null;
$this->effectif_id = trim((string) $this->effectif_id);
$this->forme_juridique_code = trim((string) $this->forme_juridique_code);
$this->effectif_id = (int) trim((string) $this->effectif_id);
$this->forme_juridique_code = (int) trim((string) $this->forme_juridique_code);
//Gencod
$this->barcode = trim($this->barcode);
@@ -2151,6 +2203,7 @@ class Societe extends CommonObject
$columnName = $deleteFromObject[2];
if (dol_include_once($filepath)) {
$child_object = new $className($this->db);
'@phan-var-force CommonObject $child_object';
$result = $child_object->deleteByParentField($id, $columnName);
if ($result < 0) {
$error++;
@@ -2701,9 +2754,9 @@ class Societe extends CommonObject
/**
* getTooltipContentArray
*
* @param array $params params to construct tooltip data
* @param array<string,mixed> $params params to construct tooltip data
* @return array<string,string> Data to show in tooltip
* @since v18
* @return array
*/
public function getTooltipContentArray($params)
{
@@ -2727,11 +2780,11 @@ class Societe extends CommonObject
$photo .= Form::showphoto('societe', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
$photo .= '</div>';
$datas['photo'] = $photo;
} elseif (!empty($this->logo_squarred) && class_exists('Form')) {
/*$label.= '<div class="photointooltip">';
$label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
$label.= '</div><div style="clear: both;"></div>';*/
}
} //elseif (!empty($this->logo_squarred) && class_exists('Form')) {
/*$label.= '<div class="photointooltip">';
$label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
$label.= '</div><div style="clear: both;"></div>';*/
// }
$datas['divopen'] = '<div class="centpercent">';
@@ -3049,10 +3102,10 @@ class Societe extends CommonObject
/**
* Return label of status (activity, closed)
* Return label of status (activity, closed)
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@@ -3063,8 +3116,8 @@ class Societe extends CommonObject
/**
* Return the label of a given status
*
* @param int $status Status id
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @param int $status Status id
* @param int<0,6> $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Status label
*/
public function LibStatut($status, $mode = 0)
@@ -3090,10 +3143,10 @@ class Societe extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of contacts emails existing for third party
* Return list of contacts emails existing for third party
*
* @param int $addthirdparty 1=Add also a record for thirdparty email, 2=Same than 1 but add text ThirdParty in grey
* @return array Array of contacts emails
* @param int<0,2> $addthirdparty 1=Add also a record for thirdparty email, 2=Same than 1 but add text ThirdParty in grey
* @return array<'thirdparty'|int,string> Array of contact's emails
*/
public function thirdparty_and_contact_email_array($addthirdparty = 0)
{
@@ -3115,9 +3168,9 @@ class Societe extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of contacts mobile phone existing for third party
* Return list of contacts mobile phone existing for third party
*
* @return array Array of contacts emails
* @return array<'thirdparty'|int,string> Array of contacts mobile phone
*/
public function thirdparty_and_contact_phone_array()
{
@@ -3140,9 +3193,9 @@ class Societe extends CommonObject
/**
* Return list of contacts emails or mobile existing for third party
*
* @param string $mode 'email' or 'mobile'
* @param int $hidedisabled 1=Hide contact if disabled
* @return array Array of contacts emails or mobile. Example: array(id=>'Name <email>')
* @param 'email'|'mobile' $mode 'email' or 'mobile'
* @param int<0,1> $hidedisabled 1=Hide contact if disabled
* @return string[] Array of contacts emails or mobile. Example: array(id=>'Name <email>')
*/
public function contact_property_array($mode = 'email', $hidedisabled = 0)
{
@@ -3208,9 +3261,9 @@ class Societe extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the contact list of this company
* Return the contact list of this company
*
* @return array array of contacts
* @return string[] $contacts array of contacts
*/
public function contact_array()
{
@@ -3237,9 +3290,9 @@ class Societe extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the contact list of this company
* Return the contact list of this company
*
* @return array $contacts array of contacts
* @return Contact[] $contacts array of contacts
*/
public function contact_array_objects()
{
@@ -3360,8 +3413,8 @@ class Societe extends CommonObject
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type='ban' AND fk_soc = ".((int) $this->id);
$result = $this->db->query($sql);
if (!$result) {
$this->error++;
$this->errors[] = $this->db->lasterror;
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
return 0;
} else {
$num_rows = $this->db->num_rows($result);
@@ -3402,6 +3455,7 @@ class Societe extends CommonObject
}
/** @var ModeleThirdPartyCode $mod */
$mod = new $module($this->db);
'@phan-var-force ModeleThirdPartyCode $mod';
$this->code_client = $mod->getNextValue($objsoc, $type);
$this->prefixCustomerIsRequired = $mod->prefixIsRequired;
@@ -3435,6 +3489,7 @@ class Societe extends CommonObject
}
/** @var ModeleThirdPartyCode $mod */
$mod = new $module($this->db);
'@phan-var-force ModeleThirdPartyCode $mod';
$this->code_fournisseur = $mod->getNextValue($objsoc, $type);
@@ -3465,6 +3520,7 @@ class Societe extends CommonObject
}
$mod = new $module($this->db);
'@phan-var-force ModeleThirdPartyCode $mod';
dol_syslog(get_class($this)."::codeclient_modifiable code_client=".$this->code_client." module=".$module);
if ($mod->code_modifiable_null && !$this->code_client) {
@@ -3505,6 +3561,7 @@ class Societe extends CommonObject
}
$mod = new $module($this->db);
'@phan-var-force ModeleThirdPartyCode $mod';
dol_syslog(get_class($this)."::codefournisseur_modifiable code_founisseur=".$this->code_fournisseur." module=".$module);
if ($mod->code_modifiable_null && !$this->code_fournisseur) {
@@ -3551,6 +3608,7 @@ class Societe extends CommonObject
}
$mod = new $module($this->db);
'@phan-var-force ModeleThirdPartyCode $mod';
dol_syslog(get_class($this)."::check_codeclient code_client=".$this->code_client." module=".$module);
$result = $mod->verif($this->db, $this->code_client, $this, 0);
@@ -3592,6 +3650,7 @@ class Societe extends CommonObject
}
$mod = new $module($this->db);
'@phan-var-force ModeleThirdPartyCode $mod';
dol_syslog(get_class($this)."::check_codefournisseur code_fournisseur=".$this->code_fournisseur." module=".$module);
$result = $mod->verif($this->db, $this->code_fournisseur, $this, 1);
@@ -3632,6 +3691,7 @@ class Societe extends CommonObject
if ($res) {
$mod = new $module();
'@phan-var-force ModeleAccountancyCode $mod';
// Set code count in $mod->code
$result = $mod->get_code($this->db, $this, $type);
@@ -3735,8 +3795,8 @@ class Societe extends CommonObject
* Get parents for company
*
* @param int $company_id ID of company to search parent
* @param array $parents List of companies ID found
* @return array
* @param int[] $parents List of companies ID found
* @return int[]
*/
public function getParentsForCompany($company_id, $parents = array())
{
@@ -3778,22 +3838,22 @@ class Societe extends CommonObject
switch ($idprof) {
case 1:
$ret = !(!getDolGlobalString('SOCIETE_IDPROF1_UNIQUE'));
$ret = getDolGlobalBool('SOCIETE_IDPROF1_UNIQUE');
break;
case 2:
$ret = !(!getDolGlobalString('SOCIETE_IDPROF2_UNIQUE'));
$ret = getDolGlobalBool('SOCIETE_IDPROF2_UNIQUE');
break;
case 3:
$ret = !(!getDolGlobalString('SOCIETE_IDPROF3_UNIQUE'));
$ret = getDolGlobalBool('SOCIETE_IDPROF3_UNIQUE');
break;
case 4:
$ret = !(!getDolGlobalString('SOCIETE_IDPROF4_UNIQUE'));
$ret = getDolGlobalBool('SOCIETE_IDPROF4_UNIQUE');
break;
case 5:
$ret = !(!getDolGlobalString('SOCIETE_IDPROF5_UNIQUE'));
$ret = getDolGlobalBool('SOCIETE_IDPROF5_UNIQUE');
break;
case 6:
$ret = !(!getDolGlobalString('SOCIETE_IDPROF6_UNIQUE'));
$ret = getDolGlobalBool('SOCIETE_IDPROF6_UNIQUE');
break;
default:
$ret = false;
@@ -4381,10 +4441,11 @@ class Societe extends CommonObject
//TODO This could be replicated for region but function `getRegion` didn't exist, so I didn't added it.
// We define state_id, state_code and state
$state_id = 0;
$state_code = $state_label = '';
$state_code = '';
$state_label = '';
if (getDolGlobalString('MAIN_INFO_SOCIETE_STATE')) {
$tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_STATE'));
$state_id = $tmp[0];
$state_id = (int) $tmp[0];
if (!empty($tmp[1])) { // If $conf->global->MAIN_INFO_SOCIETE_STATE is "id:code:label"
$state_code = $tmp[1];
$state_label = $tmp[2];
@@ -4444,7 +4505,7 @@ class Societe extends CommonObject
$this->tva_intra = getDolGlobalString('MAIN_INFO_TVAINTRA'); // VAT number, not necessarily INTRA.
$this->managers = getDolGlobalString('MAIN_INFO_SOCIETE_MANAGERS');
$this->capital = is_numeric(getDolGlobalString('MAIN_INFO_CAPITAL')) ? (float) price2num(getDolGlobalString('MAIN_INFO_CAPITAL')) : 0;
$this->forme_juridique_code = getDolGlobalString('MAIN_INFO_SOCIETE_FORME_JURIDIQUE');
$this->forme_juridique_code = getDolGlobalInt('MAIN_INFO_SOCIETE_FORME_JURIDIQUE');
$this->email = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
$this->default_lang = getDolGlobalString('MAIN_LANG_DEFAULT', 'auto');
$this->logo = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO');
@@ -4715,8 +4776,8 @@ class Societe extends CommonObject
/**
* Return amount of proposal not yet paid and total an dlist of all proposals
*
* @param string $mode 'customer' or 'supplier'
* @return array array('opened'=>Amount including tax that remains to pay, 'total_ht'=>Total amount without tax of all objects paid or not, 'total_ttc'=>Total amount including tax of all object paid or not)
* @param 'customer'|'supplier' $mode 'customer' or 'supplier'
* @return array{opened:float,total_ht:float,total_ttc:float}|array{} array('opened'=>Amount including tax that remains to pay, 'total_ht'=>Total amount without tax of all objects paid or not, 'total_ttc'=>Total amount including tax of all object paid or not)
*/
public function getOutstandingProposals($mode = 'customer')
{
@@ -4759,8 +4820,8 @@ class Societe extends CommonObject
/**
* Return amount of order not yet paid and total and list of all orders
*
* @param string $mode 'customer' or 'supplier'
* @return array array('opened'=>Amount including tax that remains to pay, 'total_ht'=>Total amount without tax of all objects paid or not, 'total_ttc'=>Total amount including tax of all object paid or not)
* @param 'customer'|'supplier' $mode 'customer' or 'supplier'
* @return array{opened:float,total_ht:float,total_ttc:float}|array{} array('opened'=>Amount including tax that remains to pay, 'total_ht'=>Total amount without tax of all objects paid or not, 'total_ttc'=>Total amount including tax of all object paid or not)
*/
public function getOutstandingOrders($mode = 'customer')
{
@@ -4802,9 +4863,9 @@ class Societe extends CommonObject
/**
* Return amount of bill not yet paid and total of all invoices
*
* @param string $mode 'customer' or 'supplier'
* @param int $late 0 => all invoice, 1=> only late
* @return array array('opened'=>Amount including tax that remains to pay, 'total_ht'=>Total amount without tax of all objects paid or not, 'total_ttc'=>Total amount including tax of all object paid or not)
* @param 'customer'|'supplier' $mode 'customer' or 'supplier'
* @param int<0,1> $late 0 => all invoice, 1=> only late
* @return array{opened:float,total_ht:float,total_ttc:float}|array{} array('opened'=>Amount including tax that remains to pay, 'total_ht'=>Total amount without tax of all objects paid or not, 'total_ttc'=>Total amount including tax of all object paid or not)
*/
public function getOutstandingBills($mode = 'customer', $late = 0)
{
@@ -4932,13 +4993,13 @@ class Societe extends CommonObject
/**
* Create a document onto disk according to template module.
*
* @param string $modele Generator to use. Caller must set it to obj->model_pdf.
* @param Translate $outputlangs object lang a utiliser pour traduction
* @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 string $modele Generator to use. Caller must set it to obj->model_pdf.
* @param Translate $outputlangs object lang a utiliser pour traduction
* @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<string,mixed> $moreparams Array to provide more information
* @return int Return integer <0 if KO, >0 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
@@ -5016,7 +5077,7 @@ class Societe extends CommonObject
*
* @param int[]|int $salesrep User ID or array of user IDs
* @param bool $onlyAdd Only add (no delete before)
* @return int Return integer <0 if KO, >0 if OK
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function setSalesRep($salesrep, $onlyAdd = false)
{
@@ -5195,11 +5256,11 @@ class Societe extends CommonObject
}
/**
* Return clickable link of object (with eventually picto)
* Return clickable link of object (with optional 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<string,mixed> $arraydata Array of data
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '', $arraydata = array())
{

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@@ -123,7 +124,7 @@ if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
}
$arrayofcss = array('/takepos/css/pos.css.php?a=xxx');
top_htmlhead($head, $title, 0, 0, '', $arrayofcss);
top_htmlhead($head, $title, 0, 0, array(), $arrayofcss);
?>
<body style="overflow: hidden">

View File

@@ -384,6 +384,8 @@ if (empty($reshook)) {
//$creditnote->remise_percent = $invoice->remise_percent;
$creditnote->create($user);
$fk_parent_line = 0; // Initialise
foreach ($invoice->lines as $line) {
// Extrafields
if (method_exists($line, 'fetch_optionals')) {

View File

@@ -72,7 +72,9 @@ if (empty($user->id) && !empty($_SESSION['dol_login'])) {
$user->loadRights();
// Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct.
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->loadMenu();
}
@@ -275,6 +277,7 @@ $colortexttitle = implode(',', colorStringToArray($colortexttitle));
$colortext = implode(',', colorStringToArray($colortext));
$colortextlink = implode(',', colorStringToArray($colortextlink));
// @phan-suppress-next-line PhanRedefinedClassReference
$nbtopmenuentries = $menumanager->showmenu('topnb');
$nbtopmenuentriesreal = $nbtopmenuentries;
if ($conf->browser->layout == 'phone') {

View File

@@ -75,7 +75,9 @@ if (empty($user->id) && !empty($_SESSION['dol_login'])) {
//$user->loadPersonalConf();
// Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct.
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->loadMenu();
}
@@ -281,6 +283,7 @@ $colortexttitle = implode(',', colorStringToArray($colortexttitle));
$colortext = implode(',', colorStringToArray($colortext));
$colortextlink = implode(',', colorStringToArray($colortextlink));
// @phan-suppress-next-line PhanRedefinedClassReference
$nbtopmenuentries = $menumanager->showmenu('topnb');
$nbtopmenuentriesreal = $nbtopmenuentries;
if ($conf->browser->layout == 'phone') {
@@ -3153,78 +3156,78 @@ li.tmenu:hover .tmenuimage:not(.menuhider), li.tmenu:hover .tmenuimage:not(.menu
<?php include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
<?php
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')
$moduletomainmenu = array(
'user' => '', 'syslog' => '', 'societe' => 'companies', 'projet' => 'project', 'propale' => 'commercial', 'commande' => 'commercial',
'produit' => 'products', 'service' => 'products', 'stock' => 'products',
'don' => 'accountancy', 'tax' => 'accountancy', 'banque' => 'accountancy', 'facture' => 'accountancy', 'compta' => 'accountancy', 'accounting' => 'accountancy', 'adherent' => 'members', 'import' => 'tools', 'export' => 'tools', 'mailing' => 'tools',
'contrat' => 'commercial', 'ficheinter' => 'commercial', 'ticket' => 'ticket', 'deplacement' => 'commercial',
'fournisseur' => 'companies',
'barcode' => '', 'fckeditor' => '', 'categorie' => '',
);
$mainmenuused = 'home';
foreach ($conf->modules as $val) {
$mainmenuused .= ','.(isset($moduletomainmenu[$val]) ? $moduletomainmenu[$val] : $val);
}
$mainmenuusedarray = array_unique(explode(',', $mainmenuused));
$generic = 1;
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined
$divalreadydefined = array('home', 'companies', 'products', 'mrp', 'commercial', 'externalsite', 'accountancy', 'project', 'tools', 'members', 'agenda', 'ftp', 'holiday', 'hrm', 'bookmark', 'cashdesk', 'takepos', 'ecm', 'geoipmaxmind', 'gravatar', 'clicktodial', 'paypal', 'stripe', 'webservices', 'website');
// Put here list of menu entries we are sure we don't want
$divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition');
foreach ($mainmenuusedarray as $val) {
if (empty($val) || in_array($val, $divalreadydefined)) {
continue;
}
if (in_array($val, $divnotrequired)) {
continue;
}
//print "XXX".$val;
$found = 0;
$url = '';
$constformoduleicon = 'MAIN_MODULE_'.strtoupper($val).'_ICON';
$iconformodule = getDolGlobalString($constformoduleicon);
if ($iconformodule) {
if (preg_match('/^fa\-/', $iconformodule)) {
// This is a fa icon
} else {
$url = dol_buildpath('/'.$val.'/img/'.$iconformodule.'.png', 1);
}
$found = 1;
} else {
// Search img file in module dir
foreach ($conf->file->dol_document_root as $dirroot) {
if (file_exists($dirroot."/".$val."/img/".$val.".png")) {
$url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
$found = 1;
break;
$moduletomainmenu = array(
'user' => '', 'syslog' => '', 'societe' => 'companies', 'projet' => 'project', 'propale' => 'commercial', 'commande' => 'commercial',
'produit' => 'products', 'service' => 'products', 'stock' => 'products',
'don' => 'accountancy', 'tax' => 'accountancy', 'banque' => 'accountancy', 'facture' => 'accountancy', 'compta' => 'accountancy', 'accounting' => 'accountancy', 'adherent' => 'members', 'import' => 'tools', 'export' => 'tools', 'mailing' => 'tools',
'contrat' => 'commercial', 'ficheinter' => 'commercial', 'ticket' => 'ticket', 'deplacement' => 'commercial',
'fournisseur' => 'companies',
'barcode' => '', 'fckeditor' => '', 'categorie' => '',
);
$mainmenuused = 'home';
foreach ($conf->modules as $val) {
$mainmenuused .= ','.(isset($moduletomainmenu[$val]) ? $moduletomainmenu[$val] : $val);
}
}
}
$mainmenuusedarray = array_unique(explode(',', $mainmenuused));
// Output entry for menu icon in CSS
if (!$found) {
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
print 'div.mainmenu.'.$val.' span::before {'."\n";
print 'content: "\f249";'."\n";
print '}'."\n";
$generic++;
} else {
if ($url) {
print "div.mainmenu.".$val." {\n";
print " background-image: url(".$url.");\n";
print " background-position-y: 3px;\n";
print " filter: saturate(0);\n";
print "}\n";
} else {
print '/* icon for module '.$val.' is a fa icon */'."\n";
}
}
}
// End of part to add more div class css
$generic = 1;
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined
$divalreadydefined = array('home', 'companies', 'products', 'mrp', 'commercial', 'externalsite', 'accountancy', 'project', 'tools', 'members', 'agenda', 'ftp', 'holiday', 'hrm', 'bookmark', 'cashdesk', 'takepos', 'ecm', 'geoipmaxmind', 'gravatar', 'clicktodial', 'paypal', 'stripe', 'webservices', 'website');
// Put here list of menu entries we are sure we don't want
$divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition');
foreach ($mainmenuusedarray as $val) {
if (empty($val) || in_array($val, $divalreadydefined)) {
continue;
}
if (in_array($val, $divnotrequired)) {
continue;
}
//print "XXX".$val;
$found = 0;
$url = '';
$constformoduleicon = 'MAIN_MODULE_'.strtoupper($val).'_ICON';
$iconformodule = getDolGlobalString($constformoduleicon);
if ($iconformodule) {
if (preg_match('/^fa\-/', $iconformodule)) {
// This is a fa icon
} else {
$url = dol_buildpath('/'.$val.'/img/'.$iconformodule.'.png', 1);
}
$found = 1;
} else {
// Search img file in module dir
foreach ($conf->file->dol_document_root as $dirroot) {
if (file_exists($dirroot."/".$val."/img/".$val.".png")) {
$url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
$found = 1;
break;
}
}
}
// Output entry for menu icon in CSS
if (!$found) {
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
print 'div.mainmenu.'.$val.' span::before {'."\n";
print 'content: "\f249";'."\n";
print '}'."\n";
$generic++;
} else {
if ($url) {
print "div.mainmenu.".$val." {\n";
print " background-image: url(".$url.");\n";
print " background-position-y: 3px;\n";
print " filter: saturate(0);\n";
print "}\n";
} else {
print '/* icon for module '.$val.' is a fa icon */'."\n";
}
}
}
// End of part to add more div class css
} // End test if $dol_hide_topmenu?>

View File

@@ -474,7 +474,7 @@ class Ticket extends CommonObject
* @param string $getRef Reference of object
* @return bool
*/
public function checkExistingRef(string $action, string $getRef): bool
public function checkExistingRef(string $action, string $getRef)
{
$test = new self($this->db);

View File

@@ -2962,6 +2962,7 @@ class User extends CommonObject
$data['connectedsince'] = '<br><b>'.$langs->trans("ConnectedSince").':</b> '.dol_print_date($this->datelastlogin, "dayhour", 'tzuser');
$data['previousconnexion'] = '<br><b>'.$langs->trans("PreviousConnexion").':</b> '.dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser');
$data['currenttheme'] = '<br><b>'.$langs->trans("CurrentTheme").':</b> '.dol_string_nohtmltag($conf->theme);
// @phan-suppress-next-line PhanRedefinedClassReference
$data['currentmenumanager'] = '<br><b>'.$langs->trans("CurrentMenuManager").':</b> '.dol_string_nohtmltag($menumanager->name);
$s = picto_from_langcode($langs->getDefaultLang());
$data['currentuserlang'] = '<br><b>'.$langs->trans("CurrentUserLanguage").':</b> '.dol_string_nohtmltag(($s ? $s.' ' : '').$langs->getDefaultLang());

View File

@@ -112,6 +112,7 @@ if (empty($reshook)) {
if ($object->id == $user->id) {
$user->clearrights();
$user->loadRights();
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->loadMenu();
}
@@ -131,6 +132,7 @@ if (empty($reshook)) {
if ($object->id == $user->id) {
$user->clearrights();
$user->loadRights();
// @phan-suppress-next-line PhanRedefinedClassReference
$menumanager->loadMenu();
}

View File

@@ -93,7 +93,7 @@ class WebPortalInvoice extends Facture
// BEGIN MODULEBUILDER PROPERTIES
/**
* @var array<string,array{type:string,label:string,enabled:int<0,2>|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<int,string>,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,array{type:string,label:string,enabled:int<0,2>|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<int,string>,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' => 0, 'notnull' => 1, 'position' => 1,),

View File

@@ -9,7 +9,7 @@ parameters:
# minimumNumberOfJobsPerProcess: 2 # default is 2
# buffer: 134217728 # 128 MB # Not documented
customRulesetUsed: true
level: 3
level: 5
fileExtensions:
- php
paths:
@@ -72,19 +72,16 @@ parameters:
- '#expects int\|null#'
- '#expects int<-2, 2>, bool given.#'
- '#expects int<0, 1>#'
- '#load.* expects int, string#'
- '#ajax.* expects int, string#'
- '#measu.* expects int, string#'
- '#color.* expects int, string#'
- '#imap.* expects int, string#'
- '#show.* expects int, string#'
- '#dol.* expects int, string#'
- '#get.* expects int, string#'
- '#send.* expects int, string#'
- '#convert.* expects int, string#'
#- '#constructor expects int, string#'
- '#\(\) expects int, string#'
- '#run_sql expects int, string#'
- '#on array{url: mixed} in empty\(\) does not exist.#'
- '#expects int, float#'
- '#expects int, array\|string given.#'
- '#expects int<0, 1>, '''' given.#'
@@ -96,18 +93,24 @@ parameters:
- '#expects string, \(float\|int\) given.#'
- '#expects string, array#'
- '#expects string, float#'
- '#expects string, bool given.#'
- '#expects string, true given.#'
- '#expects string, false given.#'
- '#expects string, null given.#'
- '#expects string, int<0, 10> given.#'
- '#expects string, DateTime given.#'
- '#expects string, bool\|mysqli_result\|resource given.#'
- '#expects array#'
- '#expects array\{#'
- '#expects array<array\{#'
- '#expects array\|LDAP#'
- '#expects array<int#'
- '#expects array\|string#'
- '#expects array\|null#'
- '#expects array<string#'
- '#expects array, string given.#'
- '#expects array, null given.#'
- '#expects array<string>, null given.#'
- '#expects array<string>, string given.#'
- '#expects array<string>\|string#'
- '#expects resource#'
- '#expects resource, object given.#'
- '#expects object#'
@@ -124,7 +127,6 @@ parameters:
- '#expects Societe#'
- '#expects ''''\|Societe#'
- '#expects SupplierProposal#'
- '#expects User#'
- '#expects CommonObjectLine#'
- '#check_authentication expects#'
- '#colorHexToHsl expects#'

View File

@@ -1,10 +1,11 @@
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@@ -153,7 +154,7 @@ if ($resql) {
if ($startbreak) {
// Break onto sales representative (new email or cid)
if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) {
sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, $duration_value);
sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, (int) $duration_value);
$trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid;
} else {
if ($oldemail != 'none') {
@@ -207,7 +208,7 @@ if ($resql) {
// If there are remaining messages to send in the buffer
if ($foundtoprocess) {
if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) { // Break onto email (new email)
sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, $duration_value);
sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, (int) $duration_value);
$trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid;
} else {
if ($oldemail != 'none') {