diff --git a/ChangeLog b/ChangeLog index 43f08b41080..4fc1a613681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,7 +11,7 @@ NEW value for FICHINTER_DISABLE_DETAILS. If FICHINTER_DISABLE_DETAILS is set to For developers: --------------- - +QUAL line classes for various business object classes have been moved to individual files. WARNING: diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 7d482dff305..a84aee22fcc 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,25 +9,25 @@ */ return [ // # Issue statistics: - // PhanUndeclaredProperty : 800+ occurrences - // PhanPluginUnknownPropertyType : 710+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 600+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 410+ occurrences - // PhanUndeclaredGlobalVariable : 380+ occurrences - // PhanPluginUnknownArrayMethodReturnType : 310+ occurrences - // PhanPluginUnknownArrayMethodParamType : 260+ occurrences + // PhanUndeclaredProperty : 680+ occurrences + // PhanPluginUnknownPropertyType : 630+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 580+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 400+ occurrences + // PhanUndeclaredGlobalVariable : 350+ occurrences + // PhanPluginUnknownArrayMethodReturnType : 300+ occurrences + // PhanPluginUnknownArrayMethodParamType : 250+ occurrences // PhanPossiblyUndeclaredVariable : 200+ occurrences // PhanTypeMismatchProperty : 170+ occurrences // PhanPluginUnknownArrayFunctionParamType : 95+ occurrences // PhanTypeMismatchArgumentNullableInternal : 70+ occurrences // PhanPluginUndeclaredVariableIsset : 65+ occurrences - // PhanPluginUnknownArrayPropertyType : 60+ occurrences + // PhanPluginUnknownArrayPropertyType : 55+ occurrences // PhanPluginUnknownArrayFunctionReturnType : 50+ occurrences // PhanRedefineFunction : 50+ occurrences // PhanPluginEmptyStatementIf : 45+ occurrences - // PhanTypeMismatchDimFetch : 40+ occurrences - // PhanTypeExpectedObjectPropAccess : 25+ occurrences - // PhanTypeInvalidDimOffset : 25+ occurrences + // PhanTypeExpectedObjectPropAccess : 40+ occurrences + // PhanTypeInvalidDimOffset : 35+ occurrences + // PhanTypeMismatchDimFetch : 30+ occurrences // PhanPluginUnknownObjectMethodCall : 15+ occurrences // PhanTypeComparisonFromArray : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences @@ -42,9 +42,9 @@ return [ // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences - // PhanTypeExpectedObjectPropAccessButGotNull : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences + // PhanTypeExpectedObjectPropAccessButGotNull : 3 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanTypeConversionFromArray : 1 occurrence @@ -52,8 +52,6 @@ return [ 'file_suppressions' => [ 'htdocs/accountancy/class/accountancycategory.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/accountancy/class/accountingjournal.class.php' => ['PhanTypeInvalidDimOffset'], - 'htdocs/accountancy/journal/purchasesjournal.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/adherents/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/admin/fckeditor.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/api/class/api_access.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], @@ -210,7 +208,7 @@ return [ 'htdocs/compta/tva/index.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchProperty'], - 'htdocs/contact/canvas/actions_contactcard_common.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach'], + 'htdocs/contact/canvas/actions_contactcard_common.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], 'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/contact/class/contact.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/contact/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -360,19 +358,16 @@ return [ 'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/modules_commande.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/contract/doc/pdf_strato.modules.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/delivery/doc/pdf_storm.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/delivery/doc/pdf_typhon.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/contract/doc/pdf_strato.modules.php' => ['PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/modules/delivery/doc/pdf_storm.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/modules/delivery/doc/pdf_typhon.modules.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/expedition/doc/pdf_espadon.modules.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/expedition/doc/pdf_merou.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/expedition/doc/pdf_rouget.modules.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/expedition/doc/pdf_merou.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/modules_facture.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/fichinter/mod_pacific.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanUndeclaredProperty'], @@ -395,7 +390,6 @@ return [ 'htdocs/core/modules/printsheet/modules_labels.php' => ['PhanParamTooMany'], 'htdocs/core/modules/product/doc/pdf_standard.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/project/doc/pdf_baleine.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/project/doc/pdf_timespent.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -408,10 +402,10 @@ return [ 'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -436,14 +430,12 @@ return [ 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/list_print_total.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], - 'htdocs/core/tpl/login.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/notes.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/objectline_edit.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/objectline_title.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanTypeExpectedObjectPropAccessButGotNull', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/onlinepaymentlinks.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/passwordforgotten.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/passwordreset.tpl.php' => ['PhanUndeclaredGlobalVariable'], @@ -743,7 +735,6 @@ return [ 'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/public/test/test_forms.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], - 'htdocs/public/ticket/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/public/webportal/webportal.main.inc.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction'], @@ -790,23 +781,19 @@ return [ 'htdocs/societe/admin/societe.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], 'htdocs/societe/ajax/ajaxcompanies.php' => ['PhanUndeclaredProperty'], 'htdocs/societe/ajax/company.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/societe/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/societe/checkvat/checkVatPopup.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/societe/class/api_contacts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/societe/class/client.class.php' => ['PhanPluginUnknownArrayPropertyType'], - 'htdocs/societe/class/companybankaccount.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/societe/class/companypaymentmode.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/societe/class/societeaccount.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/societe/paymentmodes.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], 'htdocs/societe/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/website.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/stripe/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], - 'htdocs/stripe/class/stripe.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition'], + 'htdocs/stripe/class/stripe.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty'], 'htdocs/supplier_proposal/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanUndeclaredProperty'], @@ -835,13 +822,12 @@ return [ 'htdocs/theme/md/flags-sprite.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/md/info-box.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/md/progress.inc.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/ticket/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/ticket/card.php' => ['PhanUndeclaredProperty'], 'htdocs/ticket/class/actions_ticket.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/ticket/class/api_tickets.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/ticket/class/api_tickets.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/ticket/class/ticket.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/ticket/class/ticket.class.php' => ['PhanUndeclaredProperty'], 'htdocs/ticket/class/ticketstats.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/ticket/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ticket/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/ticket/list.php' => ['PhanTypeComparisonFromArray'], 'htdocs/ticket/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index aa13ceba1c6..712e14e87b7 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -320,7 +320,7 @@ return [ 'exclude_file_regex' => '@^(' // @phpstan-ignore-line .'dummy' // @phpstan-ignore-line // mymodule seen in cti, but not in git. - .'|htdocs/custom/mymodule/.*' // @phpstan-ignore-line + .'|htdocs/custom/.*' // Ignore all custom modules @phpstan-ignore-line .'|htdocs/.*/canvas/.*/tpl/.*.tpl.php' // @phpstan-ignore-line //.'|htdocs/modulebuilder/template/.*' // @phpstan-ignore-line // Included as stub (better analysis) diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 521c0347d73..70087113db3 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -97,6 +97,7 @@ $config['suppress_issue_types'] = [ 'PhanPluginUnknownArrayMethodParamType', // this option costs more time to be supported than it solves time 'PhanPluginUnknownArrayMethodReturnType', // this option costs more time to be supported than it solves time + 'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code. ]; return $config; diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index bfdee1331b3..980779ff254 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -28,7 +28,7 @@ /** * Class to manage accountancy systems */ -class AccountancySystem +class AccountancySystem extends CommonObject { /** * @var DoliDB Database handler. @@ -58,17 +58,13 @@ class AccountancySystem public $rowid; /** - * @var int ID - */ - public $fk_pcg_version; - - /** - * @var int pcg version + * @var string Accountancy system code */ public $pcg_version; /** - * @var string ref + * @var string Ref of accountancy system. Duplicate property with ->pcg_version. + * @see $pcg_version */ public $ref; @@ -77,31 +73,11 @@ class AccountancySystem */ public $active; - /** - * @var string pcg type - */ - public $pcg_type; - - /** - * @var string Accountancy System numero - */ - public $numero; - /** * @var string Accountancy System label */ public $label; - /** - * @var string account number - */ - public $account_number; - - /** - * @var string account parent - */ - public $account_parent; - /** * Constructor * @@ -190,12 +166,12 @@ class AccountancySystem $result = $this->rowid; } else { $result = - 2; - $this->error = "AccountancySystem::Create Error $result"; + $this->error = "AccountancySystem::Create Error $result: " . $this->db->lasterror(); dol_syslog($this->error, LOG_ERR); } } else { $result = - 1; - $this->error = "AccountancySystem::Create Error $result"; + $this->error = "AccountancySystem::Create Error $result: " . $this->db->lasterror(); dol_syslog($this->error, LOG_ERR); } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 694cf1df68f..620bea2ba40 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -377,6 +377,23 @@ if ($result) { 'code_compta' => $compta_soc ); + // After the line is processed + $parameters = array( + 'obj' => $obj, + 'tabfac' => &$tabfac, + 'tabht' => &$tabht, + 'tabtva' => &$tabtva, + 'def_tva' => &$def_tva, + 'tabwarranty' => &$tabwarranty, + 'tabrevenuestamp' => &$tabrevenuestamp, + 'tabttc' => &$tabttc, + 'tablocaltax1' => &$tablocaltax1, + 'tablocaltax2' => &$tablocaltax2, + 'tabcompany' => &$tabcompany, + 'vatdata_cache' => &$vatdata_cache, + ); + $reshook = $hookmanager->executeHooks('processingJournalData', $parameters); // Note that $action and $object may have been modified by hook + $i++; // Check for too many lines. diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 38b0d37fb6c..30204770698 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -130,6 +130,11 @@ if ($action == 'update') { } } + if (GETPOSTISSET('THEME_ELDY_BORDER_RADIUS')) { + $val = GETPOST('THEME_ELDY_BORDER_RADIUS'); + dolibarr_set_const($db, 'THEME_ELDY_BORDER_RADIUS', GETPOSTINT('THEME_ELDY_BORDER_RADIUS'), 'chaine', 0, '', $conf->entity); + } + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array())))); if ($val == '') { dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 9c93d797286..989a42524c3 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004-2024 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011-2023 Juanjo Menent @@ -56,7 +56,7 @@ if (GETPOSTISSET('mode')) { dolibarr_set_const($db, "MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode, 'chaine', 0, '', $conf->entity); } } else { - $mode = (!getDolGlobalString('MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT') ? 'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT); + $mode = getDolGlobalString('MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT', 'commonkanban'); } $action = GETPOST('action', 'aZ09'); @@ -229,13 +229,68 @@ if ($action == 'install' && $allowonlineinstall) { } } - if (!$error) { - // TODO Make more test - } - dol_syslog("Uncompress of module file is a success."); - // We check if this is a metapackage + // Load module into $objMod + /* + $modulesdir = array($modulenamedir.'/core/modules/'); + foreach ($modulesdir as $dir) { + // Load modules attributes in arrays (name, numero, orders) from dir directory + //print $dir."\n
"; + dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)"); + $handle = @opendir($dir); + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + print $dir." ".$file."\n
"; + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') { + $modName = substr($file, 0, dol_strlen($file) - 10); + if ($modName) { + try { + $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. + $modName = substr($file, 0, dol_strlen($file) - 10); + if ($modName) { + if (class_exists($modName)) { + $objMod = new $modName($db); + '@phan-var-force DolibarrModules $objMod'; + + //var_dump($objMod); + } + } + } catch(Exception $e) { + // Nothing done + } + } + } + } + } + } + */ + + // Check if module is in the remote malware list + if (!$error) { + if (GETPOST('checkforcompliance') == 'on') { + try { + $res = include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; + $dolibarrmodule = new DolibarrModules($db); + $checkRes = $dolibarrmodule->checkForcompliance($modulename); + + if (!is_numeric($checkRes) && $checkRes != '') { + $langs->load("errors"); + setEventMessages($modulename.' : '.$langs->trans($checkRes), null, 'errors'); + } + + $error++; + } catch (Exception $e) { + // Nothing done + } + } + } + + if (!$error) { + // TODO Make more test ??? + } + + // We check if this is a metapackage (and wecomplete with child packages) $modulenamearrays = array(); if (dol_is_file($modulenamedir.'/metapackage.conf')) { // This is a meta package @@ -245,32 +300,34 @@ if ($action == 'install' && $allowonlineinstall) { $modulenamearrays[$modulename] = $modulename; //var_dump($modulenamearrays);exit; - // Lop on each package of the metapackage - foreach ($modulenamearrays as $modulenameval) { - if (strpos($modulenameval, '#') === 0) { - continue; // Discard comments - } - if (strpos($modulenameval, '//') === 0) { - continue; // Discard comments - } - if (!trim($modulenameval)) { - continue; - } - - // Now we install the module - if (!$error) { - @dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the target directory - $submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulenameval; - if (!dol_is_dir($submodulenamedir)) { - $submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval; + // Lop on each packages (can have several if package is a metapackage) + if (! $error) { + foreach ($modulenamearrays as $modulenameval) { + if (strpos($modulenameval, '#') === 0) { + continue; // Discard comments } - dol_syslog("We copy now directory ".$submodulenamedir." into target dir ".$dirins.'/'.$modulenameval); - $result = dolCopyDir($submodulenamedir, $dirins.'/'.$modulenameval, '0444', 1); - if ($result <= 0) { - dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$submodulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING); - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailToCopyDir", $submodulenamedir, $dirins.'/'.$modulenameval), null, 'errors'); - $error++; + if (strpos($modulenameval, '//') === 0) { + continue; // Discard comments + } + if (!trim($modulenameval)) { + continue; + } + + // Now we install the module + if (!$error) { + @dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the target directory + $submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulenameval; + if (!dol_is_dir($submodulenamedir)) { + $submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval; + } + dol_syslog("We copy now directory ".$submodulenamedir." into target dir ".$dirins.'/'.$modulenameval); + $result = dolCopyDir($submodulenamedir, $dirins.'/'.$modulenameval, '0444', 1); + if ($result <= 0) { + dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$submodulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING); + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailToCopyDir", $submodulenamedir, $dirins.'/'.$modulenameval), null, 'errors'); + $error++; + } } } } @@ -294,8 +351,6 @@ if ($action == 'install' && $allowonlineinstall) { $message = $langs->trans("SetupIsReadyForUse", $redirectUrl, $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")); setEventMessages($message, null, 'warnings'); - header('Location: ' . $redirectUrl); - exit; } } elseif ($action == 'install' && !$allowonlineinstall) { httponly_accessforbidden("You try to bypass the protection to disallow deployment of an external module. Hack attempt ?"); @@ -654,7 +709,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { $moreforfilter = '
'; $moreforfilter .= ''; print '
'; - echo ''; + echo '
'; echo ' '; echo ' \n"; - echo " \n"; + echo " \n"; /* echo '
'; @@ -1741,13 +1741,12 @@ if (empty($mode) || $mode == 'show_month') { // View by month echo "
\n"; */ - echo '
'.$langs->trans("Day".$arraytimestamp['wday'])."
'; - print '
'; + print ''; /* WIP View per hour */ $useviewhour = 0; if ($useviewhour) { - print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table $maxheightwin = (isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 500) ? ($_SESSION["dol_screenheight"] - 200) : 660; // Also into index.php file @@ -1787,13 +1786,19 @@ if (empty($mode) || $mode == 'show_month') { // View by month print '
'; } else { - print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table // @phan-suppress-next-line PhanPluginSuspiciousParamPosition show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars); print '
'; } + + + print ''; + + echo ''; + print '
'; } print "\n".''; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 07a9095d0a6..456adbdcb78 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -761,6 +761,8 @@ print '
'; print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, '', $filtert, '', $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid, $search_categ_cus); print '
'; +$moreforfilter = 1; + print '
'; print ''."\n"; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index e0cbadb55b4..082614b4cec 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1106,7 +1106,7 @@ if ($object->id > 0) { print '
'; print ''; - print '\n"; + print "\n"; foreach ($this->lines as $line) { //Line extrafield $line->fetch_optionals(); @@ -5271,7 +5271,7 @@ abstract class CommonObject $i++; } - print "\n"; + print "\n"; } /** diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8419bf8e996..abb28560b0b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -963,7 +963,8 @@ class ExtraFields * @param string $elementtype Type of element ('all' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). * @param boolean $forceload Force load of extra fields whatever is status of cache. * @param string $attrname The name of the attribute. - * @return array{}|array{label:array,type:array,size:array,default:array,computed:array,unique:array,required:array,param:array,perms:array,list:array|array,pos:array,totalizable:array,help:array,printable:array,enabled:array,langfile:array,css:array,csslist:array,hidden:array,mandatoryfieldsofotherentities?:array,loaded?:int,count:int} Array of attributes keys+label for all extra fields. Note: count set as present to avoid static analysis notices + * @return array Array of attributes keys+label for all extra fields. + * in addition $this->attributes will be completed with array{label:array,type:array,size:array,default:array,computed:array,unique:array,required:array,param:array,perms:array,list:array|array,pos:array,totalizable:array,help:array,printable:array,enabled:array,langfile:array,css:array,csslist:array,hidden:array,mandatoryfieldsofotherentities?:array,loaded?:int,count:int} Note: count set as present to avoid static analysis notices */ public function fetch_name_optionals_label($elementtype, $forceload = false, $attrname = '') { @@ -1953,16 +1954,17 @@ class ExtraFields /** * Return HTML string to put an output field into a page * - * @param string $key Key of attribute - * @param string $value Value to show - * @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering) - * @param string $extrafieldsobjectkey Required (for example $object->table_element). - * @param Translate $outputlangs Output language - * @return string Formatted value + * @param string $key Key of attribute + * @param string $value Value to show + * @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering) + * @param string $extrafieldsobjectkey Required (for example $object->table_element). + * @param Translate $outputlangs Output + * @param object $object The parent object of field to show + * @return string Formatted value */ - public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '', $outputlangs = null) + public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '', $outputlangs = null, $object = null) { - global $conf, $langs, $object; + global $conf, $langs; if (is_null($outputlangs) || !is_object($outputlangs)) { $outputlangs = $langs; @@ -2288,10 +2290,10 @@ class ExtraFields if (!empty($classpath)) { dol_include_once($InfoFieldList[1]); if ($classname && class_exists($classname)) { - $object = new $classname($this->db); - '@phan-var-force CommonObject $object'; - $object->fetch($value); - $value = $object->getNomUrl(3); + $tmpobject = new $classname($this->db); + '@phan-var-force CommonObject $tmpobject'; + $tmpobject->fetch($value); + $value = $tmpobject->getNomUrl(3); } } else { dol_syslog('Error bad setup of extrafield', LOG_WARNING); @@ -2321,8 +2323,9 @@ class ExtraFields } elseif ($type == 'password') { $value = dol_trunc(preg_replace('/./i', '*', $value), 8, 'right', 'UTF-8', 1); } elseif ($type == 'stars') { - $value = ''; - $value .= '
'; + $objectid = (int) $object->id; + $value = ''; + $value .= '
'; $i = 1; while ($i <= $size) { $value .= ''.img_picto('', 'fontawesome_star_fas').''; @@ -2331,8 +2334,8 @@ class ExtraFields $value .= '
'; $value .= '
'; + print ''; print ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index cc46110e17c..e3817512788 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -531,7 +531,7 @@ if (empty($reshook)) { $trackid = 'emailing-test'; $upload_dir_tmp = $upload_dir; - $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css, $trackid, '', 'emailing', '', $upload_dir_tmp); + $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css, $trackid, '', 'emailing', $object->email_replyto, $upload_dir_tmp); $result = $mailfile->sendfile(); if ($result) { @@ -833,6 +833,8 @@ if ($action == 'create') { // aaa print ''; + print ''; + // Other attributes $parameters = array(); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -1377,6 +1379,7 @@ if ($action == 'create') { // aaa // To if ($object->messtype != 'sms') { print ''; + print ''; } print '
'.$langs->trans("LastSendings", ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllSendings").''.$num.''; print ''; print '
'.$langs->trans("LastSendings", ($num < $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllSendings").''.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'.$langs->trans("MailErrorsTo").'
'.$langs->trans("MailReply").'
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'
'.$langs->trans("MailReply").''.dol_print_email($object->email_replyto, 0, 0, 0, 0, 1).'
'; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index fe3d3560b35..78b69f13082 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -564,7 +564,7 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $sql = 'SELECT'; -if ($search_all > 0) { +if ($search_all !== '') { $sql = 'SELECT DISTINCT'; } $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax , s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5cb172ba9e5..6576b0155be 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2732,33 +2732,36 @@ while ($i < $imaxinloop) { $numlines = count($generic_commande->lines); // Loop on each line of order for ($lig = 0; $lig < $numlines; $lig++) { - if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) { - $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id]; + $orderLine = $generic_commande->lines[$lig]; + '@phan-var-force OrderLine $orderLine'; + if (isset($generic_commande->expeditions[$orderLine->id])) { + $reliquat = $orderLine->qty - $generic_commande->expeditions[$orderLine->id]; } else { - $reliquat = $generic_commande->lines[$lig]->qty; + $reliquat = $orderLine->qty; } - if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service + if ($orderLine->product_type == 0 && $orderLine->fk_product > 0) { // If line is a product and not a service $nbprod++; // order contains real products - $generic_product->id = $generic_commande->lines[$lig]->fk_product; + $generic_product->id = $orderLine->fk_product; // Get local and virtual stock and store it into cache - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { + if (empty($productstat_cache[$orderLine->fk_product])) { $generic_product->load_stock('nobatch,warehouseopen'); // ->load_virtual_stock() is already included into load_stock() - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; - $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; + $productstat_cache[$orderLine->fk_product]['stock_reel'] = $generic_product->stock_reel; + $productstat_cachevirtual[$orderLine->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { - $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; - $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; + $generic_product->stock_reel = $productstat_cache[$orderLine->fk_product]['stock_reel']; + // @phan-suppress-next-line PhanTypeInvalidDimOffset + $generic_product->stock_theorique = $productstat_cachevirtual[$orderLine->fk_product]['stock_reel']; } if ($reliquat > $generic_product->stock_reel) { $notshippable++; } if (!getDolGlobalString('SHIPPABLE_ORDER_ICON_IN_LIST')) { // Default code. Default should be this case. - $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20); + $text_info .= $reliquat.' x '.$orderLine->product_ref.' '.dol_trunc($orderLine->product_label, 20); $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel.''; $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique.''; - $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : ''); + $text_info .= ($reliquat != $orderLine->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($orderLine->qty - $reliquat).')' : ''); $text_info .= '
'; } else { // BUGGED CODE. // DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE. @@ -2769,29 +2772,29 @@ while ($i < $imaxinloop) { $stock_order_supplier = 0; if (getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT') || getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { // What about other options ? if (isModEnabled('order')) { - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { + if (empty($productstat_cache[$orderLine->fk_product]['stats_order_customer'])) { $generic_product->load_stats_commande(0, '1,2'); - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; + $productstat_cache[$orderLine->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; } else { // @phan-suppress-next-line PhanTypeInvalidDimOffset - $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer']; + $generic_product->stats_commande['qty'] = $productstat_cache[$orderLine->fk_product]['stats_order_customer']; } $stock_order = $generic_product->stats_commande['qty']; } if (isModEnabled("supplier_order")) { - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) { + if (empty($productstat_cache[$orderLine->fk_product]['stats_order_supplier'])) { $generic_product->load_stats_commande_fournisseur(0, '3'); - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; + $productstat_cache[$orderLine->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; } else { // @phan-suppress-next-line PhanTypeInvalidDimOffset - $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier']; + $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$orderLine->fk_product]['stats_order_supplier']; } $stock_order_supplier = $generic_product->stats_commande_fournisseur['qty']; } } - $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20); + $text_info .= $reliquat.' x '.$orderLine->ref.' '.dol_trunc($orderLine->product_label, 20); $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order; - if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) { + if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $orderLine->qty)) { $warning++; $text_warning .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; } @@ -2803,7 +2806,7 @@ while ($i < $imaxinloop) { if (isModEnabled("supplier_order")) { $text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier; } - $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : ''); + $text_info .= ($reliquat != $orderLine->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($orderLine->qty - $reliquat).')' : ''); $text_info .= '
'; } } diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 251f5cce126..04285cb126d 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -2112,7 +2112,7 @@ if ($resql) { $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { $generic_product->stock_reel = $productstat_cache[$obj->fk_product]['stock_reel']; - $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; + $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel']; } if ($reliquat > $generic_product->stock_reel) { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index eb8cb1d7180..a724d2001ff 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1417,6 +1417,14 @@ class FactureRec extends CommonInvoice $facture->multicurrency_tx = $facturerec->multicurrency_tx; } + if (isset($facture->array_options) && isset($facturerec->array_options)) { + foreach ($facturerec->array_options as $key => $value) { + if (isset($facture->array_options[$key])) { + $facture->array_options[$key] = $value; + } + } + } + $invoiceidgenerated = $facture->create($user); if ($invoiceidgenerated <= 0) { $this->errors = $facture->errors; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 0f528b32b1a..7c13b8a44fb 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -148,6 +148,7 @@ $search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth, $sear $search_categ_cus = GETPOST("search_categ_cus", 'intcomma'); $search_product_category = GETPOST('search_product_category', 'intcomma'); $search_fac_rec_source_title = GETPOST("search_fac_rec_source_title", 'alpha'); +$search_fk_fac_rec_source = GETPOST('search_fk_fac_rec_source', 'int'); $search_option = GETPOST('search_option'); if ($search_option == 'late') { @@ -871,6 +872,9 @@ if ($search_option == 'late') { if (!empty($search_fac_rec_source_title)) { $sql .= natural_search('facrec.titre', $search_fac_rec_source_title); } +if ($search_fk_fac_rec_source) { + $sql .= ' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source; +} // Search on user if ($search_user > 0) { $sql .= " AND EXISTS ("; @@ -1015,6 +1019,14 @@ if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $s llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist'); +if ($search_fk_fac_rec_source) { + $object = new FactureRec($db); + $object->id = (int) $search_fk_fac_rec_source; + $head = invoice_rec_prepare_head($object); + print dol_get_fiche_head($head, 'generated', $langs->trans('InvoicesGeneratedFromRec'), -1, 'bill'); // Add a div +} + + $param = '&socid='.urlencode((string) ($socid)); if (!empty($mode)) { $param .= '&mode='.urlencode($mode); @@ -1196,6 +1208,9 @@ if ($search_categ_cus > 0) { if (!empty($search_fac_rec_source_title)) { $param .= '&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title); } +if ($search_fk_fac_rec_source) { + $param .= '&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source; +} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 4e527c8f229..eae893f579e 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -144,6 +144,7 @@ if ($action == 'setref' && $user->hasRight('banque', 'cheque')) { if ($action == 'create' && GETPOSTINT("accountid") > 0 && $user->hasRight('banque', 'cheque')) { if (GETPOSTISARRAY('toRemise')) { $object->type = $type; + $object->date_bordereau = dol_now(); $arrayofid = GETPOST('toRemise', 'array:int'); $result = $object->create($user, GETPOSTINT("accountid"), 0, $arrayofid); @@ -168,6 +169,7 @@ if ($action == 'create' && GETPOSTINT("accountid") > 0 && $user->hasRight('banqu exit; } else { setEventMessages($object->error, $object->errors, 'errors'); + $action = 'new'; } } else { setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'mesgs'); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index b0a95db90a9..0eb1559c2c6 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -345,7 +345,7 @@ class RemiseCheque extends CommonObject */ public function validate($user) { - global $langs, $conf; + global $conf; $this->errno = 0; @@ -357,7 +357,7 @@ class RemiseCheque extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; $sql .= " SET statut = 1, ref = '".$this->db->escape($numref)."'"; $sql .= " WHERE rowid = ".((int) $this->id); - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); $sql .= " AND statut = 0"; dol_syslog("RemiseCheque::Validate", LOG_DEBUG); @@ -368,13 +368,15 @@ class RemiseCheque extends CommonObject if ($num == 1) { $this->ref = $numref; $this->statut = 1; + $this->status = 1; } else { $this->errno = -1029; - dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); + dol_syslog("Remisecheque::validate Error ".$this->errno, LOG_ERR); } } else { $this->errno = -1033; - dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); + $this->error = $this->db->lasterror(); + dol_syslog("Remisecheque::validate Error ".$this->errno, LOG_ERR); } } diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index fbba4e094c6..81dbddb6739 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -597,6 +597,9 @@ class CMailFile $msg = $this->checkIfHTML($msg); // This add a header and a body including custom CSS to the HTML content } + if ($msg === '.') { + $msg = "\n.\n"; + } // Replace . alone on a new line with .. to avoid to have SMTP interpret this as end of message $msg = preg_replace('/(\r|\n)\.(\r|\n)/ims', '\1..\2', $msg); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d007d51c8d9..5f847ddc7ec 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5250,7 +5250,7 @@ abstract class CommonObject $i = 0; - print "