Qual: Fix phan/phpstan notices in class files (part 2) (#31523)

* Qual: Fix phan notices in class files (part 2)

* Qual: Fix phan notices doleditor...events.class

* Qual: Fix phan notices defaultvalues...formprojet.class

* Qual: Fix notices formsetup...formwebsite.class

* Qual: Fix phan notices in class files (part 2)

* Qual: Fix phan notices doleditor...events.class

* Qual: Fix phan notices defaultvalues...formprojet.class

* Qual: Fix notices formsetup...formwebsite.class
This commit is contained in:
MDW 2024-10-26 18:24:40 +02:00 committed by GitHub
parent 552d504868
commit 67e9eaff46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 589 additions and 389 deletions

View File

@ -9,38 +9,37 @@
*/
return [
// # Issue statistics:
// PhanUndeclaredProperty : 640+ occurrences
// PhanPluginUnknownPropertyType : 630+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 580+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 400+ occurrences
// PhanUndeclaredProperty : 560+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 550+ occurrences
// PhanPluginUnknownPropertyType : 420+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 360+ occurrences
// PhanUndeclaredGlobalVariable : 350+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 290+ occurrences
// PhanPluginUnknownArrayMethodParamType : 220+ occurrences
// PhanPossiblyUndeclaredVariable : 200+ occurrences
// PhanTypeMismatchProperty : 170+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 280+ occurrences
// PhanPluginUnknownArrayMethodParamType : 190+ occurrences
// PhanPossiblyUndeclaredVariable : 190+ occurrences
// PhanTypeMismatchProperty : 160+ occurrences
// PhanPluginUnknownArrayFunctionParamType : 95+ occurrences
// PhanPluginUndeclaredVariableIsset : 65+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 65+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 60+ occurrences
// PhanPluginUnknownArrayFunctionReturnType : 50+ occurrences
// PhanRedefineFunction : 50+ occurrences
// PhanPluginEmptyStatementIf : 45+ occurrences
// PhanPluginUnknownArrayPropertyType : 40+ occurrences
// PhanTypeExpectedObjectPropAccess : 40+ occurrences
// PhanTypeInvalidDimOffset : 35+ occurrences
// PhanPluginUnknownArrayPropertyType : 30+ occurrences
// PhanTypeMismatchDimFetch : 30+ occurrences
// PhanPluginUnknownObjectMethodCall : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanEmptyForeach : 10+ occurrences
// PhanPluginConstantVariableNull : 10+ occurrences
// PhanPossiblyNullTypeMismatchProperty : 10+ occurrences
// PhanTypeArraySuspiciousNull : 10+ occurrences
// PhanTypeComparisonFromArray : 10+ occurrences
// PhanTypeMismatchDimFetchNullable : 10+ occurrences
// PhanUndeclaredMethod : 10+ occurrences
// PhanPluginSuspiciousParamPosition : 9 occurrences
// PhanPluginBothLiteralsBinaryOp : 8 occurrences
// PhanPluginConstantVariableNull : 8 occurrences
// PhanPossiblyNullTypeMismatchProperty : 8 occurrences
// PhanPluginDuplicateExpressionBinaryOp : 7 occurrences
// PhanPossiblyNullTypeMismatchProperty : 7 occurrences
// PhanParamTooMany : 5 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
// PhanEmptyFQSENInClasslike : 3 occurrences
@ -55,6 +54,9 @@ return [
'htdocs/accountancy/class/accountancycategory.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanUndeclaredProperty'],
'htdocs/adherents/list.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/adherents/type.php' => ['PhanTypeMismatchProperty'],
'htdocs/admin/agenda_other.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/admin/defaultvalues.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/admin/fckeditor.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/api/class/api_access.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'],
'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'],
@ -91,11 +93,11 @@ return [
'htdocs/categories/edit.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/index.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/info.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/photos.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch'],
'htdocs/categories/photos.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/traduction.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/viewcat.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/collab/index.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'],
'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/comm/action/class/api_agendaevents.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/class/cactioncomm.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/comm/action/document.php' => ['PhanTypeMismatchArgumentProbablyReal'],
@ -139,7 +141,7 @@ return [
'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/deplacement/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginEmptyStatementIf'],
'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/card.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'],
@ -149,7 +151,7 @@ return [
'htdocs/compta/facture/note.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/facture/prelevement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/facture/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/facture/tpl/linkedobjectblock.tpl.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
'htdocs/compta/facture/tpl/linkedobjectblock.tpl.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/journal/purchasesjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/journal/sellsjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
@ -192,7 +194,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/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contact/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contact/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contact/perso.php' => ['PhanTypeMismatchProperty'],
@ -201,9 +203,7 @@ return [
'htdocs/contrat/class/api_contracts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/contrat/messaging.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/services_list.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/core/actions_builddoc.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/actions_comments.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_extrafields.inc.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/actions_lineupdown.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
@ -214,7 +214,6 @@ return [
'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall'],
'htdocs/core/ajax/ajaxdirpreview.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/ajax/fileupload.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/ajax/onlineSign.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/ajax/selectobject.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/ajax/selectsearchbox.php' => ['PhanPluginUndeclaredVariableIsset'],
@ -242,45 +241,24 @@ return [
'htdocs/core/class/ccountry.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/cgenericdic.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/commonsocialnetworks.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/conf.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchProperty'],
'htdocs/core/class/ctypent.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/ctyperesource.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/class/cunits.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/class/diasporahandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/discount.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/doleditor.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
'htdocs/core/class/dolgeoip.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/core/class/ctyperesource.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/cunits.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/class/dolgraph.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/dolreceiptprinter.class.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'],
'htdocs/core/class/emailsenderprofile.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/class/events.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/extrafields.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/core/class/extralanguages.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/fediverseparser.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/core/class/fileupload.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'],
'htdocs/core/class/fiscalyear.class.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/class/emailsenderprofile.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/hookmanager.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formaccounting.class.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/class/html.formbarcode.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/core/class/html.formcategory.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formfile.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/class/html.formldap.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/core/class/html.formfile.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formmargin.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
'htdocs/core/class/html.formprojet.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
'htdocs/core/class/html.formsetup.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/html.formwebsite.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
'htdocs/core/class/ldap.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/class/link.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/openid.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'],
'htdocs/core/class/reddithandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/reddithandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/core/class/smtps.class.php' => ['PhanTypeConversionFromArray'],
'htdocs/core/class/socialnetworkmanager.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/core/class/stats.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'],
@ -411,10 +389,9 @@ return [
'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/list_print_total.tpl.php' => ['PhanPluginUndeclaredVariableIsset'],
'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_title.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/core/tpl/notes.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/tpl/onlinepaymentlinks.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/passwordforgotten.tpl.php' => ['PhanUndeclaredGlobalVariable'],
@ -448,7 +425,7 @@ return [
'htdocs/delivery/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/document.php' => ['PhanRedefineFunction'],
'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'],
'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'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/paymentdonation.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
@ -460,7 +437,7 @@ return [
'htdocs/don/paiement/list.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/don/payment/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/don/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/don/tpl/linkedobjectblock.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/don/tpl/linkedobjectblock.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/ecm/class/ecmdirectory.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/ecm/class/ecmfiles.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/ecm/class/htmlecm.form.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
@ -488,7 +465,6 @@ return [
'htdocs/expedition/list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/expedition/note.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/expedition/shipment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/expedition/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'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'],
@ -520,7 +496,6 @@ return [
'htdocs/fourn/commande/info.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fourn/commande/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/commande/note.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/fourn/contact.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fourn/facture/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/fourn/facture/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
@ -532,7 +507,7 @@ return [
'htdocs/fourn/paiement/document.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/ftp/admin/ftpclient.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/ftp/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/holiday/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/holiday/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/holiday/card_group.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/holiday/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/holiday/view_log.php' => ['PhanTypeMismatchDimFetch'],
@ -703,7 +678,7 @@ return [
'htdocs/public/payment/paymentko.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/project/index.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/project/new.php' => ['PhanRedefineFunction', 'PhanUndeclaredProperty'],
'htdocs/public/project/new.php' => ['PhanRedefineFunction'],
'htdocs/public/project/suggestbooth.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/public/project/suggestconference.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
@ -725,7 +700,6 @@ return [
'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/reception/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/reception/note.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/reception/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach'],
'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall'],
'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'],
@ -744,17 +718,14 @@ return [
'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/resource/class/dolresource.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/resource/class/html.formresource.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeExpectedObjectPropAccess'],
'htdocs/resource/element_resource.php' => ['PhanUndeclaredProperty'],
'htdocs/salaries/admin/salaries.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'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/document.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/salaries/info.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/salaries/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/salaries/paiement_salary.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/salaries/virement_request.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/salaries/virement_request.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/societe/admin/societe.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'],
'htdocs/societe/ajax/company.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/societe/checkvat/checkVatPopup.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
@ -775,16 +746,14 @@ return [
'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/supplier_proposal/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/support/inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanRedefineFunction'],
'htdocs/takepos/admin/orderprinters.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/takepos/index.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/takepos/invoice.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/takepos/invoice.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/takepos/pay.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/takepos/public/menu.php' => ['PhanUndeclaredProperty'],
'htdocs/takepos/split.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/theme/eldy/badges.inc.php' => ['PhanRedefineFunction'],
'htdocs/theme/eldy/btn.inc.php' => ['PhanUndeclaredGlobalVariable'],
@ -804,10 +773,8 @@ return [
'htdocs/ticket/class/api_tickets.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'],
'htdocs/ticket/class/ticket.class.php' => ['PhanUndeclaredProperty'],
'htdocs/ticket/class/ticketstats.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/ticket/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/ticket/list.php' => ['PhanTypeComparisonFromArray'],
'htdocs/ticket/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/user/bank.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/user/card.php' => ['PhanTypeMismatchProperty'],
'htdocs/user/class/api_users.class.php' => ['PhanTypeMismatchProperty'],
@ -829,8 +796,6 @@ return [
'htdocs/webportal/class/controller.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/webportal/class/webportalinvoice.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/webportal/class/webportalmember.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/webportal/class/webportalpropal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_actioncomm.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_category.php' => ['PhanUndeclaredProperty'],

View File

@ -192,7 +192,7 @@ foreach ($dirbarcode as $reldir) {
}
}
}
'@phan-var-force array<string,ModeleBarCode> $barcodelist';
'@phan-var-force array<string,string> $barcodelist';
// Select barcode numbering module

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017-2018 Regis Houssin <regis.houssin@inodbox.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
@ -141,13 +142,13 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
if (!$error) {
if ($action == 'add' || (GETPOST('add') && $action != 'update')) {
$object->type=$mode;
$object->user_id=0;
$object->page=$defaulturl;
$object->param=$defaultkey;
$object->value=$defaultvalue;
$object->entity=$conf->entity;
$result=$object->create($user);
$object->type = $mode;
$object->user_id = 0;
$object->page = $defaulturl;
$object->param = $defaultkey;
$object->value = $defaultvalue;
$object->entity = $conf->entity;
$result = $object->create($user);
if ($result < 0) {
$action = '';
setEventMessages($object->error, $object->errors, 'errors');
@ -160,14 +161,14 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
}
}
if (GETPOST('actionmodify')) {
$object->id=$id;
$object->type=$mode;
$object->page=$urlpage;
$object->param=$key;
$object->value=$value;
$object->entity=$conf->entity;
$result=$object->update($user);
if ($result<0) {
$object->id = $id;
$object->type = $mode;
$object->page = $urlpage;
$object->param = $key;
$object->value = $value;
$object->entity = $conf->entity;
$result = $object->update($user);
if ($result < 0) {
$action = '';
setEventMessages($object->error, $object->errors, 'errors');
} else {
@ -183,9 +184,9 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
// Delete line from delete picto
if ($action == 'delete') {
$object->id=$id;
$result=$object->delete($user);
if ($result<0) {
$object->id = $id;
$result = $object->delete($user);
if ($result < 0) {
$action = '';
setEventMessages($object->error, $object->errors, 'errors');
}
@ -356,7 +357,7 @@ print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("
print '</td>'."\n";
print '</tr>'."\n";
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode, 't.entity'=>array($user->entity,$conf->entity)));
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type' => $mode, 't.entity' => array($user->entity,$conf->entity)));
if (!is_array($result) && $result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -396,7 +397,7 @@ if (!is_array($result) && $result < 0) {
// Multicompany
print '<td>';
if (isModEnabled('multicompany')) {
print dol_escape_htmltag($defaultvalue->entity);
print dol_escape_htmltag((string) $defaultvalue->entity);
}
print '</td>';

View File

@ -6,6 +6,7 @@
* Copyright (C) 2014 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -193,7 +194,7 @@ if ($object->id) {
if ($action == 'ajout_photo' && $user->hasRight('categorie', 'creer') && getDolGlobalString('MAIN_UPLOAD_DOC')) {
// Affiche formulaire upload
$formfile = new FormFile($db);
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;type='.$type, $langs->trans("AddPhoto"), 1, '', $user->hasRight('categorie', 'creer'), 50, $object, '', false, '', 0);
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;type='.$type, $langs->trans("AddPhoto"), 1, 0, $user->hasRight('categorie', 'creer'), 50, $object, '', false, '', 0);
}
// Affiche photos

View File

@ -562,7 +562,7 @@ class Propal extends CommonObject
$line->desc = $remise->description; // Description ligne
$line->vat_src_code = $remise->vat_src_code;
$line->tva_tx = $remise->tva_tx;
$line->subprice = -$remise->amount_ht;
$line->subprice = -(float) $remise->amount_ht;
$line->fk_product = 0; // Id produit predefined
$line->qty = 1;
$line->remise_percent = 0;
@ -570,11 +570,11 @@ class Propal extends CommonObject
$line->info_bits = 2;
// TODO deprecated
$line->price = -$remise->amount_ht;
$line->price = -(float) $remise->amount_ht;
$line->total_ht = -$remise->amount_ht;
$line->total_tva = -$remise->amount_tva;
$line->total_ttc = -$remise->amount_ttc;
$line->total_ht = -(float) $remise->amount_ht;
$line->total_tva = -(float) $remise->amount_tva;
$line->total_ttc = -(float) $remise->amount_ttc;
$result = $line->insert();
if ($result > 0) {

View File

@ -2056,17 +2056,17 @@ class Commande extends CommonOrder
$line->desc = $remise->description; // Description ligne
$line->vat_src_code = $remise->vat_src_code;
$line->tva_tx = $remise->tva_tx;
$line->subprice = -$remise->amount_ht;
$line->price = -$remise->amount_ht;
$line->subprice = -(float) $remise->amount_ht;
$line->price = -(float) $remise->amount_ht;
$line->fk_product = 0; // Id produit predefini
$line->qty = 1;
$line->remise_percent = 0;
$line->rang = -1;
$line->info_bits = 2;
$line->total_ht = -$remise->amount_ht;
$line->total_tva = -$remise->amount_tva;
$line->total_ttc = -$remise->amount_ttc;
$line->total_ht = -(float) $remise->amount_ht;
$line->total_tva = -(float) $remise->amount_tva;
$line->total_ttc = -(float) $remise->amount_ttc;
$result = $line->insert();
if ($result > 0) {

View File

@ -2664,7 +2664,7 @@ class Facture extends CommonInvoice
$facligne->desc = $remise->description; // Description ligne
$facligne->vat_src_code = $remise->vat_src_code;
$facligne->tva_tx = $remise->tva_tx;
$facligne->subprice = -$remise->amount_ht;
$facligne->subprice = -(float) $remise->amount_ht;
$facligne->fk_product = 0; // Id produit predefini
$facligne->qty = 1;
$facligne->remise_percent = 0;
@ -2689,14 +2689,14 @@ class Facture extends CommonInvoice
$facligne->pa_ht = $arraytmp['pa_total'];
}
$facligne->total_ht = -$remise->amount_ht;
$facligne->total_tva = -$remise->amount_tva;
$facligne->total_ttc = -$remise->amount_ttc;
$facligne->total_ht = -(float) $remise->amount_ht;
$facligne->total_tva = -(float) $remise->amount_tva;
$facligne->total_ttc = -(float) $remise->amount_ttc;
$facligne->multicurrency_subprice = -$remise->multicurrency_subprice;
$facligne->multicurrency_total_ht = -$remise->multicurrency_amount_ht;
$facligne->multicurrency_total_tva = -$remise->multicurrency_amount_tva;
$facligne->multicurrency_total_ttc = -$remise->multicurrency_amount_ttc;
$facligne->multicurrency_subprice = -(float) $remise->multicurrency_subprice;
$facligne->multicurrency_total_ht = -(float) $remise->multicurrency_amount_ht;
$facligne->multicurrency_total_tva = -(float) $remise->multicurrency_amount_tva;
$facligne->multicurrency_total_ttc = -(float) $remise->multicurrency_amount_ttc;
$lineid = $facligne->insert();
if ($lineid > 0) {

View File

@ -291,9 +291,9 @@ class FactureLigne extends CommonInvoiceLine
/**
* Insert line into database
*
* @param int $notrigger 1 no triggers
* @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another
* @return int Return integer <0 if KO, >0 if OK
* @param int<0,1> $notrigger 1 no triggers
* @param int<0,1> $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another
* @return int Return integer <0 if KO, >0 if OK
*/
public function insert($notrigger = 0, $noerrorifdiscountalreadylinked = 0)
{

View File

@ -411,7 +411,7 @@ if ($type == 'directory') {
// When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param
// When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath
// var_dump("section=".$section." title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm(permtoeditline)=".$perm." relativepath=".$relativepath." param=".$param." url=".$url);
$formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm, '', $sortfield, $sortorder);
$formfile->list_of_documents($filearray, null, $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm, '', $sortfield, $sortorder);
}
}

View File

@ -110,14 +110,15 @@ abstract class CommonOrderLine extends CommonObjectLine
{
/**
* Custom label of line. Not used by default.
* @deprecated
* @deprecated Use $product_label
* @var string
*/
public $label;
/**
* Product ref
* @var string
* @deprecated Use product_ref
* @deprecated Use $product_ref
* @see $product_ref
*/
public $ref;
@ -249,10 +250,28 @@ abstract class CommonOrderLine extends CommonObjectLine
*/
public $special_code = 0;
/**
* @var int
*/
public $fk_multicurrency;
/**
* @var string
*/
public $multicurrency_code;
/**
* @var float
*/
public $multicurrency_subprice;
/**
* @var float
*/
public $multicurrency_total_ht;
/**
* @var float
*/
public $multicurrency_total_tva;
/**
* @var float
*/
public $multicurrency_total_ttc;
}

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,7 +36,13 @@ class Ctypent extends CommonDict
*/
public $country_id;
/**
* @var string
*/
public $libelle;
/**
* @var string
*/
public $module;
/**

View File

@ -199,7 +199,7 @@ class Ctyperesource extends CommonDict
* @param string $sortfield Sort field
* @param int $limit Limit
* @param int $offset Offset limit
* @param string|array $filter filter array
* @param string|array<string,mixed> $filter Filter array
* @param string $filtermode filter mode (AND or OR)
* @return int Return integer <0 if KO, >0 if OK
*/
@ -473,7 +473,7 @@ class CtyperesourceLine
public $id;
/**
* @var mixed Sample line property 1
* @var string Sample line property 1
*/
public $code;
@ -482,5 +482,8 @@ class CtyperesourceLine
*/
public $label;
/**
* @var int
*/
public $active;
}

View File

@ -31,6 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondict.class.php';
*/
class CUnits extends CommonDict
{
/**
* @var CUnits[]
*/
public $records = array();
//var $element='ctypent'; //!< Id that identify managed objects
@ -38,14 +41,26 @@ class CUnits extends CommonDict
/**
* @var string label
* @deprecated
* @deprecated Use $label
* @see $label
*/
public $libelle;
/**
* @var string
*/
public $sortorder;
/**
* @var string
*/
public $short_label;
/**
* @var string
*/
public $unit_type;
/**
* @var string
*/
public $scale;
@ -63,9 +78,9 @@ class CUnits extends CommonDict
/**
* Create object into database
*
* @param User $user User that create
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, Id of created object if OK
* @param User $user User that create
* @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, Id of created object if OK
*/
public function create($user, $notrigger = 0)
{
@ -212,9 +227,9 @@ class CUnits extends CommonDict
* @param string $sortfield Sort field
* @param int $limit Limit
* @param int $offset Offset
* @param string|array $filter Filter USF
* @param string|array<string,mixed> $filter Filter USF
* @param string $filtermode Filter mode (AND or OR)
* @return array|int int <0 if KO, array of pages if OK
* @return CUnits[]|int int <0 if KO, array of pages if OK
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
{
@ -306,9 +321,9 @@ class CUnits extends CommonDict
/**
* Update object into database
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param User $user User that modify
* @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($user = null, $notrigger = 0)
{
@ -378,8 +393,8 @@ class CUnits extends CommonDict
/**
* Delete object in database
*
* @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @param User $user User that delete
* @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($user, $notrigger = 0)
@ -430,10 +445,10 @@ class CUnits extends CommonDict
/**
* Unit converter
* @param double $value value to convert
* @param float $value value to convert
* @param int $fk_unit current unit id of value
* @param int $fk_new_unit the id of unit to convert in
* @return double
* @return float
*/
public function unitConverter($value, $fk_unit, $fk_new_unit = 0)
{

View File

@ -240,10 +240,10 @@ class DefaultValues extends CommonObject
* @param string $sortfield Sort field
* @param int $limit limit
* @param int $offset Offset
* @param string|array $filter Filter as an Universal Search string or Array (array use is deprecated)
* @param string $filter Filter as an Universal Search string or Array (array use is deprecated)
* Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')'
* @param string $filtermode No more used
* @return array|int int <0 if KO, array of pages if OK
* @return DefaultValues[]|int int <0 if KO, array of pages if OK
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
{

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -23,13 +24,13 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/socialnetworkmanager.class.php';
/**
* Class for handling Diaspora API interactions
*/
/**
* Class for handling Diaspora API interactions
*/
class DiasporaHandler
{
/**
* @var array Posts fetched from the API
* @var array<array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar?:string}|array{}> Posts fetched from the API
*/
private $posts = [];
@ -38,15 +39,15 @@ class DiasporaHandler
*/
public $error = '';
/**
* @var array Authentication parameters, including cookie name and value
*/
/**
* @var array<string,string> Authentication parameters, including cookie name and value
*/
private $params = [];
/**
* Check if the provided cookie in params is valid.
* @return bool True if a valid cookie is found in params, false otherwise.
*/
/**
* Check if the provided cookie in params is valid.
* @return bool True if a valid cookie is found in params, false otherwise.
*/
private function isCookieValid()
{
return !empty($this->getCookieFromParams());
@ -54,7 +55,7 @@ class DiasporaHandler
/**
* Get the cookie value from params, regardless of the exact key name.
* @return string|null The cookie string if found, null otherwise.
* @return ?string The cookie string if found, null otherwise.
*/
private function getCookieFromParams()
{
@ -73,7 +74,7 @@ class DiasporaHandler
* @param int $maxNb Maximum number of posts to retrieve (default is 5).
* @param int $cacheDelay Number of seconds to use cached data (0 to disable caching).
* @param string $cacheDir Directory to store cached data.
* @param array $authParams Authentication parameters including login URL, username, and password.
* @param array<string,string> $authParams Authentication parameters including login URL, username, and password.
* @return bool Status code: False if error, true if success.
*/
public function fetch($urlAPI, $maxNb = 5, $cacheDelay = 60, $cacheDir = '', $authParams = [])
@ -146,8 +147,8 @@ class DiasporaHandler
/**
* Normalize data of retrieved posts.
*
* @param array $postData Data of a single post.
* @return array Normalized post data.
* @param array<string,mixed> $postData Data of a single post.
* @return array{}|array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar:string} Normalized post data.
*/
public function normalizeData($postData)
{
@ -179,7 +180,7 @@ class DiasporaHandler
/**
* Get the list of retrieved posts.
*
* @return array List of posts.
* @return array<array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar?:string}|array{}> Posts fetched from the API
*/
public function getPosts()
{

View File

@ -48,22 +48,64 @@ class DiscountAbsolute extends CommonObject
*/
public $discount_type; // 0 => customer discount, 1 => supplier discount
/**
* @var float
*/
public $total_ht;
/**
* @var float
*/
public $total_tva;
/**
* @var float
*/
public $total_ttc;
/**
* @var string|float
* @deprecated
*/
public $amount_ht; // deprecated
/**
* @var string|float
* @deprecated
*/
public $amount_tva; // deprecated
/**
* @var string|float
* @deprecated
*/
public $amount_ttc; // deprecated
/**
* @var float
*/
public $multicurrency_total_ht;
/**
* @var float
*/
public $multicurrency_total_tva;
/**
* @var float
*/
public $multicurrency_total_ttc;
/**
* @var string|float
* @deprecated
*/
public $multicurrency_amount_ht; // deprecated
/**
* @var string|float
* @deprecated
*/
public $multicurrency_amount_tva; // deprecated
/**
* @var string|float
* @deprecated
*/
public $multicurrency_amount_ttc; // deprecated
/**
* @var double
* @var float
*/
public $multicurrency_subprice;
@ -77,8 +119,13 @@ class DiscountAbsolute extends CommonObject
*/
public $fk_invoice_supplier_line;
// Vat rate
/**
* @var string|float Vat rate
*/
public $tva_tx;
/**
* @var string
*/
public $vat_src_code;
/**
@ -94,7 +141,7 @@ class DiscountAbsolute extends CommonObject
/**
* Date creation record (datec)
*
* @var integer
* @var int
*/
public $datec;
@ -112,11 +159,26 @@ class DiscountAbsolute extends CommonObject
* @var int ID credit note or deposit used to create the discount
*/
public $fk_facture_source;
/**
* @var string
*/
public $ref_facture_source; // Ref credit note or deposit used to create the discount
/**
* @var int
*/
public $type_facture_source;
/**
* @var int
*/
public $fk_invoice_supplier_source;
/**
* @var string
*/
public $ref_invoice_supplier_source; // Ref credit note or deposit used to create the discount
/**
* @var int
*/
public $type_invoice_supplier_source;
/**

View File

@ -31,23 +31,65 @@
*/
class DolEditor
{
/**
* @var string
*/
public $tool; // Store the selected tool
// If using fckeditor
/**
* @var Object - Note: seems to be unused
*/
public $editor;
// If not using fckeditor
/**
* @var string
*/
public $content;
/**
* @var string
*/
public $htmlname;
/**
* @var string
*/
public $toolbarname;
/**
* @var bool
*/
public $toolbarstartexpanded;
/**
* @var int
*/
public $rows;
/**
* @var string
*/
public $cols;
/**
* @var int
*/
public $height;
/**
* @var string
*/
public $width;
/**
* @var int<0,1>|bool
*/
public $uselocalbrowser;
/**
* @var int<0,1>
*/
public $readonly;
/**
* @var int
*/
public $posx;
/**
* @var int
*/
public $posy;
@ -60,14 +102,14 @@ class DolEditor
* @param int $height Height in pixel of edit area (200px by default)
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly').
* @param string $toolbarlocation Deprecated. Not used
* @param boolean $toolbarstartexpanded Bar is visible or not at start
* @param boolean|int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
* @param boolean|int|string $okforextendededitor 1 or True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
* @param bool $toolbarstartexpanded Bar is visible or not at start
* @param bool|int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
* @param bool|int|string $okforextendededitor 1 or True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
* Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave".
* @param int $rows Size of rows for textarea tool
* @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%')
* @param int $readonly 0=Read/Edit, 1=Read only
* @param array $poscursor Array for initial cursor position array('x'=>x, 'y'=>y).
* @param int<0,1> $readonly 0=Read/Edit, 1=Read only
* @param array{x?:string,y?:string,find?:string} $poscursor Array for initial cursor position array('x'=>x, 'y'=>y).
* array('find'=> 'word') can be used to go to line were the word has been found
*/
public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = 1, $okforextendededitor = true, $rows = 0, $cols = '', $readonly = 0, $poscursor = array())
@ -102,7 +144,7 @@ class DolEditor
$this->tool = 'textarea';
}
if ( isset($poscursor['find']) ) {
if (isset($poscursor['find'])) {
$posy = 0;
$lines = explode("\n", $content);
$nblines = count($lines);
@ -112,7 +154,9 @@ class DolEditor
break;
}
}
if ($posy != 0 ) $poscursor['y'] = $posy;
if ($posy != 0) {
$poscursor['y'] = $posy;
}
}
// Define some properties
@ -230,7 +274,7 @@ class DolEditor
toolbar: \''.dol_escape_js($this->toolbarname).'\',
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
width: '.($this->width ? '\''.dol_escape_js($this->width).'\'' : '\'\'').',
height: '.dol_escape_js($this->height).',
height: '.dol_escape_js((string) $this->height).',
skin: \''.dol_escape_js($skin).'\',
'.$scaytautostartup.'
language: \''.dol_escape_js($langs->defaultlang).'\',

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -35,7 +36,7 @@
class DolGeoIP
{
/**
* @var GeoIp2\Database\Reader|string
* @var \GeoIp2\Database\Reader|\GeoIP|string
*/
public $gi;
@ -52,7 +53,7 @@ class DolGeoIP
/**
* Constructor
*
* @param string $type 'country' or 'city'
* @param 'country'|'city' $type 'country' or 'city'
* @param string $datfile Data file
*/
public function __construct($type, $datfile)

View File

@ -140,6 +140,9 @@ class dolReceiptPrinter extends Printer
* @var \Mike42\Escpos\Printer
*/
public $printer;
/**
* @var string
*/
public $template;
/**
@ -150,13 +153,13 @@ class dolReceiptPrinter extends Printer
/**
* Array with list of printers
* @var array List of printers
* @var array<array{rowid:int,name:string,fk_type:int,fk_type_name:string,fk_profile:int,fk_profile_name:string,parameter:string}> List of printers
*/
public $listprinters;
/**
* Array with list of printer templates
* @var array List of printer templates
* @var array<array{rowid:int,name:string,template:string}> List of printer templates
*/
public $listprinterstemplates;
@ -772,7 +775,11 @@ class dolReceiptPrinter extends Printer
//var_dump($object);
$vatarray = array();
foreach ($object->lines as $line) {
$vatarray[$line->tva_tx] += $line->total_tva;
$vat_rate = $line->tva_tx;
if (!array_key_exists($vat_rate, $vatarray)) {
$vatarray[$vat_rate] = 0;
}
$vatarray[$vat_rate] += $line->total_tva;
}
foreach ($vatarray as $vatkey => $vatvalue) {
$spacestoadd = $nbcharactbyline - strlen($vatkey) - 12;

View File

@ -50,6 +50,9 @@ class EmailSenderProfile extends CommonObject
*/
public $picto = 'emailsenderprofile';
/**
* @var int
*/
public $fk_user_creat;
@ -114,11 +117,26 @@ class EmailSenderProfile extends CommonObject
*/
public $label;
/**
* @var string
*/
public $email;
/**
* @var int
*/
public $private;
/**
* @var string
*/
public $signature;
/**
* @var int
*/
public $position;
/**
* @var int
*/
public $active;
// END MODULEBUILDER PROPERTIES

View File

@ -56,6 +56,11 @@
*
* AUTHOR INFORMATION
* Copyright 2005, Miles Kaufmann.
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* LICENSE
* Redistribution and use in source and binary forms, with or without
@ -95,22 +100,40 @@
*/
class EvalMath
{
/**
* @var bool
*/
public $suppress_errors = false;
/**
* @var ?string
*/
public $last_error = null;
/**
* @var ?array{0:int,1:null|string|array{0:?mixed,1:int}}
*/
public $last_error_code = null;
/**
* @var array<string,float|string> variables (and constants)
*/
public $v = array('e' => 2.71, 'pi' => 3.14159);
// variables (and constants)
/**
* @var array<string,array{args:string[],func:array<string|float>}> user-defined functions
*/
public $f = array();
// user-defined functions
/**
* @var string[] constants
*/
public $vb = array('e', 'pi');
// constants
public $fb = array( // built-in functions
/**
* @var string[] built-in functions
*/
public $fb = array(
'sin', 'sinh', 'arcsin', 'asin', 'arcsinh', 'asinh', 'cos', 'cosh', 'arccos', 'acos', 'arccosh', 'acosh', 'tan', 'tanh', 'arctan', 'atan', 'arctanh', 'atanh', 'sqrt', 'abs', 'ln', 'log', 'intval', 'ceil',
);
@ -198,7 +221,7 @@ class EvalMath
/**
* Function vars
*
* @return array Output
* @return array<string,float> Output
*/
public function vars()
{
@ -211,7 +234,7 @@ class EvalMath
/**
* Function funcs
*
* @return array Output
* @return string[] Output
*/
private function funcs() // @phpstan-ignore-line
{
@ -228,7 +251,7 @@ class EvalMath
* Convert infix to postfix notation
*
* @param string $expr Expression
* @return boolean|array Output
* @return boolean|array<string|float> Output
*/
private function nfx($expr)
{
@ -372,9 +395,9 @@ class EvalMath
/**
* Evaluate postfix notation
*
* @param array $tokens Expression
* @param array $vars Array
* @return string|false Output or false if error
* @param string[] $tokens Expression
* @param array<string,string> $vars Array
* @return string|false Output or false if error
*/
private function pfx($tokens, $vars = array())
{
@ -459,9 +482,9 @@ class EvalMath
/**
* trigger an error, but nicely, if need be
*
* @param string $code Code
* @param string $msg Msg
* @param string|null $info String
* @param int $code Code
* @param string $msg Msg
* @param null|string|array{0:?mixed,1:int} $info String
* @return false
*/
public function trigger($code, $msg, $info = null)

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -70,6 +71,9 @@ class Events // extends CommonObject
*/
public $entity;
/**
* @var int|string
*/
public $dateevent;
/**
@ -103,31 +107,33 @@ class Events // extends CommonObject
public $authentication_method;
// List of all Audit/Security events supported by triggers
/**
* @var array<array{id:string,test:int<0,1>}> List of all Audit/Security events supported by triggers
*/
public $eventstolog = array(
array('id'=>'USER_LOGIN', 'test'=>1),
array('id'=>'USER_LOGIN_FAILED', 'test'=>1),
array('id'=>'USER_LOGOUT', 'test'=>1),
array('id'=>'USER_CREATE', 'test'=>1),
array('id'=>'USER_MODIFY', 'test'=>1),
array('id'=>'USER_NEW_PASSWORD', 'test'=>1),
array('id'=>'USER_ENABLEDISABLE', 'test'=>1),
array('id'=>'USER_DELETE', 'test'=>1),
array('id'=>'USERGROUP_CREATE', 'test'=>1),
array('id'=>'USERGROUP_MODIFY', 'test'=>1),
array('id'=>'USERGROUP_DELETE', 'test'=>1),
array('id' => 'USER_LOGIN', 'test' => 1),
array('id' => 'USER_LOGIN_FAILED', 'test' => 1),
array('id' => 'USER_LOGOUT', 'test' => 1),
array('id' => 'USER_CREATE', 'test' => 1),
array('id' => 'USER_MODIFY', 'test' => 1),
array('id' => 'USER_NEW_PASSWORD', 'test' => 1),
array('id' => 'USER_ENABLEDISABLE', 'test' => 1),
array('id' => 'USER_DELETE', 'test' => 1),
array('id' => 'USERGROUP_CREATE', 'test' => 1),
array('id' => 'USERGROUP_MODIFY', 'test' => 1),
array('id' => 'USERGROUP_DELETE', 'test' => 1),
);
// BEGIN MODULEBUILDER PROPERTIES
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array<int|string,string>,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20),
'prefix_session'=>array('type'=>'varchar(255)', 'label'=>'PrefixSession', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
'user_agent' =>array('type'=>'varchar(255)', 'label'=>'UserAgent', 'enabled'=>1, 'visible'=>-1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000),
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'),
'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => '1', 'index' => 1, 'position' => 20),
'prefix_session' => array('type' => 'varchar(255)', 'label' => 'PrefixSession', 'enabled' => 1, 'visible' => -1, 'notnull' => -1, 'index' => 0, 'position' => 1000),
'user_agent' => array('type' => 'varchar(255)', 'label' => 'UserAgent', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000),
);

View File

@ -50,7 +50,7 @@ class ExtraFields
public $attributes = array();
/**
* @var array<string,bool> Array with boolean of status of groups
* @var array<string,bool|int<0,1>> Array with boolean of status of groups
*/
public $expand_display;
@ -123,11 +123,11 @@ class ExtraFields
* @param int $pos Position of attribute
* @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma.
* @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param int<0,1> $unique Is field unique or not
* @param int<0,1> $required Is field required or not
* @param string $default_value Defaulted value (In database. use the default_value feature for default value on screen. Example: '', '0', 'null', 'avalue')
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param array<string,mixed|mixed[]>|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int<0,1> $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param string $list Visibility ('0'=never visible, '1'=visible on list+forms, '2'=list only, '3'=form only or 'eval string')
* @param string $help Text with help tooltip
@ -135,9 +135,9 @@ class ExtraFields
* @param string $entity Entity of extrafields (for multicompany modules)
* @param string $langfile Language file
* @param string $enabled Condition to have the field enabled or not
* @param int $totalizable Is a measure. Must show a total on lists
* @param int $printable Is extrafield displayed on PDF
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...)
* @param int<0,1> $totalizable Is a measure. Must show a total on lists
* @param int<0,1> $printable Is extrafield displayed on PDF
* @param array<string,mixed> $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...)
* @return int Return integer <=0 if KO, >0 if OK
*/
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array())
@ -199,11 +199,11 @@ class ExtraFields
* @param int $pos Position of attribute
* @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma.
* @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param int<0,1> $unique Is field unique or not
* @param int<0,1> $required Is field required or not
* @param string $default_value Defaulted value (In database. use the default_value feature for default value on screen. Example: '', '0', 'null', 'avalue')
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param array<string,mixed|mixed[]>|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int<0,1> $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param string $list Visibility ('0'=never visible, '1'=visible on list+forms, '2'=list only, '3'=form only or 'eval string')
* @param string $help Text with help tooltip
@ -211,9 +211,9 @@ class ExtraFields
* @param string $entity Entity of extrafields (for multicompany modules)
* @param string $langfile Language file
* @param string $enabled Condition to have the field enabled or not
* @param int $totalizable Is a measure. Must show a total on lists
* @param int $printable Is extrafield displayed on PDF
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...)
* @param int<0,1> $totalizable Is a measure. Must show a total on lists
* @param int<0,1> $printable Is extrafield displayed on PDF
* @param array<string,mixed> $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...)
* @return int Return integer <=0 if KO, >0 if OK
*/
public function updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array())
@ -270,15 +270,15 @@ class ExtraFields
* @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime', 'price', 'pricecy', 'phone', 'mail', 'password', 'url', 'select', 'checkbox', ...)
* @param string $length Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param int<0,1> $unique Is field unique or not
* @param int<0,1> $required Is field required or not
* @param string $default_value Default value for field (in database)
* @param array $param Params for field (ex for select list : array('options'=>array('value'=>'label of option'))
* @param array<string,mixed|mixed[]> $param Params for field (ex for select list : array('options'=>array('value'=>'label of option'))
* @param string $perms Permission
* @param string $list Into list view by default
* @param string $computed Computed value
* @param string $help Help on tooltip
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
* @param array<string,mixed> $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
* @return int Return integer <=0 if KO, >0 if OK
*/
private function create($attrname, $type = 'varchar', $length = '255', $elementtype = '', $unique = 0, $required = 0, $default_value = '', $param = array(), $perms = '', $list = '0', $computed = '', $help = '', $moreparams = array())
@ -382,10 +382,10 @@ class ExtraFields
* @param int $pos Position of attribute
* @param string $size Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param int<0,1> $unique Is field unique or not
* @param int<0,1> $required Is field required or not
* @param array<string,mixed|mixed[]>|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int<0,1> $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param string $list Visibility
* @param string $help Help on tooltip
@ -394,9 +394,9 @@ class ExtraFields
* @param string $entity Entity of extrafields
* @param string $langfile Language file
* @param string $enabled Condition to have the field enabled or not
* @param int $totalizable Is a measure. Must show a total on lists
* @param int $printable Is extrafield displayed on PDF
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
* @param int<0,1> $totalizable Is a measure. Must show a total on lists
* @param int<0,1> $printable Is extrafield displayed on PDF
* @param array<string,mixed> $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
* @return int Return integer <=0 if KO, >0 if OK
* @throws Exception
*/
@ -583,7 +583,7 @@ class ExtraFields
if (empty($error)) {
return $result;
} else {
return $error*-1;
return $error * -1;
}
} else {
return 0;
@ -637,10 +637,10 @@ class ExtraFields
* @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime','price','phone','mail','password','url','select','checkbox', ...)
* @param string $length Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param int $pos Position of attribute
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int<0,1> $unique Is field unique or not
* @param int<0,1> $required Is field required or not
* @param int<0,1> $pos Position of attribute
* @param array<string,mixed|mixed[]> $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param string $list Visibility
@ -650,9 +650,9 @@ class ExtraFields
* @param string $entity Entity of extrafields
* @param string $langfile Language file
* @param string $enabled Condition to have the field enabled or not
* @param int $totalizable Is extrafield totalizable on list
* @param int $printable Is extrafield displayed on PDF
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
* @param int<0,1> $totalizable Is extrafield totalizable on list
* @param int<0,1> $printable Is extrafield displayed on PDF
* @param array<string,mixed> $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
* @return int >0 if OK, <=0 if KO
* @throws Exception
*/
@ -792,11 +792,11 @@ class ExtraFields
* @param string $type Type of attribute
* @param string $size Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param int<0,1> $unique Is field unique or not
* @param int<0,1> $required Is field required or not
* @param int $pos Position of attribute
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param array<string,mixed|array<string,mixed>> $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int<0,1> $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param string $list Visibility
* @param string $help Help on tooltip.
@ -805,9 +805,9 @@ class ExtraFields
* @param string $entity Entity of extrafields
* @param string $langfile Language file
* @param string $enabled Condition to have the field enabled or not
* @param int $totalizable Is extrafield totalizable on list
* @param int $printable Is extrafield displayed on PDF
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
* @param int<0,1> $totalizable Is extrafield totalizable on list
* @param int<0,1> $printable Is extrafield displayed on PDF
* @param array<string,mixed> $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
* @return int Return integer <=0 if KO, >0 if OK
* @throws Exception
*/
@ -1067,7 +1067,7 @@ class ExtraFields
* Code very similar with showInputField of common object
*
* @param string $key Key of attribute
* @param string|array $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value); for dates in filter mode, a range array('start'=><timestamp>, 'end'=><timestamp>) should be provided
* @param string|array{start:int,end:int} $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value); for dates in filter mode, a range array('start'=><timestamp>, 'end'=><timestamp>) should be provided
* @param string $moreparam To add more parameters on html input tag
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
@ -1559,7 +1559,7 @@ class ExtraFields
if (!is_array($value)) {
$value_arr = explode(',', $value);
}
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, '', 0, '', 0, '100%');
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, 0, 0, '', 0, '100%');
} elseif ($type == 'radio') {
$out = '';
foreach ($param['options'] as $keyopt => $val) {
@ -1823,14 +1823,14 @@ class ExtraFields
}
$this->db->free($resql);
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, '', 0, '100%');
} else {
print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
}
} else {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, '', 0, '100%');
}
}
} elseif ($type == 'link') {
@ -2511,8 +2511,8 @@ class ExtraFields
/**
* Fill array_options property of object by extrafields value (using for data sent by forms)
*
* @param array|null $extralabels Deprecated (old $array of extrafields, now set this to null)
* @param object $object Object
* @param null $extralabels Deprecated (old $array of extrafields, now set this to null)
* @param CommonObject $object Object
* @param string $onlykey Only some keys are filled:
* 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset.
* '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
@ -2567,13 +2567,13 @@ class ExtraFields
&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'checkbox', 'chkbxlst'))
&& in_array(abs($enabled), array(2, 5))
&& ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided
)
) {
continue;
)
) {
continue;
}
$visibility_abs = abs($visibility);
// not modify if extra field is not in update form (0 : never, 2 or -2 : list only, 5 or - 5 : list and view only)
$visibility_abs = abs($visibility);
// not modify if extra field is not in update form (0 : never, 2 or -2 : list only, 5 or - 5 : list and view only)
if (empty($visibility_abs) || $visibility_abs == 2 || $visibility_abs == 5) {
continue;
}
@ -2584,9 +2584,9 @@ class ExtraFields
if ($this->attributes[$object->table_element]['required'][$key]) { // Value is required
// Check if functionally empty without using GETPOST (depending on the type of extrafield, a
// technically non-empty value may be treated as empty functionally).
// value can be alpha, int, array, etc...
$v = $_POST["options_".$key] ?? null;
$type = $this->attributes[$object->table_element]['type'][$key];
// value can be alpha, int, array, etc...
$v = $_POST["options_".$key] ?? null;
$type = $this->attributes[$object->table_element]['type'][$key];
if (self::isEmptyValue($v, $type)) {
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];
@ -2658,7 +2658,7 @@ class ExtraFields
}
}
$object->array_options["options_".$key] = $value_key;
$object->array_options["options_".$key] = $value_key;
}
if ($nofillrequired) {
@ -2677,10 +2677,10 @@ class ExtraFields
/**
* return array_options array of data of extrafields value of object sent by a search form
*
* @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage)
* @param array<string,mixed>|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @return array|int array_options set or 0 if no value
* @return array<string,mixed>|int<0,0> array_options set or 0 if no value
*/
public function getOptionalsFromPost($extrafieldsobjectkey, $keysuffix = '', $keyprefix = '')
{
@ -2846,9 +2846,9 @@ class ExtraFields
/**
* Return if a value is "empty" for a mandatory vision.
*
* @param mixed $v Value to test
* @param null|int|float|string|array<int|string,mixed> $v Value to test
* @param string $type Type of extrafield 'sellist', 'link', 'select', ...
* @return boolean True is value is an empty value, not allowed for a mandatory field.
* @return bool True is value is an empty value, not allowed for a mandatory field.
*/
public static function isEmptyValue($v, string $type)
{
@ -2864,6 +2864,6 @@ class ExtraFields
if ($type == 'sellist') {
return ($v == '0');
}
return (empty($v) && $v != '0');
return empty($v); // Note empty('0') is also true, tested 7.0 up to 8.3.12
}
}

View File

@ -34,7 +34,7 @@ class ExtraLanguages
public $db;
/**
* @var array New array to store extralanguages definition
* @var array<string,array<string,string>> New array to store extralanguages definition
*/
public $attributes;
@ -77,7 +77,7 @@ class ExtraLanguages
*
* @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is status of cache.
* @return array Array of attributes keys+label for all extra fields.
* @return array<string,array<string,string>> Array of attributes keys+label for all extra fields.
*/
public function fetch_name_extralanguages($elementtype, $forceload = false)
{

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -84,7 +85,7 @@ class FediverseParser
/**
* Get the list of retrieved posts.
*
* @return array List of posts.
* @return array<array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar?:string}|array{}> Posts fetched from the API
*/
public function getPosts()
{
@ -94,7 +95,7 @@ class FediverseParser
/**
* Get the last fetch date.
*
* @return int|String Timestamp of the last successful fetch.
* @return int|string Timestamp of the last successful fetch.
*/
public function getLastFetchDate()
{

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2011-2022 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -33,7 +34,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
*/
class FileUpload
{
/**
* @var array{script_url:string,upload_dir:string,upload_url:string,param_name:string,delete_type:string,max_file_size:?int,min_file_size:int,accept_file_types:string,max_number_of_files:?int,max_width:?int,max_height:?int,min_width:int,min_height:int,discard_aborted_uploads:bool,image_versions:array<string,array{upload_dir:string,upload_url:string,max_width:int,max_height:int,jpeg_quality?:int}>}
*/
public $options;
/**
* @var int
*/
protected $fk_element;
/**
@ -45,7 +52,7 @@ class FileUpload
* Constructor.
* This set ->$options
*
* @param array $options Options array
* @param ?array{script_url?:string,upload_dir?:string,upload_url?:string,param_name?:string,delete_type?:string,max_file_size?:?int,min_file_size?:int,accept_file_types?:string,max_number_of_files?:?int,max_width?:?int,max_height?:?int,min_width?:int,min_height?:int,discard_aborted_uploads?:bool,image_versions?:array<string,array{upload_dir?:string,upload_url?:string,max_width?:int,max_height?:int,jpeg_quality?:int}>} $options Options array
* @param int $fk_element ID of element
* @param string $element Code of element
*/
@ -73,6 +80,7 @@ class FileUpload
throw new Exception('The element '.$element.' is not supported for uploading file. dir_output is unknown.');
}
$object_ref = 'UndefinedReference';
// If pathname and filename are null then we can still upload files if we have specified upload_dir on $options
if ($pathname !== null && $filename !== null) {
// Get object from its id and type
@ -196,7 +204,7 @@ class FileUpload
/**
* Set delete url
*
* @param object $file Filename
* @param stdClass $file File object (see getFileObject)
* @return void
*/
protected function setFileDeleteUrl($file)
@ -212,7 +220,7 @@ class FileUpload
* getFileObject
*
* @param string $file_name Filename
* @return stdClass|null
* @return ?stdClass
*/
protected function getFileObject($file_name)
{
@ -243,7 +251,7 @@ class FileUpload
/**
* getFileObjects
*
* @return array Array of objects
* @return array<?stdClass> Array of objects
*/
protected function getFileObjects()
{
@ -253,9 +261,9 @@ class FileUpload
/**
* Create thumbs of a file uploaded.
*
* @param string $file_name Filename
* @param string $options is array('max_width', 'max_height')
* @return boolean
* @param string $file_name Filename
* @param array{upload_dir:string} $options is array('max_width', 'max_height')
* @return bool
*/
protected function createScaledImage($file_name, $options)
{

View File

@ -460,7 +460,7 @@ class Fiscalyear extends CommonObject
*
* @param int|string $datestart Date start to scan
* @param int|string $dateend Date end to scan
* @return string Number of entries
* @return int Number of entries
*/
public function getAccountancyEntriesByFiscalYear($datestart = '', $dateend = '')
{
@ -478,10 +478,11 @@ class Fiscalyear extends CommonObject
$sql .= " WHERE entity IN (".getEntity('bookkeeping', 0).")";
$sql .= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'";
$nb = 0;
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
$nb = $obj->nb;
$nb = (int) $obj->nb;
} else {
dol_print_error($this->db);
}
@ -494,7 +495,7 @@ class Fiscalyear extends CommonObject
*
* @param int|string $datestart Date start to scan
* @param int|string $dateend Date end to scan
* @return string Number of movements
* @return int Number of movements
*/
public function getAccountancyMovementsByFiscalYear($datestart = '', $dateend = '')
{
@ -512,10 +513,11 @@ class Fiscalyear extends CommonObject
$sql .= " WHERE entity IN (".getEntity('bookkeeping', 0).")";
$sql .= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'";
$nb = 0;
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
$nb = $obj->nb;
$nb = (int) $obj->nb;
} else {
dol_print_error($this->db);
}

View File

@ -1731,15 +1731,15 @@ class Form
* Note: you must use the select_contact() to get the component to select a contact. This function must only be called by select_contact.
*
* @param int $socid Id of third party or 0 for all or -1 for empty list
* @param array|int|string $selected Array of ID of preselected contact id
* @param string[]|int|string $selected Array of ID of preselected contact id
* @param string $htmlname Name of HTML field ('none' for a not editable field)
* @param int<0,3>|string $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list
* @param string $exclude List of contacts id to exclude
* @param string $limitto Disable answers that are not id in this array list
* @param integer $showfunction Add function into label
* @param int<0,1> $showfunction Add function into label
* @param string $morecss Add more class to class style
* @param int $options_only 1=Return options only (for ajax treatment), 2=Return array
* @param integer $showsoc Add company into label
* @param int<0,1> $showsoc Add company into label
* @param int $forcecombo Force to use combo box (so no ajax beautify effect)
* @param array<array{method:string,url:string,htmlname:string,params:array<string,string>}> $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
@ -2881,21 +2881,21 @@ class Form
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
* @param string $filterkey Filter on product
* @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int<-1,1> $status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $finished Filter on finished field: 2=No filter
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @param string|int<0,1> $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @param int $hidepriceinlabel 1=Hide prices in label
* @param string $warehouseStatus Warehouse status filter to group/count stock. Following comma separated filter options can be used.
* 'warehouseopen' = count products from open warehouses,
* 'warehouseclosed' = count products from closed warehouses,
* 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
* @param int<0,1> $hidepriceinlabel 1=Hide prices in label
* @param ''|'warehouseopen'|'warehouseclosed'|'warehouseinternal' $warehouseStatus Warehouse status filter to group/count stock. Following comma separated filter options can be used.
* 'warehouseopen' = count products from open warehouses,
* 'warehouseclosed' = count products from closed warehouses,
* 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @param int<-1,1> $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
* @param int $warehouseId Filter by Warehouses Id where there is real stock
* @return array|string Array of keys for json
* @return string|array<array{key:string,value:string,label:string,label2:string,desc:string,type:string,price_ht:string,price_ttc:string,price_ht_locale:string,price_ttc_locale:string,pricebasetype:string,tva_tx:string,default_vat_code:string,qty:string,discount:string,duration_value:string,duration_unit:string,pbq:string,labeltrans:string,desctrans:string,ref_customer:string}> Array of keys for json
*/
public function select_produits_list($selected = 0, $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = 'maxwidth500', $hidepriceinlabel = 0, $warehouseStatus = '', $status_purchase = -1, $warehouseId = 0)
{
@ -3201,7 +3201,7 @@ class Form
//$objp->default_vat_code is not overwritten by $objp2 value
$this->constructProductListOption($objp, $opt, $optJson, 0, $selected, $hidepriceinlabel, $filterkey);
'@phan-var-force array{key:string,value:string,label:string,label2:string,desc:string,type:string,price_ht:string,price_ttc:string,price_ht_locale:string,price_ttc_locale:string,pricebasetype:string,tva_tx:string,default_vat_code:string,qty:string,discount:string,duration_value:string,duration_unit:string,pbq:string,labeltrans:string,desctrans:string,ref_customer:string} $optJson';
$j++;
// Add new entry
@ -3264,7 +3264,7 @@ class Form
*
* @param stdClass $objp Resultset of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param array{key:string,value:string,label:string,label2:string,desc:string,type:string,price_ht:string,price_ttc:string,price_ht_locale:string,price_ttc_locale:string,pricebasetype:string,tva_tx:string,default_vat_code:string,qty:string,discount:string,duration_value:string,duration_unit:string,pbq:string,labeltrans:string,desctrans:string,ref_customer:string} $optJson Option (var used for returned value in json format)
* @param array{key?:string,value?:string,label?:string,label2?:string,desc?:string,type?:string,price_ht?:string,price_ttc?:string,price_ht_locale?:string,price_ttc_locale?:string,pricebasetype?:string,tva_tx?:string,default_vat_code?:string,qty?:string,discount?:string,duration_value?:string,duration_unit?:string,pbq?:string,labeltrans?:string,desctrans?:string,ref_customer?:string} $optJson Option (var used for returned value in json format)
* @param int $price_level Price level
* @param int $selected Preselected value
* @param int<0,1> $hidepriceinlabel Hide price in label
@ -3696,7 +3696,7 @@ class Form
* @param string $morecss Add more CSS
* @param int $showstockinlist Show stock information (slower).
* @param string $placeholder Placeholder
* @return array|string Array of keys for json or HTML component
* @return array<array<string,mixed>>|string Array of keys for json or HTML component
*/
public function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '', $showstockinlist = 0, $placeholder = '')
{
@ -7025,12 +7025,12 @@ class Form
* @param int<0,1> $disabled Disable input fields
* @param int|string $fullday When a checkbox with id #fullday is checked, hours are set with 00:00 (if value if 'fulldaystart') or 23:59 (if value is 'fulldayend')
* @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field.
* @param int|string|array $adddateof Add a link "Date of ..." using the following date. Must be array(array('adddateof' => ..., 'labeladddateof' => ...))
* @param int|string|array<string,mixed> $adddateof Add a link "Date of ..." using the following date. Must be array(array('adddateof' => ..., 'labeladddateof' => ...))
* @param string $openinghours Specify hour start and hour end for the select ex 8,20
* @param int $stepminutes Specify step for minutes between 1 and 30
* @param string $labeladddateof Label to use for the $adddateof parameter. Deprecated. Used only when $adddateof is not an array.
* @param string $placeholder Placeholder
* @param mixed $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel'
* @param 'auto'|'gmt'|'tzserver'|'tzuserrel' $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel'
* @return string Html for selectDate
* @see form_date(), select_month(), select_year(), select_dayofweek()
*/
@ -7682,7 +7682,7 @@ class Form
* @param string|int<0,1> $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @return array|string Array of keys for json or HTML component
* @return array<array{key:string,value:mixed,type:int}>|string Array of keys for json or HTML component
*/
public function selectTicketsList($selected = '', $htmlname = 'ticketid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '')
{
@ -7767,6 +7767,7 @@ class Form
$objp = $this->db->fetch_object($result);
$this->constructTicketListOption($objp, $opt, $optJson, $selected, $filterkey);
'@phan-var-force array{key:string,value:mixed,type:int} $optJson';
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value
// "label" value of json key array is used by jQuery automatically as text for combo box
@ -7797,7 +7798,7 @@ class Form
*
* @param object $objp Result set of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param mixed[] $optJson Option (var used for returned value in json format)
* @param array{key?:string,value?:mixed,type?:int} $optJson Option (var used for returned value in json format)
* @param string $selected Preselected value
* @param string $filterkey Filter key to highlight
* @return void
@ -7906,7 +7907,7 @@ class Form
* @param string|int<0,1> $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @return array|string Array of keys for json or HTML component
* @return mixed[]|string Array of keys for json or HTML component
*/
public function selectProjectsList($selected = '', $htmlname = 'projectid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '')
{
@ -8138,7 +8139,7 @@ class Form
* @param string|int<0,1> $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @return array|string Array of keys for json or HTML string component
* @return mixed[]|string Array of keys for json or HTML string component
*/
public function selectMembersList($selected = '', $htmlname = 'adherentid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '')
{
@ -8256,7 +8257,7 @@ class Form
*
* @param object $objp Result set of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param mixed[] $optJson Option (var used for returned value in json format)
* @param array{key?:string,value?:mixed,type?:int} $optJson Option (var used for returned value in json format)
* @param string $selected Preselected value
* @param string $filterkey Filter key to highlight
* @return void
@ -8485,7 +8486,7 @@ class Form
* @param int $disabled 1=Html component is disabled
* @param string $sortfield Sort field
* @param string $filter Add more filter (Universal Search Filter)
* @return string|array Return HTML string
* @return string|array<array{key:string,value:mixed,label:string}> Return HTML string
* @see selectForForms()
*/
public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0, $sortfield = '', $filter = '')

View File

@ -376,6 +376,7 @@ class FormAccounting extends Form
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$out = '';
$selected = '';
$options = array();

View File

@ -525,7 +525,6 @@ class FormAdmin
// Set $valhtml with the picto for the type
$valhtml = ($key ? getPictoForType($key) : '').$val;
// @phpstan-ignore-next-line
if (empty($typewecanchangeinto) || in_array($key, $typewecanchangeinto[$type])) {
$out .= '<option value="'.$key.'"'.$selected.' data-html="'.dol_escape_htmltag($valhtml).'">'.($val ? $val : '&nbsp;').'</option>';
} else {

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-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
@ -55,7 +56,7 @@ class FormBarCode
* Return HTML select with list of bar code generators
*
* @param int $selected Id code pre-selected
* @param array $barcodelist Array of barcodes generators
* @param array<string,string> $barcodelist Array of barcodes generators
* @param int $code_id Id du code barre
* @param string $idForm Id of html form, ex id="idform"
* @return string HTML select string

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.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
@ -35,12 +36,12 @@ class FormCategory extends Form
* Return a HTML filter box for a list filter view
*
* @param string $type The categorie type (e.g Categorie::TYPE_WAREHOUSE)
* @param array $preSelected A list with the elements that should pre-selected
* @param array<int|string> $preSelected A list with the elements that should pre-selected
* @param string $morecss More CSS
* @param int $searchCategoryProductOperator Used only if $multiselect is 1. Set to 0 or 1 to enable the checkbox to search with a or (0=not preseleted, 1=preselected), -1=Checkbox never shown.
* @param int $multiselect 0 or 1
* @param int $nocateg 1=Add an entry '- No Category -'
* @param string $showempty 1 or 'string' to add an empty entry
* @param int<-1,1> $searchCategoryProductOperator Used only if $multiselect is 1. Set to 0 or 1 to enable the checkbox to search with a or (0=not preselected, 1=preselected), -1=Checkbox never shown.
* @param int<0,1> $multiselect 0 or 1
* @param int<0,1> $nocateg 1=Add an entry '- No Category -'
* @param int<1,1>|string $showempty 1 or 'string' to add an empty entry
* @return string A HTML filter box (Note: selected results can get with GETPOST("search_category_".$type."_list"))
*/
public function getFilterBox($type, array $preSelected, $morecss = "minwidth300imp widthcentpercentminusx", $searchCategoryProductOperator = -1, $multiselect = 1, $nocateg = 1, $showempty = '')

View File

@ -91,7 +91,7 @@ class FormFile
* @param int<0,1> $capture 1=Add tag capture="capture" to force use of micro or video recording to generate file. When setting this to 1, you must also provide a value for $accept.
* @param int<0,1> $disablemulti 0=Default, 1=Disable multiple file upload
* @param int<0,1> $nooutput 0=Output result with print, 1=Return result
* @return int|string|array Return integer <0 if KO, >0 if OK, or string if $noouput=1 or array if $nooutput=2
* @return int|string|array{formToUploadAFile:string,formToAddALink:string} Return integer <0 if KO, >0 if OK, or string if $nooutput=1 or array if $nooutput=2
*/
public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = null, $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '', $usewithoutform = 0, $capture = 0, $disablemulti = 0, $nooutput = 0)
{
@ -425,7 +425,7 @@ class FormFile
$hookmanager->initHooks(array('formfile'));
// Get list of files
$file_list = null;
$file_list = array();
if (!empty($filedir)) {
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
}
@ -802,7 +802,7 @@ class FormFile
if ($conf->browser->layout == 'phone') {
$morecss = 'maxwidth100';
}
$out .= $formadmin->select_language($defaultlang, 'lang_id', 0, null, 0, 0, 0, $morecss);
$out .= $formadmin->select_language($defaultlang, 'lang_id', 0, array(), 0, 0, 0, $morecss);
} else {
$out .= '&nbsp;';
}
@ -851,7 +851,7 @@ class FormFile
if (is_object($object)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$link = new Link($this->db);
$sortfield = $sortorder = null;
$sortfield = $sortorder = '';
$res = $link->fetchAll($link_list, $object->element, $object->id, $sortfield, $sortorder);
}
@ -868,6 +868,7 @@ class FormFile
// Loop on each file found
if (is_array($file_list)) {
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string}> $file_list'; // phan limitations loose typing information with empty() tests, etc. Force again.
// Defined relative dir to DOL_DATA_ROOT
$relativedir = '';
if ($filedir) {
@ -887,12 +888,12 @@ class FormFile
foreach ($file_list as $file) {
// Define relative path for download link (depends on module)
$relativepath = $file["name"]; // Cas general
$relativepath = (string) $file["name"]; // Cas general
if ($modulesubdir) {
$relativepath = $modulesubdir."/".$file["name"]; // Cas propal, facture...
$relativepath = (string) $modulesubdir."/".$file["name"]; // Cas propal, facture...
}
if ($modulepart == 'export') {
$relativepath = $file["name"]; // Other case
$relativepath = (string) $file["name"]; // Other case
}
$out .= '<tr class="oddeven">';
@ -1123,20 +1124,20 @@ class FormFile
// Define relative path for download link (depends on module)
$relativepath = $file["name"]; // Cas general
if ($modulesubdir) {
$relativepath = $modulesubdir."/".$file["name"]; // Cas propal, facture...
$relativepath = (string) $modulesubdir."/".$file["name"]; // Cas propal, facture...
}
// Autre cas
if ($modulepart == 'donation') {
$relativepath = get_exdir($modulesubdir, 2, 0, 0, null, 'donation').$file["name"];
$relativepath = (string) get_exdir($modulesubdir, 2, 0, 0, null, 'donation').$file["name"];
}
if ($modulepart == 'export') {
$relativepath = $file["name"];
$relativepath = (string) $file["name"];
}
$this->infofiles['nboffiles']++;
$this->infofiles['files'][] = $file['fullname'];
$ext = pathinfo($file['name'], PATHINFO_EXTENSION);
if (empty($this->infofiles['extensions'][$ext])) {
$ext = (string) pathinfo($file['name'], PATHINFO_EXTENSION); // pathinfo returns a string here (cast for static analysis)
if (!array_key_exists($ext, $this->infofiles['extensions'])) {
$this->infofiles['extensions'][$ext] = 1;
} else {
$this->infofiles['extensions'][$ext]++;
@ -1189,14 +1190,14 @@ class FormFile
* Show list of documents in $filearray (may be they are all in same directory but may not)
* This also sync database if $upload_dir is defined.
*
* @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this.
* @param Object|null $object Object on which document is linked to.
* @param array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string}> $filearray Array of files loaded by dol_dir_list('files') function before calling this.
* @param ?CommonObject $object Object on which document is linked to.
* @param string $modulepart Value for modulepart used by download or viewimage wrapper.
* @param string $param Parameters on sort links (param must start with &, example &aaa=bbb&ccc=ddd)
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file.
* @param int<0,1> $forcedownload Force to open dialog box "Save As" when clicking on file.
* @param string $relativepath Relative path of docs (autodefined if not provided), relative to module dir, not to MAIN_DATA_ROOT.
* @param int $permonobject Permission on object (so permission to delete or crop document)
* @param int $useinecm Change output to add more information:
* @param int<0,1> $permonobject Permission on object (so permission to delete or crop document)
* @param int<0,6> $useinecm Change output to add more information:
* 0, 4, 5, 6: Add a preview column. Show also a rename button. Show also a crop button for some values of $modulepart (must be supported into hard coded list in this function + photos_resize.php + restrictedArea + checkUserAccessToObject)
* 1: Add link to edit ECM entry
* 2: Add rename and crop link
@ -1205,16 +1206,16 @@ class FormFile
* @param int $maxlength Maximum length of file name shown.
* @param string $title Title before list. Use 'none' to disable title.
* @param string $url Full url to use for click links ('' = autodetect)
* @param int $showrelpart 0=Show only filename (default), 1=Show first level 1 dir
* @param int $permtoeditline Permission to edit document line (You must provide a value, -1 is deprecated and must not be used any more)
* @param int<0,1> $showrelpart 0=Show only filename (default), 1=Show first level 1 dir
* @param int<-1,1> $permtoeditline Permission to edit document line (You must provide a value, -1 is deprecated and must not be used any more)
* @param string $upload_dir Full path directory so we can know dir relative to MAIN_DATA_ROOT. Fill this to complete file data with database indexes.
* @param string $sortfield Sort field ('name', 'size', 'position', ...)
* @param string $sortorder Sort order ('ASC' or 'DESC')
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
* @param int $addfilterfields Add the line with filters
* @param int $disablecrop Disable crop feature on images (-1 = auto, prefer to set it explicitly to 0 or 1)
* @param int<0,1> $disablemove 1=Disable move button, 0=Position move is possible.
* @param int<0,1> $addfilterfields Add the line with filters
* @param int<-1,1> $disablecrop Disable crop feature on images (-1 = auto, prefer to set it explicitly to 0 or 1)
* @param string $moreattrondiv More attributes on the div for responsive. Example 'style="height:280px; overflow: auto;"'
* @param array $moreoptions Add more options like array('afteruploadtitle', ...)
* @param array<string,mixed> $moreoptions Add more options like array('afteruploadtitle', ...)
* @return int Return integer <0 if KO, nb of files shown if OK
* @see list_of_autoecmfiles()
*/
@ -1716,7 +1717,7 @@ class FormFile
* Show list of documents in a directory of ECM module.
*
* @param string $upload_dir Directory that was scanned. This directory will contains files into subdirs REF/files
* @param array $filearray Array of files loaded by dol_dir_list function before calling this function
* @param array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string}> $filearray Array of files loaded by dol_dir_list('files') function before calling this.
* @param string $modulepart Value for modulepart used by download wrapper. Value can be $object->table_name (that is 'myobject' or 'mymodule_myobject') or $object->element.'-'.$module (for compatibility purpose)
* @param string $param Parameters on sort links
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file
@ -2109,13 +2110,13 @@ class FormFile
/**
* Show array with linked files
*
* @param Object $object Object
* @param int $permissiontodelete Deletion is allowed
* @param string $action Action
* @param string $selected ???
* @param string $param More param to add into URL
* @param string $htmlname Html name of component
* @param array $moreoptions Add more options like array('afterlinktitle', ...)
* @param CommonObject $object Object
* @param int<0,1> $permissiontodelete Deletion is allowed
* @param ?string $action Action
* @param ?string $selected ???
* @param string $param More param to add into URL
* @param string $htmlname Html name of component
* @param array<string,mixed> $moreoptions Add more options like array('afterlinktitle', ...)
* @return int Number of links
*/
public function listOfLinks($object, $permissiontodelete = 1, $action = null, $selected = null, $param = '', $htmlname = 'formaddlink', $moreoptions = array())
@ -2265,7 +2266,7 @@ class FormFile
/**
* Show detail icon with link for preview
*
* @param array $file Array with data of file. Example: array('name'=>...)
* @param array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string} $file Array with data of file. Example: array('name'=>...)
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $relativepath Relative path of docs
* @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file). Use a negative value to show a generic picto even if preview not available.

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2021 Regis Houssin <regis.houssin@inodbox.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
@ -108,8 +109,8 @@ class FormLdap
*
* @param int $selected Preselected type
* @param string $htmlname Name of field in form
* @param array $exclude Exclude values from the list
* @param int $scriptonly Add warning if synchro only work with a script (0 = disable, 1 = Dolibarr2ldap, 2 = ldap2dolibarr, 3 = all)
* @param string[] $exclude Exclude values from the list
* @param int<0,3> $scriptonly Add warning if synchro only work with a script (0 = disable, 1 = Dolibarr2ldap, 2 = ldap2dolibarr, 3 = all)
* @param int $showempty Add an empty field
* @return string HTML select string
*/

View File

@ -57,8 +57,8 @@ class FormMargin
* TODO Move this in common class.
*
* @param CommonObject $object Object we want to get margin information for
* @param boolean $force_price True of not
* @return array Array with info
* @param bool $force_price True of not
* @return array{pa_products:float,pv_products:float, margin_on_products:float, margin_rate_products :string, mark_rate_products :string, pa_services:float, pv_services:float, margin_on_services:float, margin_rate_services :string, mark_rate_services :string, pa_total:float, pv_total:float, total_margin:float, total_margin_rate :string, total_mark_rate :string} Array with info
*/
public function getMarginInfosArray($object, $force_price = false)
{
@ -99,13 +99,16 @@ class FormMargin
}
$pv = $line->total_ht;
// We chose to have line->pa_ht always positive in database, so we guess the correct sign
// @phan-suppress-next-line PhanUndeclaredConstantOfClass
// $line->pa_ht is always positive in database, so we guess the correct sign
'@phan-var-force Facture|FactureFournisseur $object';
$pa_ht = (($pv < 0 || ($pv == 0 && in_array($object->element, array('facture', 'facture_fourn')) && $object->type == $object::TYPE_CREDIT_NOTE)) ? -$line->pa_ht : $line->pa_ht);
'@phan-var-force CommonObject $object';
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { // Special case for old situation mode
// @phan-suppress-next-line PhanUndeclaredConstantOfClass
'@phan-var-force Facture $object';
if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION)
// @phan-suppress-next-line PhanUndeclaredConstantOfClass
|| ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) {
// We need a compensation relative to $line->situation_percent
$pa = $line->qty * $pa_ht * ($line->situation_percent / 100);

View File

@ -46,6 +46,9 @@ class FormProjets extends Form
public $errors = array();
/**
* @var int
*/
public $nboftasks;
@ -149,7 +152,8 @@ class FormProjets extends Form
* @param string $htmlid Html id to use instead of htmlname
* @param string $morecss More CSS
* @param string $morefilter More filters (Must be a sql sanitized string)
* @return int|string|array HTML string or array of option or <0 if KO
* @return int|string|array<array{key:int,value:string,ref:string,labelx:string,label:string,disabled:bool}> HTML string or array of option or <0 if KO
*/
public function select_projects_list($socid = -1, $selected = 0, $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500', $morefilter = '')
{
@ -818,7 +822,7 @@ class FormProjets extends Form
* @param string $htmlNameInvoice Name of HTML select for Invoice
* @param string $htmlNameInvoiceLine Name of HTML select for Invoice Line
* @param string $morecss More css added to the select component
* @param array $filters Array of filters
* @param array<string,int> $filters Array of filters
* @param int $lineOnly return only option for line
* @return string HTML Select
*/

View File

@ -67,7 +67,7 @@ class FormSetup
/**
*
* @var array
* @var array<string,string>
*/
public $formAttributes = array(
'action' => '', // set in __construct
@ -76,7 +76,7 @@ class FormSetup
/**
* an list of hidden inputs used only in edit mode
* @var array
* @var array<string,string> Currently array{token:string,action:string}
*/
public $formHiddenInputs = array();
@ -116,7 +116,7 @@ class FormSetup
/**
* Generate an attributes string form an input array
*
* @param array $attributes an array of attributes keys and values,
* @param array<string,mixed|mixed[]|Object> $attributes an array of attributes keys and values,
* @return string attribute string
*/
public static function generateAttributesStringFromArray($attributes)
@ -618,13 +618,13 @@ class FormSetupItem
/** @var string $picto */
public $picto = '';
/** @var string $fieldValue */
/** @var ?string $fieldValue */
public $fieldValue;
/** @var string $defaultFieldValue */
/** @var ?string $defaultFieldValue */
public $defaultFieldValue = null;
/** @var array $fieldAttr fields attribute only for compatible fields like input text */
/** @var array{name?:string,id?:string,value?:mixed,class?:string,disabled?:?int<0,1>,type?:string,size?:int,placeholder?:string,step?:float|string,min?:int,max?:int} fields attribute only for compatible fields like input text */
public $fieldAttr = array();
/** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */
@ -639,10 +639,10 @@ class FormSetupItem
/** @var int $rank */
public $rank = 0;
/** @var array set this var for options on select and multiselect items */
/** @var array<string,string|array{id:string,label:string,color:string,picto:string,labelhtml:string}> set this var for options on select and multiselect items */
public $fieldOptions = array();
/** @var array set this var to add more parameters */
/** @var array<string,string|int|array{id:string,label:string,color:string,picto:string,labelhtml:string}> set this var to add more parameters */
public $fieldParams = array();
/** @var callable $saveCallBack */
@ -1513,7 +1513,7 @@ class FormSetupItem
/**
* Set type of input as a simple title. No data to store
*
* @param array $fieldOptions A table of field options
* @param array<string,string|array{id:string,label:string,color:string,picto:string,labelhtml:string}> $fieldOptions A table of field options
* @return self
*/
public function setAsMultiSelect($fieldOptions)
@ -1529,7 +1529,7 @@ class FormSetupItem
/**
* Set type of input as a simple title. No data to store
*
* @param array $fieldOptions A table of field options
* @param array<string,string|array{id:string,label:string,color:string,picto:string,labelhtml:string}> $fieldOptions A table of field options
* @return self
*/
public function setAsSelect($fieldOptions)

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,6 +28,9 @@
*/
class FormWebsite
{
/**
* @var DoliDB
*/
private $db;
/**
@ -35,7 +39,7 @@ class FormWebsite
public $error;
/**
* var int A number of lines
* @var int A number of lines
*/
public $num;
@ -251,10 +255,10 @@ class FormWebsite
* @param Website $website Object Website
* @param string $htmlname Name of select zone
* @param int $pageid Preselected container ID
* @param int $showempty Show empty record
* @param int<0,1> $showempty Show empty record
* @param string $action Action on page that use this select list
* @param string $morecss More CSS
* @param array $excludeids Exclude some ID in list
* @param null|string[] $excludeids Exclude some ID in list
* @return string HTML select component with list of block containers
*/
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200', $excludeids = null)
@ -385,7 +389,7 @@ class FormWebsite
$out .= '<div class="template-option" data-template="'.$template.'" data-content="'.htmlentities($contentHtml).'">';
$out .= '<img class="maillayout" alt="'.$template.'" src="'.DOL_URL_ROOT.'/theme/common/maillayout/'.$template.'.png" />';
$out .= '<span class="template-option-text">'.($template != 'text' ? ucfirst($template) : ucfirst($templateFunction)).'</span>';
$out .= '<span class="template-option-text">'.($template != 'text' ? ucfirst($template) : ucfirst($templateFunction)).'</span>';
$out .= '</div>';
}
$out .= '<input type="hidden" name="sample" value="" />';

View File

@ -185,7 +185,7 @@ class MastodonHandler
/**
* Get the list of retrieved posts.
*
* @return array<array{id:string,content:string,created_at:string,url:string,media_url:string}|array{}> List of posts
* @return array<array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar?:string}|array{}> Posts fetched from the API
*/
public function getPosts()
{

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -70,7 +71,7 @@ class RedditHandler
public $error = '';
/**
* @var Array posts of social network (Mastodon)
* @var array<array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar?:string}|array{}> Posts of the social network
*/
private $posts;
@ -236,7 +237,7 @@ class RedditHandler
/**
* Get the list of retrieved posts.
*
* @return array List of posts.
* @return array<array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar?:string}|array{}> Posts fetched from the API
*/
public function getPosts()
{

View File

@ -111,7 +111,7 @@ class SocialNetworkManager
/**
* Get the list of retrieved posts.
*
* @return array<array{id:string,content:string,created_at:string,url:string,media_url:string}|array{}> List of posts.
* @return array<array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar?:string}|array{}> Posts fetched from the API
*/
public function getPosts()
{

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2008-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2009 Regis Houssin <regis.houssin@inodbox.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
@ -117,79 +118,79 @@ $sectionauto = array();
if (isModEnabled("product") || isModEnabled("service")) {
$langs->load("products");
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(isModEnabled("product") || isModEnabled("service")), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts"));
$sectionauto[] = array('level' => 1, 'module' => 'product', 'test' => (isModEnabled("product") || isModEnabled("service")), 'label' => $langs->trans("ProductsAndServices"), 'desc' => $langs->trans("ECMDocsByProducts"));
}
if (isModEnabled("societe")) {
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>isModEnabled('societe'), 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties")));
$sectionauto[] = array('level' => 1, 'module' => 'company', 'test' => isModEnabled('societe'), 'label' => $langs->trans("ThirdParties"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties")));
}
if (isModEnabled("propal")) {
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>isModEnabled('propal'), 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals")));
$sectionauto[] = array('level' => 1, 'module' => 'propal', 'test' => isModEnabled('propal'), 'label' => $langs->trans("Proposals"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals")));
}
if (isModEnabled('contract')) {
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>isModEnabled('contract'), 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts")));
$sectionauto[] = array('level' => 1, 'module' => 'contract', 'test' => isModEnabled('contract'), 'label' => $langs->trans("Contracts"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts")));
}
if (isModEnabled('order')) {
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>isModEnabled('order'), 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders")));
$sectionauto[] = array('level' => 1, 'module' => 'order', 'test' => isModEnabled('order'), 'label' => $langs->trans("CustomersOrders"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders")));
}
if (isModEnabled('invoice')) {
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>isModEnabled('invoice'), 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
$sectionauto[] = array('level' => 1, 'module' => 'invoice', 'test' => isModEnabled('invoice'), 'label' => $langs->trans("CustomersInvoices"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
}
if (isModEnabled('supplier_proposal')) {
$langs->load("supplier_proposal");
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>isModEnabled('supplier_proposal'), 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
$sectionauto[] = array('level' => 1, 'module' => 'supplier_proposal', 'test' => isModEnabled('supplier_proposal'), 'label' => $langs->trans("SupplierProposals"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
}
if (isModEnabled("supplier_order")) {
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>isModEnabled("supplier_order"), 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
$sectionauto[] = array('level' => 1, 'module' => 'order_supplier', 'test' => isModEnabled("supplier_order"), 'label' => $langs->trans("SuppliersOrders"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
}
if (isModEnabled("supplier_invoice")) {
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>isModEnabled("supplier_invoice"), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
$sectionauto[] = array('level' => 1, 'module' => 'invoice_supplier', 'test' => isModEnabled("supplier_invoice"), 'label' => $langs->trans("SuppliersInvoices"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
}
if (isModEnabled('tax')) {
$langs->load("compta");
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>isModEnabled('tax'), 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
$sectionauto[] = array('level' => 1, 'module' => 'tax', 'test' => isModEnabled('tax'), 'label' => $langs->trans("SocialContributions"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
}
if (isModEnabled('project')) {
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
$sectionauto[] = array('level' => 1, 'module' => 'project', 'test' => isModEnabled('project'), 'label' => $langs->trans("Projects"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
}
if (isModEnabled('intervention')) {
$langs->load("interventions");
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>isModEnabled('intervention'), 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
$sectionauto[] = array('level' => 1, 'module' => 'fichinter', 'test' => isModEnabled('intervention'), 'label' => $langs->trans("Interventions"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
}
if (isModEnabled('expensereport')) {
$langs->load("trips");
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>isModEnabled('expensereport'), 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports")));
$sectionauto[] = array('level' => 1, 'module' => 'expensereport', 'test' => isModEnabled('expensereport'), 'label' => $langs->trans("ExpenseReports"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports")));
}
if (isModEnabled('holiday')) {
$langs->load("holiday");
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>isModEnabled('holiday'), 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays")));
$sectionauto[] = array('level' => 1, 'module' => 'holiday', 'test' => isModEnabled('holiday'), 'label' => $langs->trans("Holidays"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays")));
}
if (isModEnabled("bank")) {
$langs->load("banks");
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>isModEnabled('bank'), 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
$sectionauto[] = array('level' => 1, 'module' => 'banque', 'test' => isModEnabled('bank'), 'label' => $langs->trans("BankAccount"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
}
if (isModEnabled('mrp')) {
$langs->load("mrp");
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>isModEnabled('mrp'), 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
$sectionauto[] = array('level' => 1, 'module' => 'mrp-mo', 'test' => isModEnabled('mrp'), 'label' => $langs->trans("MOs"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
}
if (isModEnabled('recruitment')) {
$langs->load("recruitment");
$rowspan++;
$sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>isModEnabled('recruitment'), 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications")));
$sectionauto[] = array('level' => 1, 'module' => 'recruitment-recruitmentcandidature', 'test' => isModEnabled('recruitment'), 'label' => $langs->trans("Candidatures"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications")));
}
@ -265,7 +266,7 @@ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)
$formfile = new FormFile($db);
$param = '&section='.urlencode($section);
$textifempty = ($section ? $langs->trans("NoFileFound") : $langs->trans("ECMSelectASection"));
$formfile->list_of_documents($filearray, '', 'ecm', $param, 1, $relativepath, $user->hasRight('ecm', 'upload'), 1, $textifempty);
$formfile->list_of_documents($filearray, null, 'ecm', $param, 1, $relativepath, $user->hasRight('ecm', 'upload'), 1, $textifempty);
print '</td></tr>';

View File

@ -1361,7 +1361,7 @@ class FactureFournisseur extends CommonInvoice
$facligne->desc = $remise->description; // Description ligne
$facligne->vat_src_code = $remise->vat_src_code;
$facligne->tva_tx = $remise->tva_tx;
$facligne->subprice = -$remise->amount_ht;
$facligne->subprice = -(float) $remise->amount_ht;
$facligne->fk_product = 0; // Id produit predefini
$facligne->product_type = 0;
$facligne->qty = 1;
@ -1388,9 +1388,9 @@ class FactureFournisseur extends CommonInvoice
$facligne->pa_ht = $arraytmp['pa_total'];
}
$facligne->total_ht = -$remise->amount_ht;
$facligne->total_tva = -$remise->amount_tva;
$facligne->total_ttc = -$remise->amount_ttc;
$facligne->total_ht = -(float) $remise->amount_ht;
$facligne->total_tva = -(float) $remise->amount_tva;
$facligne->total_ttc = -(float) $remise->amount_ttc;
$facligne->multicurrency_subprice = -$remise->multicurrency_subprice;
$facligne->multicurrency_total_ht = -$remise->multicurrency_total_ht;

View File

@ -372,16 +372,16 @@ class SupplierProposal extends CommonObject
$supplier_proposalligne->fk_remise_except = $remise->id;
$supplier_proposalligne->desc = $remise->description; // Description ligne
$supplier_proposalligne->tva_tx = $remise->tva_tx;
$supplier_proposalligne->subprice = -$remise->amount_ht;
$supplier_proposalligne->subprice = -(float) $remise->amount_ht;
$supplier_proposalligne->fk_product = 0; // Id produit predefini
$supplier_proposalligne->qty = 1;
$supplier_proposalligne->remise_percent = 0;
$supplier_proposalligne->rang = -1;
$supplier_proposalligne->info_bits = 2;
$supplier_proposalligne->total_ht = -$remise->amount_ht;
$supplier_proposalligne->total_tva = -$remise->amount_tva;
$supplier_proposalligne->total_ttc = -$remise->amount_ttc;
$supplier_proposalligne->total_ht = -(float) $remise->amount_ht;
$supplier_proposalligne->total_tva = -(float) $remise->amount_tva;
$supplier_proposalligne->total_ttc = -(float) $remise->amount_ttc;
$result = $supplier_proposalligne->insert();
if ($result > 0) {

View File

@ -80,7 +80,6 @@ parameters:
- '#(?:colorAdjustBrightness|imap_(?:(?:fetch)?body|fetchstructure)) expects int, string#'
- '#(?:(?:(?:BonPrelevement::generat|CommonObject::update_pric)e|Form(?:::getSelectConditionsPaiements|Company::select_state)|In(?:foBox::listBoxes|tracommReport::addItemsFact)|Menubase::recur|Ticket::sendTicketMessageByEmail|mod_barcode_(?:(?:product|thirdparty)_standard::literalBarcodeType))\(\)) expects int, string given\.#'
- '#on array{url: mixed} in empty\(\) does not exist.#'
- '#EvalMath::trigger\(\) expects string, int given#'
- '# Diff::generatePartialDiff\(\) expects array#'
- '# EmailCollector::getpart\(\) expects string#'
- '#(?:(?:CommonStickerGenerator::_Croix|pdf_(?:azur::_tableau_(?:info|tot)|ban::_tableau))\(\)|pdf_(?:bank|c(?:anelle::_tableau_(?:(?:tot|versements)\(\))|ornas::_tableau_(?:(?:info|tot)\(\))|rabe::_tableau_(?:(?:info|tot|versements)\(\))|yan::draw(?:(?:Info|Total)Table\(\)))|e(?:agle(?:(?:::_tableau_tot|_proforma::drawTotalTable)\(\))|instein::_tableau_(?:(?:info|tot)\(\))|ratosthene::draw(?:(?:Info|Total)Table\(\))|spadon::_tableau_tot\(\))|muscadet::_tableau_(?:(?:info|tot)\(\))|octopus::(?:_table(?:(?:FirstPage|au)\(\))|draw(?:(?:Info|Total)Table\(\)))|page(?:foot|head)|(?:rouget::_tableau_tot|s(?:epamandate::_tableau(?:_info)?|ponge::draw(?:(?:Info|Total)Table)|quille::_tableau_tot|t(?:andard_(?:e(?:(?:valuation|xpensereport)::_tableau|xpensereport::tablePayments)|(?:myobjec|supplierpaymen)t::_tableau|supplierpayment::_tableau_cheque)|orm::_tableau_info|rato::tabSignature))|t(?:cpdflabel::writeBarcode|yphon::_tableau_info)|vinci::_tableau_info)\(\)|w(?:atermark|rite(?:LinkedObjects|linedesc))|zenith::_tableau_tot\(\))) expects int, float given\.#'
@ -88,7 +87,6 @@ parameters:
- '#(?:dol_(?:mktime|remove_file_process)|print_actions_filter) expects int, array\|string given\.#'
- '# (CSMSFile) constructor expects int, array\|string given.#'
- '#(?:(?:Asset::addDepreciationL|Facture(?:(?:(?:Fournisseur)?::add|Fournisseur::update)l))ine\(\)|calcul_price_total|(?:loanCalcMonthlyPaymen|print_paypal_redirec)t) expects float, string given.#'
- '#EvalMath::trigger\(\) expects string\|null,#'
- '#(?:F(?:acture(?:(?:Fournisseur)?Rec::addline\(\))|ichinterRec::addLineRec\(\))|dolMd2Html) expects string\|null,#'
- '#::printStdColumnContent\(\) expects string, float(\|(int|array)(\<.*\>)?)* given.#'
- '#::HTML2OpenIDServer\(\) expects string, array given.#'