Qual: Fix phan/phpstan notices in class files (part 5) (#31617)

* Qual: fix commonstickergen..don.class

* Fix notifications for pdf_paiement...cronjob.class

* Qual: Fix notifications for emailcollector..price_parser.class

* Ensure that NULL is used in the database when fk's are 0/empty

* Fix notifications for pdf_paiement...cronjob.class

* Cope with updated phpstan, and make fk_origin_stock int in multiple locations
This commit is contained in:
MDW 2024-11-06 20:15:15 +01:00 committed by GitHub
parent 0d7bc505d3
commit 178d748cad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
52 changed files with 510 additions and 225 deletions

View File

@ -21470,6 +21470,11 @@ parameters:
count: 1
path: ../../htdocs/opensurvey/class/opensurveysondage.class.php
-
message: "#^Property Opensurveysondage\\:\\:\\$status \\(int\\) in isset\\(\\) is not nullable\\.$#"
count: 1
path: ../../htdocs/opensurvey/class/opensurveysondage.class.php
-
message: "#^Left side of && is always true\\.$#"
count: 1

View File

@ -9,46 +9,49 @@
*/
return [
// # Issue statistics:
// PhanUndeclaredProperty : 560+ occurrences
// PhanUndeclaredProperty : 570+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 520+ occurrences
// PhanUndeclaredGlobalVariable : 350+ occurrences
// PhanPluginUnknownPropertyType : 330+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 330+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 230+ occurrences
// PhanPossiblyUndeclaredVariable : 180+ occurrences
// PhanPluginUnknownArrayMethodParamType : 160+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 320+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 220+ occurrences
// PhanPluginUnknownPropertyType : 200+ occurrences
// PhanTypeMismatchProperty : 160+ occurrences
// PhanPluginUnknownArrayMethodParamType : 140+ occurrences
// PhanPossiblyUndeclaredVariable : 120+ occurrences
// PhanPluginUndeclaredVariableIsset : 65+ occurrences
// PhanPluginUnknownArrayFunctionParamType : 60+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 60+ occurrences
// PhanPluginUnknownArrayFunctionReturnType : 50+ occurrences
// PhanPluginEmptyStatementIf : 45+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 50+ occurrences
// PhanRedefineFunction : 45+ occurrences
// PhanTypeExpectedObjectPropAccess : 40+ occurrences
// PhanTypeInvalidDimOffset : 35+ occurrences
// PhanPluginEmptyStatementIf : 35+ occurrences
// PhanPluginUnknownArrayFunctionParamType : 35+ occurrences
// PhanPluginUnknownArrayFunctionReturnType : 30+ occurrences
// PhanTypeInvalidDimOffset : 30+ occurrences
// PhanTypeMismatchDimFetch : 30+ occurrences
// PhanPluginUnknownArrayPropertyType : 15+ occurrences
// PhanPluginUnknownObjectMethodCall : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanEmptyForeach : 10+ occurrences
// PhanPluginUnknownArrayPropertyType : 10+ occurrences
// PhanTypeArraySuspiciousNull : 10+ occurrences
// PhanTypeComparisonFromArray : 10+ occurrences
// PhanTypeMismatchDimFetchNullable : 10+ occurrences
// PhanUndeclaredMethod : 10+ occurrences
// PhanPluginSuspiciousParamPosition : 9 occurrences
// PhanPluginBothLiteralsBinaryOp : 8 occurrences
// PhanPossiblyNullTypeMismatchProperty : 8 occurrences
// PhanPluginSuspiciousParamPosition : 8 occurrences
// PhanPluginDuplicateExpressionBinaryOp : 7 occurrences
// PhanPluginConstantVariableNull : 6 occurrences
// PhanParamTooMany : 5 occurrences
// PhanPossiblyNullTypeMismatchProperty : 5 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
// PhanEmptyFQSENInClasslike : 3 occurrences
// PhanInvalidFQSENInClasslike : 3 occurrences
// PhanTypeExpectedObjectPropAccessButGotNull : 2 occurrences
// PhanTypeMismatchDimAssignment : 2 occurrences
// PhanAccessMethodProtected : 1 occurrence
// PhanParamTooFew : 1 occurrence
// PhanPluginRedundantReturnComment : 1 occurrence
// PhanTypeConversionFromArray : 1 occurrence
// PhanTypeMismatchArgumentReal : 1 occurrence
// PhanTypeMismatchReturn : 1 occurrence
// PhanTypeSuspiciousStringExpression : 1 occurrence
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
@ -119,7 +122,7 @@ return [
'htdocs/commande/list.php' => ['PhanUndeclaredProperty'],
'htdocs/commande/list_det.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/accounting-files.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/accounting-files.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
'htdocs/compta/bank/account_statement_document.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/bank/annuel.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/bank/bankentries_list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
@ -163,7 +166,6 @@ return [
'htdocs/compta/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/paiement/cheque/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/paiement/cheque/list.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/paiement/class/paiement.class.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/compta/paiement/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/paiement_charge.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/paiement_vat.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
@ -256,7 +258,7 @@ return [
'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/smtps.class.php' => ['PhanTypeConversionFromArray'],
'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/core/customreports.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable'],
'htdocs/core/customreports.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginRedundantReturnComment', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable'],
'htdocs/core/datepicker.php' => ['PhanTypeInvalidDimOffset'],
'htdocs/core/db/sqlite3.class.php' => ['PhanTypeMismatchReturn'],
'htdocs/core/extrafieldsinimport.inc.php' => ['PhanTypeMismatchArgumentNullableInternal'],
@ -269,14 +271,12 @@ return [
'htdocs/core/lib/images.lib.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/core/lib/pdf.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/lib/project.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/lib/xcal.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
'htdocs/core/modules/action/doc/pdf_standard_actions.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/core/lib/xcal.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/barcode/doc/phpbarcode.modules.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/barcode/mod_barcode_product_standard.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/cheque/doc/pdf_blochet.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanParamTooFew', 'PhanPluginSuspiciousParamPosition'],
'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'],
@ -299,8 +299,6 @@ return [
'htdocs/core/modules/mailings/contacts1.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/mailings/modules_mailings.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/member/doc/doc_generic_member_odt.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/member/doc/pdf_standard_member.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchProperty'],
'htdocs/core/modules/member/modules_cards.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
@ -308,8 +306,6 @@ return [
'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/modules/printing/modules_printing.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/core/modules/printing/printgcp.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchProperty'],
'htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchProperty'],
'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'],
@ -318,7 +314,6 @@ return [
'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/propale/modules_propale.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/rapport/pdf_paiement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'],
@ -364,14 +359,10 @@ return [
'htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
'htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/triggers/interface_50_modNotification_Notification.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess'],
'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanPluginEmptyStatementIf', 'PhanUndeclaredProperty'],
'htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php' => ['PhanUndeclaredProperty'],
'htdocs/cron/card.php' => ['PhanPluginBothLiteralsBinaryOp'],
'htdocs/cron/class/cronjob.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/cron/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'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/DolMemoryCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'],
@ -387,7 +378,7 @@ return [
'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'],
'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/don/class/api_donations.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/don/class/paymentdonation.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/don/document.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/don/index.php' => ['PhanPluginUndeclaredVariableIsset'],
@ -403,9 +394,7 @@ return [
'htdocs/ecm/class/htmlecm.form.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/ecm/dir_card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/ecm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
'htdocs/emailcollector/class/emailcollectoraction.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/emailcollector/class/emailcollectorfilter.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'],
'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
@ -416,7 +405,6 @@ return [
'htdocs/expedition/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/expedition/class/api_shipments.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/expedition/class/expedition.class.php' => ['PhanUndeclaredProperty'],
'htdocs/expedition/class/expeditionlinebatch.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/expedition/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/expedition/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/expedition/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
@ -425,7 +413,6 @@ return [
'htdocs/expedition/shipment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/expensereport/payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/payment/info.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
@ -437,17 +424,14 @@ return [
'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'],
'htdocs/fichinter/class/fichinterstats.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/fourn/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/class/fournisseur.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
'htdocs/fourn/class/paiementfourn.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/commande/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanUndeclaredProperty'],
'htdocs/fourn/commande/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimAssignment', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'],
'htdocs/fourn/commande/contact.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fourn/commande/dispatch.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fourn/commande/document.php' => ['PhanUndeclaredGlobalVariable'],
@ -486,7 +470,6 @@ return [
'htdocs/hrm/position_list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/hrm/skill_card.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/hrm/skill_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/imports/class/import.class.php' => ['PhanPluginEmptyStatementIf'],
'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/imports/import.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
@ -498,21 +481,16 @@ return [
'htdocs/install/step5.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/intracommreport/class/intracommreport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/knowledgemanagement/class/knowledgerecord.class.php' => ['PhanUndeclaredProperty'],
'htdocs/knowledgemanagement/knowledgerecord_card.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/knowledgemanagement/knowledgerecord_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/loan/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/loan/class/loan.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/loan/class/loanschedule.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'],
'htdocs/loan/class/paymentloan.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/loan/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/schedule.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/mailmanspip/class/mailmanspip.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/margin/customerMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/margin/productMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/master.inc.php' => ['PhanUndeclaredGlobalVariable'],
@ -523,18 +501,17 @@ return [
'htdocs/mrp/mo_production.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/mrp/tpl/originproductline.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/multicurrency/class/multicurrency.class.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/multicurrency/class/multicurrency.class.php' => ['PhanTypeExpectedObjectPropAccess'],
'htdocs/opcachepreload.php' => ['PhanEmptyForeach'],
'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'],
'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/opensurvey/list.php' => ['PhanEmptyForeach', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/opensurvey/results.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'],
'htdocs/opensurvey/wizard/choix_date.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/opensurvey/wizard/create_survey.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/partnership/class/api_partnerships.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/partnership/class/partnership.class.php' => ['PhanUndeclaredProperty'],
'htdocs/partnership/class/partnershiputils.class.php' => ['PhanPluginUnknownObjectMethodCall'],
'htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/partnership/partnership_card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/partnership/partnership_list.php' => ['PhanUndeclaredProperty'],
@ -544,14 +521,9 @@ return [
'htdocs/product/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/product/class/api_products.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
'htdocs/product/class/html.formproduct.class.php' => ['PhanUndeclaredProperty'],
'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/product/class/productbatch.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'],
'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/product/class/propalmergepdfproduct.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/product/document.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/product/dynamic_price/class/price_global_variable.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'],
'htdocs/product/dynamic_price/class/price_global_variable_updater.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'],
'htdocs/product/dynamic_price/class/price_parser.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
@ -634,7 +606,7 @@ return [
'htdocs/public/project/suggestconference.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/public/test/test_forms.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'],
@ -673,7 +645,6 @@ return [
'htdocs/salaries/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/salaries/class/api_salaries.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/salaries/class/paymentsalary.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/salaries/class/salariesstats.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/salaries/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/salaries/paiement_salary.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/salaries/virement_request.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
@ -691,7 +662,7 @@ return [
'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/website.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition'],
'htdocs/stripe/class/stripe.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty'],
'htdocs/stripe/class/stripe.class.php' => ['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'],
@ -718,7 +689,7 @@ return [
'htdocs/theme/md/info-box.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/md/progress.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/ticket/card.php' => ['PhanUndeclaredProperty'],
'htdocs/ticket/class/actions_ticket.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/ticket/class/actions_ticket.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/ticket/class/api_tickets.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'],
'htdocs/ticket/class/ticket.class.php' => ['PhanUndeclaredProperty'],
@ -743,7 +714,7 @@ return [
'htdocs/webhook/target_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/webportal/class/context.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/webportal/class/controller.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/webportal/class/webportalpropal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_actioncomm.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'],

View File

@ -223,7 +223,7 @@ return [
'simplify_ast' => true,
'analyzed_file_extensions' => ['php','inc'],
'globals_type_map' => [
'_Avery_Labels' => 'array<string,array{name:string,paper-size:string,orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:float,custom_x:float,custom_y:float}>',
'_Avery_Labels' => 'array<string,array{name:string,paper-size:string|array{0:float,1:float},orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:float,custom_x:float,custom_y:float}>',
'action' => 'string',
'actioncode' => 'string',
'badgeStatus0' => 'string',

View File

@ -203,8 +203,8 @@ foreach ($object->fields as $key => $val) {
$arrayfields[$tableprefix.'.'.$key] = array(
'label' => $val['label'],
'checked' => (($visible < 0) ? 0 : 1),
'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
'position' => $val['position'],
'enabled' => (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
'position' => (int) $val['position'],
'help' => isset($val['help']) ? $val['help'] : ''
);
}

View File

@ -876,7 +876,7 @@ class Paiement extends CommonObject
$fac = new Facture($this->db);
$fac->fetch($key);
$fac->fetch_thirdparty();
if (!in_array($fac->thirdparty->id, $linkaddedforthirdparty)) { // Not yet done for this thirdparty
if (!in_array($fac->thirdparty->id, $linkaddedforthirdparty)) { // Not yet done for this thirdparty @phan-suppress-current-line PhanPossiblyUndeclaredVariable
$result = $acc->add_url_line(
$bank_line_id,
$fac->thirdparty->id,

View File

@ -344,7 +344,7 @@ abstract class CommonObject
public $newref;
/**
* @var int|array<int, string> The object's status. Use status instead.
* @var null|int|array<int, string> The object's status. Use status instead.
* @deprecated Use $status instead.
* @see $status
* @see setStatut(), $status
@ -352,9 +352,10 @@ abstract class CommonObject
public $statut;
/**
* @var int|array<int, string> The object's status (an int).
* @var null|int|array<int, string> The object's status (an int).
* Or an array listing all the potential status of the object:
* array: int of the status => translated label of the status
* In some classes status must be able to be null.
* See for example the Account class.
* @see setStatut()
*/

View File

@ -107,12 +107,12 @@ abstract class CommonStickerGenerator extends CommonDocGenerator
protected $_COUNTY = 1;
protected $_First = 1;
/**
* @var array{name:string,paper-size:string,orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:float,custom_x:float,custom_y:float}
* @var ?array{name:string,paper-size:'custom'|array{0:float,1:float},orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:float,custom_x:float,custom_y:float}
*/
public $Tformat;
/**
* @var array<string,array{name:string,paper-size:string,orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:float,custom_x:float,custom_y:float}>
* @var array<string,array{name:string,paper-size:'custom'|array{0:float,1:float},orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:float,custom_x:float,custom_y:float}>
*/
public $_Avery_Labels;
// phpcs:enable

View File

@ -104,7 +104,7 @@ class pdf_standard_actions
public $marge_basse;
/**
* @var array format
* @var array{0:float,1:float} format
*/
public $format;

View File

@ -57,6 +57,9 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
*/
public $line_per_page;
/**
* @var string
*/
public $ref_ext;
@ -206,7 +209,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$this->Body($pdf, $pagenb, $pages, $outputlangs);
// Pied de page
$this->_pagefoot($pdf, '', $outputlangs);
$this->_pagefoot($pdf, null, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) {
$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
}
@ -422,10 +425,10 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param ?CommonObject $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return mixed
* @param int<0,1> $hidefreetext 1=Hide free text
* @return int
*/
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{

View File

@ -295,6 +295,7 @@ class doc_generic_member_odt extends ModelePDFMember
$result = $object->fetch_contact($arrayidcontact[0]);
}
$contactobject = null;
// Recipient name
if (!empty($usecontact)) {
// We can use the company of contact instead of thirdparty company
@ -426,7 +427,7 @@ class doc_generic_member_odt extends ModelePDFMember
* @param CommonObject $object member
* @param Translate $outputlangs translation object
* @param string $array_key key for array
* @return array array of substitutions
* @return array<string,string> Array of substitutions
*/
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
{

View File

@ -67,7 +67,7 @@ class pdf_standard_member extends CommonStickerGenerator
*
* @param TCPDF $pdf PDF reference
* @param Translate $outputlangs Output langs
* @param array $param Associative array containing label content and optional parameters
* @param array<string,string> $param Associative array containing label content and optional parameters
* @return void
*/
public function addSticker(&$pdf, $outputlangs, $param)

View File

@ -39,7 +39,7 @@ class pdf_standardlabel extends CommonStickerGenerator
*
* @param TCPDF $pdf PDF reference
* @param Translate $outputlangs Output langs
* @param array $param Associative array containing label content and optional parameters
* @param array<string,string> $param Associative array containing label content and optional parameters
* @return void
*/
public function addSticker(&$pdf, $outputlangs, $param)
@ -228,7 +228,7 @@ class pdf_standardlabel extends CommonStickerGenerator
/**
* Function to build PDF on disk, then output on HTTP stream.
*
* @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param array<array{textleft:string,textheader:string,textfooter:string,textright:string,photo:string}> $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $outputdir Output directory for pdf file

View File

@ -94,7 +94,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
*
* @param TCPDF $pdf PDF reference
* @param Translate $outputlangs Output langs
* @param array $param Associative array containing label content and optional parameters
* @param array{textleft:string,textheader:string,textfooter:string,textright:string,code:string,encoding:string,is2d:int<0,1>|bool} $param Associative array containing label content and optional parameters
* @return void
*/
public function addSticker(&$pdf, $outputlangs, $param)
@ -251,7 +251,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
/**
* Function to build PDF on disk, then output on HTTP stream.
*
* @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param array<array{textleft:string,textheader:string,textfooter:string,textright:string,code:string,encoding:string,is2d:int<0,1>|bool}> $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $outputdir Output directory for pdf file

View File

@ -37,22 +37,55 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
*/
class pdf_paiement extends CommonDocGenerator
{
/**
* @var int
*/
public $tab_top;
/**
* @var int
*/
public $line_height;
/**
* @var int
*/
public $line_per_page;
/**
* @var int
*/
public $tab_height;
/**
* @var int
*/
public $posxdate;
/**
* @var int
*/
public $posxpaymenttype;
/**
* @var int
*/
public $posxinvoice;
/**
* @var int
*/
public $posxbankaccount;
/**
* @var int
*/
public $posxinvoiceamount;
/**
* @var int
*/
public $posxpaymentamount;
/**
* @var string
*/
public $doc_type;
/**
@ -208,6 +241,8 @@ class pdf_paiement extends CommonDocGenerator
$result = $this->db->query($sql);
if ($result) {
$numpaiement = $this->db->num_rows($result);
} else {
$numpaiement = 0;
}
// number of bill
@ -464,7 +499,7 @@ class pdf_paiement extends CommonDocGenerator
*
* @param TCPDF $pdf PDF object
* @param int $page Page
* @param array $lines Array of lines
* @param array<int,array<int,string>> $lines Array of lines
* @param Translate $outputlangs Object langs
* @return void
*/
@ -477,13 +512,14 @@ class pdf_paiement extends CommonDocGenerator
$pdf->SetFont('', '', $default_font_size - 1);
$oldprowid = 0;
$total_page = 0;
$total_mod = 0;
$mod = 0;
$total = 0;
$pdf->SetFillColor(220, 220, 220);
$yp = 0;
$numlines = count($lines);
if (($this->doc_type == 'client' && getDolGlobalString('PAYMENTS_REPORT_GROUP_BY_MOD')) || ($this->doc_type == 'fourn' && getDolGlobalString('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD'))) {
$mod = $lines[0][2];
$total_mod = 0;
}
for ($j = 0; $j < $numlines; $j++) {
$i = $j;
@ -528,9 +564,9 @@ class pdf_paiement extends CommonDocGenerator
$pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][4], 0, 'R', 1);
$yp += 5;
$total_page += $lines[$j][9];
$total_page += (float) $lines[$j][9];
if (($this->doc_type == 'client' && getDolGlobalString('PAYMENTS_REPORT_GROUP_BY_MOD')) || ($this->doc_type == 'fourn' && getDolGlobalString('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD'))) {
$total_mod += $lines[$j][9];
$total_mod += (float) $lines[$j][9];
}
}

View File

@ -33,6 +33,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
*/
class InterfaceNotification extends DolibarrTriggers
{
/**
* @var string[]
*/
public $listofmanagedevents = array();
/**
@ -102,7 +105,7 @@ class InterfaceNotification extends DolibarrTriggers
/**
* Return list of events managed by notification module
*
* @return array Array of events managed by notification module
* @return array<array{rowid:int,code:string,contexts:string,label:string,description:string,elementtype:string}> Array of events managed by notification module
*/
public function getListOfManagedEvents()
{

View File

@ -198,14 +198,15 @@ class InterfaceTicketEmail extends DolibarrTriggers
$contactid = empty($object->context['contactid']) ? 0 : $object->context['contactid'];
$res = 0;
$contactObj = null;
if (!empty($contactid)) {
$contact = new Contact($this->db);
$res = $contact->fetch($contactid);
$contactObj = new Contact($this->db);
$res = $contactObj->fetch($contactid);
}
if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
$sendto = $contact->email;
if ($contactObj !== null && !empty($contactObj->email) && !empty($contactObj->statut)) {
$sendto = $contactObj->email;
} elseif (!empty($object->fk_soc)) {
$object->fetch_thirdparty();
$sendto = $object->thirdparty->email;
@ -256,13 +257,14 @@ class InterfaceTicketEmail extends DolibarrTriggers
$contactid = empty($object->context['contactid']) ? 0 : $object->context['contactid'];
$res = 0;
$contactObj = null;
if ($contactid > 0) {
// TODO This security test has no sens. We must check that $contactid is inside $linked_contacts[]['id'] when $linked_contacts[]['source'] = 'external' or 'thirdparty'
// Refuse email if not
$contact = new Contact($this->db);
$res = $contact->fetch($contactid);
if (! in_array($contact, $linked_contacts)) {
$contactObj = new Contact($this->db);
$res = $contactObj->fetch($contactid);
if (! in_array($contactObj, $linked_contacts)) {
$error_msg = $langs->trans('Error'). ': ';
$error_msg .= $langs->transnoentities('TicketWrongContact');
setEventMessages($error_msg, [], 'errors');
@ -272,8 +274,8 @@ class InterfaceTicketEmail extends DolibarrTriggers
}
$sendto = '';
if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
$sendto = $contact->email;
if ($contactObj !== null && $res > 0 && !empty($contactObj->email) && !empty($contactObj->statut)) {
$sendto = $contactObj->email;
} elseif (!empty($linked_contacts) && ($contactid == -2 || (GETPOST('massaction', 'alpha') == 'close' && GETPOST('confirm', 'alpha') == 'yes'))) {
// if sending to all contacts or sending to contacts while mass closing
$temp_emails = [];
@ -350,6 +352,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
$trackid = 'tic'.$object->id;
$old_MAIN_MAIL_AUTOCOPY_TO = null;
if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
$old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';

View File

@ -206,10 +206,10 @@ class InterfaceStripe extends DolibarrTriggers
}
// If payment mode is linked to Stripe, we update/delete Stripe too
if ($action == 'COMPANYPAYMENTMODE_CREATE' && $object->type == 'card') {
// For creation of credit card, we do not create in Stripe automatically
}
if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card' && $object instanceof CompanyPaymentMode) {
//if ($action == 'COMPANYPAYMENTMODE_CREATE' && $object instanceof CompanyPaymentMode && $object->type == 'card') {
// For creation of credit card, we do not create in Stripe automatically
//}
if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object instanceof CompanyPaymentMode && $object->type == 'card') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($object->stripe_card_ref)) {

View File

@ -73,12 +73,33 @@ class Cronjob extends CommonObject
* @var string Job command
*/
public $command;
/**
* @var null|string
*/
public $classesname;
/**
* @var null|string
*/
public $objectname;
/**
* @var null|string
*/
public $methodename;
/**
* @var null|string
*/
public $params;
/**
* @var null|string
*/
public $md5params;
/**
* @var null|string
*/
public $module_name;
/**
* @var null|int|string
*/
public $priority;
/**
@ -515,9 +536,9 @@ class Cronjob extends CommonObject
* @param string $sortfield Sort field
* @param int $limit Limit page
* @param int $offset Offset ppage
* @param int $status Display active or not (-1=no filter, 0=not active, 1=active, 2=archived)
* @param string|array $filter Filter USF.
* @param int $processing Processing or not (-1=all, 0=not in progress, 1=in progress)
* @param int<-1,2> $status Display active or not (-1=no filter, 0=not active, 1=active, 2=archived)
* @param string|array<string,string> $filter Filter USF.
* @param int<-1,1> $processing Processing or not (-1=all, 0=not in progress, 1=in progress)
* @return int if KO: <0 || if OK: >0
*/
public function fetchAll(string $sortorder = 'DESC', string $sortfield = 't.rowid', int $limit = 0, int $offset = 0, int $status = 1, $filter = '', int $processing = -1)

View File

@ -34,8 +34,14 @@ class DataPolicyCron
*/
public $db;
/**
* @var string
*/
public $error;
/**
* @var string
*/
public $output;

View File

@ -477,10 +477,10 @@ class Don extends CommonObject
}
}
if (!$error && (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_DONATION'))) {
//$res = $this->setValid($user);
//if ($res < 0) $error++;
}
//if (!$error && (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_DONATION'))) {
//$res = $this->setValid($user);
//if ($res < 0) $error++;
//}
if (!$error) {
$this->db->commit();

View File

@ -1179,6 +1179,8 @@ class EmailCollector extends CommonObject
return -1;
}
$client = null;
$sourcedir = $this->source_directory;
$targetdir = ($this->target_directory ? $this->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag'

View File

@ -84,15 +84,42 @@ class EmailCollectorAction extends CommonObject
'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,),
'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')),
);
/**
* @var int
*/
public $rowid;
/**
* @var int
*/
public $fk_emailcollector;
/**
* @var string
*/
public $type;
/**
* @var string
*/
public $actionparam;
/**
* @var int
*/
public $fk_user_creat;
/**
* @var int
*/
public $fk_user_modif;
/**
* @var int
*/
public $position;
/**
* @var string
*/
public $import_key;
/**
* @var int
*/
public $status;
// END MODULEBUILDER PROPERTIES

View File

@ -85,14 +85,38 @@ class EmailCollectorFilter extends CommonObject
'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,),
'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '1', 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')),
);
/**
* @var int
*/
public $rowid;
/**
* @var int
*/
public $fk_emailcollector;
/**
* @var string
*/
public $type;
/**
* @var string
*/
public $rulevalue;
/**
* @var int
*/
public $fk_user_creat;
/**
* @var int
*/
public $fk_user_modif;
/**
* @var string
*/
public $import_key;
/**
* @var int
*/
public $status;
// END MODULEBUILDER PROPERTIES

View File

@ -511,8 +511,8 @@ class ExpeditionLigne extends CommonObjectLine
$qty = price2num($this->qty);
$remainingQty = 0;
$batch = null;
$batch_id = null;
$expedition_batch_id = null;
$batch_id = 0;
$expedition_batch_id = 0;
if (is_array($this->detail_batch)) { // array of ExpeditionLineBatch
if (count($this->detail_batch) > 1) {
dol_syslog(get_class($this).'::update only possible for one batch', LOG_ERR);
@ -605,7 +605,7 @@ class ExpeditionLigne extends CommonObjectLine
$shipmentLot->sellby = $lot->sellby;
$shipmentLot->entrepot_id = $this->detail_batch->entrepot_id;
$shipmentLot->qty = $this->detail_batch->qty;
$shipmentLot->fk_origin_stock = $batch_id;
$shipmentLot->fk_origin_stock = (int) $batch_id;
if ($shipmentLot->create($this->id) < 0) {
$this->errors = $shipmentLot->errors;
$error++;

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.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
@ -38,18 +39,43 @@ class ExpeditionLineBatch extends CommonObject
*/
public $table_element = 'expeditiondet_batch';
/**
* @var null|int|string
*/
public $sellby;
/**
* @var null|int|string
*/
public $eatby;
/**
* @var ?string
*/
public $batch;
/**
* @var float Quantity
*/
public $qty;
public $dluo_qty; // deprecated, use qty
/**
* @var null|float
* @deprecated Use $qty
*/
public $dluo_qty;
/**
* @var int
*/
public $entrepot_id;
/**
* @var int
*/
public $fk_origin_stock; // rowid in llx_product_batch table (not useful)
/**
* @var int
*/
public $fk_warehouse; // warehouse ID
/**
* @var int
*/
public $fk_expeditiondet;
@ -134,10 +160,10 @@ class ExpeditionLineBatch extends CommonObject
$sql .= $id_line_expdet;
$sql .= ", ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : ("'".$this->db->idate($this->sellby))."'");
$sql .= ", ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : ("'".$this->db->idate($this->eatby))."'");
$sql .= ", ".(!isset($this->batch) ? 'NULL' : ("'".$this->db->escape($this->batch)."'"));
$sql .= ", ".(!empty($this->batch) ? 'NULL' : ("'".$this->db->escape($this->batch)."'"));
$sql .= ", ".(!isset($this->qty) ? ((!isset($this->dluo_qty)) ? 'NULL' : $this->dluo_qty) : $this->qty); // dluo_qty deprecated, use qty
$sql .= ", ".(!isset($this->fk_origin_stock) ? 'NULL' : $this->fk_origin_stock);
$sql .= ", ".(!isset($this->fk_warehouse) ? 'NULL' : $this->fk_warehouse);
$sql .= ", ".((int) $this->fk_origin_stock);
$sql .= ", ".(empty($this->fk_warehouse) ? 'NULL' : $this->fk_warehouse);
$sql .= ")";
dol_syslog(__METHOD__, LOG_DEBUG);
@ -195,9 +221,9 @@ class ExpeditionLineBatch extends CommonObject
/**
* Retrieve all batch number detailed information of a shipment line
*
* @param int $id_line_expdet id of shipment line
* @param int $fk_product If provided, load also detailed information of lot
* @return int|array -1 if KO, array of ExpeditionLineBatch if OK
* @param int $id_line_expdet id of shipment line
* @param int $fk_product If provided, load also detailed information of lot
* @return int<-1,-1>|ExpeditionLineBatch[] -1 if KO, array of ExpeditionLineBatch if OK
*/
public function fetchAll($id_line_expdet, $fk_product = 0)
{

View File

@ -557,6 +557,7 @@ class PaymentExpenseReport extends CommonObject
//Fix me field
$total = $this->amount;
$amount = 0;
if ($mode == 'payment_expensereport') {
$amount = $total;
@ -569,7 +570,7 @@ class PaymentExpenseReport extends CommonObject
$label,
-$amount,
$this->num_payment,
'',
0,
$user,
$emetteur_nom,
$emetteur_banque

View File

@ -39,11 +39,26 @@ class FichinterStats extends Stats
*/
public $table_element;
/**
* @var int
*/
public $socid;
/**
* @var int
*/
public $userid;
/**
* @var string
*/
public $from;
/**
* @var string
*/
public $field;
/**
* @var string
*/
public $where;

View File

@ -35,7 +35,7 @@ class SupplierInvoices extends DolibarrApi
{
/**
*
* @var array $FIELDS Mandatory fields, checked when create and update object
* @var string[] $FIELDS Mandatory fields, checked when create and update object
*/
public static $FIELDS = array(
'socid',

View File

@ -3,6 +3,7 @@
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* 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
@ -190,7 +191,7 @@ class Fournisseur extends Societe
/**
* Return the suppliers list
*
* @return array Array of suppliers
* @return array<int,string> Array of suppliers
*/
public function ListArray()
{

View File

@ -83,7 +83,7 @@ class CommandeFournisseur extends CommonOrder
/**
* 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;
@ -115,7 +115,7 @@ class CommandeFournisseur extends CommonOrder
public $ref_fourn;
/**
* @var int
* @var ?int<0,9>
*/
public $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Ordered/Process running -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially
// -> 7=Canceled/Never received -> (reopen) 3=Process running
@ -123,6 +123,9 @@ class CommandeFournisseur extends CommonOrder
// -> 9=Refused -> (reopen) 1=Validated
// Note: billed or not is on another field "billed"
/**
* @var int<0,1>
*/
public $billed;
/**
@ -161,9 +164,18 @@ class CommandeFournisseur extends CommonOrder
*/
public $date_commande;
//For backward compatibility
/**
* @deprecated Provided or backward compatibility
* @var float
*/
public $remise_percent;
/**
* @var int
*/
public $methode_commande_id;
/**
* @var int
*/
public $methode_commande;
/**
@ -196,6 +208,9 @@ class CommandeFournisseur extends CommonOrder
*/
public $total_ttc;
/**
* @var int
*/
public $source;
/**
@ -259,6 +274,9 @@ class CommandeFournisseur extends CommonOrder
*/
public $user_approve_id2;
/**
* @var string
*/
public $refuse_note;
/**
@ -276,8 +294,13 @@ class CommandeFournisseur extends CommonOrder
*/
public $line;
// Add for supplier_proposal
/**
* @var CommonObject Add for supplier_proposal
*/
public $origin;
/**
* @var int
*/
public $origin_id;
public $linked_objects = array();
@ -969,7 +992,7 @@ class CommandeFournisseur extends CommonOrder
if ($user->hasRight("fournisseur", "commande", "read")) {
$datas['picto'] = '<u class="paddingrightonly">'.$langs->trans("SupplierOrder").'</u>';
if (isset($this->statut)) {
if ($this->statut) {
$datas['picto'] .= ' '.$this->getLibStatut(5);
}
if (!empty($this->ref)) {
@ -2523,7 +2546,7 @@ class CommandeFournisseur extends CommonOrder
* @since 8.0 Return dispatched quantity (qty).
*
* @param int $status Filter on stats (-1 = no filter, 0 = lines draft to be approved, 1 = approved lines)
* @return array Array of lines
* @return array<array{id:int,productid:int,warehouseid:int,qty:float,orderlineid:int}> Array of lines
*/
public function getDispachedLines($status = -1)
{
@ -2574,8 +2597,8 @@ class CommandeFournisseur extends CommonOrder
* Set a delivery in database for this supplier order
*
* @param User $user User that input data
* @param integer $date Date of reception
* @param string $type Type of receipt ('tot' = total/done, 'par' = partial, 'nev' = never, 'can' = cancel)
* @param int $date Date of reception
* @param 'tot'|'par'|'nev'|'can' $type Type of receipt ('tot' = total/done, 'par' = partial, 'nev' = never, 'can' = cancel)
* @param string $comment Comment
* @return int Return integer <0 if KO, >0 if OK
*/
@ -2586,6 +2609,7 @@ class CommandeFournisseur extends CommonOrder
$result = 0;
$error = 0;
$dispatchedlinearray = array();
dol_syslog(get_class($this)."::Livraison");
@ -2925,9 +2949,9 @@ class CommandeFournisseur extends CommonOrder
* @param int $info_bits Miscellaneous information
* @param int $type Type of line (0=product, 1=service)
* @param int $notrigger Disable triggers
* @param integer $date_start Date start of service
* @param integer $date_end Date end of service
* @param array $array_options Extrafields array
* @param int $date_start Date start of service
* @param int $date_end Date end of service
* @param array<string,mixed|mixed[]> $array_options Extrafields array
* @param int|null $fk_unit Code of the unit to use. Null to use the default one
* @param int|float $pu_ht_devise Unit price in currency
* @param string $ref_supplier Supplier ref
@ -3379,10 +3403,10 @@ class CommandeFournisseur extends CommonOrder
*
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs Object lang to use for 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
* @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 = no doc generated, > 0 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)

View File

@ -2595,8 +2595,8 @@ class FactureFournisseur extends CommonInvoice
* Return list of replaceable invoices
* Status valid or abandoned for other reason + not paid + no payment + not already replaced
*
* @param int $socid Thirdparty id
* @return array|int Table of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
* @param int $socid Thirdparty id
* @return array<int,array{id:int,ref:string,status:int}>|int<-1,-1> Table of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
* <0 if error
*/
public function list_replacable_supplier_invoices($socid = 0)
@ -2646,7 +2646,7 @@ class FactureFournisseur extends CommonInvoice
* (validated + payment in progress) or classified (paid in full or paid in part) + not already replaced + not already having
*
* @param int $socid Thirdparty id
* @return array|int Table of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
* @return array<int,array{ref:string,status:int,type:int,paye:int<0,1>,paymentornot:int<0,1>}>|int<-1,-1> Table of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
* <0 if error
*/
public function list_qualified_avoir_supplier_invoices($socid = 0)
@ -2682,7 +2682,7 @@ class FactureFournisseur extends CommonInvoice
}
if ($qualified) {
$paymentornot = ($obj->fk_paiementfourn ? 1 : 0);
$return[$obj->rowid] = array('ref' => $obj->ref, 'status' => $obj->fk_statut, 'type' => $obj->type, 'paye' => $obj->paye, 'paymentornot' => $paymentornot);
$return[$obj->rowid] = array('ref' => (string) $obj->ref, 'status' => (int) $obj->fk_statut, 'type' => (int) $obj->type, 'paye' => (int) $obj->paye, 'paymentornot' => (int) $paymentornot);
}
}

View File

@ -54,7 +54,10 @@ class PaiementFourn extends Paiement
*/
public $picto = 'payment';
public $statut; //Status of payment. 0 = unvalidated; 1 = validated
/**
* @var int Status of payment. 0 = unvalidated; 1 = validated
*/
public $statut;
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
// fk_paiement dans llx_paiement_facture est le rowid du paiement
@ -239,6 +242,8 @@ class PaiementFourn extends Paiement
$totalamount = (float) price2num($totalamount);
$totalamount_converted = (float) price2num($totalamount_converted);
$mtotal = 0;
$total = 0;
dol_syslog(get_class($this)."::create", LOG_DEBUG);
@ -302,7 +307,7 @@ class PaiementFourn extends Paiement
// Insert one discount by VAT rate category
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
$discount = new DiscountAbsolute($this->db);
$discount->fetch('', 0, $invoice->id);
$discount->fetch(0, 0, $invoice->id);
if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here)
$discount->discount_type = 1; // Supplier discount
$discount->description = '(DEPOSIT)';
@ -565,7 +570,7 @@ class PaiementFourn extends Paiement
* Return list of supplier invoices the payment point to
*
* @param string $filter SQL filter. Warning: This value must not come from a user input.
* @return array|int Array of supplier invoice id | <0 si ko
* @return array<int,int>|int<-1,-1> Array of supplier invoice id | <0 si ko
*/
public function getBillsArray($filter = '')
{
@ -848,13 +853,13 @@ class PaiementFourn extends Paiement
/**
* Create a document onto disk according to template model.
*
* @param string $modele Force template to use ('' to not force)
* @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 nothing done, >0 if OK
* @param string $modele Force template to use ('' to not force)
* @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 nothing done, >0 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{

View File

@ -1306,7 +1306,7 @@ if (empty($reshook)) {
$object->origin_id = $originid;
// Possibility to add external linked objects with hooks
$object->linked_objects [$object->origin] = $object->origin_id;
$object->linked_objects[$object->origin] = $object->origin_id;
$other_linked_objects = GETPOST('other_linked_objects', 'array');
if (!empty($other_linked_objects)) {
$object->linked_objects = array_merge($object->linked_objects, $other_linked_objects);
@ -1521,7 +1521,7 @@ if (empty($reshook)) {
* View
*/
$form = new Form($db);
$form = new Form($db);
$formfile = new FormFile($db);
$formorder = new FormOrder($db);
$productstatic = new Product($db);
@ -1934,7 +1934,7 @@ if ($action == 'create') {
$text = $langs->trans('ConfirmValidateOrder', $newref);
if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db);
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('ORDER_SUPPLIER_VALIDATE', $object->socid, $object);
}
@ -1971,7 +1971,7 @@ if ($action == 'create') {
$text = $langs->trans("ConfirmApproveThisOrder", $object->ref);
if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db);
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid, $object);
}
@ -2006,7 +2006,7 @@ if ($action == 'create') {
);
if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db);
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('ORDER_SUPPLIER_CANCEL', $object->socid, $object);
}
@ -2018,7 +2018,7 @@ if ($action == 'create') {
$date_com = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear"));
if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db);
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('ORDER_SUPPLIER_SUBMIT', $object->socid, $object);
}

View File

@ -453,16 +453,15 @@ class Import
$this->errors[] = "Error ".$this->db->lasterror();
}
/* Not used. This is not a business object. To convert it we must herit from CommonObject
if (!$error) {
if (!$notrigger) {
/* Not used. This is not a business object. To convert it we must herit from CommonObject
// Call trigger
$result=$this->call_trigger('IMPORT_DELETE',$user);
if ($result < 0) $error++;
// End call triggers
*/
}
}
*/
// Commit or rollback
if ($error) {

View File

@ -142,7 +142,13 @@ class IntracommReport extends CommonObject
* @var string
*/
public $type_export;
/**
* @var int|string
*/
public $datec;
/**
* @var int
*/
public $tms;
// END MODULEBUILDER PROPERTIES
@ -152,8 +158,14 @@ class IntracommReport extends CommonObject
*/
public $label;
/**
* @var string
*/
public $period;
/**
* @var string
*/
public $declaration;
/**
@ -391,6 +403,7 @@ class IntracommReport extends CommonObject
return 0;
}
$categ_fraisdeport = null;
if ($exporttype == 'deb' && getDolGlobalInt('INTRACOMMREPORT_CATEG_FRAISDEPORT') > 0) {
$categ_fraisdeport = new Categorie($this->db);
$categ_fraisdeport->fetch(getDolGlobalString('INTRACOMMREPORT_CATEG_FRAISDEPORT'));
@ -530,7 +543,7 @@ class IntracommReport extends CommonObject
* This function adds an item by retrieving the customs code of the product with the highest amount in the invoice
*
* @param SimpleXMLElement $declaration Reference declaration
* @param array $TLinesFraisDePort Data of shipping costs line
* @param Object[] $TLinesFraisDePort Data of shipping costs line
* @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des)
* @param Categorie $categ_fraisdeport category of shipping costs
* @param int $i Line Id
@ -595,11 +608,12 @@ class IntracommReport extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE exporttype = '".$this->db->escape($this->type_export)."'";
$resql = $this->db->query($sql);
$res = null;
if ($resql) {
$res = $this->db->fetch_object($resql);
}
return (string) ($res->max_declaration_number + 1);
return (string) ($res !== null ? ($res->max_declaration_number + 1) : '');
}
/**

View File

@ -350,7 +350,7 @@ class Loan extends CommonObject
// Get bank transaction lines for this loan
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$account = new Account($this->db);
$lines_url = $account->get_url('', $this->id, 'loan');
$lines_url = $account->get_url(0, $this->id, 'loan');
// Delete bank urls
foreach ($lines_url as $line_url) {

View File

@ -46,7 +46,13 @@ class LoanSchedule extends CommonObject
*/
public $fk_loan;
/**
* @var int
*/
public $bank_account;
/**
* @var int
*/
public $bank_line;
/**
@ -59,9 +65,21 @@ class LoanSchedule extends CommonObject
*/
public $datep;
/**
* @var float[]
*/
public $amounts = array(); // Array of amounts
public $amount_capital; // Total amount of payment
/**
* @var null|float|string Total amount of payment
*/
public $amount_capital;
/**
* @var null|float|string
*/
public $amount_insurance;
/**
* @var null|float|string
*/
public $amount_interest;
/**
@ -102,12 +120,19 @@ class LoanSchedule extends CommonObject
public $lines = array();
/**
* @deprecated
* @deprecated Use $amount, $amounts
* @see $amount, $amounts
* @var float
*/
public $total;
/**
* @var string
*/
public $type_code;
/**
* @var string
*/
public $type_label;
@ -565,9 +590,9 @@ class LoanSchedule extends CommonObject
/**
* paimenttorecord
*
* @param int $loanid Loan id
* @param int $datemax Date max
* @return array Array of id
* @param int $loanid Loan id
* @param int $datemax Date max
* @return int[] Array of id
*/
public function paimenttorecord($loanid, $datemax)
{

View File

@ -78,7 +78,7 @@ class PaymentLoan extends CommonObject
public $amount_insurance;
/**
* @var float|int
* @var null|float|int
*/
public $amount_interest;
@ -116,6 +116,9 @@ class PaymentLoan extends CommonObject
* @var string
*/
public $type_label;
/**
* @var int
*/
public $chid;
/**
* @var string
@ -131,6 +134,9 @@ class PaymentLoan extends CommonObject
* @var int
*/
public $bank_account;
/**
* @var int
*/
public $bank_line;
@ -552,7 +558,7 @@ class PaymentLoan extends CommonObject
$label,
$total,
$this->num_payment,
'',
0,
$user,
$emetteur_nom,
$emetteur_banque

View File

@ -56,22 +56,22 @@ class MailmanSpip
public $errors = array();
/**
* @var array
* @var array<string,string>
*/
public $mladded_ok;
/**
* @var array
* @var array<string,string>
*/
public $mladded_ko;
/**
* @var array
* @var array<string,string>
*/
public $mlremoved_ok;
/**
* @var array
* @var array<string,string>
*/
public $mlremoved_ko;

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2022 J-F Bouculat <jfbouculat@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
@ -144,7 +145,7 @@ class MultiCurrencies extends DolibarrApi
public function getByCode($code)
{
$multicurrency = new MultiCurrency($this->db);
if (!$multicurrency->fetch('', $code)) {
if (!$multicurrency->fetch(0, $code)) {
throw new RestException(404, 'Currency not found');
}

View File

@ -713,13 +713,13 @@ class MultiCurrency extends CommonObject
/**
* Check in database if the current code already exists
*
* @param string $code current code to search
* @return boolean True if exists, false if not exists
* @param string $code current code to search
* @return bool True if exists, false if not exists
*/
public function checkCodeAlreadyExists($code)
{
$currencytmp = new MultiCurrency($this->db);
if ($currencytmp->fetch('', $code) > 0) {
if ($currencytmp->fetch(0, $code) > 0) {
return true;
} else {
return false;

View File

@ -97,7 +97,7 @@ if (empty($reshook)) {
accessforbidden();
}
$result = $object->delete($user, '', $numsondage);
$result = $object->delete($user, 0, $numsondage);
header('Location: '.dol_buildpath('/opensurvey/list.php', 1));
exit();
@ -217,7 +217,7 @@ $toutsujet = explode(",", $object->sujet);
$listofanswers = array();
foreach ($toutsujet as $value) {
$tmp = explode('@', $value);
$listofanswers[] = array('label'=>$tmp[0], 'format'=>(!empty($tmp[1]) ? $tmp[1] : 'checkbox'));
$listofanswers[] = array('label' => $tmp[0], 'format' => (!empty($tmp[1]) ? $tmp[1] : 'checkbox'));
}
$toutsujet = str_replace("@", "<br>", $toutsujet);
$toutsujet = str_replace("°", "'", $toutsujet);
@ -350,7 +350,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
$url = $urlwithroot.'/public/opensurvey/studs.php?sondage='.$object->id_sondage;
print '<input type="text" class="quatrevingtpercent" '.($action == 'edit' ? 'disabled' : '').' id="opensurveyurl" name="opensurveyurl" value="'.$url.'">';
//if ($action != 'edit') {
print ajax_autoselect("opensurveyurl", $url, 'image');
print ajax_autoselect("opensurveyurl", $url, 'image');
//}
print '</td></tr>';

View File

@ -157,6 +157,9 @@ class Opensurveysondage extends CommonObject
* @var int|'' end date of survey
*/
public $date_fin = '';
/**
* @var int
*/
public $status;
/**
@ -393,7 +396,7 @@ class Opensurveysondage extends CommonObject
$sql .= " nom_admin=".(isset($this->nom_admin) ? "'".$this->db->escape($this->nom_admin)."'" : "null").",";
$sql .= " titre=".(isset($this->title) ? "'".$this->db->escape($this->title)."'" : "null").",";
$sql .= " date_fin=".(dol_strlen($this->date_fin) != 0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').",";
$sql .= " status=".(isset($this->status) ? "'".$this->db->escape($this->status)."'" : "null").",";
$sql .= " status=".(!empty($this->status) ? (int) $this->status : "null").",";
$sql .= " format=".(isset($this->format) ? "'".$this->db->escape($this->format)."'" : "null").",";
$sql .= " mailsonde=".(isset($this->mailsonde) ? ((int) $this->mailsonde) : "null").",";
$sql .= " allow_comments=".((int) $this->allow_comments).",";
@ -528,10 +531,10 @@ class Opensurveysondage extends CommonObject
/**
* Return a link to the object card (with optionally the picto)
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int<0,2> $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param int<0,1> $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
@ -694,10 +697,10 @@ class Opensurveysondage extends CommonObject
/**
* Adds a comment to the poll
*
* @param string $comment Comment content
* @param string $comment_user Comment author
* @param string $user_ip Comment author IP
* @return boolean False in case of the query fails, true if it was successful
* @param string $comment Comment content
* @param string $comment_user Comment author
* @param string $user_ip Comment author IP
* @return bool False in case of the query fails, true if it was successful
*/
public function addComment($comment, $comment_user, $user_ip = '')
{

View File

@ -552,6 +552,7 @@ class PartnershipUtils
$xpath = new DOMXPath($dom);
$hrefs = $xpath->evaluate("//a");
'@phan-var-force DOMNodeList $hrefs';
for ($i = 0; $i < $hrefs->length; $i++) {
$href = $hrefs->item($i);

View File

@ -611,47 +611,47 @@ class Product extends CommonObject
public $barcode_type_code;
/**
* @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats propales
* @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats propales
*/
public $stats_propale = array();
/**
* @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats orders
* @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats orders
*/
public $stats_commande = array();
/**
* @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats contracts
* @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats contracts
*/
public $stats_contrat = array();
/**
* @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats invoices
* @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats invoices
*/
public $stats_facture = array();
/**
* @var array{}|array{suppliers:int,nb:int,rows:int,qty:int} stats supplier propales
* @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats supplier propales
*/
public $stats_proposal_supplier = array();
/**
* @var array{}|array{suppliers:int,nb:int,rows:int,qty:int|float} stats supplier orders
* @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats supplier orders
*/
public $stats_commande_fournisseur = array();
/**
* @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats shipping
* @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats shipping
*/
public $stats_expedition = array();
/**
* @var array{}|array{suppliers:int,nb:int,rows:int,qty:int|float} stats receptions
* @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats receptions
*/
public $stats_reception = array();
/**
* @var array{}|array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:int,customers_consumed:int,nb_consumed:int,qty_consumed:int,customers_toproduce:int,nb_toproduce:int,qty_toproduce:int,customers_produced:int,nb_produced:int,qty_produced:int} stats by role toconsume, consumed, toproduce, produced
* @var array{}|array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:float,customers_consumed:int,nb_consumed:int,qty_consumed:float,customers_toproduce:int,nb_toproduce:int,qty_toproduce:float,customers_produced:int,nb_produced:int,qty_produced:float} stats by role toconsume, consumed, toproduce, produced
*/
public $stats_mo = array();
public $stats_bom = array();
@ -687,7 +687,9 @@ class Product extends CommonObject
*/
public $nbphoto = 0;
//! Contains detail of stock of product into each warehouse
/**
* @var array<int,stdClass> Contains detail of stock of product into each warehouse
*/
public $stock_warehouse = array();
/**
@ -1475,7 +1477,7 @@ class Product extends CommonObject
$ObjBatch = new Productbatch($this->db);
$ObjBatch->batch = $valueforundefinedlot;
$ObjBatch->qty = ($ObjW->real - $qty_batch);
$ObjBatch->fk_product_stock = $ObjW->id;
$ObjBatch->fk_product_stock = (int) $ObjW->id;
if ($ObjBatch->create($user, 1) < 0) {
$error++;
@ -5287,7 +5289,7 @@ class Product extends CommonObject
* Function recursive, used only by get_arbo_each_prod(), to build tree of subproducts into ->res
* Define value of this->res
*
* @param array $prod Products array
* @param array<int,array{0:int,1:float,2:int,3:string,4:int,5:string}> $prod Products array
* @param string $compl_path Directory path of parents to add before
* @param int $multiply Because each sublevel must be multiplicated by parent nb
* @param int $level Init level
@ -5459,7 +5461,7 @@ class Product extends CommonObject
/**
* Return all parent products for current product (first level only)
*
* @return array|int Array of product
* @return array<int,array{id:int,ref:string,label:string,qty:float,incdec:int<0,1>,fk_product_type:int,entity:int,status:int,status_buy:int}>|int<-1,-1> Array of product
* @see hasFatherOrChild()
*/
public function getFather()
@ -5476,6 +5478,7 @@ class Product extends CommonObject
$prods = array();
while ($record = $this->db->fetch_array($res)) {
// $record['id'] = $record['rowid'] = id of father
$prods[$record['id']] = array();
$prods[$record['id']]['id'] = $record['rowid'];
$prods[$record['id']]['ref'] = $record['ref'];
$prods[$record['id']]['label'] = $record['label'];

View File

@ -44,8 +44,14 @@ class Productbatch extends CommonObject
*/
public $element = 'productbatch';
/**
* @var string
*/
private static $_table_element = 'product_batch'; //!< Name of table without prefix where object is stored
/**
* @var ?int
*/
public $fk_product_stock;
/**
@ -222,8 +228,10 @@ class Productbatch extends CommonObject
$this->cleanParam();
// TODO Check qty is ok for stock move. Negative may not be allowed.
/*
if ($this->qty < 0) {
}
*/
// Update request
$sql = "UPDATE ".$this->db->prefix().self::$_table_element." SET";
@ -360,7 +368,7 @@ class Productbatch extends CommonObject
$this->id = 0;
$this->tms = dol_now();
$this->fk_product_stock = '';
$this->fk_product_stock = 0;
$this->sellby = '';
$this->eatby = '';
$this->batch = '';
@ -377,7 +385,7 @@ class Productbatch extends CommonObject
private function cleanParam()
{
if (isset($this->fk_product_stock)) {
$this->fk_product_stock = (int) trim($this->fk_product_stock);
$this->fk_product_stock = (int) trim((string) $this->fk_product_stock);
}
if (isset($this->batch)) {
$this->batch = trim($this->batch);
@ -466,7 +474,7 @@ class Productbatch extends CommonObject
* @param int $fk_product_stock id product_stock for object
* @param int $with_qty 1 = doesn't return line with 0 quantity
* @param int $fk_product If set to a product id, get eatby and sellby from table llx_product_lot
* @return array|int Return integer <0 if KO, array of batch
* @return Productbatch[]|int Return integer <0 if KO, array of batch
*/
public static function findAll($dbs, $fk_product_stock, $with_qty = 0, $fk_product = 0)
{
@ -569,7 +577,7 @@ class Productbatch extends CommonObject
* @param int $qty_min [=NULL] Minimum quantity
* @param string $sortfield [=NULL] List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb'
* @param string $sortorder [=NULL] Sort order, separated by comma. Example: 'ASC,DESC';
* @return int|array Return integer <0 if KO, array of batch
* @return int<-1,-1>|Productbatch[] Return integer <0 if KO, array of batch
*
* @throws Exception
*/

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Florian HENRY <florian.henry@open-concept.pro>
* 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
@ -61,6 +62,9 @@ class Propalmergepdfproduct extends CommonObject
* @var int Id user
*/
public $fk_user_mod;
/**
* @var int|''
*/
public $datec = '';
/**
@ -601,7 +605,13 @@ class PropalmergepdfproductLine extends CommonObjectLine
*/
public $fk_user_mod;
/**
* @var int|''
*/
public $datec = '';
/**
* @var string
*/
public $import_key;
}

View File

@ -358,7 +358,7 @@ if ($id > 0 || !empty($ref)) {
print '<tr class="oddeven">';
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.dol_escape_htmltag($productstatic->label).'</td>';
print '<td class="right">'.dol_escape_htmltag($value['qty']).'</td>';
print '<td class="right">'.dol_escape_htmltag((string) $value['qty']).'</td>';
print '</tr>';
}
} else {

View File

@ -3,6 +3,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
* 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
@ -228,10 +229,10 @@ class PriceGlobalVariable
/**
* Delete object in database
*
* @param int $rowid Row id of global variable
* @param User $user User that deletes
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param int $rowid Row id of global variable
* @param User $user User that deletes
* @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function delete($rowid, $user, $notrigger = 0)
{
@ -239,6 +240,7 @@ class PriceGlobalVariable
$this->db->begin();
/*
if (!$error) {
if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
@ -250,6 +252,7 @@ class PriceGlobalVariable
//// End call triggers
}
}
*/
if (!$error) {
$sql = "DELETE FROM ".$this->db->prefix().$this->table_element;

View File

@ -46,7 +46,13 @@ class PriceGlobalVariableUpdater
*/
public $errors = array();
/**
* @var int[]
*/
public $types = array(0, 1); //!< Updater types
/**
* @var int
*/
public $update_min = 5; //!< Minimal update rate
/**
@ -54,6 +60,9 @@ class PriceGlobalVariableUpdater
*/
public $id;
/**
* @var int
*/
public $type;
/**
@ -61,6 +70,9 @@ class PriceGlobalVariableUpdater
*/
public $description;
/**
* @var ?string
*/
public $parameters;
/**
@ -68,8 +80,17 @@ class PriceGlobalVariableUpdater
*/
public $fk_variable;
public $update_interval; //!< Interval in mins
public $next_update; //!< Next update timestamp
/**
* @var int Interval in mins
*/
public $update_interval;
/**
* @var int Next update timestamp
*/
public $next_update;
/**
* @var ?string
*/
public $last_status;
/**
@ -126,6 +147,7 @@ class PriceGlobalVariableUpdater
if (!$error) {
$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
/*
if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@ -135,6 +157,7 @@ class PriceGlobalVariableUpdater
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
*/
}
// Commit or rollback
@ -561,9 +584,9 @@ class PriceGlobalVariableUpdater
/**
* Update next_update into database
*
* @param string $next_update Next update to write
* @param User|null $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @param int $next_update Next update to write
* @param ?User $user User that modifies
* @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function update_next_update($next_update, $user = null, $notrigger = 0)

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015 Ion Agorria <ion@agorria.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
@ -32,16 +33,29 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
*/
class PriceParser
{
/**
* @var DoliDB
*/
protected $db;
// Limit of expressions per price
/**
* @var int Limit of expressions per price
*/
public $limit = 100;
// The error that occurred when parsing price
/**
* @var array<int,null|int|string|array{0:string,1:string}> The error that occurred when parsing price
*/
public $error_parser;
// The expression that caused the error
/**
* @var ?string The expression that caused the error
*/
public $error_expr;
//The special char
/**
* @var string The special char
*/
public $special_chr = "#";
//The separator char
/**
* @var string The separator char
*/
public $separator_chr = ";";
/**
@ -117,8 +131,8 @@ class PriceParser
* Calculates price based on expression
*
* @param Product $product The Product object to get information
* @param String $expression The expression to parse
* @param array $values Strings to replaces
* @param string $expression The expression to parse
* @param array<string,mixed> $values Strings to replace
* @return int > 0 if OK, < 1 if KO
*/
public function parseExpression($product, $expression, $values)
@ -246,7 +260,7 @@ class PriceParser
* Calculates product price based on product id and associated expression
*
* @param Product $product The Product object to get information
* @param array $extra_values Any additional values for expression
* @param array<string,mixed> $extra_values Any additional values for expression
* @return int > 0 if OK, < 1 if KO
*/
public function parseProduct($product, $extra_values = array())
@ -293,7 +307,7 @@ class PriceParser
* Calculates supplier product price based on product supplier price and associated expression
*
* @param ProductFournisseur $product_supplier The Product supplier object to get information
* @param array $extra_values Any additional values for expression
* @param array<string,mixed> $extra_values Any additional values for expression
* @return int > 0 if OK, < 1 if KO
*/
public function parseProductSupplier($product_supplier, $extra_values = array())
@ -324,7 +338,7 @@ class PriceParser
*
* @param int $product_id The Product id to get information
* @param string $expression The expression to parse
* @param array $extra_values Any additional values for expression
* @param array<string,mixed> $extra_values Any additional values for expression
* @return int > 0 if OK, < 1 if KO
*/
public function testExpression($product_id, $expression, $extra_values = array())

View File

@ -207,7 +207,7 @@ class FormCardWebPortal
$this->backtopagejsfields = $backtopagejsfields;
$this->cancel = $cancel;
$this->elementEn = $elementEn;
$this->id = $id;
$this->id = (int) $id;
$this->object = $object;
$this->permissiontoread = $permissiontoread;
$this->permissiontoadd = $permissiontoadd;