Qual: Fix FunctionArray phan notices (#31754)

* Qual: Fix FunctionArray phan notices

* Fix class name in typing of htdocs/modulebuilder/index.php

* Fix customreports phpdoc

* Adjust file type after completeFileArrayWithDatabaseInfo

* Further phpdoc typing improvements

* More phpdoc

* Improve typing with cast on position field

* Force phpstan version

* Add phpstan exception

* Fix array index type + adjust phan config comment
This commit is contained in:
MDW 2024-11-11 14:48:18 +01:00 committed by GitHub
parent 3448985640
commit 9ec4618199
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
44 changed files with 611 additions and 733 deletions

View File

@ -1330,6 +1330,11 @@ parameters:
count: 1
path: ../../htdocs/admin/system/filecheck.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 3
path: ../../htdocs/admin/system/filecheck.php
-
message: "#^Ternary operator condition is always false\\.$#"
count: 1
@ -1490,6 +1495,11 @@ parameters:
count: 1
path: ../../htdocs/admin/website.php
-
message: "#^Return type of call to function dol_sort_array contains unresolvable type\\.$#"
count: 1
path: ../../htdocs/admin/workflow.php
-
message: "#^If condition is always false\\.$#"
count: 1
@ -1765,6 +1775,11 @@ parameters:
count: 1
path: ../../htdocs/api/class/api_setup.class.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 3
path: ../../htdocs/api/class/api_setup.class.php
-
message: "#^Variable \\$multicurrency in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
@ -1925,6 +1940,11 @@ parameters:
count: 1
path: ../../htdocs/asset/model/card.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/asset/model/card.php
-
message: "#^Property CommonObject\\:\\:\\$entity \\(int\\) in isset\\(\\) is not nullable\\.$#"
count: 1
@ -1965,26 +1985,11 @@ parameters:
count: 1
path: ../../htdocs/asset/tpl/accountancy_codes_view.tpl.php
-
message: "#^Variable \\$assetdepreciationoptions might not be defined\\.$#"
count: 11
path: ../../htdocs/asset/tpl/depreciation_options_edit.tpl.php
-
message: "#^Variable \\$langs might not be defined\\.$#"
count: 4
path: ../../htdocs/asset/tpl/depreciation_options_edit.tpl.php
-
message: "#^Variable \\$parameters might not be defined\\.$#"
count: 1
path: ../../htdocs/asset/tpl/depreciation_options_edit.tpl.php
-
message: "#^Variable \\$assetdepreciationoptions might not be defined\\.$#"
count: 4
path: ../../htdocs/asset/tpl/depreciation_options_view.tpl.php
-
message: "#^Variable \\$db might not be defined\\.$#"
count: 1
@ -2000,6 +2005,11 @@ parameters:
count: 1
path: ../../htdocs/asset/tpl/depreciation_options_view.tpl.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/asset/tpl/depreciation_view.tpl.php
-
message: "#^Variable \\$assetdepreciationoptions might not be defined\\.$#"
count: 7
@ -2180,6 +2190,11 @@ parameters:
count: 1
path: ../../htdocs/bom/class/bom.class.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/bom/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$object might not be defined\\.$#"
count: 2
@ -2655,6 +2670,11 @@ parameters:
count: 3
path: ../../htdocs/categories/class/categorie.class.php
-
message: "#^Return type of call to function dol_sort_array contains unresolvable type\\.$#"
count: 1
path: ../../htdocs/categories/class/categorie.class.php
-
message: "#^Variable \\$url in empty\\(\\) always exists and is not falsy\\.$#"
count: 2
@ -2840,11 +2860,6 @@ parameters:
count: 1
path: ../../htdocs/comm/action/document.php
-
message: "#^Function show_day_events\\(\\) has parameter \\$eventarray with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/comm/action/index.php
-
message: "#^If condition is always false\\.$#"
count: 1
@ -2915,16 +2930,6 @@ parameters:
count: 1
path: ../../htdocs/comm/action/pertype.php
-
message: "#^Function show_day_events_pertype\\(\\) has parameter \\$colorsbytype with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/comm/action/pertype.php
-
message: "#^Function show_day_events_pertype\\(\\) has parameter \\$eventarray with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/comm/action/pertype.php
-
message: "#^If condition is always false\\.$#"
count: 1
@ -2975,16 +2980,6 @@ parameters:
count: 1
path: ../../htdocs/comm/action/pertype.php
-
message: "#^Function show_day_events2\\(\\) has parameter \\$colorsbytype with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/comm/action/peruser.php
-
message: "#^Function show_day_events2\\(\\) has parameter \\$eventarray with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/comm/action/peruser.php
-
message: "#^If condition is always false\\.$#"
count: 2
@ -3060,6 +3055,11 @@ parameters:
count: 6
path: ../../htdocs/comm/card.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 6
path: ../../htdocs/comm/card.php
-
message: "#^Variable \\$filedir in empty\\(\\) always exists and is not falsy\\.$#"
count: 6
@ -3500,6 +3500,11 @@ parameters:
count: 2
path: ../../htdocs/comm/propal/stats/index.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/comm/propal/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$object might not be defined\\.$#"
count: 1
@ -3795,6 +3800,11 @@ parameters:
count: 10
path: ../../htdocs/commande/list.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/commande/list.php
-
message: "#^Variable \\$contextpage in empty\\(\\) always exists and is not falsy\\.$#"
count: 3
@ -3865,6 +3875,11 @@ parameters:
count: 1
path: ../../htdocs/commande/stats/index.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/commande/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$object might not be defined\\.$#"
count: 2
@ -4940,6 +4955,11 @@ parameters:
count: 1
path: ../../htdocs/compta/facture/stats/index.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$object might not be defined\\.$#"
count: 1
@ -5470,6 +5490,11 @@ parameters:
count: 1
path: ../../htdocs/compta/recap-compta.php
-
message: "#^Return type of call to function dol_sort_array contains unresolvable type\\.$#"
count: 2
path: ../../htdocs/compta/recap-compta.php
-
message: "#^Variable \\$builddate might not be defined\\.$#"
count: 1
@ -6305,6 +6330,11 @@ parameters:
count: 1
path: ../../htdocs/contact/list.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/contact/list.php
-
message: "#^Variable \\$contextpage in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
@ -6575,6 +6605,11 @@ parameters:
count: 1
path: ../../htdocs/contrat/list.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/contrat/list.php
-
message: "#^Variable \\$contextpage in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
@ -6965,11 +7000,6 @@ parameters:
count: 1
path: ../../htdocs/core/ajax/ajaxdirpreview.php
-
message: "#^Function treeOutputForAbsoluteDir\\(\\) has parameter \\$sqltree with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/core/ajax/ajaxdirtree.php
-
message: "#^Variable \\$action might not be defined\\.$#"
count: 1
@ -7010,11 +7040,6 @@ parameters:
count: 1
path: ../../htdocs/core/ajax/locationincoterms.php
-
message: "#^Function dolPrintSignatureImage\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/core/ajax/onlineSign.php
-
message: "#^Variable \\$tva_tx in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
@ -7755,6 +7780,11 @@ parameters:
count: 1
path: ../../htdocs/core/class/commonobject.class.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/core/class/commonobject.class.php
-
message: "#^Variable \\$minSize in empty\\(\\) always exists and is always falsy\\.$#"
count: 1
@ -8350,6 +8380,11 @@ parameters:
count: 1
path: ../../htdocs/core/class/html.form.class.php
-
message: "#^Return type of call to function dol_sort_array contains unresolvable type\\.$#"
count: 4
path: ../../htdocs/core/class/html.form.class.php
-
message: "#^Right side of && is always true\\.$#"
count: 2
@ -8360,6 +8395,11 @@ parameters:
count: 8
path: ../../htdocs/core/class/html.form.class.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 2
path: ../../htdocs/core/class/html.form.class.php
-
message: "#^Variable \\$more in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
@ -8390,6 +8430,11 @@ parameters:
count: 1
path: ../../htdocs/core/class/html.formcompany.class.php
-
message: "#^Return type of call to function dol_sort_array contains unresolvable type\\.$#"
count: 1
path: ../../htdocs/core/class/html.formcompany.class.php
-
message: "#^Variable \\$idprof might not be defined\\.$#"
count: 1
@ -8420,6 +8465,11 @@ parameters:
count: 3
path: ../../htdocs/core/class/html.formfile.class.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 3
path: ../../htdocs/core/class/html.formfile.class.php
-
message: "#^Variable \\$fileinfo might not be defined\\.$#"
count: 4
@ -9120,6 +9170,11 @@ parameters:
count: 1
path: ../../htdocs/core/lib/ftp.lib.php
-
message: "#^Array has 2 duplicate keys with value 6 \\(\\\\LOG_INFO, \\\\LOG_DEBUG\\)\\.$#"
count: 1
path: ../../htdocs/core/lib/functions.lib.php
-
message: "#^Comparison operation \"\\>\" between int\\<1, max\\> and 0 is always true\\.$#"
count: 1
@ -9255,6 +9310,11 @@ parameters:
count: 1
path: ../../htdocs/core/lib/json.lib.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/core/lib/modulebuilder.lib.php
-
message: "#^Comparison operation \"\\>\" between 0 and 0 is always false\\.$#"
count: 4
@ -10500,11 +10560,6 @@ parameters:
count: 1
path: ../../htdocs/core/modules/member/doc/pdf_standard_member.class.php
-
message: "#^Function members_card_pdf_create\\(\\) has parameter \\$arrayofmembers with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/core/modules/member/modules_cards.php
-
message: "#^Variable \\$user in empty\\(\\) always exists and is not falsy\\.$#"
count: 2
@ -11415,6 +11470,11 @@ parameters:
count: 1
path: ../../htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
-
message: "#^Array has 2 duplicate keys with value 6 \\(\\\\LOG_INFO, \\\\LOG_DEBUG\\)\\.$#"
count: 1
path: ../../htdocs/core/modules/syslog/mod_syslog_file.php
-
message: "#^Parameter \\#2 \\$config of class Odf constructor expects string, array\\<string, mixed\\> given\\.$#"
count: 1
@ -12515,6 +12575,11 @@ parameters:
count: 1
path: ../../htdocs/delivery/class/delivery.class.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/delivery/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$object might not be defined\\.$#"
count: 2
@ -12705,6 +12770,11 @@ parameters:
count: 1
path: ../../htdocs/don/info.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/don/list.php
-
message: "#^Variable \\$contextpage in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
@ -14165,6 +14235,11 @@ parameters:
count: 1
path: ../../htdocs/fichinter/note.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/fichinter/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$object might not be defined\\.$#"
count: 1
@ -15770,41 +15845,6 @@ parameters:
count: 1
path: ../../htdocs/hrm/class/skillrank.class.php
-
message: "#^Function diff\\(\\) has parameter \\$TMergedSkills with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/hrm/compare.php
-
message: "#^Function displayUsersListWithPicto\\(\\) has parameter \\$TUser with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/hrm/compare.php
-
message: "#^Function mergeSkills\\(\\) has parameter \\$TSkill1 with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/hrm/compare.php
-
message: "#^Function mergeSkills\\(\\) has parameter \\$TSkill2 with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/hrm/compare.php
-
message: "#^Function mergeSkills\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/hrm/compare.php
-
message: "#^Function rate\\(\\) has parameter \\$TMergedSkills with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/hrm/compare.php
-
message: "#^Function skillList\\(\\) has parameter \\$TMergedSkills with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/hrm/compare.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
@ -16000,6 +16040,11 @@ parameters:
count: 2
path: ../../htdocs/hrm/skill_card.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/hrm/skill_card.php
-
message: "#^Variable \\$contextpage in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
@ -16020,6 +16065,11 @@ parameters:
count: 1
path: ../../htdocs/hrm/skill_document.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/hrm/skill_list.php
-
message: "#^Variable \\$contextpage in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
@ -16055,36 +16105,6 @@ parameters:
count: 1
path: ../../htdocs/imports/import.php
-
message: "#^Function arrayInsert\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/imports/import.php
-
message: "#^Function arrayInsert\\(\\) has parameter \\$insertArray with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/imports/import.php
-
message: "#^Function arrayInsert\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/imports/import.php
-
message: "#^Function getnewkey\\(\\) has parameter \\$fieldssource with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/imports/import.php
-
message: "#^Function getnewkey\\(\\) has parameter \\$listofkey with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/imports/import.php
-
message: "#^Function show_elem\\(\\) has parameter \\$fieldssource with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/imports/import.php
-
message: "#^If condition is always true\\.$#"
count: 12
@ -16100,6 +16120,11 @@ parameters:
count: 1
path: ../../htdocs/imports/import.php
-
message: "#^Parameter \\#3 \\$insertArray of function arrayInsert expects array\\{label\\?\\: string, example1\\?\\: string, required\\?\\: bool, imported\\?\\: bool\\|int\\<0, 1\\>, position\\?\\: int\\}, non\\-empty\\-array\\<string, array\\{label\\?\\: string, example1\\?\\: string, required\\?\\: bool, imported\\?\\: bool\\|int\\<0, 1\\>, position\\?\\: int\\}\\> given\\.$#"
count: 1
path: ../../htdocs/imports/import.php
-
message: "#^If condition is always true\\.$#"
count: 1
@ -17050,6 +17075,11 @@ parameters:
count: 1
path: ../../htdocs/main.inc.php
-
message: "#^Return type of call to function dol_sort_array contains unresolvable type\\.$#"
count: 1
path: ../../htdocs/margin/agentMargins.php
-
message: "#^Ternary operator condition is always false\\.$#"
count: 1
@ -17190,6 +17220,11 @@ parameters:
count: 3
path: ../../htdocs/modulebuilder/index.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/modulebuilder/index.php
-
message: "#^Variable \\$class might not be defined\\.$#"
count: 1
@ -17770,6 +17805,11 @@ parameters:
count: 1
path: ../../htdocs/mrp/mo_production.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/mrp/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$action might not be defined\\.$#"
count: 1
@ -20240,31 +20280,6 @@ parameters:
count: 1
path: ../../htdocs/projet/element.php
-
message: "#^Function constructGanttLine\\(\\) has parameter \\$tarr with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/projet/ganttchart.inc.php
-
message: "#^Function constructGanttLine\\(\\) has parameter \\$task with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/projet/ganttchart.inc.php
-
message: "#^Function constructGanttLine\\(\\) has parameter \\$task_dependencies with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/projet/ganttchart.inc.php
-
message: "#^Function findChildGanttLine\\(\\) has parameter \\$tarr with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/projet/ganttchart.inc.php
-
message: "#^Function findChildGanttLine\\(\\) has parameter \\$task_dependencies with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/projet/ganttchart.inc.php
-
message: "#^Variable \\$dateformat might not be defined\\.$#"
count: 1
@ -20695,6 +20710,11 @@ parameters:
count: 2
path: ../../htdocs/projet/tasks/time.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$object might not be defined\\.$#"
count: 1
@ -22070,6 +22090,11 @@ parameters:
count: 6
path: ../../htdocs/reception/note.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/reception/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$object might not be defined\\.$#"
count: 2
@ -24290,6 +24315,11 @@ parameters:
count: 1
path: ../../htdocs/ticket/messaging.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/ticket/tpl/linkedobjectblock.tpl.php
-
message: "#^Variable \\$object might not be defined\\.$#"
count: 2
@ -24410,6 +24440,11 @@ parameters:
count: 4
path: ../../htdocs/user/class/user.class.php
-
message: "#^Return type of call to function dol_sort_array contains unresolvable type\\.$#"
count: 1
path: ../../htdocs/user/class/user.class.php
-
message: "#^Ternary operator condition is always false\\.$#"
count: 1
@ -24645,6 +24680,11 @@ parameters:
count: 1
path: ../../htdocs/variants/list.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/variants/list.php
-
message: "#^Variable \\$rowid might not be defined\\.$#"
count: 2
@ -24845,6 +24885,11 @@ parameters:
count: 1
path: ../../htdocs/webportal/class/html.formlistwebportal.class.php
-
message: "#^Unable to resolve the template type T in call to function dol_sort_array$#"
count: 1
path: ../../htdocs/webportal/class/html.formlistwebportal.class.php
-
message: "#^Parameter \\#3 \\$preselectedvalue of method FormWebPortal\\:\\:selectForForms\\(\\) expects int, array\\|string given\\.$#"
count: 1
@ -24880,246 +24925,21 @@ parameters:
count: 1
path: ../../htdocs/webportal/class/webportalpropal.class.php
-
message: "#^Function createActionComm\\(\\) has parameter \\$actioncomm with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_actioncomm.php
-
message: "#^Function createActionComm\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_actioncomm.php
-
message: "#^Function updateActionComm\\(\\) has parameter \\$actioncomm with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_actioncomm.php
-
message: "#^Function updateActionComm\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_actioncomm.php
-
message: "#^Parameter \\#1 \\$authentication of function check_authentication expects array\\{login\\: string, password\\: string, entity\\: int\\|null, dolibarrkey\\: string\\}, array\\{login\\: string, entity\\: int\\} given\\.$#"
count: 1
path: ../../htdocs/webservices/server_category.php
-
message: "#^Function createContact\\(\\) has parameter \\$contact with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_contact.php
-
message: "#^Function createContact\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_contact.php
-
message: "#^Function getContactsForThirdParty\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_contact.php
-
message: "#^Function updateContact\\(\\) has parameter \\$contact with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_contact.php
-
message: "#^Function updateContact\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_contact.php
-
message: "#^Function createInvoice\\(\\) has parameter \\$invoice with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_invoice.php
-
message: "#^Function createInvoice\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_invoice.php
-
message: "#^Function getInvoice\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_invoice.php
-
message: "#^Function getInvoicesForThirdParty\\(\\) return type has no value type specified in iterable type array\\.$#"
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: ../../htdocs/webservices/server_invoice.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: ../../htdocs/webservices/server_invoice.php
-
message: "#^Variable \\$newobject might not be defined\\.$#"
count: 3
path: ../../htdocs/webservices/server_invoice.php
-
message: "#^Variable \\$socid might not be defined\\.$#"
count: 2
path: ../../htdocs/webservices/server_invoice.php
-
message: "#^Function createOrder\\(\\) has parameter \\$order with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_order.php
-
message: "#^Function createOrder\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_order.php
-
message: "#^Function getOrder\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_order.php
-
message: "#^Function getOrdersForThirdParty\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_order.php
-
message: "#^Function updateOrder\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_order.php
-
message: "#^Function validOrder\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_order.php
-
message: "#^Variable \\$socid might not be defined\\.$#"
count: 1
path: ../../htdocs/webservices/server_order.php
-
message: "#^Function createProductOrService\\(\\) has parameter \\$product with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_productorservice.php
-
message: "#^Function createProductOrService\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_productorservice.php
-
message: "#^Function deleteProductOrService\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_productorservice.php
-
message: "#^Function getListOfProductsOrServices\\(\\) has parameter \\$filterproduct with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_productorservice.php
-
message: "#^Function getListOfProductsOrServices\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_productorservice.php
-
message: "#^Function getProductsForCategory\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_productorservice.php
-
message: "#^Function updateProductOrService\\(\\) has parameter \\$product with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_productorservice.php
-
message: "#^Function updateProductOrService\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_productorservice.php
-
message: "#^Function createProject\\(\\) has parameter \\$project with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_project.php
-
message: "#^Function createProject\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_project.php
-
message: "#^Function getProject\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_project.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: ../../htdocs/webservices/server_project.php
-
message: "#^Function getSupplierInvoice\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_supplier_invoice.php
-
message: "#^Function getSupplierInvoicesForThirdParty\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_supplier_invoice.php
-
message: "#^Function createThirdParty\\(\\) has parameter \\$thirdparty with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_thirdparty.php
-
message: "#^Function createThirdParty\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_thirdparty.php
-
message: "#^Function deleteThirdParty\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_thirdparty.php
-
message: "#^Function getListOfThirdParties\\(\\) has parameter \\$filterthirdparty with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_thirdparty.php
-
message: "#^Function getListOfThirdParties\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_thirdparty.php
-
message: "#^Function getThirdParty\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_thirdparty.php
-
message: "#^Function updateThirdParty\\(\\) has parameter \\$thirdparty with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_thirdparty.php
-
message: "#^Function updateThirdParty\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_thirdparty.php
-
message: "#^Function createUserFromThirdparty\\(\\) has parameter \\$thirdpartywithuser with no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_user.php
-
message: "#^Function getListOfGroups\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: ../../htdocs/webservices/server_user.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 2

View File

@ -12,21 +12,19 @@ return [
// PhanUndeclaredProperty : 560+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 520+ occurrences
// PhanUndeclaredGlobalVariable : 350+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 320+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 310+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 180+ occurrences
// PhanTypeMismatchProperty : 160+ occurrences
// PhanPluginUnknownPropertyType : 130+ occurrences
// PhanPluginUnknownArrayMethodParamType : 120+ occurrences
// PhanPossiblyUndeclaredVariable : 110+ occurrences
// PhanPluginUndeclaredVariableIsset : 65+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 50+ occurrences
// PhanRedefineFunction : 45+ occurrences
// PhanTypeExpectedObjectPropAccess : 40+ occurrences
// PhanTypeExpectedObjectPropAccess : 45+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 45+ occurrences
// PhanTypeMismatchDimFetch : 40+ occurrences
// PhanPluginEmptyStatementIf : 35+ occurrences
// PhanPluginUnknownArrayFunctionParamType : 35+ occurrences
// PhanPluginUnknownArrayFunctionReturnType : 30+ occurrences
// PhanTypeInvalidDimOffset : 30+ occurrences
// PhanTypeInvalidDimOffset : 35+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanEmptyForeach : 10+ occurrences
// PhanPluginUnknownObjectMethodCall : 10+ occurrences
@ -39,17 +37,17 @@ return [
// PhanPluginDuplicateExpressionBinaryOp : 7 occurrences
// PhanParamTooMany : 5 occurrences
// PhanPossiblyNullTypeMismatchProperty : 5 occurrences
// PhanTypeMismatchReturn : 5 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
// PhanEmptyFQSENInClasslike : 3 occurrences
// PhanInvalidFQSENInClasslike : 3 occurrences
// PhanTypeMismatchReturn : 3 occurrences
// PhanPluginUnknownArrayPropertyType : 2 occurrences
// PhanTypeExpectedObjectPropAccessButGotNull : 2 occurrences
// PhanTypeMismatchDimAssignment : 2 occurrences
// PhanTypeSuspiciousStringExpression : 2 occurrences
// PhanAccessMethodProtected : 1 occurrence
// PhanParamTooFew : 1 occurrence
// PhanTypeConversionFromArray : 1 occurrence
// PhanTypeSuspiciousStringExpression : 1 occurrence
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
@ -102,11 +100,11 @@ return [
'htdocs/comm/action/class/api_agendaevents.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/class/cactioncomm.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/comm/action/document.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/comm/action/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/index.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/info.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/action/list.php' => ['PhanTypeMismatchProperty'],
'htdocs/comm/action/pertype.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch'],
'htdocs/comm/action/peruser.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray'],
'htdocs/comm/action/pertype.php' => ['PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchDimFetch'],
'htdocs/comm/action/peruser.php' => ['PhanTypeComparisonFromArray'],
'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'],
@ -212,8 +210,7 @@ return [
'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall'],
'htdocs/core/ajax/ajaxdirpreview.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/ajax/onlineSign.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/ajax/selectobject.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/ajax/selectsearchbox.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/core/boxes/box_actions.php' => ['PhanPossiblyUndeclaredVariable'],
@ -285,7 +282,7 @@ return [
'htdocs/core/modules/expedition/doc/pdf_merou.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanTypeMismatchReturn', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/modules_facture.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/fichinter/mod_pacific.php' => ['PhanPossiblyUndeclaredVariable'],
@ -295,7 +292,6 @@ return [
'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanTypeMismatchProperty'],
'htdocs/core/modules/mailings/contacts1.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/member/modules_cards.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanUndeclaredProperty'],
@ -436,7 +432,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'],
'htdocs/holiday/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/holiday/card_group.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/holiday/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/holiday/view_log.php' => ['PhanTypeMismatchDimFetch'],
@ -448,7 +444,6 @@ return [
'htdocs/hrm/class/skill.class.php' => ['PhanUndeclaredProperty'],
'htdocs/hrm/class/skilldet.class.php' => ['PhanUndeclaredProperty'],
'htdocs/hrm/class/skillrank.class.php' => ['PhanUndeclaredProperty'],
'htdocs/hrm/compare.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/hrm/core/tpl/objectline_view.tpl.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/hrm/evaluation_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/hrm/job_agenda.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
@ -458,7 +453,7 @@ return [
'htdocs/hrm/skill_card.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/hrm/skill_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/imports/import.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/imports/import.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset'],
@ -472,9 +467,8 @@ return [
'htdocs/knowledgemanagement/class/knowledgerecord.class.php' => ['PhanUndeclaredProperty'],
'htdocs/knowledgemanagement/knowledgerecord_card.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/knowledgemanagement/knowledgerecord_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/loan/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/loan/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/loan/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/schedule.php' => ['PhanUndeclaredGlobalVariable'],
@ -519,7 +513,7 @@ return [
'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'],
'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'],
'htdocs/product/stock/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/product/stock/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/product/stock/class/api_stockmovements.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/product/stock/class/api_warehouses.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/product/stock/class/entrepot.class.php' => ['PhanUndeclaredProperty'],
@ -549,7 +543,7 @@ return [
'htdocs/projet/class/api_tasks.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/projet/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/element.php' => ['PhanUndeclaredProperty'],
'htdocs/projet/ganttchart.inc.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/projet/ganttchart.inc.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/projet/ganttview.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/graph_opportunities.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'],
'htdocs/projet/index.php' => ['PhanUndeclaredGlobalVariable'],
@ -690,17 +684,17 @@ return [
'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanTypeInvalidDimOffset', 'PhanUndeclaredProperty'],
'htdocs/webportal/class/webportalpropal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_actioncomm.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_actioncomm.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_category.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_contact.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_invoice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_order.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_contact.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_invoice.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_order.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeInvalidDimOffset', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_payment.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_productorservice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_project.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_supplier_invoice.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_thirdparty.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_user.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_productorservice.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_project.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_supplier_invoice.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_thirdparty.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_user.php' => ['PhanUndeclaredProperty'],
'htdocs/website/class/website.class.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/website/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/website/samples/wrapper.php' => ['PhanTypeMismatchArgumentProbablyReal'],

View File

@ -421,7 +421,7 @@ return [
'PhanCompatibleNegativeStringOffset', // return false positive
'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is
// 'PhanPluginUnknownArrayPropertyType', // Helps find missing array keys or mismatches, remaining occurrences are likely unused properties
'PhanTypeArraySuspiciousNullable', // Was All fixed, but a lot of occurrences again because of properties made nullable for phpstan.
'PhanTypeArraySuspiciousNullable', // About 440 occurrences
// 'PhanTypeInvalidDimOffset', // Helps identify missing array indexes in types or reference to unset indexes
'PhanTypeObjectUnsetDeclaredProperty',
'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is

View File

@ -775,7 +775,7 @@ class AccountancyCategory // extends CommonObject
*
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @param int $active 1= active, 0=not active
* @return array<array{rowid:string,code:string,label:string,formula:string,position:string,category_type:string,sens:string,bc:string}>|int Array of groups or -1 if error
* @return never|array<array{rowid:string,code:string,label:string,formula:string,position:string,category_type:string,sens:string,bc:string}>|int Array of groups or -1 if error
* @see getCatsCpts(), getCptsCat()
*/
public function getCats($categorytype = -1, $active = 1)
@ -839,7 +839,7 @@ class AccountancyCategory // extends CommonObject
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts. This value must be sanitized and not come from an input of a user.
* Example: "pcg_type = 'EXPENSE' AND fk_pcg_version = 'xx'"
* Example: "fk_accounting_category = 99"
* @return array<array{id:int,account_number:string,account_label:string}>|int<-1,-1> Array of accounting accounts or -1 if error
* @return never|array<array{id:int,account_number:string,account_label:string}>|int<-1,-1> Array of accounting accounts or -1 if error
* @see getCats(), getCatsCpts()
*/
public function getCptsCat($cat_id, $predefinedgroupwhere = '')

View File

@ -268,6 +268,7 @@ if (empty($error) && !empty($xml)) {
// Fill file_list with files in signature, new files, modified files
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
'@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list';
// Complete with list of new files
foreach ($scanfiles as $keyfile => $valfile) {
$tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']);
@ -392,7 +393,7 @@ if (empty($error) && !empty($xml)) {
$out .= ' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i);
}
$out .= '</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag($file['expectedmd5']).'</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag($file['expectedmd5']).'</td>'."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset
$out .= '<td class="center">'.dol_escape_htmltag($file['md5']).'</td>'."\n";
$size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
$totalsize += $size;
@ -427,6 +428,7 @@ if (empty($error) && !empty($xml)) {
{
$file_list = array();
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list
'@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list';
}*/

View File

@ -2551,6 +2551,7 @@ class Setup extends DolibarrApi
// Fill file_list with files in signature, new files, modified files
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
'@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list';
// Complete with list of new files
foreach ($scanfiles as $keyfile => $valfile) {
$tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']);
@ -2578,7 +2579,7 @@ class Setup extends DolibarrApi
$out .= '<tr class="oddeven">';
$out .= '<td>'.$i.'</td>'."\n";
$out .= '<td>'.dol_escape_htmltag($file['filename']).'</td>'."\n";
$out .= '<td class="center">'.$file['expectedmd5'].'</td>'."\n";
$out .= '<td class="center">'.(array_key_exists('expectedmd5', $file) ? $file['expectedmd5'] : '').'</td>'."\n";
$out .= "</tr>\n";
}
} else {
@ -2657,7 +2658,7 @@ class Setup extends DolibarrApi
$out .= '<tr class="oddeven">';
$out .= '<td>'.$i.'</td>'."\n";
$out .= '<td>'.dol_escape_htmltag($file['filename']).'</td>'."\n";
$out .= '<td class="center">'.$file['expectedmd5'].'</td>'."\n";
$out .= '<td class="center">'.$file['expectedmd5'].'</td>'."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset,PhanTypeSuspiciousStringExpression
$out .= '<td class="center">'.$file['md5'].'</td>'."\n";
$size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
$totalsize += $size;

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 José <jose.martinez@pichinov.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
@ -31,7 +32,19 @@
* @var DoliDB $db
* @var Form $form
* @var HookManager $hookmanager
* @var AssetDepreciationOptions $assetdepreciationoptions
* @var Translate $langs
* @var ?array<array{mode_key:string,field_key:string,value:string,target:string}> $enabled_field_info
*/
'
@phan-var-force Conf $conf
@phan-var-force DoliDB $db
@phan-var-force ?Form $form
@phan-var-force HookManager $hookmanager
@phan-var-force AssetDepreciationOptions $assetdepreciationoptions
@phan-var-force Translate $langs
@phan-var-force ?array<array{mode_key:string,field_key:string,value:string,target:string}> $enabled_field_info
';
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
@ -84,7 +97,7 @@ if (empty($reshook)) {
$assetdepreciationoptions->setInfosForMode($mode_key, $class_type, true);
$prefix_html_name = $mode_key . '_';
$width = ($mode_key == "economic")? "width50p pull-left" : "width50p";
$width = ($mode_key == "economic") ? "width50p pull-left" : "width50p";
print '<table class="border '. $width .'" id="block_' . $mode_key . '">' . "\n";
print '<tr><td class="info-box-title">'.$langs->trans($mode_info['label']).'</td></tr>';
if ($mode_key == "economic") {

View File

@ -29,7 +29,13 @@
/**
* @var Form $form
* @var HookManager $hookmanager
* @var AssetDepreciationOptions $assetdepreciationoptions
*/
'
@phan-var-force ?Form $form
@phan-var-force HookManager $hookmanager
@phan-var-force AssetDepreciationOptions $assetdepreciationoptions
';
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
@ -103,7 +109,7 @@ if (empty($reshook)) {
if (!empty($field_info['help'])) {
print $form->textwithpicto($langs->trans($field_info['label']), $langs->trans($field_info['help']));
} else {
if (isset($field_info['copytoclipboard']) && $field_info['copytoclipboard'] == 1) {
if (isset($field_info['copytoclipboard']) && $field_info['copytoclipboard'] == 1) { // @phan-suppress-current-line PhanTypeInvalidDimOffset
print showValueWithClipboardCPButton($value, 0, $langs->transnoentitiesnoconv($field_info['label']));
} else {
print $langs->trans($field_info['label']);

View File

@ -114,7 +114,7 @@ if (empty($reshook)) {
if (!empty($field_info['help'])) {
print $form->textwithpicto($langs->trans($field_info['label']), $langs->trans($field_info['help']));
} else {
if (isset($field_info['copytoclipboard']) && $field_info['copytoclipboard'] == 1) {
if (isset($field_info['copytoclipboard']) && $field_info['copytoclipboard'] == 1) { // @phan-suppress-current-line PhanTypeInvalidDimOffset
print showValueWithClipboardCPButton($value, 0, $langs->transnoentitiesnoconv($field_info['label']));
} else {
print $langs->trans($field_info['label']);

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2020-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
@ -77,7 +78,7 @@ if ($result <= 0) {
$type = $object->type;
if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$type = Categorie::$MAP_ID_TO_CODE[(int) $type]; // For backward compatibility
}
$extrafields = new ExtraFields($db);
@ -89,7 +90,7 @@ $error = 0;
/*
* Actions
*/
$parameters = array('id' => $id, 'ref' => $ref, 'cancel'=> $cancel, 'backtopage' => $backtopage, 'socid' => $socid, 'label' => $label, 'description' => $description, 'color' => $color, 'position' => $position, 'visible' => $visible, 'parent' => $parent);
$parameters = array('id' => $id, 'ref' => $ref, 'cancel' => $cancel, 'backtopage' => $backtopage, 'socid' => $socid, 'label' => $label, 'description' => $description, 'color' => $color, 'position' => $position, 'visible' => $visible, 'parent' => $parent);
// Note that $action and $object may be modified by some hooks
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
if ($reshook < 0) {

View File

@ -52,7 +52,7 @@ $nosearch = GETPOSTINT('nosearch');
$categstatic = new Categorie($db);
if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$type = Categorie::$MAP_ID_TO_CODE[(int) $type]; // For backward compatibility
}
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array array

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -64,7 +65,7 @@ if ($result <= 0) {
$type = $object->type;
if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$type = Categorie::$MAP_ID_TO_CODE[(int) $type]; // For backward compatibility
}
/*

View File

@ -69,7 +69,7 @@ if ($result <= 0) {
$type = $object->type;
if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$type = Categorie::$MAP_ID_TO_CODE[(int) $type]; // For backward compatibility
}
$upload_dir = $conf->categorie->multidir_output[$object->entity];

View File

@ -4,6 +4,7 @@
* Copyright (C) 2010-2016 Destailleur Laurent <eldy@users.sourceforge.net>
* 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
@ -65,7 +66,7 @@ if ($result <= 0) {
$type = $object->type;
if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$type = Categorie::$MAP_ID_TO_CODE[(int) $type]; // For backward compatibility
}
// Security check

View File

@ -100,7 +100,7 @@ if ($result <= 0) {
$type = $object->type;
if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$type = Categorie::$MAP_ID_TO_CODE[(int) $type]; // For backward compatibility
}
$extrafields = new ExtraFields($db);

View File

@ -1826,13 +1826,13 @@ $db->close();
* @param int $year Year
* @param int $monthshown Current month shown in calendar view
* @param string $style Style to use for this day
* @param array $eventarray Array of events
* @param array<int,ActionComm[]> $eventarray Array of events
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
* @param int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL
* @param int $showinfo Add extended information (used by day and week view)
* @param int $minheight Minimum height for each event. 60px by default.
* @param int $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button"
* @param int<-1,1> $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button"
* @param array{}|array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int}} $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal
* @return void
*/

View File

@ -834,9 +834,9 @@ $labelbytype = array();
$sql = "SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX."c_actioncomm ORDER BY position";
$resql = $db->query($sql);
while ($obj = $db->fetch_object($resql)) {
$typeofevents[$obj->code] = $obj->code;
$colorsbytype[$obj->code] = $obj->color;
$labelbytype[$obj->code] = $obj->label;
$typeofevents[(string) $obj->code] = (string) $obj->code;
$colorsbytype[(string) $obj->code] = (string) $obj->color;
$labelbytype[(string) $obj->code] = (string) $obj->label;
}
// Loop on each user to show calendar
@ -961,20 +961,20 @@ $db->close();
/**
* Show event line of a particular day for a user
*
* @param User $username Login
* @param string $username Login
* @param int $day Day
* @param int $month Month
* @param int $year Year
* @param int $monthshown Current month shown in calendar view
* @param string $style Style to use for this day
* @param array $eventarray Array of events
* @param array<int,ActionComm[]> $eventarray Array of events
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
* @param int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL
* @param int $showinfo Add extended information (used by day view)
* @param int $minheight Minimum height for each event. 60px by default.
* @param boolean $showheader Show header
* @param array $colorsbytype Array with colors by type
* @param bool $showheader Show header
* @param array<string,string> $colorsbytype Array with colors by type
* @param bool $var true or false for alternat style on tr/td
* @return void
*/

View File

@ -1146,14 +1146,14 @@ $db->close();
* @param int $year Year
* @param int $monthshown Current month shown in calendar view
* @param string $style Style to use for this day
* @param array $eventarray Array of events
* @param array<int,ActionComm[]> $eventarray Array of events
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
* @param int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL
* @param int $showinfo Add extended information (used by day view)
* @param int $minheight Minimum height for each event. 60px by default.
* @param boolean $showheader Show header
* @param array $colorsbytype Array with colors by type
* @param array<string,string> $colorsbytype Array with colors by type
* @param bool $var true or false for alternat style on tr/td
* @return void
*/

View File

@ -403,7 +403,7 @@ if ($object->id > 0) {
print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
}
$accountingAccountByDefault = " (" . $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) . ")";
print (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') ? $accountingAccountByDefault : '');
print(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') ? $accountingAccountByDefault : '');
print '</td>';
}
@ -932,6 +932,7 @@ if ($object->id > 0) {
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
@ -1050,6 +1051,7 @@ if ($object->id > 0) {
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
@ -1150,6 +1152,7 @@ if ($object->id > 0) {
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
@ -1263,6 +1266,7 @@ if ($object->id > 0) {
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
@ -1362,6 +1366,7 @@ if ($object->id > 0) {
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
@ -1590,6 +1595,7 @@ if ($object->id > 0) {
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)

View File

@ -1400,7 +1400,7 @@ class Facture extends CommonInvoice
/**
* Load an object from an order and create a new invoice into database
*
* @param Facture $object Object source
* @param Commande $object Object source
* @param User $user Object user
* @return int<-1,1> Return integer <0 if KO, 0 if nothing done, 1 if OK
*/

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Pierre-Henry Favre <support@atm-consulting.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
@ -82,7 +83,7 @@ if (!$sortorder) {
$arrayfields = array(
'f.datef'=>array('label'=>"Date", 'checked'=>1),
'f.datef' => array('label' => "Date", 'checked' => 1),
//...
);
@ -261,12 +262,12 @@ if ($id > 0) {
// Balance calculation
$balance = 0;
foreach ($TData as &$data1) {
$balance += $data1['amount'];
if (!isset($data1['balance'])) {
$data1['balance'] = 0;
foreach (array_keys($TData) as $key) {
$balance += $TData[$key]['amount'];
if (!array_key_exists('balance', $TData[$key])) {
$TData[$key]['balance'] = 0;
}
$data1['balance'] += $balance;
$TData[$key]['balance'] += $balance;
}
// Resorte array to have elements on the required $sortorder

View File

@ -367,7 +367,7 @@ if ((!isset($mode) || $mode != 'noajax') && is_object($db)) {
/**
* treeOutputForAbsoluteDir
*
* @param array $sqltree Sqltree
* @param array<int,array{id:int,id_mere:int,fulllabel:string,fullpath:string,fullrelativename:string,label:string,description:string,cachenbofdoc:int,date_c:int,fk_user_c:int,statut_c:int,login_c:int,id_children?:int[],level:int}> $sqltree Sqltree
* @param string $selecteddir Selected dir
* @param string $fullpathselecteddir Full path of selected dir
* @param string $modulepart Modulepart

View File

@ -228,7 +228,7 @@ if ($action == "importSignature") {
// TODO Get position of box from PDF template
if (getDolGlobalString("PROPAL_SIGNATURE_XFORIMGSTART")) {
$param['xforimgstart'] = getDolGlobalString("PROPAL_SIGNATURE_XFORIMGSTART");
$param['xforimgstart'] = getDolGlobalString("PROPAL_SIGNATURE_XFORIMGSTART");
} else {
$param['xforimgstart'] = (empty($s['w']) ? 120 : round($s['w'] / 2) + 15);
}
@ -945,7 +945,7 @@ echo $response;
*
* @param TCPDF $pdf PDF handler
* @param Translate $langs Language
* @param array $params Array of params
* @param array<string,int|float|string|mixed[]> $params Array of params
* @return void
*/
function dolPrintSignatureImage(TCPDF $pdf, $langs, $params)

View File

@ -9733,6 +9733,7 @@ abstract class CommonObject
}*/
completeFileArrayWithDatabaseInfo($filearray, $relativedir);
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $filearray';
if (count($filearray)) {
if ($sortfield && $sortorder) {

View File

@ -967,6 +967,7 @@ class FormFile
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
@ -1453,6 +1454,7 @@ class FormFile
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($filearray, $relativedir);
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $filearray';
//var_dump($sortfield.' - '.$sortorder);
if ($sortfield && $sortorder) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
@ -1972,6 +1974,7 @@ class FormFile
$relativepathfromroot = preg_replace('/'.preg_quote(DOL_DATA_ROOT.'/', '/').'/', '', $upload_dir);
if ($relativepathfromroot) {
completeFileArrayWithDatabaseInfo($filearray, $relativepathfromroot.'/%');
'@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $filearray';
//var_dump($sortfield.' - '.$sortorder);
if ($sortfield && $sortorder) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)

View File

@ -29,11 +29,11 @@
* @param mixed $object Any object
* @param string $tablealias Alias of table
* @param string $labelofobject Label of object
* @param array<string,array{abel:string,labelnohtml:string,position:int,table:string,tablefromt:string}> $arrayofmesures Array of measures already filled
* @param array<string,array{label:string,labelnohtml:string,position:int,table:string,tablefromt:string}> $arrayofmesures Array of measures already filled
* @param int $level Level
* @param int $count Count
* @param string $tablepath Path of all tables ('t' or 't,contract' or 't,contract,societe'...)
* @return array<string,array{abel:string,labelnohtml:string,position:int,table:string,tablefromt:string}> Array of measures
* @return array<string,array{label:string,labelnohtml:string,position:int,table:string,tablefromt:string}> Array of measures
*/
function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesures, $level = 0, &$count = 0, &$tablepath = '')
{
@ -183,11 +183,11 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu
* @param mixed $object Any object
* @param string $tablealias Alias of table ('t' for example)
* @param string $labelofobject Label of object
* @param array<string,array{abel:string,labelnohtml:string,position:int,table:string,tablefromt:string}> $arrayofxaxis Array of xaxis already filled
* @param array<string,array{label:string,labelnohtml:string,position:int,table:string,tablefromt:string}> $arrayofxaxis Array of xaxis already filled
* @param int $level Level
* @param int $count Count
* @param string $tablepath Path of all tables ('t' or 't,contract' or 't,contract,societe'...)
* @return array<string,array{abel:string,labelnohtml:string,position:int,table:string,tablefromt:string}> Array of xaxis
* @return array<string,array{label:string,labelnohtml:string,position:int,table:string,tablefromt:string}> Array of xaxis
*/
function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, $level = 0, &$count = 0, &$tablepath = '')
{
@ -352,11 +352,11 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis,
* @param CommonObject $object Any object
* @param string $tablealias Alias of table
* @param string $labelofobject Label of object
* @param array<string,array{abel:string,labelnohtml:string,position:int,table:string,tablefromt:string}> $arrayofgroupby Array of groupby already filled
* @param array<string,array{label:string,labelnohtml:string,position:int,table:string,tablefromt:string}> $arrayofgroupby Array of groupby already filled
* @param int $level Level
* @param int $count Count
* @param string $tablepath Path of all tables ('t' or 't,contract' or 't,contract,societe'...)
* @return array<string,array{abel:string,labelnohtml:string,position:int,table:string,tablefromt:string}> Array of groupby
* @return array<string,array{label:string,labelnohtml:string,position:int,table:string,tablefromt:string}> Array of groupby
*/
function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroupby, $level = 0, &$count = 0, &$tablepath = '')
{

View File

@ -10198,7 +10198,11 @@ function dol_htmloutput_errors($mesgstring = '', $mesgarray = array(), $keepembe
* Advanced sort array by the value of a given key, which produces ascending (default) or descending
* output and uses optionally natural case insensitive sorting (which can be optionally case sensitive as well).
*
* @phpstan-template T of array<string|int,mixed>
* @phan-template T of array<string|int,mixed>
* @param array<string|int,mixed> $array Array to sort (array of array('key1'=>val1,'key2'=>val2,'key3'...) or array of objects)
* @phpstan-param T $array
* @phan-param T $array
* @param string $index Key in array to use for sorting criteria
* @param string $order Sort order ('asc' or 'desc')
* @param int<-1,1> $natsort If values are strings (I said value not type): 0=Use alphabetical order, 1=use "natural" sort (natsort), -1=Force alpha order
@ -10206,6 +10210,9 @@ function dol_htmloutput_errors($mesgstring = '', $mesgarray = array(), $keepembe
* @param int<0,1> $case_sensitive 1=sort is case sensitive, 0=not case sensitive
* @param int<0,1> $keepindex If 0 and index key of array to sort is a numeric, then index will be rewritten. If 1 or index key is not numeric, key for index is kept after sorting.
* @return array<string|int,mixed> Return the sorted array (the source array is not modified !)
* @phpstan-return T
* @phan-return T // Seems useful
* @phan-suppress PhanTypeMismatchReturn // T not understood without caller
*/
function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sensitive = 0, $keepindex = 0)
{
@ -10220,7 +10227,7 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen
if (is_object($array[$key])) {
$temp[$key] = empty($array[$key]->$index) ? 0 : $array[$key]->$index;
} else {
// @phan-suppress-next-line PhanTypeArraySuspiciousNullable
// @phan-suppress-next-line PhanTypeArraySuspiciousNullable,PhanTypeArraySuspicious,PhanTypeMismatchDimFetch
$temp[$key] = empty($array[$key][$index]) ? 0 : $array[$key][$index];
}
if ($natsort == -1) {

View File

@ -68,7 +68,7 @@ class ModelePDFCards
* Cree un fichier de cartes de visites en fonction du modele de ADHERENT_CARDS_ADDON_PDF
*
* @param DoliDB $db Database handler
* @param array $arrayofmembers Array of members
* @param array<array{textleft:string,textheader:string,textfooter:string,textright:string,id:int,ref:string,photo:string}> $arrayofmembers Array of members
* @param string $modele Force modele to use ('' to not force)
* @param Translate $outputlangs Object langs to use for translation
* @param string $outputdir Output directory

View File

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

View File

@ -414,7 +414,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
break;
}
setEventMessages($errors, null, 'errors');
setEventMessages($errors, array(), 'errors');
}

View File

@ -298,7 +298,7 @@ $db->close();
*
* Return a html list element with diff between required rank and user rank
*
* @param array $TMergedSkills skill list with all rate to add good picto
* @param array<int,stdClass> $TMergedSkills skill list with all rate to add good picto
* @return string
*/
function diff(&$TMergedSkills)
@ -332,7 +332,7 @@ function diff(&$TMergedSkills)
/**
* Return a html list with rank information
* @param array $TMergedSkills skill list for display
* @param array<int,stdClass> $TMergedSkills skill list for display
* @param string $field which column of comparison we are working with
* @return string
*/
@ -372,7 +372,7 @@ function rate(&$TMergedSkills, $field)
/**
* return a html ul list of skills
*
* @param array $TMergedSkills skill list for display
* @param array<int,stdClass> $TMergedSkills skill list for display
* @return string (ul list in html )
*/
function skillList(&$TMergedSkills)
@ -394,9 +394,9 @@ function skillList(&$TMergedSkills)
/**
* create an array of lines [ skillLabel,description, maxrank on group1 , minrank needed for this skill ]
*
* @param array $TSkill1 skill list of first column
* @param array $TSkill2 skill list of second column
* @return array
* @param array<int,stdClass> $TSkill1 skill list of first column
* @param array<int,stdClass> $TSkill2 skill list of second column
* @return array<int,stdClass>
*/
function mergeSkills($TSkill1, $TSkill2)
{
@ -429,7 +429,7 @@ function mergeSkills($TSkill1, $TSkill2)
/**
* Display a list of User with picto
*
* @param array $TUser list of users (employees) in selected usergroup of a column
* @param int[] $TUser list of users (employees) in selected usergroup of a column
* @param int $fk_usergroup selected usergroup id
* @param string $namelist html name
* @return string

View File

@ -894,7 +894,7 @@ if ($step == 4 && $datatoimport) {
}
if (!empty($array_match_database_to_file[$key])) {
$fieldstarget_tmp[$key]["imported"] = true;
$fieldstarget_tmp[$key]["position"] = $array_match_database_to_file[$key] - 1;
$fieldstarget_tmp[$key]["position"] = (int) $array_match_database_to_file[$key] - 1;
$keytoswap = $key;
while (!empty($array_match_database_to_file[$keytoswap])) {
if ($position + 1 > $array_match_database_to_file[$keytoswap]) {
@ -2407,7 +2407,7 @@ $db->close();
/**
* Function to put the movable box of a source field
*
* @param array $fieldssource List of source fields
* @param array<int|string,array{label?:string,example1?:string,required?:bool,imported?:bool|int<0,1>,position?:int}> $fieldssource List of source fields
* @param int $pos Pos
* @param string $key Key
* @return void
@ -2490,9 +2490,9 @@ function show_elem($fieldssource, $pos, $key)
/**
* Return not used field number
*
* @param array $fieldssource Array of field source
* @param array $listofkey Array of keys
* @return integer
* @param array<int,mixed|mixed[]> $fieldssource Array of field source
* @param array<int,mixed|mixed[]> $listofkey Array of keys
* @return int
*/
function getnewkey(&$fieldssource, &$listofkey)
{
@ -2517,10 +2517,10 @@ function getnewkey(&$fieldssource, &$listofkey)
/**
* Return array with element inserted in it at position $position
*
* @param array $array Array of field source
* @param mixed $position key of position to insert to
* @param array $insertArray Array to insert
* @return array
* @param array<int|string,array{label?:string,example1?:string,required?:bool,imported?:bool|int<0,1>,position?:int}> $array Array of field source
* @param int $position key of position to insert to
* @param array{label?:string,example1?:string,required?:bool,imported?:bool|int<0,1>,position?:int} $insertArray Array to insert
* @return array<int|string,array{label?:string,example1?:string,required?:bool,imported?:bool|int<0,1>,position?:int}>
*/
function arrayInsert($array, $position, $insertArray)
{

View File

@ -151,6 +151,7 @@ if ($dirread != DOL_DOCUMENT_ROOT && (getDolGlobalInt('MAIN_FEATURES_LEVEL') >=
// Search modules to edit
$textforlistofdirs = '<!-- Directory scanned -->'."\n";
$listofmodules = array();
'@phan-var-force array<string,array{modulenamewithcase:string,moduledescriptorrelpath:string,moduledescriptorfullpath:string,moduledescriptorrootpath,moduletype?:string}> $listofmodules';
$i = 0;
foreach ($dirsrootforscan as $tmpdirread) {
$moduletype = 'external';
@ -1981,7 +1982,7 @@ if ($dirins && $action == 'confirm_deletemodule' && $user->hasRight("modulebuild
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
@ -2065,12 +2066,17 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname && $user->hasRig
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
dol_print_error($db, $e->getMessage());
}
} else {
$error++;
$langs->load("errors");
dol_print_error($db, $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module));
exit;
}
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
@ -2249,7 +2255,7 @@ if ($dirins && $action == 'updatedictionary' && GETPOST('dictionnarykey') && $us
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
@ -2319,7 +2325,7 @@ if ($dirins && $action == 'generatepackage' && $user->hasRight("modulebuilder",
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
@ -2597,7 +2603,7 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOSTINT
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
@ -2772,7 +2778,7 @@ if ($dirins && $action == 'confirm_deletemenu' && GETPOSTINT('menukey') && $user
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
@ -2837,7 +2843,7 @@ if ($dirins && $action == 'addmenu' && empty($cancel) && $user->hasRight("module
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
@ -2996,7 +3002,7 @@ if ($dirins && $action == "update_menu" && GETPOSTINT('menukey') && GETPOST('tab
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
@ -3101,7 +3107,7 @@ if ($dirins && $action == "update_props_module" && !empty(GETPOST('keydescriptio
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
@ -3265,7 +3271,7 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule') {
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
@ -6626,13 +6632,14 @@ if ($module == 'initmodule') {
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
dol_print_error($db, $e->getMessage());
}
} else {
}
if ($moduleobj === null) {
$error++;
$langs->load("errors");
dol_print_error($db, $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module));

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2010-2017 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
@ -128,15 +129,15 @@ if (g.getDivId() != null)
$projecttmp = new Project($db);
$projecttmp->fetch($t['task_project_id']);
$tmpt = array(
'task_id'=> '-'.$t['task_project_id'],
'task_alternate_id'=> '-'.$t['task_project_id'],
'task_name'=>$projecttmp->ref.' '.$projecttmp->title,
'task_resources'=>'',
'task_start_date'=>'',
'task_end_date'=>'',
'task_is_group'=>1, 'task_position'=>0, 'task_css'=>'ggroupblack', 'task_milestone'=> 0, 'task_parent'=>0, 'task_parent_alternate_id'=>0,
'task_notes'=>'',
'task_planned_workload'=>0
'task_id' => '-'.$t['task_project_id'],
'task_alternate_id' => '-'.$t['task_project_id'],
'task_name' => $projecttmp->ref.' '.$projecttmp->title,
'task_resources' => '',
'task_start_date' => '',
'task_end_date' => '',
'task_is_group' => 1, 'task_position' => 0, 'task_css' => 'ggroupblack', 'task_milestone' => 0, 'task_parent' => 0, 'task_parent_alternate_id' => 0,
'task_notes' => '',
'task_planned_workload' => 0
);
constructGanttLine($tasks, $tmpt, array(), 0, $t['task_project_id']);
$old_project_id = $t['task_project_id'];
@ -167,9 +168,9 @@ else
/**
* Add a gant chart line
*
* @param array $tarr Array of all tasks
* @param array $task Array with properties of one task
* @param array $task_dependencies Task dependencies (array(array(0=>idtask,1=>idtasktofinishfisrt))
* @param array<int,array{task_id:string,task_alternate_id:string,task_name:string,task_resources:string,task_start_date:string,task_end_date:string,task_is_group:int<0,1>,task_position:int,task_css:string,task_milestone:int,task_parent:int,task_parent_alternate_id:int}> $tarr Array of all tasks
* @param array{task_id:string,task_alternate_id:string,task_name:string,task_resources:string,task_start_date:string,task_end_date:string,task_is_group:int<0,1>,task_position:int,task_css:string,task_milestone:int,task_parent:int,task_parent_alternate_id:int} $task Array with properties of one task
* @param array<int[]> $task_dependencies Task dependencies (array(array(0=>idtask,1=>idtasktofinishfisrt))
* @param int $level Level
* @param int $project_id Id of project
* @return void
@ -279,9 +280,9 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje
/**
* Find child Gantt line
*
* @param array $tarr tarr
* @param int $parent Parent
* @param array $task_dependencies Task dependencies
* @param array<int,array{task_id:string,task_alternate_id:string,task_name:string,task_resources:string,task_start_date:string,task_end_date:string,task_is_group:int<0,1>,task_position:int,task_css:string,task_milestone:int,task_parent:int,task_parent_alternate_id:int}> $tarr tarr
* @param string $parent Parent
* @param array<int[]> $task_dependencies Task dependencies
* @param int $level Level
* @return void
*/

View File

@ -6,6 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* 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
@ -53,7 +54,7 @@ $printer2 = GETPOST('printer2', 'alpha');
$printer3 = GETPOST('printer3', 'alpha');
if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$type = Categorie::$MAP_ID_TO_CODE[(int) $type]; // For backward compatibility
}
if (!$user->hasRight('categorie', 'lire')) {
@ -163,7 +164,7 @@ $fulltree = $cate_arbo;
// Define data (format for treeview)
$data = array();
$data[] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>'');
$data[] = array('rowid' => 0, 'fk_menu' => -1, 'title' => "racine", 'mainmenu' => '', 'leftmenu' => '', 'fk_mainmenu' => '', 'fk_leftmenu' => '');
foreach ($fulltree as $key => $val) {
$categstatic->id = $val['id'];
$categstatic->ref = $val['label'];

View File

@ -135,7 +135,6 @@ $actioncomm_fields = array(
'fk_element' => array('name' => 'fk_element', 'type' => 'xsd:string'),
'elementtype' => array('name' => 'elementtype', 'type' => 'xsd:string'));
$elementtype = 'actioncomm';
//Retrieve all extrafield for actioncomm
@ -434,8 +433,8 @@ function getListActionCommType($authentication)
* Create ActionComm
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $actioncomm $actioncomm
* @return array Array result
* @param array{id:string,ref:string,ref_ext:string,type_id:string,type_code:string,type:string,label:string,datep:int,datef:int,datec:int,datem:int,note:string,percentage:string,author:string,usermod:string,userownerid:string,priority:string,fulldayevent:string,location:string,socid:string,contactid:string,projectid:string,fk_element:string,elementtype:string} $actioncomm $actioncomm
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function createActionComm($authentication, $actioncomm)
{
@ -462,18 +461,18 @@ function createActionComm($authentication, $actioncomm)
$newobject->datep = $actioncomm['datep'];
$newobject->datef = $actioncomm['datef'];
$newobject->type_code = $actioncomm['type_code'];
$newobject->socid = $actioncomm['socid'];
$newobject->fk_project = $actioncomm['projectid'];
$newobject->socid = (int) $actioncomm['socid'];
$newobject->fk_project = (int) $actioncomm['projectid'];
$newobject->note = $actioncomm['note'];
$newobject->note_private = $actioncomm['note'];
$newobject->contact_id = $actioncomm['contactid'];
$newobject->userownerid = $actioncomm['userownerid'];
$newobject->contact_id = (int) $actioncomm['contactid'];
$newobject->userownerid = (int) $actioncomm['userownerid'];
$newobject->label = $actioncomm['label'];
$newobject->percentage = $actioncomm['percentage'];
$newobject->priority = $actioncomm['priority'];
$newobject->fulldayevent = $actioncomm['fulldayevent'];
$newobject->percentage = (int) $actioncomm['percentage'];
$newobject->priority = (int) $actioncomm['priority'];
$newobject->fulldayevent = (int) $actioncomm['fulldayevent'];
$newobject->location = $actioncomm['location'];
$newobject->fk_element = $actioncomm['fk_element'];
$newobject->fk_element = (int) $actioncomm['fk_element'];
$newobject->elementtype = $actioncomm['elementtype'];
$elementtype = 'actioncomm';
@ -518,8 +517,8 @@ function createActionComm($authentication, $actioncomm)
* Create ActionComm
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $actioncomm $actioncomm
* @return array Array result
* @param array{id:string,ref:string,ref_ext:string,type_id:string,type_code:string,type:string,label:string,datep:int,datef:int,datec:int,datem:int,note:string,percentage:string,author:string,usermod:string,userownerid:string,priority:string,fulldayevent:string,location:string,socid:string,contactid:string,projectid:string,fk_element:string,elementtype:string} $actioncomm $actioncomm
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function updateActionComm($authentication, $actioncomm)
{
@ -558,17 +557,17 @@ function updateActionComm($authentication, $actioncomm)
$object->datep = $actioncomm['datep'];
$object->datef = $actioncomm['datef'];
$object->type_code = $actioncomm['type_code'];
$object->socid = $actioncomm['socid'];
$object->contact_id = $actioncomm['contactid'];
$object->fk_project = $actioncomm['projectid'];
$object->socid = (int) $actioncomm['socid'];
$object->contact_id = (int) $actioncomm['contactid'];
$object->fk_project = (int) $actioncomm['projectid'];
$object->note = $actioncomm['note'];
$object->userownerid = $actioncomm['userownerid'];
$object->userownerid = (int) $actioncomm['userownerid'];
$object->label = $actioncomm['label'];
$object->percentage = $actioncomm['percentage'];
$object->priority = $actioncomm['priority'];
$object->fulldayevent = $actioncomm['fulldayevent'];
$object->percentage = (int) $actioncomm['percentage'];
$object->priority = (int) $actioncomm['priority'];
$object->fulldayevent = (int) $actioncomm['fulldayevent'];
$object->location = $actioncomm['location'];
$object->fk_element = $actioncomm['fk_element'];
$object->fk_element = (int) $actioncomm['fk_element'];
$object->elementtype = $actioncomm['elementtype'];
$elementtype = 'actioncomm';

View File

@ -267,7 +267,7 @@ $server->register(
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param int $id Id of object
* @param string $ref_ext Ref external of object
* @return mixed
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getContact($authentication, $id, $ref_ext)
{
@ -382,8 +382,8 @@ function getContact($authentication, $id, $ref_ext)
* Create Contact
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $contact $contact
* @return array Array result
* @param array{id:string,ref_ext:string,lastname:string,firstname:string,address:string,zip:string,town:string,state_id:string,state_code:string,state:string,country_id:string,country_code:string,country:string,socid:string,status:string,phone_pro:string,fax:string,phone_perso:string,phone_mobile:string,code:string,email:string,birthday:string,default_lang:string,note:string,ref_facturation:string,ref_contrat:string,ref_commande:string,ref_propal:string,user_id:string,user_login:string,civility_id:string,poste:string} $contact $contact
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function createContact($authentication, $contact)
{
@ -413,7 +413,7 @@ function createContact($authentication, $contact)
if (!$error) {
$newobject = new Contact($db);
$newobject->id = $contact['id'];
$newobject->id = (int) $contact['id'];
$newobject->ref_ext = $contact['ref_ext'];
$newobject->civility_id = $contact['civility_id'];
$newobject->lastname = $contact['lastname'];
@ -421,14 +421,14 @@ function createContact($authentication, $contact)
$newobject->address = $contact['address'];
$newobject->zip = $contact['zip'];
$newobject->town = $contact['town'];
$newobject->state_id = $contact['state_id'];
$newobject->state_id = (int) $contact['state_id'];
$newobject->state_code = $contact['state_code'];
$newobject->state = $contact['state'];
$newobject->country_id = $contact['country_id'];
$newobject->country_id = (int) $contact['country_id'];
$newobject->country_code = $contact['country_code'];
$newobject->country = $contact['country'];
$newobject->socid = $contact['socid'];
$newobject->statut = $contact['status'];
$newobject->socid = (int) $contact['socid'];
$newobject->statut = (int) $contact['status'];
$newobject->phone_pro = $contact['phone_pro'];
$newobject->fax = $contact['fax'];
$newobject->phone_perso = $contact['phone_perso'];
@ -438,11 +438,11 @@ function createContact($authentication, $contact)
$newobject->birthday = $contact['birthday'];
$newobject->default_lang = $contact['default_lang'];
$newobject->note = $contact['note'];
$newobject->ref_facturation = $contact['ref_facturation'];
$newobject->ref_contrat = $contact['ref_contrat'];
$newobject->ref_commande = $contact['ref_commande'];
$newobject->ref_propal = $contact['ref_propal'];
$newobject->user_id = $contact['user_id'];
$newobject->ref_facturation = (int) $contact['ref_facturation'];
$newobject->ref_contrat = (int) $contact['ref_contrat'];
$newobject->ref_commande = (int) $contact['ref_commande'];
$newobject->ref_propal = (int) $contact['ref_propal'];
$newobject->user_id = (int) $contact['user_id'];
$newobject->user_login = $contact['user_login'];
$newobject->poste = $contact['poste'];
@ -492,7 +492,7 @@ function createContact($authentication, $contact)
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param int $idthirdparty Id thirdparty
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getContactsForThirdParty($authentication, $idthirdparty)
{
@ -620,8 +620,8 @@ function getContactsForThirdParty($authentication, $idthirdparty)
* Update a contact
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $contact Contact
* @return array Array result
* @param array{id:string,ref_ext:string,lastname:string,firstname:string,address:string,zip:string,town:string,state_id:string,state_code:string,state:string,country_id:string,country_code:string,country:string,socid:string,status:string,phone_pro:string,fax:string,phone_perso:string,phone_mobile:string,code:string,email:string,birthday:string,default_lang:string,note:string,ref_facturation:string,ref_contrat:string,ref_commande:string,ref_propal:string,user_id:string,user_login:string,civility_id:string,poste:string} $contact Contact
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function updateContact($authentication, $contact)
{
@ -674,11 +674,11 @@ function updateContact($authentication, $contact)
$object->zip = $contact['zip'];
$object->town = $contact['town'];
$object->country_id = $contact['country_id'];
$object->country_id = (int) $contact['country_id'];
if ($contact['country_code']) {
$object->country_id = getCountry($contact['country_code'], '3');
}
$object->province_id = $contact['province_id'];
$object->province_id = isset($contact['province_id']) ? $contact['province_id'] : null;
$object->phone_pro = $contact['phone_pro'];
@ -690,7 +690,7 @@ function updateContact($authentication, $contact)
$object->civility_id = $contact['civility_id'];
$object->poste = $contact['poste'];
$object->statut = $contact['status'];
$object->statut = (int) $contact['status'];
$elementtype = 'socpeople';

View File

@ -162,7 +162,7 @@ $server->wsdl->addComplexType(
'maxOccurs' => 'unbounded'
)
),
null,
array(),
'tns:line'
);
@ -226,7 +226,7 @@ $server->wsdl->addComplexType(
'maxOccurs' => 'unbounded'
)
),
null,
array(),
'tns:invoice'
);
@ -309,7 +309,7 @@ $server->register(
* @param int $id Id
* @param string $ref Ref
* @param string $ref_ext Ref_ext
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '')
{
@ -418,7 +418,7 @@ function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '')
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param int $idthirdparty Id thirdparty
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getInvoicesForThirdParty($authentication, $idthirdparty)
{
@ -435,6 +435,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty)
$errorcode = '';
$errorlabel = '';
$error = 0;
$socid = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
if ($fuser->socid) {
@ -552,8 +553,8 @@ function getInvoicesForThirdParty($authentication, $idthirdparty)
* Create an invoice
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $invoice Invoice
* @return array Array result
* @param array{id:string,ref:string,ref_ext:string,thirdparty_id:int,fk_user_author:string,fk_user_valid:string,date:string,date_due:string,date_creation:string,date_validation:string,date_modification:string,payment_mode_id:string,type:int,total_net:float,total_vat:float,total:float,note_private:string,note_public:string,status:int,close_code:string,close_note:string,project_id:string,lines?:array{id:string,type:int,desc:string,vat_rate:float,qty:float,unitprice:float,total_net:float,total_vat:float,total:float,date_start:string,date_end:string,product_id:int,product_ref:string,product_label:string,product_desc:string}} $invoice Invoice
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function createInvoice($authentication, $invoice)
{
@ -562,7 +563,6 @@ function createInvoice($authentication, $invoice)
$now = dol_now();
dol_syslog("Function: createInvoice login=".$authentication['login']." id=".$invoice['id'].", ref=".$invoice['ref'].", ref_ext=".$invoice['ref_ext']);
if ($authentication['entity']) {
$conf->entity = $authentication['entity'];
}
@ -590,7 +590,7 @@ function createInvoice($authentication, $invoice)
$new_invoice->note_private = $invoice['note_private'];
$new_invoice->note_public = $invoice['note_public'];
$new_invoice->statut = Facture::STATUS_DRAFT; // We start with status draft
$new_invoice->fk_project = $invoice['project_id'];
$new_invoice->fk_project = (int) $invoice['project_id'];
$new_invoice->date_creation = $now;
//take mode_reglement and cond_reglement from thirdparty
@ -600,16 +600,19 @@ function createInvoice($authentication, $invoice)
$new_invoice->mode_reglement_id = !empty($invoice['payment_mode_id']) ? $invoice['payment_mode_id'] : $soc->mode_reglement_id;
$new_invoice->cond_reglement_id = $soc->cond_reglement_id;
} else {
$new_invoice->mode_reglement_id = $invoice['payment_mode_id'];
$new_invoice->mode_reglement_id = (int) $invoice['payment_mode_id'];
}
// Trick because nusoap does not store data with same structure if there is one or several lines
$arrayoflines = array();
if (isset($invoice['lines']['line'][0])) {
$arrayoflines = $invoice['lines']['line'];
$arrayoflines = $invoice['lines']['line']; // @phan-suppress-current-line PhanTypeInvalidDimOffset
} else {
$arrayoflines = $invoice['lines'];
}
if (!is_array($arrayoflines)) {
$arrayoflines = array();
}
foreach ($arrayoflines as $line) {
// $key can be 'line' or '0','1',...
@ -689,6 +692,8 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = ''
$errorcode = '';
$errorlabel = '';
$error = 0;
$newobject = null;
$socid = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
if ($fuser->socid) {
$socid = $fuser->socid;
@ -737,7 +742,7 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = ''
}
}
if ($error) {
if ($error || $newobject === null) {
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
} else {
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref, 'ref_ext' => $newobject->ref_ext);
@ -782,7 +787,7 @@ function updateInvoice($authentication, $invoice)
$objectfound = false;
$object = new Facture($db);
$result = $object->fetch($invoice['id'], $invoice['ref'], $invoice['ref_ext'], '');
$result = $object->fetch($invoice['id'], $invoice['ref'], $invoice['ref_ext'], 0);
if (!empty($object->id)) {
$objectfound = true;

View File

@ -377,7 +377,7 @@ $server->register(
* @param int $id Id
* @param string $ref Ref
* @param string $ref_ext Ref_ext
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '')
{
@ -520,7 +520,7 @@ function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '')
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param int $idthirdparty Id of thirdparty
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getOrdersForThirdParty($authentication, $idthirdparty)
{
@ -541,6 +541,8 @@ function getOrdersForThirdParty($authentication, $idthirdparty)
if ($fuser->socid) {
$socid = $fuser->socid;
} else {
$socid = 0;
}
// Check parameters
@ -672,8 +674,8 @@ function getOrdersForThirdParty($authentication, $idthirdparty)
* Create order
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $order Order info
* @return array array of new order
* @param array{id:string,ref:string,ref_client:string,ref_ext:string,thirdparty_id:int,status:int,billed:string,total_net:float,total_vat:float,total_localtax1:float,total_localtax2:float,total:float,date:string,date_creation:string,date_validation:string,date_modification:string,source:string,note_private:string,note_public:string,project_id:string,mode_reglement_id:string,mode_reglement_code:string,mode_reglement:string,cond_reglement_id:string,cond_reglement_code:string,cond_reglement:string,cond_reglement_doc:string,date_livraison:int,demand_reason_id:string,lines:array{lines:array<array{id:string,type:int,fk_commande:int,fk_parent_line:int,desc:string,qty:float,price:float,unitprice:float,vat_rate:float,remise:float,remise_percent:float,total_net:float,total_vat:float,total:float,date_start:int,date_end:int,product_id:int,product_ref:string,product_label:string,product_desc:string}>}} $order Order info
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function createOrder($authentication, $order)
{
@ -695,6 +697,7 @@ function createOrder($authentication, $order)
$errorlabel = '';
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
$newobject = null;
// Check parameters
@ -709,10 +712,10 @@ function createOrder($authentication, $order)
$newobject->note_private = $order['note_private'];
$newobject->note_public = $order['note_public'];
$newobject->statut = Commande::STATUS_DRAFT; // We start with status draft
$newobject->billed = $order['billed'];
$newobject->fk_project = $order['project_id'];
$newobject->cond_reglement_id = $order['cond_reglement_id'];
$newobject->demand_reason_id = $order['demand_reason_id'];
$newobject->billed = (int) $order['billed'];
$newobject->fk_project = (int) $order['project_id'];
$newobject->cond_reglement_id = (int) $order['cond_reglement_id'];
$newobject->demand_reason_id = (int) $order['demand_reason_id'];
$newobject->date_creation = $now;
$elementtype = 'commande';
@ -731,10 +734,13 @@ function createOrder($authentication, $order)
// Trick because nusoap does not store data with same structure if there is one or several lines
$arrayoflines = array();
if (isset($order['lines']['line'][0])) {
$arrayoflines = $order['lines']['line'];
$arrayoflines = $order['lines']['line']; // @phan-suppress-current-line PhanTypeInvalidDimOffset
} else {
$arrayoflines = $order['lines'];
}
if (!is_array($arrayoflines)) {
$arrayoflines = array();
}
foreach ($arrayoflines as $key => $line) {
// $key can be 'line' or '0','1',...
@ -815,7 +821,7 @@ function createOrder($authentication, $order)
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param int $id Id of order to validate
* @param int $id_warehouse Id of warehouse to use for stock decrease
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function validOrder($authentication, $id = 0, $id_warehouse = 0)
{
@ -884,7 +890,7 @@ function validOrder($authentication, $id = 0, $id_warehouse = 0)
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array{id:string,ref:string,refext:string} $order Order info
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function updateOrder($authentication, $order)
{

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 JF FERRY <jfefe@aternatik.fr>
* Copyright (C) 2020-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
@ -91,11 +92,11 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'),
'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'),
'login' => array('name'=>'login', 'type'=>'xsd:string'),
'password' => array('name'=>'password', 'type'=>'xsd:string'),
'entity' => array('name'=>'entity', 'type'=>'xsd:string')
'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'),
'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'),
'login' => array('name' => 'login', 'type' => 'xsd:string'),
'password' => array('name' => 'password', 'type' => 'xsd:string'),
'entity' => array('name' => 'entity', 'type' => 'xsd:string')
)
);
// Define WSDL Return object
@ -106,51 +107,51 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'),
'result_label' => array('name'=>'result_label', 'type'=>'xsd:string')
'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'),
'result_label' => array('name' => 'result_label', 'type' => 'xsd:string')
)
);
$productorservice_fields = array(
'id' => array('name'=>'id', 'type'=>'xsd:string'),
'ref' => array('name'=>'ref', 'type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'),
'type' => array('name'=>'type', 'type'=>'xsd:string'),
'label' => array('name'=>'label', 'type'=>'xsd:string'),
'description' => array('name'=>'description', 'type'=>'xsd:string'),
'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'),
'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'),
'note' => array('name'=>'note', 'type'=>'xsd:string'),
'status_tobuy' => array('name'=>'status_tobuy', 'type'=>'xsd:string'),
'status_tosell' => array('name'=>'status_tosell', 'type'=>'xsd:string'),
'barcode' => array('name'=>'barcode', 'type'=>'xsd:string'),
'barcode_type' => array('name'=>'barcode_type', 'type'=>'xsd:string'),
'country_id' => array('name'=>'country_id', 'type'=>'xsd:string'),
'country_code' => array('name'=>'country_code', 'type'=>'xsd:string'),
'customcode' => array('name'=>'customcode', 'type'=>'xsd:string'),
'id' => array('name' => 'id', 'type' => 'xsd:string'),
'ref' => array('name' => 'ref', 'type' => 'xsd:string'),
'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'),
'type' => array('name' => 'type', 'type' => 'xsd:string'),
'label' => array('name' => 'label', 'type' => 'xsd:string'),
'description' => array('name' => 'description', 'type' => 'xsd:string'),
'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'),
'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'),
'note' => array('name' => 'note', 'type' => 'xsd:string'),
'status_tobuy' => array('name' => 'status_tobuy', 'type' => 'xsd:string'),
'status_tosell' => array('name' => 'status_tosell', 'type' => 'xsd:string'),
'barcode' => array('name' => 'barcode', 'type' => 'xsd:string'),
'barcode_type' => array('name' => 'barcode_type', 'type' => 'xsd:string'),
'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'),
'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'),
'customcode' => array('name' => 'customcode', 'type' => 'xsd:string'),
'price_net' => array('name'=>'price_net', 'type'=>'xsd:string'),
'price' => array('name'=>'price', 'type'=>'xsd:string'),
'price_min_net' => array('name'=>'price_min_net', 'type'=>'xsd:string'),
'price_min' => array('name'=>'price_min', 'type'=>'xsd:string'),
'price_net' => array('name' => 'price_net', 'type' => 'xsd:string'),
'price' => array('name' => 'price', 'type' => 'xsd:string'),
'price_min_net' => array('name' => 'price_min_net', 'type' => 'xsd:string'),
'price_min' => array('name' => 'price_min', 'type' => 'xsd:string'),
'price_base_type' => array('name'=>'price_base_type', 'type'=>'xsd:string'),
'price_base_type' => array('name' => 'price_base_type', 'type' => 'xsd:string'),
'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:string'),
'vat_npr' => array('name'=>'vat_npr', 'type'=>'xsd:string'),
'localtax1_tx' => array('name'=>'localtax1_tx', 'type'=>'xsd:string'),
'localtax2_tx' => array('name'=>'localtax2_tx', 'type'=>'xsd:string'),
'vat_rate' => array('name' => 'vat_rate', 'type' => 'xsd:string'),
'vat_npr' => array('name' => 'vat_npr', 'type' => 'xsd:string'),
'localtax1_tx' => array('name' => 'localtax1_tx', 'type' => 'xsd:string'),
'localtax2_tx' => array('name' => 'localtax2_tx', 'type' => 'xsd:string'),
'stock_alert' => array('name'=>'stock_alert', 'type'=>'xsd:string'),
'stock_real' => array('name'=>'stock_real', 'type'=>'xsd:string'),
'stock_pmp' => array('name'=>'stock_pmp', 'type'=>'xsd:string'),
'warehouse_ref' => array('name'=>'warehouse_ref', 'type'=>'xsd:string'), // Used only for create or update to set which warehouse to use for stock correction if stock_real differs from database
'stock_alert' => array('name' => 'stock_alert', 'type' => 'xsd:string'),
'stock_real' => array('name' => 'stock_real', 'type' => 'xsd:string'),
'stock_pmp' => array('name' => 'stock_pmp', 'type' => 'xsd:string'),
'warehouse_ref' => array('name' => 'warehouse_ref', 'type' => 'xsd:string'), // Used only for create or update to set which warehouse to use for stock correction if stock_real differs from database
'canvas' => array('name'=>'canvas', 'type'=>'xsd:string'),
'import_key' => array('name'=>'import_key', 'type'=>'xsd:string'),
'canvas' => array('name' => 'canvas', 'type' => 'xsd:string'),
'import_key' => array('name' => 'import_key', 'type' => 'xsd:string'),
'dir' => array('name'=>'dir', 'type'=>'xsd:string'),
'images' => array('name'=>'images', 'type'=>'tns:ImagesArray')
'dir' => array('name' => 'dir', 'type' => 'xsd:string'),
'images' => array('name' => 'images', 'type' => 'tns:ImagesArray')
);
@ -174,7 +175,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie
$type = 'xsd:string';
}
$extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type);
$extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type);
}
}
@ -222,10 +223,10 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'photo' => array('name'=>'photo', 'type'=>'xsd:string'),
'photo_vignette' => array('name'=>'photo_vignette', 'type'=>'xsd:string'),
'imgWidth' => array('name'=>'imgWidth', 'type'=>'xsd:string'),
'imgHeight' => array('name'=>'imgHeight', 'type'=>'xsd:string')
'photo' => array('name' => 'photo', 'type' => 'xsd:string'),
'photo_vignette' => array('name' => 'photo_vignette', 'type' => 'xsd:string'),
'imgWidth' => array('name' => 'imgWidth', 'type' => 'xsd:string'),
'imgHeight' => array('name' => 'imgHeight', 'type' => 'xsd:string')
)
);
@ -239,9 +240,9 @@ $server->wsdl->addComplexType(
'',
array(
//'limit' => array('name'=>'limit','type'=>'xsd:string'),
'type' => array('name'=>'type', 'type'=>'xsd:string'),
'status_tobuy' => array('name'=>'status_tobuy', 'type'=>'xsd:string'),
'status_tosell' => array('name'=>'status_tosell', 'type'=>'xsd:string'),
'type' => array('name' => 'type', 'type' => 'xsd:string'),
'status_tobuy' => array('name' => 'status_tobuy', 'type' => 'xsd:string'),
'status_tosell' => array('name' => 'status_tosell', 'type' => 'xsd:string'),
)
);
@ -274,9 +275,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped
$server->register(
'getProductOrService',
// Entry values
array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string', 'lang'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string', 'lang' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'product'=>'tns:product'),
array('result' => 'tns:result', 'product' => 'tns:product'),
$ns,
$ns.'#getProductOrService',
$styledoc,
@ -288,9 +289,9 @@ $server->register(
$server->register(
'createProductOrService',
// Entry values
array('authentication'=>'tns:authentication', 'product'=>'tns:product'),
array('authentication' => 'tns:authentication', 'product' => 'tns:product'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string'),
$ns,
$ns.'#createProductOrService',
$styledoc,
@ -302,9 +303,9 @@ $server->register(
$server->register(
'updateProductOrService',
// Entry values
array('authentication'=>'tns:authentication', 'product'=>'tns:product'),
array('authentication' => 'tns:authentication', 'product' => 'tns:product'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string'),
$ns,
$ns.'#updateProductOrService',
$styledoc,
@ -316,9 +317,9 @@ $server->register(
$server->register(
'deleteProductOrService',
// Entry values
array('authentication'=>'tns:authentication', 'listofid'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'listofid' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'nbdeleted'=>'xsd:int'),
array('result' => 'tns:result', 'nbdeleted' => 'xsd:int'),
$ns,
$ns.'#deleteProductOrService',
$styledoc,
@ -330,9 +331,9 @@ $server->register(
$server->register(
'getListOfProductsOrServices',
// Entry values
array('authentication'=>'tns:authentication', 'filterproduct'=>'tns:filterproduct'),
array('authentication' => 'tns:authentication', 'filterproduct' => 'tns:filterproduct'),
// Exit values
array('result'=>'tns:result', 'products'=>'tns:ProductsArray2'),
array('result' => 'tns:result', 'products' => 'tns:ProductsArray2'),
$ns,
$ns.'#getListOfProductsOrServices',
$styledoc,
@ -344,9 +345,9 @@ $server->register(
$server->register(
'getProductsForCategory',
// Entry values
array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'lang'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'lang' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'products'=>'tns:ProductsArray2'),
array('result' => 'tns:result', 'products' => 'tns:ProductsArray2'),
$ns,
$ns.'#getProductsForCategory',
$styledoc,
@ -363,7 +364,7 @@ $server->register(
* @param string $ref Ref of object
* @param string $ref_ext Ref external of object
* @param string $lang Lang to force
* @return mixed
* @return array{product?:mixed[],result:array{result_code:string,result_label:string}} Array result
*/
function getProductOrService($authentication, $id = 0, $ref = '', $ref_ext = '', $lang = '')
{
@ -475,8 +476,8 @@ function getProductOrService($authentication, $id = 0, $ref = '', $ref_ext = '',
// Create
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'product'=>$productorservice_result_fields
'result' => array('result_code' => 'OK', 'result_label' => ''),
'product' => $productorservice_result_fields
);
} else {
$error++;
@ -491,7 +492,7 @@ function getProductOrService($authentication, $id = 0, $ref = '', $ref_ext = '',
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
//var_dump($objectresp);exit;
return $objectresp;
@ -502,8 +503,8 @@ function getProductOrService($authentication, $id = 0, $ref = '', $ref_ext = '',
* Create an invoice
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $product Product
* @return array Array result
* @param array{id:string,ref:string,ref_ext:string,type:string,label:string,description:string,date_creation:string,date_modification:string,note:string,status_tobuy:string,status_tosell:string,barcode:string,barcode_type:string,country_id:string,country_code:string,customcode:string,price_net:string,price:string,price_min_net:string,price_min:string,price_base_type:string,vat_rate:string,vat_npr:string,localtax1_tx:string,localtax2_tx:string,stock_alert:string,stock_real:string,stock_pmp:string,warehouse_ref:string,canvas:string,import_key:string,dir:string,images:array<array{photo:string,photo_vignette:string,imgWidth:string,imgHeight:string}>} $product Product
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function createProductOrService($authentication, $product)
{
@ -558,22 +559,22 @@ function createProductOrService($authentication, $product)
$newobject->note_private = empty($product['note_private']) ? '' : $product['note_private'];
$newobject->status = empty($product['status_tosell']) ? 0 : $product['status_tosell'];
$newobject->status_buy = empty($product['status_tobuy']) ? 0 : $product['status_tobuy'];
$newobject->price = isset($product['price_net']) ? $product['price_net'] : 0;
$newobject->price_ttc = isset($product['price']) ? $product['price'] : 0;
$newobject->price = isset($product['price_net']) ? (float) $product['price_net'] : 0;
$newobject->price_ttc = isset($product['price']) ? (float) $product['price'] : 0;
$newobject->tva_tx = empty($product['vat_rate']) ? 0 : $product['vat_rate'];
$newobject->price_base_type = $product['price_base_type'];
$newobject->date_creation = $now;
if (!empty($product['barcode'])) {
$newobject->barcode = $product['barcode'];
$newobject->barcode_type = $product['barcode_type'];
$newobject->barcode_type = (int) $product['barcode_type'];
}
$newobject->stock_reel = isset($product['stock_real']) ? $product['stock_real'] : null;
$newobject->pmp = isset($product['pmp']) ? $product['pmp'] : null;
$newobject->seuil_stock_alerte = isset($product['stock_alert']) ? $product['stock_alert'] : null;
$newobject->stock_reel = isset($product['stock_real']) ? (int) $product['stock_real'] : null;
$newobject->pmp = isset($product['pmp']) ? (float) $product['pmp'] : 0;
$newobject->seuil_stock_alerte = isset($product['stock_alert']) ? (float) $product['stock_alert'] : null;
$newobject->country_id = isset($product['country_id']) ? $product['country_id'] : 0;
$newobject->country_id = isset($product['country_id']) ? (int) $product['country_id'] : 0;
if (!empty($product['country_code'])) {
$newobject->country_id = getCountry($product['country_code'], '3');
}
@ -647,7 +648,7 @@ function createProductOrService($authentication, $product)
if (!$error) {
$db->commit();
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref);
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref);
} else {
$db->rollback();
$error++;
@ -657,7 +658,7 @@ function createProductOrService($authentication, $product)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@ -668,8 +669,8 @@ function createProductOrService($authentication, $product)
* Update a product or service
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $product Product
* @return array Array result
* @param array{id:string,ref:string,ref_ext:string,type:string,label:string,description:string,date_creation:string,date_modification:string,note:string,status_tobuy:string,status_tosell:string,barcode:string,barcode_type:string,country_id:string,country_code:string,customcode:string,price_net:string,price:string,price_min_net:string,price_min:string,price_base_type:string,vat_rate:string,vat_npr:string,localtax1_tx:string,localtax2_tx:string,stock_alert:string,stock_real:string,stock_pmp:string,warehouse_ref:string,canvas:string,import_key:string,dir:string,images:array<array{photo:string,photo_vignette:string,imgWidth:string,imgHeight:string}>} $product Product
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function updateProductOrService($authentication, $product)
{
@ -722,28 +723,28 @@ function updateProductOrService($authentication, $product)
if (isset($product['ref_ext'])) {
$newobject->ref_ext = $product['ref_ext'];
}
$newobject->type = $product['type'];
$newobject->type = (int) $product['type'];
$newobject->label = $product['label'];
$newobject->description = $product['description'];
$newobject->note = $product['note'];
$newobject->status = $product['status_tosell'];
$newobject->status_buy = $product['status_tobuy'];
$newobject->price = $product['price_net'];
$newobject->price_ttc = $product['price'];
$newobject->status = (int) $product['status_tosell'];
$newobject->status_buy = (int) $product['status_tobuy'];
$newobject->price = (float) $product['price_net'];
$newobject->price_ttc = (float) $product['price'];
$newobject->tva_tx = $product['vat_rate'];
$newobject->price_base_type = $product['price_base_type'];
$newobject->date_creation = $now;
if ($product['barcode']) {
$newobject->barcode = $product['barcode'];
$newobject->barcode_type = $product['barcode_type'];
$newobject->barcode_type = (int) $product['barcode_type'];
}
$newobject->stock_reel = isset($product['stock_real']) ? $product['stock_real'] : null;
$newobject->pmp = isset($product['pmp']) ? $product['pmp'] : null;
$newobject->seuil_stock_alerte = isset($product['stock_alert']) ? $product['stock_alert'] : null;
$newobject->stock_reel = isset($product['stock_real']) ? (int) $product['stock_real'] : null;
$newobject->pmp = isset($product['pmp']) ? (float) $product['pmp'] : 0;
$newobject->seuil_stock_alerte = isset($product['stock_alert']) ? (float) $product['stock_alert'] : null;
$newobject->country_id = isset($product['country_id']) ? $product['country_id'] : 0;
$newobject->country_id = isset($product['country_id']) ? (int) $product['country_id'] : 0;
if (!empty($product['country_code'])) {
$newobject->country_id = getCountry($product['country_code'], '3');
}
@ -814,7 +815,7 @@ function updateProductOrService($authentication, $product)
if (!$error) {
$db->commit();
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref);
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref);
} else {
$db->rollback();
$error++;
@ -824,7 +825,7 @@ function updateProductOrService($authentication, $product)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@ -836,7 +837,7 @@ function updateProductOrService($authentication, $product)
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param string $listofidstring List of id with comma
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function deleteProductOrService($authentication, $listofidstring)
{
@ -897,7 +898,7 @@ function deleteProductOrService($authentication, $listofidstring)
if (!$error) {
$db->commit();
//$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'listofid'=>$listofiddeleted);
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'nbdeleted'=>count($listofiddeleted));
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'nbdeleted' => count($listofiddeleted));
} else {
$db->rollback();
$error++;
@ -908,10 +909,10 @@ function deleteProductOrService($authentication, $listofidstring)
if ($error) {
//$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'listofid'=>$listofiddeleted);
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'nbdeleted'=>0);
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel), 'nbdeleted' => 0);
} elseif (count($listofiddeleted) == 0) {
//$objectresp=array('result'=>array('result_code'=>'NOT_FOUND', 'result_label'=>'No product or service with id '.join(',',$listofid).' found'), 'listofid'=>$listofiddeleted);
$objectresp = array('result'=>array('result_code'=>'NOT_FOUND', 'result_label'=>'No product or service with id '.implode(',', $listofid).' found'), 'nbdeleted'=>0);
$objectresp = array('result' => array('result_code' => 'NOT_FOUND', 'result_label' => 'No product or service with id '.implode(',', $listofid).' found'), 'nbdeleted' => 0);
}
return $objectresp;
@ -922,8 +923,8 @@ function deleteProductOrService($authentication, $listofidstring)
* getListOfProductsOrServices
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $filterproduct Filter fields
* @return array Array result
* @param array<string,mixed> $filterproduct Filter fields
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getListOfProductsOrServices($authentication, $filterproduct)
{
@ -966,7 +967,7 @@ function getListOfProductsOrServices($authentication, $filterproduct)
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
$arrayproducts[] = array('id'=>$obj->rowid, 'ref'=>$obj->ref, 'ref_ext'=>$obj->ref_ext);
$arrayproducts[] = array('id' => $obj->rowid, 'ref' => $obj->ref, 'ref_ext' => $obj->ref_ext);
$i++;
}
} else {
@ -978,13 +979,13 @@ function getListOfProductsOrServices($authentication, $filterproduct)
if ($error) {
$objectresp = array(
'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel),
'products'=>$arrayproducts
'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel),
'products' => $arrayproducts
);
} else {
$objectresp = array(
'result'=>array('result_code' => 'OK', 'result_label' => ''),
'products'=>$arrayproducts
'result' => array('result_code' => 'OK', 'result_label' => ''),
'products' => $arrayproducts
);
}
@ -998,7 +999,7 @@ function getListOfProductsOrServices($authentication, $filterproduct)
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param int $id Category id
* @param string $lang Force lang
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getProductsForCategory($authentication, $id, $lang = '')
{
@ -1112,13 +1113,13 @@ function getProductsForCategory($authentication, $id, $lang = '')
// Retour
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'products'=> $products
'result' => array('result_code' => 'OK', 'result_label' => ''),
'products' => $products
);
} else {
$errorcode = 'NORECORDS_FOR_ASSOCIATION';
$errorlabel = 'No products associated'.$sql;
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
dol_syslog("getProductsForCategory:: ".$errorcode, LOG_DEBUG);
}
} else {
@ -1134,7 +1135,7 @@ function getProductsForCategory($authentication, $id, $lang = '')
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016 Ion Agorria <ion@agorria.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -104,11 +105,11 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'),
'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'),
'login' => array('name'=>'login', 'type'=>'xsd:string'),
'password' => array('name'=>'password', 'type'=>'xsd:string'),
'entity' => array('name'=>'entity', 'type'=>'xsd:string'),
'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'),
'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'),
'login' => array('name' => 'login', 'type' => 'xsd:string'),
'password' => array('name' => 'password', 'type' => 'xsd:string'),
'entity' => array('name' => 'entity', 'type' => 'xsd:string'),
)
);
@ -120,8 +121,8 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'),
'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'),
'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'),
'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'),
)
);
@ -133,8 +134,8 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'id' => array('name'=>'id', 'type'=>'xsd:int'),
'user' => array('name'=>'user', 'type'=>'xsd:int'),
'id' => array('name' => 'id', 'type' => 'xsd:int'),
'user' => array('name' => 'user', 'type' => 'xsd:int'),
)
);
@ -156,7 +157,7 @@ $server->wsdl->addComplexType(
$project_elements = array();
foreach ($listofreferent as $key => $label) {
$project_elements[$key] = array('name'=>$key, 'type'=>'tns:elementsArray');
$project_elements[$key] = array('name' => $key, 'type' => 'tns:elementsArray');
}
$server->wsdl->addComplexType(
'elements',
@ -169,17 +170,17 @@ $server->wsdl->addComplexType(
// Define project
$project_fields = array(
'id' => array('name'=>'id', 'type'=>'xsd:string'),
'ref' => array('name'=>'ref', 'type'=>'xsd:string'),
'label' => array('name'=>'label', 'type'=>'xsd:string'),
'thirdparty_id' => array('name'=>'thirdparty_id', 'type'=>'xsd:int'),
'public' => array('name'=>'public', 'type'=>'xsd:int'),
'status' => array('name'=>'status', 'type'=>'xsd:int'),
'date_start' => array('name'=>'date_start', 'type'=>'xsd:date'),
'date_end' => array('name'=>'date_end', 'type'=>'xsd:date'),
'budget' => array('name'=>'budget', 'type'=>'xsd:int'),
'description' => array('name'=>'description', 'type'=>'xsd:string'),
'elements' => array('name'=>'elements', 'type'=>'tns:elements')
'id' => array('name' => 'id', 'type' => 'xsd:string'),
'ref' => array('name' => 'ref', 'type' => 'xsd:string'),
'label' => array('name' => 'label', 'type' => 'xsd:string'),
'thirdparty_id' => array('name' => 'thirdparty_id', 'type' => 'xsd:int'),
'public' => array('name' => 'public', 'type' => 'xsd:int'),
'status' => array('name' => 'status', 'type' => 'xsd:int'),
'date_start' => array('name' => 'date_start', 'type' => 'xsd:date'),
'date_end' => array('name' => 'date_end', 'type' => 'xsd:date'),
'budget' => array('name' => 'budget', 'type' => 'xsd:int'),
'description' => array('name' => 'description', 'type' => 'xsd:string'),
'elements' => array('name' => 'elements', 'type' => 'tns:elements')
);
$elementtype = 'project';
@ -201,7 +202,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie
} else {
$type = 'xsd:string';
}
$extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type);
$extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type);
}
}
if (is_array($extrafield_array)) {
@ -228,9 +229,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped
$server->register(
'createProject',
// Entry values
array('authentication'=>'tns:authentication', 'project'=>'tns:project'),
array('authentication' => 'tns:authentication', 'project' => 'tns:project'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string'),
$ns,
$ns.'#createProject',
$styledoc,
@ -242,9 +243,9 @@ $server->register(
$server->register(
'getProject',
// Entry values
array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'project'=>'tns:project'),
array('result' => 'tns:result', 'project' => 'tns:project'),
$ns,
$ns.'#getProject',
$styledoc,
@ -257,8 +258,8 @@ $server->register(
* Create project
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $project Project info
* @return array array of new order
* @param array{id:string,ref:string,label:string,thirdparty_id:int,public:int,status:int,date_start:string,date_end:string,budget:int,description:string,elements:array<array{id:int,user:int}>} $project Project info
* @return array{id?:int,ref?:string,result:array{result_code:string,result_label:string}} Array result
*/
function createProject($authentication, $project)
{
@ -327,7 +328,7 @@ function createProject($authentication, $project)
if (!$error) {
$db->commit();
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref);
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref);
} else {
$db->rollback();
$error++;
@ -342,7 +343,7 @@ function createProject($authentication, $project)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@ -354,7 +355,7 @@ function createProject($authentication, $project)
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param string $id internal id
* @param string $ref internal reference
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getProject($authentication, $id = '', $ref = '')
{
@ -432,8 +433,8 @@ function getProject($authentication, $id = '', $ref = '')
//Result
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'project'=>$project_result_fields
'result' => array('result_code' => 'OK', 'result_label' => ''),
'project' => $project_result_fields
);
} else {
$error++;
@ -448,7 +449,7 @@ function getProject($authentication, $id = '', $ref = '')
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;

View File

@ -246,7 +246,7 @@ $server->register(
* @param int $id Id
* @param string $ref Ref
* @param string $ref_ext Ref_ext
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getSupplierInvoice($authentication, $id = 0, $ref = '', $ref_ext = '')
{
@ -351,7 +351,7 @@ function getSupplierInvoice($authentication, $id = 0, $ref = '', $ref_ext = '')
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param int $idthirdparty Id thirdparty
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getSupplierInvoicesForThirdParty($authentication, $idthirdparty)
{

View File

@ -317,7 +317,7 @@ $server->register(
* @param string $barcode barcode
* @param string $profid1 profid1
* @param string $profid2 profid2
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $barcode = '', $profid1 = '', $profid2 = '')
{
@ -438,8 +438,8 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar
* Create a thirdparty
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $thirdparty Thirdparty
* @return array Array result
* @param array{id:string,ref:string,ref_ext:string,fk_user_author:string,status:string,client:string,supplier:string,customer_code:string,supplier_code:string,customer_code_accountancy:string,supplier_code_accountancy:string,date_creation:string,date_modification:string,note_private:string,note_public:string,address:string,zip:string,town:string,region_code:string,country_id:string,country_code:string,country:string,phone:string,fax:string,email:string,url:string,profid1:string,profid2:string,profid3:string,profid4:string,profid5:string,profid6:string,capital:string,vat_used:string,vat_number:string} $thirdparty Thirdparty
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function createThirdParty($authentication, $thirdparty)
{
@ -474,9 +474,9 @@ function createThirdParty($authentication, $thirdparty)
$newobject->ref = $thirdparty['ref'];
$newobject->name = $thirdparty['ref'];
$newobject->ref_ext = $thirdparty['ref_ext'];
$newobject->status = $thirdparty['status'];
$newobject->client = $thirdparty['client'];
$newobject->fournisseur = $thirdparty['supplier'];
$newobject->status = (int) $thirdparty['status'];
$newobject->client = (int) $thirdparty['client'];
$newobject->fournisseur = (int) $thirdparty['supplier'];
$newobject->code_client = $thirdparty['customer_code'];
$newobject->code_fournisseur = $thirdparty['supplier_code'];
$newobject->code_compta = $thirdparty['customer_code_accountancy'];
@ -489,7 +489,7 @@ function createThirdParty($authentication, $thirdparty)
$newobject->zip = $thirdparty['zip'];
$newobject->town = $thirdparty['town'];
$newobject->country_id = $thirdparty['country_id'];
$newobject->country_id = (int) $thirdparty['country_id'];
if ($thirdparty['country_code']) {
$newobject->country_id = getCountry($thirdparty['country_code'], '3');
}
@ -507,13 +507,13 @@ function createThirdParty($authentication, $thirdparty)
$newobject->idprof5 = $thirdparty['profid5'];
$newobject->idprof6 = $thirdparty['profid6'];
$newobject->capital = $thirdparty['capital'];
$newobject->capital = (float) $thirdparty['capital'];
$newobject->barcode = empty($thirdparty['barcode']) ? '' : $thirdparty['barcode'];
$newobject->barcode = !isset($thirdparty['barcode']) ? '' : $thirdparty['barcode'];
$newobject->tva_assuj = empty($thirdparty['vat_used']) ? 0 : $thirdparty['vat_used'];
$newobject->tva_intra = empty($thirdparty['vat_number']) ? '' : $thirdparty['vat_number'];
$newobject->canvas = empty($thirdparty['canvas']) ? '' : $thirdparty['canvas'];
$newobject->canvas = !isset($thirdparty['canvas']) ? '' : $thirdparty['canvas'];
$newobject->particulier = empty($thirdparty['individual']) ? 0 : $thirdparty['individual'];
$elementtype = 'societe';
@ -535,8 +535,8 @@ function createThirdParty($authentication, $thirdparty)
$result = $newobject->create($fuser);
if ($newobject->particulier && $result > 0) {
$newobject->firstname = $thirdparty['firstname'];
$newobject->name_bis = $thirdparty['lastname'];
$newobject->firstname = isset($thirdparty['firstname']) ? $thirdparty['firstname'] : '';
$newobject->name_bis = isset($thirdparty['lastname']) ? $thirdparty['lastname'] : '';
$result = $newobject->create_individual($fuser);
}
if ($result <= 0) {
@ -546,9 +546,9 @@ function createThirdParty($authentication, $thirdparty)
if (!$error) {
$db->commit();
// Patch to add capability to associate (one) sale representative
if (!empty($thirdparty['commid']) && $thirdparty['commid'] > 0) {
$newobject->add_commercial($fuser, $thirdparty["commid"]);
// Patch to add capability to associate (one) sales representative
if (isset($thirdparty['commid']) && $thirdparty['commid'] > 0) { // @phan-suppress-current-line PhanTypeInvalidDimOffset
$newobject->add_commercial($fuser, $thirdparty['commid']);
}
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref);
@ -571,8 +571,8 @@ function createThirdParty($authentication, $thirdparty)
* Update a thirdparty
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $thirdparty Thirdparty
* @return array Array result
* @param array{id:string,ref:string,ref_ext:string,fk_user_author:string,status:string,client:string,supplier:string,customer_code:string,supplier_code:string,customer_code_accountancy:string,supplier_code_accountancy:string,date_creation:string,date_modification:string,note_private:string,note_public:string,address:string,zip:string,town:string,region_code:string,country_id:string,country_code:string,country:string,phone:string,fax:string,email:string,url:string,profid1:string,profid2:string,profid3:string,profid4:string,profid5:string,profid6:string,capital:string,vat_used:string,vat_number:string} $thirdparty Thirdparty
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function updateThirdParty($authentication, $thirdparty)
{
@ -613,9 +613,9 @@ function updateThirdParty($authentication, $thirdparty)
$object->ref = $thirdparty['ref'];
$object->name = $thirdparty['ref'];
$object->ref_ext = $thirdparty['ref_ext'];
$object->status = $thirdparty['status'];
$object->client = $thirdparty['client'];
$object->fournisseur = $thirdparty['supplier'];
$object->status = (int) $thirdparty['status'];
$object->client = (int) $thirdparty['client'];
$object->fournisseur = (int) $thirdparty['supplier'];
$object->code_client = $thirdparty['customer_code'];
$object->code_fournisseur = $thirdparty['supplier_code'];
$object->code_compta = $thirdparty['customer_code_accountancy'];
@ -628,7 +628,7 @@ function updateThirdParty($authentication, $thirdparty)
$object->zip = $thirdparty['zip'];
$object->town = $thirdparty['town'];
$object->country_id = $thirdparty['country_id'];
$object->country_id = (int) $thirdparty['country_id'];
if ($thirdparty['country_code']) {
$object->country_id = getCountry($thirdparty['country_code'], '3');
}
@ -646,13 +646,13 @@ function updateThirdParty($authentication, $thirdparty)
$object->idprof5 = $thirdparty['profid5'];
$object->idprof6 = $thirdparty['profid6'];
$object->capital = $thirdparty['capital'];
$object->capital = (float) $thirdparty['capital'];
$object->barcode = $thirdparty['barcode'];
$object->tva_assuj = $thirdparty['vat_used'];
$object->barcode = !isset($thirdparty['barcode']) ? '' : $thirdparty['barcode'];
$object->tva_assuj = (int) $thirdparty['vat_used'];
$object->tva_intra = $thirdparty['vat_number'];
$object->canvas = $thirdparty['canvas'];
$object->canvas = !isset($thirdparty['canvas']) ? '' : $thirdparty['canvas'];
$elementtype = 'societe';
@ -710,8 +710,8 @@ function updateThirdParty($authentication, $thirdparty)
* getListOfThirdParties
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $filterthirdparty Filter fields (key=>value to filer on. For example 'client'=>2, 'supplier'=>1, 'category'=>idcateg, 'name'=>'searchstring', ...)
* @return array Array result
* @param array<string,mixed> $filterthirdparty Filter fields (key=>value to filer on. For example 'client'=>2, 'supplier'=>1, 'category'=>idcateg, 'name'=>'searchstring', ...)
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getListOfThirdParties($authentication, $filterthirdparty)
{
@ -823,7 +823,7 @@ function getListOfThirdParties($authentication, $filterthirdparty)
* @param string $id internal id
* @param string $ref internal reference
* @param string $ref_ext external reference
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
{

View File

@ -422,7 +422,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '')
* getListOfGroups
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @return array Array result
* @return array{result:array{result_code:string,result_label:string}} Array result
*/
function getListOfGroups($authentication)
{
@ -490,8 +490,8 @@ function getListOfGroups($authentication)
* Create an external user with thirdparty and contact
*
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array $thirdpartywithuser Datas
* @return mixed
* @param array{name:string,firstname:string,name_thirdparty:string,ref_ext:string,client:string,fournisseur:string,address:string,zip:string,town:string,country_id:string,country_code:string,phone:string,phone_mobile:string,fax:string,email:string,url:string,profid1:string,profid2:string,profid3:string,profid4:string,profid5:string,profid6:string,capital:string,tva_assuj:string,tva_intra:string,login:string,password:string,group_id:string} $thirdpartywithuser Datas
* @return array{id?:int,result:array{result_code:string,result_label:string}} Array result
*/
function createUserFromThirdparty($authentication, $thirdpartywithuser)
{
@ -552,7 +552,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
$thirdparty->address = $thirdpartywithuser['address'];
$thirdparty->zip = $thirdpartywithuser['zip'];
$thirdparty->town = $thirdpartywithuser['town'];
$thirdparty->country_id = $thirdpartywithuser['country_id'];
$thirdparty->country_id = (int) $thirdpartywithuser['country_id'];
$thirdparty->country_code = $thirdpartywithuser['country_code'];
// find the country id by code
@ -583,8 +583,8 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
$thirdparty->idprof5 = $thirdpartywithuser['prof5'];
$thirdparty->idprof6 = $thirdpartywithuser['prof6'];
$thirdparty->client = $thirdpartywithuser['client'];
$thirdparty->fournisseur = $thirdpartywithuser['fournisseur'];
$thirdparty->client = (int) $thirdpartywithuser['client'];
$thirdparty->fournisseur = (int) $thirdpartywithuser['fournisseur'];
$socid_return = $thirdparty->create($fuser);