From 86f80d0da5d5c49e93cf2c41ee6d5d5069018e95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 14:00:39 +0100 Subject: [PATCH 01/17] Debug v21 --- htdocs/core/tpl/objectline_view.tpl.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index ff1b423e2d857..36452dd9d2eef 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -304,15 +304,17 @@ print ''; } +// Set the text for tooltip. +// The value of maount must be shown with price(..., 0, '', 0, 0) so value will be visible exactly like it is into database. $tooltiponprice = ''; $tooltiponpricemultiprice = ''; $tooltiponpriceend = ''; $tooltiponpriceendmultiprice = ''; if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht); - $tooltiponpricemultiprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->multicurrency_total_ht); - $tooltiponprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva); - $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->multicurrency_total_tva); + $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht, 0, '', 0, 0); + $tooltiponpricemultiprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->multicurrency_total_ht, 0, '', 0, 0); + $tooltiponprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva, 0, '', 0, 0); + $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->multicurrency_total_tva, 0, '', 0, 0); if (is_object($object->thirdparty)) { if ($senderissupplier) { $seller = $object->thirdparty; @@ -324,8 +326,8 @@ if ($mysoc->useLocalTax(1)) { if (($seller->country_code == $buyer->country_code) || $line->total_localtax1 || $seller->useLocalTax(1)) { - $tooltiponprice .= '
'.$langs->transcountry("TotalLT1", $seller->country_code).'='.price($line->total_localtax1); - $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalLT1", $seller->country_code).'='.price($line->multicurrency_total_localtax1); + $tooltiponprice .= '
'.$langs->transcountry("TotalLT1", $seller->country_code).'='.price($line->total_localtax1, 0, '', 0, 0); + $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalLT1", $seller->country_code).'='.price($line->multicurrency_total_localtax1, 0, '', 0, 0); } else { $tooltiponprice .= '
'.$langs->transcountry("TotalLT1", $seller->country_code).'='.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").''; $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalLT1", $seller->country_code).'='.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").''; @@ -333,16 +335,16 @@ } if ($mysoc->useLocalTax(2)) { if ((isset($seller->country_code) && isset($buyer->thirdparty->country_code) && $seller->country_code == $buyer->thirdparty->country_code) || $line->total_localtax2 || $seller->useLocalTax(2)) { - $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.price($line->total_localtax2); - $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.price($line->multicurrency_total_localtax2); + $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.price($line->total_localtax2, 0, '', 0, 0); + $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.price($line->multicurrency_total_localtax2, 0, '', 0, 0); } else { $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").''; $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").''; } } } - $tooltiponprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc); - $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->multicurrency_total_ttc); + $tooltiponprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc, 0, '', 0, 0); + $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->multicurrency_total_ttc, 0, '', 0, 0); $tooltiponprice = ''; $tooltiponpricemultiprice = ''; From 661059ca9a734e12cc2c109a4e3cec226d437c63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 11 Nov 2024 14:33:53 +0100 Subject: [PATCH 02/17] fix phpstan (#31763) * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan --------- Co-authored-by: Laurent Destailleur --- .github/workflows/phpstan.yml | 2 +- build/phpstan/phpstan-baseline.neon | 763 +----------------- .../codespell/codespell-lines-ignore.txt | 4 +- .../journal/expensereportsjournal.php | 12 +- .../accountancy/journal/purchasesjournal.php | 12 +- htdocs/accountancy/journal/sellsjournal.php | 12 +- htdocs/accountancy/journal/variousjournal.php | 12 +- htdocs/adherents/subscription.php | 2 +- htdocs/admin/expensereport_rules.php | 4 +- htdocs/blockedlog/admin/blockedlog_list.php | 4 +- htdocs/bookcal/availabilities_card.php | 20 +- htdocs/comm/action/card.php | 12 +- htdocs/comm/propal/card.php | 16 +- htdocs/commande/card.php | 14 +- htdocs/compta/bank/line.php | 4 +- htdocs/compta/facture/card-rec.php | 10 +- htdocs/compta/facture/card.php | 16 +- htdocs/compta/journal/purchasesjournal.php | 4 +- htdocs/compta/journal/sellsjournal.php | 4 +- htdocs/compta/localtax/card.php | 8 +- htdocs/compta/localtax/clients.php | 4 +- htdocs/compta/localtax/index.php | 6 +- htdocs/compta/localtax/quadri_detail.php | 4 +- htdocs/compta/paiement/cheque/card.php | 2 +- htdocs/compta/sociales/card.php | 4 +- htdocs/compta/stats/byratecountry.php | 4 +- htdocs/compta/stats/cabyprodserv.php | 4 +- htdocs/compta/stats/cabyuser.php | 4 +- htdocs/compta/stats/casoc.php | 4 +- .../stats/supplier_turnover_by_thirdparty.php | 4 +- htdocs/compta/tva/initdatesforvat.inc.php | 4 +- htdocs/contact/perso.php | 2 +- htdocs/contrat/card.php | 42 +- htdocs/contrat/services_list.php | 24 +- htdocs/core/actions_addupdatedelete.inc.php | 4 +- htdocs/core/tpl/objectline_create.tpl.php | 4 +- htdocs/don/card.php | 2 +- htdocs/don/payment/payment.php | 4 +- htdocs/expedition/dispatch.php | 12 +- htdocs/expedition/list.php | 2 +- htdocs/fichinter/card-rec.php | 36 +- htdocs/fourn/commande/card.php | 16 +- htdocs/supplier_proposal/card.php | 4 +- 43 files changed, 188 insertions(+), 943 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index c638ee83e500a..c041232b26e0d 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -44,7 +44,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - tools: phpstan, cs2pr + tools: phpstan:1.12, cs2pr extensions: calendar, json, imagick, gd, zip, mbstring, intl, opcache, imap, mysql, pgsql, sqlite3, ldap, xml, mcrypt diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 042a6584be811..506a68b929e74 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -630,21 +630,6 @@ parameters: count: 1 path: ../../htdocs/accountancy/journal/expensereportsjournal.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/expensereportsjournal.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/expensereportsjournal.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/expensereportsjournal.php - - message: "#^Right side of && is always true\\.$#" count: 1 @@ -660,61 +645,16 @@ parameters: count: 1 path: ../../htdocs/accountancy/journal/expensereportsjournal.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/purchasesjournal.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/purchasesjournal.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/purchasesjournal.php - - message: "#^Ternary operator condition is always true\\.$#" count: 1 path: ../../htdocs/accountancy/journal/purchasesjournal.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/sellsjournal.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/sellsjournal.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/sellsjournal.php - - message: "#^Ternary operator condition is always true\\.$#" count: 1 path: ../../htdocs/accountancy/journal/sellsjournal.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/variousjournal.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/variousjournal.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/accountancy/journal/variousjournal.php - - message: "#^Ternary operator condition is always true\\.$#" count: 1 @@ -965,21 +905,6 @@ parameters: count: 1 path: ../../htdocs/adherents/subscription.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/adherents/subscription.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/adherents/subscription.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/adherents/subscription.php - - message: "#^Variable \\$bankline in empty\\(\\) always exists and is not falsy\\.$#" count: 1 @@ -1095,21 +1020,6 @@ parameters: count: 1 path: ../../htdocs/admin/events.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/admin/expensereport_rules.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/admin/expensereport_rules.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/admin/expensereport_rules.php - - message: "#^Variable \\$result might not be defined\\.$#" count: 1 @@ -2125,21 +2035,6 @@ parameters: count: 1 path: ../../htdocs/barcode/printsheet.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/blockedlog/admin/blockedlog_list.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/blockedlog/admin/blockedlog_list.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/blockedlog/admin/blockedlog_list.php - - message: "#^Variable \\$contextpage in empty\\(\\) always exists and is not falsy\\.$#" count: 1 @@ -2395,26 +2290,6 @@ parameters: count: 1 path: ../../htdocs/bookcal/availabilities_card.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/bookcal/availabilities_card.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/bookcal/availabilities_card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/bookcal/availabilities_card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/bookcal/availabilities_card.php - - message: "#^Property Availabilities\\:\\:\\$status \\(int\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -2830,36 +2705,6 @@ parameters: count: 1 path: ../../htdocs/comm/action/card.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/comm/action/card.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/comm/action/card.php - - - - message: "#^Parameter \\#3 \\$second of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/comm/action/card.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/comm/action/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/comm/action/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/comm/action/card.php - - message: "#^Result of && is always false\\.$#" count: 1 @@ -3350,36 +3195,6 @@ parameters: count: 1 path: ../../htdocs/comm/propal/card.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/comm/propal/card.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/comm/propal/card.php - - - - message: "#^Parameter \\#3 \\$second of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/comm/propal/card.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/comm/propal/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/comm/propal/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/comm/propal/card.php - - message: "#^Property CommonObject\\:\\:\\$fk_project \\(int\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -3705,36 +3520,6 @@ parameters: count: 1 path: ../../htdocs/commande/card.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/commande/card.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/commande/card.php - - - - message: "#^Parameter \\#3 \\$second of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/commande/card.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 7 - path: ../../htdocs/commande/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 7 - path: ../../htdocs/commande/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 7 - path: ../../htdocs/commande/card.php - - message: "#^Right side of && is always false\\.$#" count: 2 @@ -4310,21 +4095,6 @@ parameters: count: 1 path: ../../htdocs/compta/bank/graph.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/bank/line.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/bank/line.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/bank/line.php - - message: "#^Right side of && is always true\\.$#" count: 2 @@ -4600,36 +4370,6 @@ parameters: count: 1 path: ../../htdocs/compta/facture/card-rec.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/compta/facture/card-rec.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/compta/facture/card-rec.php - - - - message: "#^Parameter \\#3 \\$second of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/facture/card-rec.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/compta/facture/card-rec.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/compta/facture/card-rec.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/compta/facture/card-rec.php - - message: "#^Variable \\$newlang in empty\\(\\) always exists and is always falsy\\.$#" count: 2 @@ -4660,41 +4400,11 @@ parameters: count: 2 path: ../../htdocs/compta/facture/card.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/compta/facture/card.php - - message: "#^Parameter \\#12 \\$localtaxes_array of function calcul_price_total expects array\\{string, int\\|string, string, int\\|string, string, string\\}\\|array\\{string, int\\|string, string, string\\}, array\\{\\} given\\.$#" count: 1 path: ../../htdocs/compta/facture/card.php - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/compta/facture/card.php - - - - message: "#^Parameter \\#3 \\$second of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/compta/facture/card.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/compta/facture/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/compta/facture/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/compta/facture/card.php - - message: "#^Property CommonObject\\:\\:\\$fk_project \\(int\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -5255,21 +4965,6 @@ parameters: count: 1 path: ../../htdocs/compta/index.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/journal/purchasesjournal.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/journal/purchasesjournal.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/journal/purchasesjournal.php - - message: "#^Variable \\$tabcompany might not be defined\\.$#" count: 2 @@ -5305,21 +5000,6 @@ parameters: count: 1 path: ../../htdocs/compta/journal/purchasesjournal.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/journal/sellsjournal.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/journal/sellsjournal.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/journal/sellsjournal.php - - message: "#^Variable \\$tabcompany might not be defined\\.$#" count: 3 @@ -5355,21 +5035,6 @@ parameters: count: 1 path: ../../htdocs/compta/journal/sellsjournal.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/compta/localtax/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/compta/localtax/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/compta/localtax/card.php - - message: "#^Variable \\$accountline might not be defined\\.$#" count: 1 @@ -5385,21 +5050,6 @@ parameters: count: 2 path: ../../htdocs/compta/localtax/class/localtax.class.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/localtax/clients.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/localtax/clients.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/localtax/clients.php - - message: "#^Variable \\$builddate might not be defined\\.$#" count: 1 @@ -5440,21 +5090,6 @@ parameters: count: 1 path: ../../htdocs/compta/localtax/clients.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/localtax/index.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/localtax/index.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/localtax/index.php - - message: "#^Variable \\$arrayofselected might not be defined\\.$#" count: 1 @@ -5480,21 +5115,6 @@ parameters: count: 1 path: ../../htdocs/compta/localtax/quadri_detail.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/localtax/quadri_detail.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/localtax/quadri_detail.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/localtax/quadri_detail.php - - message: "#^Ternary operator condition is always false\\.$#" count: 1 @@ -5560,21 +5180,6 @@ parameters: count: 2 path: ../../htdocs/compta/paiement/card.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/compta/paiement/cheque/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/compta/paiement/cheque/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/compta/paiement/cheque/card.php - - message: "#^Ternary operator condition is always false\\.$#" count: 1 @@ -5970,36 +5575,6 @@ parameters: count: 1 path: ../../htdocs/compta/sociales/card.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/sociales/card.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/sociales/card.php - - - - message: "#^Parameter \\#3 \\$second of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/sociales/card.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/sociales/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/sociales/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/sociales/card.php - - message: "#^Property CommonObject\\:\\:\\$entity \\(int\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -6125,41 +5700,11 @@ parameters: count: 2 path: ../../htdocs/compta/sociales/payments.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/byratecountry.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/byratecountry.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/byratecountry.php - - message: "#^If condition is always false\\.$#" count: 4 path: ../../htdocs/compta/stats/cabyprodserv.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/cabyprodserv.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/cabyprodserv.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/cabyprodserv.php - - message: "#^Ternary operator condition is always false\\.$#" count: 1 @@ -6205,21 +5750,6 @@ parameters: count: 1 path: ../../htdocs/compta/stats/cabyprodserv.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/cabyuser.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/cabyuser.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/cabyuser.php - - message: "#^Ternary operator condition is always false\\.$#" count: 1 @@ -6250,21 +5780,6 @@ parameters: count: 1 path: ../../htdocs/compta/stats/cabyuser.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/casoc.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/casoc.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/casoc.php - - message: "#^Ternary operator condition is always false\\.$#" count: 1 @@ -6385,25 +5900,10 @@ parameters: count: 1 path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - - message: "#^Variable \\$type might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php + - + message: "#^Variable \\$type might not be defined\\.$#" + count: 1 + path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - message: "#^Ternary operator condition is always false\\.$#" @@ -6570,21 +6070,6 @@ parameters: count: 4 path: ../../htdocs/compta/tva/index.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/tva/initdatesforvat.inc.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/tva/initdatesforvat.inc.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/compta/tva/initdatesforvat.inc.php - - message: "#^Variable \\$contextpage in empty\\(\\) always exists and is not falsy\\.$#" count: 2 @@ -6835,21 +6320,6 @@ parameters: count: 1 path: ../../htdocs/contact/perso.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/contact/perso.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/contact/perso.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/contact/perso.php - - message: "#^If condition is always false\\.$#" count: 1 @@ -6865,36 +6335,6 @@ parameters: count: 1 path: ../../htdocs/contrat/card.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 15 - path: ../../htdocs/contrat/card.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 15 - path: ../../htdocs/contrat/card.php - - - - message: "#^Parameter \\#3 \\$second of function dol_mktime expects int, array\\|string given\\.$#" - count: 4 - path: ../../htdocs/contrat/card.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 21 - path: ../../htdocs/contrat/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 21 - path: ../../htdocs/contrat/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 21 - path: ../../htdocs/contrat/card.php - - message: "#^Ternary operator condition is always true\\.$#" count: 1 @@ -7165,21 +6605,6 @@ parameters: count: 1 path: ../../htdocs/contrat/services_list.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/contrat/services_list.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/contrat/services_list.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/contrat/services_list.php - - message: "#^Result of && is always false\\.$#" count: 5 @@ -7210,36 +6635,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_addupdatedelete.inc.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/core/actions_addupdatedelete.inc.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/core/actions_addupdatedelete.inc.php - - - - message: "#^Parameter \\#3 \\$second of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/core/actions_addupdatedelete.inc.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/core/actions_addupdatedelete.inc.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/core/actions_addupdatedelete.inc.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/core/actions_addupdatedelete.inc.php - - message: "#^Result of && is always false\\.$#" count: 1 @@ -12530,31 +11925,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/objectline_create.tpl.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/core/tpl/objectline_create.tpl.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/core/tpl/objectline_create.tpl.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/core/tpl/objectline_create.tpl.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/core/tpl/objectline_create.tpl.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/core/tpl/objectline_create.tpl.php - - message: "#^Variable \\$buyer might not be defined\\.$#" count: 6 @@ -13160,21 +12530,6 @@ parameters: count: 1 path: ../../htdocs/document.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/don/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/don/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/don/card.php - - message: "#^Variable \\$hidedesc might not be defined\\.$#" count: 1 @@ -13410,21 +12765,6 @@ parameters: count: 1 path: ../../htdocs/don/payment/payment.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/don/payment/payment.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/don/payment/payment.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/don/payment/payment.php - - message: "#^Variable \\$sumpaid might not be defined\\.$#" count: 3 @@ -14165,21 +13505,6 @@ parameters: count: 1 path: ../../htdocs/expedition/dispatch.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/expedition/dispatch.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/expedition/dispatch.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/expedition/dispatch.php - - message: "#^Variable \\$modebatch might not be defined\\.$#" count: 4 @@ -14230,21 +13555,6 @@ parameters: count: 1 path: ../../htdocs/expedition/list.php - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/expedition/list.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/expedition/list.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 1 - path: ../../htdocs/expedition/list.php - - message: "#^Variable \\$contextpage in empty\\(\\) always exists and is not falsy\\.$#" count: 2 @@ -14665,31 +13975,6 @@ parameters: count: 1 path: ../../htdocs/fichinter/card-rec.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/fichinter/card-rec.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/fichinter/card-rec.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/fichinter/card-rec.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/fichinter/card-rec.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 3 - path: ../../htdocs/fichinter/card-rec.php - - message: "#^Property CommonObjectLine\\:\\:\\$product_type \\(int\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -14700,11 +13985,6 @@ parameters: count: 1 path: ../../htdocs/fichinter/card-rec.php - - - message: "#^Variable \\$objp might not be defined\\.$#" - count: 1 - path: ../../htdocs/fichinter/card-rec.php - - message: "#^Left side of && is always false\\.$#" count: 1 @@ -15530,36 +14810,6 @@ parameters: count: 3 path: ../../htdocs/fourn/commande/card.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/fourn/commande/card.php - - - - message: "#^Parameter \\#2 \\$minute of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/fourn/commande/card.php - - - - message: "#^Parameter \\#3 \\$second of function dol_mktime expects int, array\\|string given\\.$#" - count: 6 - path: ../../htdocs/fourn/commande/card.php - - - - message: "#^Parameter \\#4 \\$month of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/fourn/commande/card.php - - - - message: "#^Parameter \\#5 \\$day of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/fourn/commande/card.php - - - - message: "#^Parameter \\#6 \\$year of function dol_mktime expects int, array\\|string given\\.$#" - count: 8 - path: ../../htdocs/fourn/commande/card.php - - message: "#^Result of && is always false\\.$#" count: 1 @@ -24090,11 +23340,6 @@ parameters: count: 1 path: ../../htdocs/supplier_proposal/card.php - - - message: "#^Parameter \\#1 \\$hour of function dol_mktime expects int, array\\|string given\\.$#" - count: 2 - path: ../../htdocs/supplier_proposal/card.php - - message: "#^Result of && is always false\\.$#" count: 1 diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index 4a92b80dc80f0..f013fa5ede579 100644 --- a/dev/tools/codespell/codespell-lines-ignore.txt +++ b/dev/tools/codespell/codespell-lines-ignore.txt @@ -19,7 +19,7 @@ jQuery("#mouvement option[value=1]").attr("selected","selected").trigger("change"); jQuery("#mouvement").trigger("change"); $action = 'transfert'; - $date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); + $date_liv = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $newfiletmp = preg_replace('/\.od(s|t)/i', '', $newfile); $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $this->category->childs[] = $this->_cleanObjectDatas($cat); @@ -59,7 +59,7 @@ "sme", $action = 'transfert'; $cle_rib = strtolower(checkES($rib, $CCC)); - $date_com = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); + $date_com = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOSTINT('remonth') ? dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')) : -1); $datefrom = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 125d5fc39dc07..8c8407ff3a18d 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -54,12 +54,12 @@ $id_journal = GETPOSTINT('id_journal'); $action = GETPOST('action', 'aZ09'); -$date_startmonth = GETPOST('date_startmonth'); -$date_startday = GETPOST('date_startday'); -$date_startyear = GETPOST('date_startyear'); -$date_endmonth = GETPOST('date_endmonth'); -$date_endday = GETPOST('date_endday'); -$date_endyear = GETPOST('date_endyear'); +$date_startmonth = GETPOSTINT('date_startmonth'); +$date_startday = GETPOSTINT('date_startday'); +$date_startyear = GETPOSTINT('date_startyear'); +$date_endmonth = GETPOSTINT('date_endmonth'); +$date_endday = GETPOSTINT('date_endday'); +$date_endyear = GETPOSTINT('date_endyear'); $in_bookkeeping = GETPOST('in_bookkeeping'); if ($in_bookkeeping == '') { $in_bookkeeping = 'notyet'; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index aa486e706eb24..d735901fa1b5a 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -55,12 +55,12 @@ $id_journal = GETPOSTINT('id_journal'); $action = GETPOST('action', 'aZ09'); -$date_startmonth = GETPOST('date_startmonth'); -$date_startday = GETPOST('date_startday'); -$date_startyear = GETPOST('date_startyear'); -$date_endmonth = GETPOST('date_endmonth'); -$date_endday = GETPOST('date_endday'); -$date_endyear = GETPOST('date_endyear'); +$date_startmonth = GETPOSTINT('date_startmonth'); +$date_startday = GETPOSTINT('date_startday'); +$date_startyear = GETPOSTINT('date_startyear'); +$date_endmonth = GETPOSTINT('date_endmonth'); +$date_endday = GETPOSTINT('date_endday'); +$date_endyear = GETPOSTINT('date_endyear'); $in_bookkeeping = GETPOST('in_bookkeeping'); if ($in_bookkeeping == '') { $in_bookkeeping = 'notyet'; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 06d9b7354e481..ecf9ce56121b4 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -57,12 +57,12 @@ $id_journal = GETPOSTINT('id_journal'); $action = GETPOST('action', 'aZ09'); -$date_startmonth = GETPOST('date_startmonth'); -$date_startday = GETPOST('date_startday'); -$date_startyear = GETPOST('date_startyear'); -$date_endmonth = GETPOST('date_endmonth'); -$date_endday = GETPOST('date_endday'); -$date_endyear = GETPOST('date_endyear'); +$date_startmonth = GETPOSTINT('date_startmonth'); +$date_startday = GETPOSTINT('date_startday'); +$date_startyear = GETPOSTINT('date_startyear'); +$date_endmonth = GETPOSTINT('date_endmonth'); +$date_endday = GETPOSTINT('date_endday'); +$date_endyear = GETPOSTINT('date_endyear'); $in_bookkeeping = GETPOST('in_bookkeeping'); if ($in_bookkeeping == '') { $in_bookkeeping = 'notyet'; diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index 5af6e57dd9b2b..872bfce5d7206 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -44,12 +44,12 @@ $id_journal = GETPOSTINT('id_journal'); $action = GETPOST('action', 'aZ09'); -$date_startmonth = GETPOST('date_startmonth'); -$date_startday = GETPOST('date_startday'); -$date_startyear = GETPOST('date_startyear'); -$date_endmonth = GETPOST('date_endmonth'); -$date_endday = GETPOST('date_endday'); -$date_endyear = GETPOST('date_endyear'); +$date_startmonth = GETPOSTINT('date_startmonth'); +$date_startday = GETPOSTINT('date_startday'); +$date_startyear = GETPOSTINT('date_startyear'); +$date_endmonth = GETPOSTINT('date_endmonth'); +$date_endday = GETPOSTINT('date_endday'); +$date_endyear = GETPOSTINT('date_endyear'); $in_bookkeeping = GETPOST('in_bookkeeping'); if ($in_bookkeeping == '') { $in_bookkeeping = 'notyet'; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index e48c05dedeb37..a4d7451af031a 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -966,7 +966,7 @@ // Date payment if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) { - $paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear')); + $paymentdate = dol_mktime(0, 0, 0, GETPOSTINT('paymentmonth'), GETPOSTINT('paymentday'), GETPOSTINT('paymentyear')); } print ''; diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 9d3bc8f964407..0fcfb94d63b8a 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -80,8 +80,8 @@ $restrictive = GETPOSTINT('restrictive'); $fk_c_type_fees = GETPOSTINT('fk_c_type_fees'); $code_expense_rules_type = GETPOST('code_expense_rules_type'); - $dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear')); - $datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + $dates = dol_mktime(12, 0, 0, GETPOSTINT('startmonth'), GETPOSTINT('startday'), GETPOSTINT('startyear')); + $datee = dol_mktime(12, 0, 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear')); $amount = (float) price2num(GETPOST('amount'), 'MT', 2); if (!empty($id)) { diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 860a2c2955285..b89e047492f7b 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -73,12 +73,12 @@ $search_id = GETPOST('search_id', 'alpha'); $search_fk_user = GETPOST('search_fk_user', 'intcomma'); $search_start = -1; -if ($search_startyear != '') { +if (GETPOST('search_startyear') != '') { $search_start = dol_mktime(0, 0, 0, $search_startmonth, $search_startday, $search_startyear); } $search_end = -1; if (GETPOST('search_endyear') != '') { - $search_end = dol_mktime(23, 59, 59, GETPOST('search_endmonth'), GETPOST('search_endday'), GETPOST('search_endyear')); + $search_end = dol_mktime(23, 59, 59, $search_endmonth, $search_endday, $search_endyear); } $search_code = GETPOST('search_code', 'alpha'); $search_ref = GETPOST('search_ref', 'alpha'); diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php index e25dfbf54283b..a3278fd97a3e9 100644 --- a/htdocs/bookcal/availabilities_card.php +++ b/htdocs/bookcal/availabilities_card.php @@ -145,24 +145,24 @@ $triggermodname = 'BOOKCAL_AVAILABILITIES_MODIFY'; // Name of trigger action code to execute when we modify record - $startday = GETPOST('startday', 'int'); - $startmonth = GETPOST('startmonth', 'int'); - $startyear = GETPOST('startyear', 'int'); - $starthour = GETPOST('startHour', 'int'); + $startday = GETPOSTINT('startday'); + $startmonth = GETPOSTINT('startmonth'); + $startyear = GETPOSTINT('startyear'); + $starthour = GETPOSTINT('startHour'); - if ($starthour == "0") { + if (GETPOST('startHour') == "") { $error++; setEventMessages($langs->trans("ErrorStartHourIsNull"), $hookmanager->errors, 'errors'); } $dateStartTimestamp = dol_mktime($starthour, 0, 0, $startmonth, $startday, $startyear); - $endday = GETPOST('endday', 'int'); - $endmonth = GETPOST('endmonth', 'int'); - $endyear = GETPOST('endyear', 'int'); - $endhour = GETPOST('endHour', 'int'); + $endday = GETPOSTINT('endday'); + $endmonth = GETPOSTINT('endmonth'); + $endyear = GETPOSTINT('endyear'); + $endhour = GETPOSTINT('endHour'); - if ($endhour == "0") { + if (GETPOST('endHour') == "") { $error++; setEventMessages($langs->trans("ErrorEndHourIsNull"), $hookmanager->errors, 'errors'); } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index b3d66a43a767a..0c4d89411c11f 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -629,14 +629,14 @@ // We set first date of recurrence and offsets if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) { $firstdatearray = dol_get_first_day_week(GETPOSTINT("apday"), GETPOSTINT("apmonth"), GETPOSTINT("apyear")); - $datep = dol_mktime($fulldayevent ? '00' : GETPOSTINT("aphour"), $fulldayevent ? '00' : GETPOSTINT("apmin"), $fulldayevent ? '00' : GETPOSTINT("apsec"), $firstdatearray['month'], $firstdatearray['first_day'], $firstdatearray['year'], $tzforfullday ? $tzforfullday : 'tzuserrel'); + $datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstdatearray['month'], $firstdatearray['first_day'], $firstdatearray['year'], $tzforfullday ? $tzforfullday : 'tzuserrel'); $datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd');//We begin the week after $dayoffset = 7; $monthoffset = 0; } elseif ($selectedrecurrulefreq == 'MONTHLY' && !empty($selectedrecurrulebymonthday)) { $firstday = $selectedrecurrulebymonthday; $firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth");//We begin the week after - $datep = dol_mktime($fulldayevent ? '00' : GETPOSTINT("aphour"), $fulldayevent ? '00' : GETPOSTINT("apmin"), $fulldayevent ? '00' : GETPOSTINT("apsec"), $firstmonth, $firstday, GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel'); + $datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstmonth, $firstday, GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel'); $dayoffset = 0; $monthoffset = 1; } else { @@ -790,11 +790,11 @@ if ($fulldayevent) { $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) - $datep = dol_mktime(0, 0, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel'); - $datef = dol_mktime(23, 59, 59, GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel'); + $datep = dol_mktime(0, 0, 0, GETPOSTINT("apmonth"), GETPOSTINT("apday"), GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel'); + $datef = dol_mktime(23, 59, 59, GETPOSTINT("p2month"), GETPOSTINT("p2day"), GETPOSTINT("p2year"), $tzforfullday ? $tzforfullday : 'tzuserrel'); } else { - $datep = dol_mktime(GETPOST("aphour", 'int'), GETPOST("apmin", 'int'), GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel'); - $datef = dol_mktime(GETPOST("p2hour", 'int'), GETPOST("p2min", 'int'), GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel'); + $datep = dol_mktime(GETPOSTINT("aphour"), GETPOSTINT("apmin"), GETPOSTINT("apsec"), GETPOSTINT("apmonth"), GETPOSTINT("apday"), GETPOSTINT("apyear"), 'tzuserrel'); + $datef = dol_mktime(GETPOSTINT("p2hour"), GETPOSTINT("p2min"), GETPOSTINT("apsec"), GETPOSTINT("p2month"), GETPOSTINT("p2day"), GETPOSTINT("p2year"), 'tzuserrel'); } //set end date to now if percentage is set to 100 and end date not set $datef = (!$datef && $percentage == 100) ? dol_now() : $datef; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b7c1eeb1eab81..7c5606887e8c7 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -435,8 +435,8 @@ $object->socid = $socid; $object->fetch_thirdparty(); - $datep = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - $date_delivery = dol_mktime(12, 0, 0, GETPOST('date_livraisonmonth'), GETPOST('date_livraisonday'), GETPOST('date_livraisonyear')); + $datep = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); + $date_delivery = dol_mktime(12, 0, 0, GETPOSTINT('date_livraisonmonth'), GETPOSTINT('date_livraisonday'), GETPOSTINT('date_livraisonyear')); $duration = GETPOSTINT('duree_validite'); if (empty($datep)) { @@ -969,8 +969,8 @@ } } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && (GETPOST('alldate_start', 'alpha') || GETPOST('alldate_end', 'alpha')) && $usercancreate) { // Define date start and date end for all line - $alldate_start = dol_mktime(GETPOST('alldate_starthour'), GETPOST('alldate_startmin'), 0, GETPOST('alldate_startmonth'), GETPOST('alldate_startday'), GETPOST('alldate_startyear')); - $alldate_end = dol_mktime(GETPOST('alldate_endhour'), GETPOST('alldate_endmin'), 0, GETPOST('alldate_endmonth'), GETPOST('alldate_endday'), GETPOST('alldate_endyear')); + $alldate_start = dol_mktime(GETPOSTINT('alldate_starthour'), GETPOSTINT('alldate_startmin'), 0, GETPOSTINT('alldate_startmonth'), GETPOSTINT('alldate_startday'), GETPOSTINT('alldate_startyear')); + $alldate_end = dol_mktime(GETPOSTINT('alldate_endhour'), GETPOSTINT('alldate_endmin'), 0, GETPOSTINT('alldate_endmonth'), GETPOSTINT('alldate_endday'), GETPOSTINT('alldate_endyear')); foreach ($object->lines as $line) { if ($line->product_type == 1) { // only service line $result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $alldate_start, $alldate_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); @@ -1411,8 +1411,8 @@ $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value - $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); - $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); + $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; @@ -1544,8 +1544,8 @@ $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); $pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2); - $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), GETPOSTINT('date_startsec'), GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear')); + $date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), GETPOSTINT('date_endsec'), GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); $remise_percent = price2num(GETPOST('remise_percent'), '', 2); if (empty($remise_percent)) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 775f65691d9ea..441ff76239c12 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -309,7 +309,7 @@ $object->setProject(GETPOSTINT('projectid')); } elseif ($action == 'add' && $usercancreate) { // Add order - $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $datecommande = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); $date_delivery = dol_mktime(GETPOSTINT('liv_hour'), GETPOSTINT('liv_min'), 0, GETPOSTINT('liv_month'), GETPOSTINT('liv_day'), GETPOSTINT('liv_year')); if ($datecommande == '') { @@ -689,8 +689,8 @@ // $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2)); } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && (GETPOST('alldate_start', 'alpha') || GETPOST('alldate_end', 'alpha')) && $usercancreate) { // Define date start and date end for all line - $alldate_start = dol_mktime(GETPOST('alldate_starthour'), GETPOST('alldate_startmin'), 0, GETPOST('alldate_startmonth'), GETPOST('alldate_startday'), GETPOST('alldate_startyear')); - $alldate_end = dol_mktime(GETPOST('alldate_endhour'), GETPOST('alldate_endmin'), 0, GETPOST('alldate_endmonth'), GETPOST('alldate_endday'), GETPOST('alldate_endyear')); + $alldate_start = dol_mktime(GETPOSTINT('alldate_starthour'), GETPOSTINT('alldate_startmin'), 0, GETPOSTINT('alldate_startmonth'), GETPOSTINT('alldate_startday'), GETPOSTINT('alldate_startyear')); + $alldate_end = dol_mktime(GETPOSTINT('alldate_endhour'), GETPOSTINT('alldate_endmin'), 0, GETPOSTINT('alldate_endmonth'), GETPOSTINT('alldate_endday'), GETPOSTINT('alldate_endyear')); foreach ($object->lines as $line) { if ($line->product_type == 1) { // only service line $result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $alldate_start, $alldate_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); @@ -819,8 +819,8 @@ if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { // Clean parameters - $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); - $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); + $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); $price_min = $price_min_ttc = 0; @@ -1217,8 +1217,8 @@ // Clean parameters $date_start = ''; $date_end = ''; - $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), GETPOSTINT('date_startsec'), GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear')); + $date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), GETPOSTINT('date_endsec'), GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml')); diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index d2334d377d07c..1e9a8a4080fc9 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -168,8 +168,8 @@ $db->begin(); $amount = price2num(GETPOST('amount')); - $dateop = dol_mktime(12, 0, 0, GETPOST("dateomonth"), GETPOST("dateoday"), GETPOST("dateoyear")); - $dateval = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear")); + $dateop = dol_mktime(12, 0, 0, GETPOSTINT("dateomonth"), GETPOSTINT("dateoday"), GETPOSTINT("dateoyear")); + $dateval = dol_mktime(12, 0, 0, GETPOSTINT("datevmonth"), GETPOSTINT("datevday"), GETPOSTINT("datevyear")); $sql = "UPDATE ".MAIN_DB_PREFIX."bank"; $sql .= " SET "; // Always opened diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 221cc3d9d93c4..9fe72354ac737 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -362,7 +362,7 @@ $object->setFrequencyAndUnit(GETPOSTINT('frequency'), GETPOST('unit_frequency')); } elseif ($action == 'setdate_when' && $usercancreate) { // Set next date of execution - $date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')); + $date = dol_mktime(GETPOSTINT('date_whenhour'), GETPOSTINT('date_whenmin'), 0, GETPOSTINT('date_whenmonth'), GETPOSTINT('date_whenday'), GETPOSTINT('date_whenyear')); if (!empty($date)) { $object->setNextDate($date); } @@ -540,8 +540,8 @@ $ret = $object->fetch_thirdparty(); // Clean parameters - $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); - $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); + $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); $tva_npr = ""; @@ -777,8 +777,8 @@ // Clean parameters $date_start = ''; $date_end = ''; - //$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - //$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + //$date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), GETPOSTINT('date_startsec'), GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear')); + //$date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), GETPOSTINT('date_endsec'), GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml') ? GETPOST('product_desc', 'restricthtml') : GETPOST('desc', 'restricthtml')); $pu_ht = price2num(GETPOST('price_ht'), '', 2); $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a3db802de3a62..251485126bb94 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1947,8 +1947,8 @@ if (GETPOSTINT('idprod'.$i)) { $product = new Product($db); $product->fetch(GETPOSTINT('idprod'.$i)); - $startday = dol_mktime(12, 0, 0, GETPOST('date_start'.$i.'month'), GETPOST('date_start'.$i.'day'), GETPOST('date_start'.$i.'year')); - $endday = dol_mktime(12, 0, 0, GETPOST('date_end'.$i.'month'), GETPOST('date_end'.$i.'day'), GETPOST('date_end'.$i.'year')); + $startday = dol_mktime(12, 0, 0, GETPOSTINT('date_start'.$i.'month'), GETPOSTINT('date_start'.$i.'day'), GETPOSTINT('date_start'.$i.'year')); + $endday = dol_mktime(12, 0, 0, GETPOSTINT('date_end'.$i.'month'), GETPOSTINT('date_end'.$i.'day'), GETPOSTINT('date_end'.$i.'year')); $result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, GETPOSTINT('idprod'.$i), price2num(GETPOST('remise_percent'.$i), '', 2), $startday, $endday, 0, 0, 0, $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, 0, 0, '', array(), 100, 0, $product->fk_unit, 0, '', 1); } } @@ -2127,8 +2127,8 @@ } } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && (GETPOST('alldate_start', 'alpha') || GETPOST('alldate_end', 'alpha')) && $usercancreate) { // Define date start and date end for all line - $alldate_start = dol_mktime(GETPOST('alldate_starthour'), GETPOST('alldate_startmin'), 0, GETPOST('alldate_startmonth'), GETPOST('alldate_startday'), GETPOST('alldate_startyear')); - $alldate_end = dol_mktime(GETPOST('alldate_endhour'), GETPOST('alldate_endmin'), 0, GETPOST('alldate_endmonth'), GETPOST('alldate_endday'), GETPOST('alldate_endyear')); + $alldate_start = dol_mktime(GETPOSTINT('alldate_starthour'), GETPOSTINT('alldate_startmin'), 0, GETPOSTINT('alldate_startmonth'), GETPOSTINT('alldate_startday'), GETPOSTINT('alldate_startyear')); + $alldate_end = dol_mktime(GETPOSTINT('alldate_endhour'), GETPOSTINT('alldate_endmin'), 0, GETPOSTINT('alldate_endmonth'), GETPOSTINT('alldate_endday'), GETPOSTINT('alldate_endyear')); foreach ($object->lines as $line) { if ($line->product_type == 1) { // only service line $result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $alldate_start, $alldate_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice); @@ -2280,8 +2280,8 @@ $ret = $object->fetch_thirdparty(); // Clean parameters - $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); - $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); + $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); $tva_npr = ""; @@ -2600,8 +2600,8 @@ // Clean parameters $date_start = ''; $date_end = ''; - $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), GETPOSTINT('date_startsec'), GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear')); + $date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), GETPOSTINT('date_endsec'), GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml') ? GETPOST('product_desc', 'restricthtml') : GETPOST('desc', 'restricthtml')); $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $vat_rate = str_replace('*', '', $vat_rate); diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index ec7ff9a40574b..1c398bb363354 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -96,8 +96,8 @@ $pastmonthyear--; } -$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); -$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); +$date_start = dol_mktime(0, 0, 0, (int) $date_startmonth, (int) $date_startday, (int) $date_startyear); +$date_end = dol_mktime(23, 59, 59, (int) $date_endmonth, (int) $date_endday, (int) $date_endyear); if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 2ea014474a25a..82dcf48aa4b09 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -100,8 +100,8 @@ $pastmonthyear--; } -$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); -$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); +$date_start = dol_mktime(0, 0, 0, (int) $date_startmonth, (int) $date_startday, (int) $date_startyear); +$date_end = dol_mktime(23, 59, 59, (int) $date_endmonth, (int) $date_endday, (int) $date_endyear); if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index ef827e8b47b1d..2a88632027b75 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -80,8 +80,8 @@ if ($action == 'add' && !$cancel && $permissiontoadd) { $db->begin(); - $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear")); - $datep = dol_mktime(12, 0, 0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear")); + $datev = dol_mktime(12, 0, 0, GETPOSTINT("datevmonth"), GETPOSTINT("datevday"), GETPOSTINT("datevyear")); + $datep = dol_mktime(12, 0, 0, GETPOSTINT("datepmonth"), GETPOSTINT("datepday"), GETPOSTINT("datepyear")); $object->accountid = GETPOSTINT("accountid"); $object->paymenttype = GETPOST("paiementtype"); @@ -159,8 +159,8 @@ llxHeader('', $title, $help_url); if ($action == 'create') { - $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear")); - $datep = dol_mktime(12, 0, 0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear")); + $datev = dol_mktime(12, 0, 0, GETPOSTINT("datevmonth"), GETPOSTINT("datevday"), GETPOSTINT("datevyear")); + $datep = dol_mktime(12, 0, 0, GETPOSTINT("datepmonth"), GETPOSTINT("datepday"), GETPOSTINT("datepyear")); print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code)); diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 2a32737c48773..818696545cd05 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -55,8 +55,8 @@ $year_current = $year; $year_start = $year; } -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); +$date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear")); +$date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear")); // Quarter if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $q = GETPOST("q"); diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index 9dea8b1c87a97..a45def867f38e 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -56,8 +56,8 @@ $year_current = $year; $year_start = $year; } -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); +$date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear")); +$date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear")); if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $q = GETPOSTINT("q"); if (empty($q)) { @@ -455,7 +455,7 @@ function pt($db, $sql, $date) print ''; - print ''.dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y").''; + print ''.dol_print_date(dol_mktime(0, 0, 0, (int) $m, 1, (int) $y), "%b %Y").''; $x_coll_sum = 0; foreach (array_keys($x_coll) as $rate) { diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 888775978843e..40b573d117df9 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -65,8 +65,8 @@ $year_current = $year; $year_start = $year; } -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); +$date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear")); +$date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear")); // Quarter if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $q = GETPOSTINT("q"); diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 1d7625e6d7708..b82395149acb6 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -232,7 +232,7 @@ } if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->hasRight('banque', 'cheque')) { - $reject_date = dol_mktime(0, 0, 0, GETPOST('rejectdate_month'), GETPOST('rejectdate_day'), GETPOST('rejectdate_year')); + $reject_date = dol_mktime(0, 0, 0, GETPOSTINT('rejectdate_month'), GETPOSTINT('rejectdate_day'), GETPOSTINT('rejectdate_year')); $rejected_check = GETPOSTINT('bankid'); $object->fetch($id); diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index b81bcb7720806..df9f47b227b51 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -69,8 +69,8 @@ $fk_project = (GETPOST('fk_project') ? GETPOSTINT('fk_project') : 0); -$dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear')); -$dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear')); +$dateech = dol_mktime(GETPOSTINT('echhour'), GETPOSTINT('echmin'), GETPOSTINT('echsec'), GETPOSTINT('echmonth'), GETPOSTINT('echday'), GETPOSTINT('echyear')); +$dateperiod = dol_mktime(GETPOSTINT('periodhour'), GETPOSTINT('periodmin'), GETPOSTINT('periodsec'), GETPOSTINT('periodmonth'), GETPOSTINT('periodday'), GETPOSTINT('periodyear')); $label = GETPOST('label', 'alpha'); $actioncode = GETPOSTINT('actioncode'); $fk_user = GETPOSTINT('userid') > 0 ? GETPOSTINT('userid') : 0; diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 13d36659f14b9..e9a2dd49be76c 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -62,8 +62,8 @@ $month_current = dol_print_date(dol_now(), '%m'); $year_start = $year; } -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere +$date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere +$date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere // Quarter $q = ''; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 8158eff60e828..bad0f6a66484f 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -113,8 +113,8 @@ $month_current = dol_print_date(dol_now(), '%m'); $year_start = $year; } -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere +$date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere +$date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere // Quarter if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $q = GETPOSTINT("q"); diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 3b6b291f6fd52..cf5b5a53edc01 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -88,8 +88,8 @@ $month_current = dol_print_date(dol_now(), '%m'); $year_start = $year; } -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere +$date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere +$date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere // Quarter if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $q = GETPOST("q") ? GETPOST("q") : 0; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index cbbb160daf74c..2adb147bc8157 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -113,8 +113,8 @@ $month_current = dol_print_date(dol_now(), '%m'); $year_start = $year; } -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere +$date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere +$date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere // Quarter if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $q = GETPOSTINT("q") ? GETPOSTINT("q") : 0; diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index e628f49e9c878..b7b7526dcf9c3 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -102,8 +102,8 @@ $month_current = (int) dol_print_date(dol_now(), "%m"); $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); } -$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere -$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere +$date_start = dol_mktime(0, 0, 0, (int) $date_startmonth, (int) $date_startday, (int) $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere +$date_end = dol_mktime(23, 59, 59, (int) $date_endmonth, (int) $date_endday, (int) $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere // We define date_start and date_end if (empty($date_start) || empty($date_end)) { // We define date_start and date_end diff --git a/htdocs/compta/tva/initdatesforvat.inc.php b/htdocs/compta/tva/initdatesforvat.inc.php index 9b2808fe38c3a..75f6124a9c27a 100644 --- a/htdocs/compta/tva/initdatesforvat.inc.php +++ b/htdocs/compta/tva/initdatesforvat.inc.php @@ -42,8 +42,8 @@ $year_current = $year; $year_start = $year; } -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); +$date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear"), 'tzserver'); +$date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear"), 'tzserver'); // Set default period if not defined if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $q = GETPOSTINT("q"); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 509dc38093877..4bc907f6c1553 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -64,7 +64,7 @@ $ret = $object->fetch($id); // Note: Correct date should be completed with location to have exact GM time of birth. - $object->birthday = dol_mktime(0, 0, 0, GETPOST("birthdaymonth"), GETPOST("birthdayday"), GETPOST("birthdayyear")); + $object->birthday = dol_mktime(0, 0, 0, GETPOSTINT("birthdaymonth"), GETPOSTINT("birthdayday"), GETPOSTINT("birthdayyear")); $object->birthday_alert = GETPOSTINT("birthday_alert"); if (GETPOST('deletephoto')) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5c00ce691eb55..7fab37fabc7ef 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -176,10 +176,10 @@ $date_start = ''; $date_end = ''; if (GETPOST('startmonth') && GETPOST('startday') && GETPOST('startyear')) { - $date_start = dol_mktime(GETPOST('starthour'), GETPOST('startmin'), 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear')); + $date_start = dol_mktime(GETPOSTINT('starthour'), GETPOSTINT('startmin'), 0, GETPOSTINT('startmonth'), GETPOSTINT('startday'), GETPOSTINT('startyear')); } if (GETPOST('endmonth') && GETPOST('endday') && GETPOST('endyear')) { - $date_end = dol_mktime(GETPOST('endhour'), GETPOST('endmin'), 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + $date_end = dol_mktime(GETPOSTINT('endhour'), GETPOSTINT('endmin'), 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear')); } $result = $object->active_line($user, GETPOSTINT('ligne'), $date_start, $date_end, GETPOST('comment')); @@ -209,7 +209,7 @@ } elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $permissiontoactivate) { $date_end = ''; if (GETPOST('endmonth') && GETPOST('endday') && GETPOST('endyear')) { - $date_end = dol_mktime(GETPOST('endhour'), GETPOST('endmin'), 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + $date_end = dol_mktime(GETPOSTINT('endhour'), GETPOSTINT('endmin'), 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear')); } if (!$date_end) { $error++; @@ -230,10 +230,10 @@ $date_start = ''; $date_end = ''; if (GETPOST('date_startmonth') && GETPOST('date_startday') && GETPOST('date_startyear')) { - $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); + $date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), 0, GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear')); } if (GETPOST('date_endmonth') && GETPOST('date_endday') && GETPOST('date_endyear')) { - $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); } } @@ -243,19 +243,19 @@ $date_start_real_update = ''; $date_end_real_update = ''; if (GETPOST('date_start_updatemonth') && GETPOST('date_start_updateday') && GETPOST('date_start_updateyear')) { - $date_start_update = dol_mktime(GETPOST('date_start_updatehour'), GETPOST('date_start_updatemin'), 0, GETPOST('date_start_updatemonth'), GETPOST('date_start_updateday'), GETPOST('date_start_updateyear')); + $date_start_update = dol_mktime(GETPOSTINT('date_start_updatehour'), GETPOSTINT('date_start_updatemin'), 0, GETPOSTINT('date_start_updatemonth'), GETPOSTINT('date_start_updateday'), GETPOSTINT('date_start_updateyear')); } if (GETPOST('date_end_updatemonth') && GETPOST('date_end_updateday') && GETPOST('date_end_updateyear')) { - $date_end_update = dol_mktime(GETPOST('date_end_updatehour'), GETPOST('date_end_updatemin'), 0, GETPOST('date_end_updatemonth'), GETPOST('date_end_updateday'), GETPOST('date_end_updateyear')); + $date_end_update = dol_mktime(GETPOSTINT('date_end_updatehour'), GETPOSTINT('date_end_updatemin'), 0, GETPOSTINT('date_end_updatemonth'), GETPOSTINT('date_end_updateday'), GETPOSTINT('date_end_updateyear')); } if (GETPOST('date_start_real_updatemonth') && GETPOST('date_start_real_updateday') && GETPOST('date_start_real_updateyear')) { - $date_start_real_update = dol_mktime(GETPOST('date_start_real_updatehour'), GETPOST('date_start_real_updatemin'), 0, GETPOST('date_start_real_updatemonth'), GETPOST('date_start_real_updateday'), GETPOST('date_start_real_updateyear')); + $date_start_real_update = dol_mktime(GETPOSTINT('date_start_real_updatehour'), GETPOSTINT('date_start_real_updatemin'), 0, GETPOSTINT('date_start_real_updatemonth'), GETPOSTINT('date_start_real_updateday'), GETPOSTINT('date_start_real_updateyear')); } if (GETPOST('date_end_real_updatemonth') && GETPOST('date_end_real_updateday') && GETPOST('date_end_real_updateyear')) { - $date_end_real_update = dol_mktime(GETPOST('date_end_real_updatehour'), GETPOST('date_end_real_updatemin'), 0, GETPOST('date_end_real_updatemonth'), GETPOST('date_end_real_updateday'), GETPOST('date_end_real_updateyear')); + $date_end_real_update = dol_mktime(GETPOSTINT('date_end_real_updatehour'), GETPOSTINT('date_end_real_updatemin'), 0, GETPOSTINT('date_end_real_updatemonth'), GETPOSTINT('date_end_real_updateday'), GETPOSTINT('date_end_real_updateyear')); } if (GETPOST('remonth') && GETPOST('reday') && GETPOST('reyear')) { - $datecontrat = dol_mktime(GETPOST('rehour'), GETPOST('remin'), 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $datecontrat = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); } // Add contract @@ -511,8 +511,8 @@ $error++; } - $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); - $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); + $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); if (!empty($date_start) && !empty($date_end) && $date_start > $date_end) { setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors'); $error++; @@ -531,8 +531,8 @@ if (!$error) { // Clean parameters - $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); - $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); + $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); $price_base_type = ''; $price_min = ''; @@ -908,8 +908,8 @@ setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) { - $date_start = dol_mktime(12, 0, 0, GETPOST('d_startmonth'), GETPOST('d_startday'), GETPOST('d_startyear')); - $date_end = dol_mktime(12, 0, 0, GETPOST('d_endmonth'), GETPOST('d_endday'), GETPOST('d_endyear')); + $date_start = dol_mktime(12, 0, 0, GETPOSTINT('d_startmonth'), GETPOSTINT('d_startday'), GETPOSTINT('d_startyear')); + $date_end = dol_mktime(12, 0, 0, GETPOSTINT('d_endmonth'), GETPOSTINT('d_endday'), GETPOSTINT('d_endyear')); $comment = GETPOST('comment', 'alpha'); $result = $object->activateAll($user, $date_start, 0, $comment, $date_end); if ($result < 0) { @@ -1027,7 +1027,7 @@ if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - $datacontrat = dol_mktime(GETPOST('date_contrathour'), GETPOST('date_contratmin'), 0, GETPOST('date_contratmonth'), GETPOST('date_contratday'), GETPOST('date_contratyear')); + $datacontrat = dol_mktime(GETPOSTINT('date_contrathour'), GETPOSTINT('date_contratmin'), 0, GETPOSTINT('date_contratmonth'), GETPOSTINT('date_contratday'), GETPOSTINT('date_contratyear')); $result = $object->setValueFrom('date_contrat', $datacontrat, '', null, 'date', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -2045,14 +2045,14 @@ // Definie date debut et fin par default $dateactstart = $objp->date_start; if (GETPOST('remonth')) { - $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $dateactstart = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); } elseif (!$dateactstart) { $dateactstart = time(); } $dateactend = $objp->date_end; if (GETPOST('endmonth')) { - $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + $dateactend = dol_mktime(12, 0, 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear')); } elseif (!$dateactend) { if ($objp->fk_product > 0) { $product = new Product($db); @@ -2102,14 +2102,14 @@ // Definie date debut et fin par default $dateactstart = $objp->date_start_real; if (GETPOST('remonth')) { - $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $dateactstart = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); } elseif (!$dateactstart) { $dateactstart = time(); } $dateactend = $objp->date_end_real; if (GETPOST('endmonth')) { - $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + $dateactend = dol_mktime(12, 0, 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear')); } elseif (!$dateactend) { if ($objp->fk_product > 0) { $product = new Product($db); diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 2730a1d01fe7f..cb3ec8f7c4447 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -358,26 +358,26 @@ $filter_date2 = ''; $filter_opcloture = ''; -$filter_dateouvertureprevue_start = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear); -$filter_dateouvertureprevue_end = dol_mktime(23, 59, 59, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear); +$filter_dateouvertureprevue_start = dol_mktime(0, 0, 0, (int) $opouvertureprevuemonth, (int) $opouvertureprevueday, (int) $opouvertureprevueyear); +$filter_dateouvertureprevue_end = dol_mktime(23, 59, 59, (int) $opouvertureprevuemonth, (int) $opouvertureprevueday, (int) $opouvertureprevueyear); if ($filter_dateouvertureprevue_start != '' && $filter_opouvertureprevue == -1) { $filter_opouvertureprevue = ' BETWEEN '; } -$filter_date1_start = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year); -$filter_date1_end = dol_mktime(23, 59, 59, $op1month, $op1day, $op1year); +$filter_date1_start = dol_mktime(0, 0, 0, (int) $op1month, (int) $op1day, (int) $op1year); +$filter_date1_end = dol_mktime(23, 59, 59, (int) $op1month, (int) $op1day, (int) $op1year); if ($filter_date1_start != '' && $filter_op1 == -1) { $filter_op1 = ' BETWEEN '; } -$filter_date2_start = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year); -$filter_date2_end = dol_mktime(23, 59, 59, $op2month, $op2day, $op2year); +$filter_date2_start = dol_mktime(0, 0, 0, (int) $op2month, (int) $op2day, (int) $op2year); +$filter_date2_end = dol_mktime(23, 59, 59, (int) $op2month, (int) $op2day, (int) $op2year); if ($filter_date2_start != '' && $filter_op2 == -1) { $filter_op2 = ' BETWEEN '; } -$filter_datecloture_start = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear); -$filter_datecloture_end = dol_mktime(23, 59, 59, $opcloturemonth, $opclotureday, $opclotureyear); +$filter_datecloture_start = dol_mktime(0, 0, 0, (int) $opcloturemonth, (int) $opclotureday, (int) $opclotureyear); +$filter_datecloture_end = dol_mktime(23, 59, 59, (int) $opcloturemonth, (int) $opclotureday, (int) $opclotureyear); if ($filter_datecloture_start != '' && $filter_opcloture == -1) { $filter_opcloture = ' BETWEEN '; } @@ -661,7 +661,7 @@ $arrayofoperators = array('<' => '<', '>' => '>'); print $form->selectarray('filter_opouvertureprevue', $arrayofoperators, $filter_opouvertureprevue, 1, 0, 0, '', 0, 0, 0, '', 'width50'); print ' '; - $filter_dateouvertureprevue = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear); + $filter_dateouvertureprevue = dol_mktime(0, 0, 0, (int) $opouvertureprevuemonth, (int) $opouvertureprevueday, (int) $opouvertureprevueyear); print $form->selectDate($filter_dateouvertureprevue, 'opouvertureprevue', 0, 0, 1, '', 1, 0); print ''; } @@ -670,7 +670,7 @@ $arrayofoperators = array('<' => '<', '>' => '>'); print $form->selectarray('filter_op1', $arrayofoperators, $filter_op1, 1, 0, 0, '', 0, 0, 0, '', 'width50'); print ' '; - $filter_date1 = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year); + $filter_date1 = dol_mktime(0, 0, 0, (int) $op1month, (int) $op1day, (int) $op1year); print $form->selectDate($filter_date1, 'op1', 0, 0, 1, '', 1, 0); print ''; } @@ -679,7 +679,7 @@ $arrayofoperators = array('<' => '<', '>' => '>'); print $form->selectarray('filter_op2', $arrayofoperators, $filter_op2, 1, 0, 0, '', 0, 0, 0, '', 'width50'); print ' '; - $filter_date2 = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year); + $filter_date2 = dol_mktime(0, 0, 0, (int) $op2month, (int) $op2day, (int) $op2year); print $form->selectDate($filter_date2, 'op2', 0, 0, 1, '', 1, 0); print ''; } @@ -688,7 +688,7 @@ $arrayofoperators = array('<' => '<', '>' => '>'); print $form->selectarray('filter_opcloture', $arrayofoperators, $filter_opcloture, 1, 0, 0, '', 0, 0, 0, '', 'width50'); print ' '; - $filter_date_cloture = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear); + $filter_date_cloture = dol_mktime(0, 0, 0, (int) $opcloturemonth, (int) $opclotureday, (int) $opclotureyear); print $form->selectDate($filter_date_cloture, 'opcloture', 0, 0, 1, '', 1, 0); print ''; } diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index a69eb15fbf586..3df9395845309 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -394,7 +394,7 @@ $keyforfield = $reg[1]; if (property_exists($object, $keyforfield)) { if (!empty($object->fields[$keyforfield]) && in_array($object->fields[$keyforfield]['type'], array('date', 'datetime', 'timestamp'))) { - $object->$keyforfield = dol_mktime(GETPOST($keyforfield.'hour'), GETPOST($keyforfield.'min'), GETPOST($keyforfield.'sec'), GETPOST($keyforfield.'month'), GETPOST($keyforfield.'day'), GETPOST($keyforfield.'year')); + $object->$keyforfield = dol_mktime(GETPOSTINT($keyforfield.'hour'), GETPOSTINT($keyforfield.'min'), GETPOSTINT($keyforfield.'sec'), GETPOSTINT($keyforfield.'month'), GETPOSTINT($keyforfield.'day'), GETPOSTINT($keyforfield.'year')); } else { $object->$keyforfield = GETPOST($keyforfield); } @@ -650,7 +650,7 @@ // We clone object to avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. $objectutil = dol_clone($object, 1); // We used native clone to keep this->db valid and allow to use later all the methods of object. - //$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int')); + // $objectutil->date = dol_mktime(12, 0, 0, GETPOSTINT('newdatemonth', 'int'), GETPOSTINT('newdateday', 'int'), GETPOSTINT('newdateyear', 'int')); // ... $result = $objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id)); if (is_object($result) || $result > 0) { diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 7c8d308c028ac..fb4489e38bf21 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -549,8 +549,8 @@ print ''; } print ''; - $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - $date_end = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), 0, GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear')); + $date_end = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); $prefillDates = false; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 06d7212fadfcb..1038cdb68d289 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -65,7 +65,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $socid = GETPOSTINT('socid'); $amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT'); -$donation_date = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); +$donation_date = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); $projectid = (GETPOST('projectid') ? GETPOSTINT('projectid') : 0); $public_donation = GETPOSTINT("public"); diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index dfc91a5b9e900..dbdbe39b67cad 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -70,7 +70,7 @@ exit; } - $datepaid = dol_mktime(12, 0, 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); + $datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); if (!(GETPOST("paymenttype") > 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors'); @@ -198,7 +198,7 @@ print ''; print '"; diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 15a18ee4c67b2..6e2d7997a706a 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -237,8 +237,8 @@ if (!$error && $modebatch == "batch") { if ($newqty > 0) { $suffixkeyfordate = preg_replace('/^product_batch/', '', $key); - $sellby = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffixkeyfordate.'month'), GETPOST('dlc'.$suffixkeyfordate.'day'), GETPOST('dlc'.$suffixkeyfordate.'year'), ''); - $eatby = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffixkeyfordate.'month'), GETPOST('dluo'.$suffixkeyfordate.'day'), GETPOST('dluo'.$suffixkeyfordate.'year')); + $sellby = dol_mktime(0, 0, 0, GETPOSTINT('dlc'.$suffixkeyfordate.'month'), GETPOSTINT('dlc'.$suffixkeyfordate.'day'), GETPOSTINT('dlc'.$suffixkeyfordate.'year'), ''); + $eatby = dol_mktime(0, 0, 0, GETPOSTINT('dluo'.$suffixkeyfordate.'month'), GETPOSTINT('dluo'.$suffixkeyfordate.'day'), GETPOSTINT('dluo'.$suffixkeyfordate.'year')); $sqlsearchdet = "SELECT rowid FROM ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element; $sqlsearchdet .= " WHERE fk_expeditiondet = ".((int) $idline); @@ -841,13 +841,13 @@ print ''; if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; } @@ -986,13 +986,13 @@ print ''; if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; } diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 6ca09ff8fb6a5..141c0ff6161da 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -284,7 +284,7 @@ $objecttmp->ref_customer = $expd->ref_customer; } - $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); if (empty($datefacture)) { $datefacture = dol_now(); } diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 0a0c187ebd9c0..4447c9f1e1c34 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -10,7 +10,7 @@ * Copyright (C) 2016-2018 Charlie Benke * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * 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 @@ -155,19 +155,19 @@ // gestion des fréquences et des échéances $frequency = GETPOSTINT('frequency'); - $reyear = GETPOST('reyear'); - $remonth = GETPOST('remonth'); - $reday = GETPOST('reday'); - $rehour = GETPOST('rehour'); - $remin = GETPOST('remin'); + $rec_year = GETPOST('rec_year'); + $rec_month = GETPOST('rec_month'); + $rec_day = GETPOST('rec_day'); + $rec_hour = GETPOST('rec_hour'); + $rec_min = GETPOST('rec_min'); $nb_gen_max = GETPOSTINT('nb_gen_max'); if ($frequency) { - if (empty($reyear) || empty($remonth) || empty($reday)) { + if (empty($rec_year) || empty($rec_month) || empty($rec_day)) { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); $action = "create"; $error++; } else { - $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear); + $date_next_execution = dol_mktime((int) $rec_hour, (int) $rec_min, 0, (int) $rec_month, (int) $rec_day, (int) $rec_year); } if ($nb_gen_max === 0) { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("MaxPeriodNumber")), null, 'errors'); @@ -178,11 +178,11 @@ if (!$error) { $object->id_origin = $id; - $object->title = GETPOST('title', 'alpha'); - $object->description = GETPOST('description', 'restricthtml'); - $object->socid = GETPOSTINT('socid'); - $object->fk_project = GETPOSTINT('projectid'); - $object->fk_contrat = GETPOSTINT('contractid'); + $object->title = GETPOST('title', 'alpha'); + $object->description = GETPOST('description', 'restricthtml'); + $object->socid = GETPOSTINT('socid'); + $object->fk_project = GETPOSTINT('projectid'); + $object->fk_contrat = GETPOSTINT('contractid'); $object->frequency = $frequency; $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); @@ -258,7 +258,7 @@ } elseif ($action == 'setdate_when' && $permissiontoadd) { // Set next date of execution $object->fetch($id); - $date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')); + $date = dol_mktime(GETPOSTINT('date_whenhour'), GETPOSTINT('date_whenmin'), 0, GETPOSTINT('date_whenmonth'), GETPOSTINT('date_whenday'), GETPOSTINT('date_whenyear')); if (!empty($date)) { $object->setNextDate($date); } @@ -395,9 +395,9 @@ // First date of execution for cron print ""; // Number max of generation @@ -685,7 +685,7 @@ // Frequencry/Recurring section if ($object->frequency > 0) { print '
'; - if (empty($conf->cron->enabled)) { + if (isModEnabled('cron')) { $txtinfoadmin = $langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name")); print info_admin($txtinfoadmin); } @@ -742,7 +742,7 @@ $type = $object->lines[$i]->product_type; } // else { $object->lines[$i]->fk_product_type; } - if (is_object($objp)) { + if (isset($objp) && is_object($objp)) { // Try to enhance type detection using date_start and date_end for free lines when type // was not saved. if (!empty($objp->date_start)) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 35dc581371d54..4e648b3271122 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -420,8 +420,8 @@ // Add a product line if ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && (GETPOST('alldate_start', 'alpha') || GETPOST('alldate_end', 'alpha')) && $usercancreate) { // Define date start and date end for all line - $alldate_start = dol_mktime(GETPOST('alldate_starthour'), GETPOST('alldate_startmin'), 0, GETPOST('alldate_startmonth'), GETPOST('alldate_startday'), GETPOST('alldate_startyear')); - $alldate_end = dol_mktime(GETPOST('alldate_endhour'), GETPOST('alldate_endmin'), 0, GETPOST('alldate_endmonth'), GETPOST('alldate_endday'), GETPOST('alldate_endyear')); + $alldate_start = dol_mktime(GETPOSTINT('alldate_starthour'), GETPOSTINT('alldate_startmin'), 0, GETPOSTINT('alldate_startmonth'), GETPOSTINT('alldate_startday'), GETPOSTINT('alldate_startyear')); + $alldate_end = dol_mktime(GETPOSTINT('alldate_endhour'), GETPOSTINT('alldate_endmin'), 0, GETPOSTINT('alldate_endmonth'), GETPOSTINT('alldate_endday'), GETPOSTINT('alldate_endyear')); foreach ($object->lines as $line) { if ($line->product_type == 1) { // only service line $result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, 0, $alldate_start, $alldate_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, $line->ref_supplier); @@ -445,8 +445,8 @@ // Set if we used free entry or predefined product $predef = ''; $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); - $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); - $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); + $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); $prod_entry_mode = GETPOST('prod_entry_mode'); if ($prod_entry_mode == 'free') { @@ -789,8 +789,8 @@ } } - $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), GETPOSTINT('date_startsec'), GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear')); + $date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), GETPOSTINT('date_endsec'), GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); // Define info_bits $info_bits = 0; @@ -1167,7 +1167,7 @@ $db->begin(); if (GETPOST("type") != '') { - $date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); + $date_liv = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $result = $object->Livraison($user, $date_liv, GETPOST("type"), GETPOST("comment")); // GETPOST("type") is 'tot', 'par', 'nev', 'can' if ($result > 0) { @@ -2015,7 +2015,7 @@ // Confirmation de l'envoi de la commande if ($action == 'commande') { - $date_com = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); + $date_com = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; $notify = new Notify($db); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 032764896635c..b2db656331449 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -602,8 +602,8 @@ // Set if we used free entry or predefined product $predef = ''; $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); - $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); - $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); + $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); + $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); $ref_supplier = GETPOST('fourn_ref', 'alpha'); From 8ccab8a5fa49a1e8831af87659334b85e8cdd28d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 14:36:19 +0100 Subject: [PATCH 03/17] Doc --- htdocs/core/lib/date.lib.php | 1 + htdocs/mrp/class/mo.class.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index dad36d1d546de..1005cc70941c2 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -333,6 +333,7 @@ function convertSecondToTime($iSecond, $format = 'all', $lengthOfDay = 86400, $l * @param float $duration_value Duration value * @param string $duration_unit Duration unit * @return float $result + * @see measuringUnitString() */ function convertDurationtoHour($duration_value, $duration_unit) { diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 7b3e68b72981c..64048fde9d4a9 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2020 Lenin Rivas +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2020 Lenin Rivas * Copyright (C) 2023-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * 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 @@ -742,6 +742,7 @@ public function createProduction(User $user, $notrigger = 0) $moline->qty = $this->qty; $moline->fk_product = $this->fk_product; $moline->position = 1; + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $tmpproduct = new Product($this->db); $tmpproduct->fetch($this->fk_product); From 9ec4618199c60e4dedbc1e733d90e88f11ed3656 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Nov 2024 14:48:18 +0100 Subject: [PATCH 04/17] 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 --- build/phpstan/phpstan-baseline.neon | 560 ++++++------------ dev/tools/phan/baseline.txt | 56 +- dev/tools/phan/config.php | 2 +- .../class/accountancycategory.class.php | 4 +- htdocs/admin/system/filecheck.php | 4 +- htdocs/api/class/api_setup.class.php | 5 +- .../tpl/depreciation_options_edit.tpl.php | 15 +- .../tpl/depreciation_options_view.tpl.php | 8 +- htdocs/asset/tpl/depreciation_view.tpl.php | 2 +- htdocs/categories/edit.php | 5 +- htdocs/categories/index.php | 2 +- htdocs/categories/info.php | 3 +- htdocs/categories/photos.php | 2 +- htdocs/categories/traduction.php | 3 +- htdocs/categories/viewcat.php | 2 +- htdocs/comm/action/index.php | 4 +- htdocs/comm/action/pertype.php | 14 +- htdocs/comm/action/peruser.php | 4 +- htdocs/comm/card.php | 8 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/compta/recap-compta.php | 13 +- htdocs/core/ajax/ajaxdirtree.php | 2 +- htdocs/core/ajax/onlineSign.php | 4 +- htdocs/core/class/commonobject.class.php | 1 + htdocs/core/class/html.formfile.class.php | 3 + htdocs/core/lib/customreports.lib.php | 12 +- htdocs/core/lib/functions.lib.php | 9 +- htdocs/core/modules/member/modules_cards.php | 2 +- .../printsheet/doc/pdf_tcpdflabel.class.php | 2 +- htdocs/holiday/card_group.php | 2 +- htdocs/hrm/compare.php | 14 +- htdocs/imports/import.php | 18 +- htdocs/modulebuilder/index.php | 31 +- htdocs/projet/ganttchart.inc.php | 31 +- htdocs/takepos/admin/orderprinters.php | 5 +- htdocs/webservices/server_actioncomm.php | 41 +- htdocs/webservices/server_contact.php | 38 +- htdocs/webservices/server_invoice.php | 29 +- htdocs/webservices/server_order.php | 28 +- .../webservices/server_productorservice.php | 223 +++---- htdocs/webservices/server_project.php | 69 +-- .../webservices/server_supplier_invoice.php | 4 +- htdocs/webservices/server_thirdparty.php | 56 +- htdocs/webservices/server_user.php | 12 +- 44 files changed, 616 insertions(+), 738 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 506a68b929e74..834cef0ff2739 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -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\\ 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\\, 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\\.$#" - 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 diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 5ca02d5529cee..eec86c9aaf528 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -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'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 03ba8fccff4d1..aea2e9135f107 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -421,7 +421,7 @@ '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 diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index f7cf45ce0b111..0bf41cf2e422e 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -775,7 +775,7 @@ public function getCatsCpts($catid = 0) * * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @param int $active 1= active, 0=not active - * @return array|int Array of groups or -1 if error + * @return never|array|int Array of groups or -1 if error * @see getCatsCpts(), getCptsCat() */ public function getCats($categorytype = -1, $active = 1) @@ -839,7 +839,7 @@ public function getCats($categorytype = -1, $active = 1) * @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|int<-1,-1> Array of accounting accounts or -1 if error + * @return never|array|int<-1,-1> Array of accounting accounts or -1 if error * @see getCats(), getCatsCpts() */ public function getCptsCat($cat_id, $predefinedgroupwhere = '') diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 5863686bef41a..06905ffb3ca84 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -268,6 +268,7 @@ // 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,updated:array} $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 @@ $out .= ' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i); } $out .= ''."\n"; - $out .= ''."\n"; + $out .= ''."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset $out .= ''."\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; @@ -427,6 +428,7 @@ { $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,updated:array} $file_list'; }*/ diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index d30ba75b5a4e2..f888c5a1efe00 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -2551,6 +2551,7 @@ public function getCheckIntegrity($target) // 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,updated:array} $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 @@ public function getCheckIntegrity($target) $out .= ''; $out .= ''."\n"; $out .= ''."\n"; - $out .= ''."\n"; + $out .= ''."\n"; $out .= "\n"; } } else { @@ -2657,7 +2658,7 @@ public function getCheckIntegrity($target) $out .= ''; $out .= ''."\n"; $out .= ''."\n"; - $out .= ''."\n"; + $out .= ''."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset,PhanTypeSuspiciousStringExpression $out .= ''."\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; diff --git a/htdocs/asset/tpl/depreciation_options_edit.tpl.php b/htdocs/asset/tpl/depreciation_options_edit.tpl.php index 6bdc7aff4e471..e33af821779b2 100644 --- a/htdocs/asset/tpl/depreciation_options_edit.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_edit.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2021 Open-Dsi * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 José + * Copyright (C) 2024 MDW * * 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 $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 $enabled_field_info +'; // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { @@ -84,7 +97,7 @@ $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 '
'.$langs->trans("Date").''; - $datepaid = dol_mktime(12, 0, 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); + $datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $datepayment = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? (GETPOST("remonth") ? $datepaid : -1) : 0; print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1, 0, '', '', $object->date, '', 1, $langs->trans("DonationDate")); print "'; - $dlcdatesuffix = !empty($objd->sellby) ? dol_stringtotime($objd->sellby) : dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); + $dlcdatesuffix = !empty($objd->sellby) ? dol_stringtotime($objd->sellby) : dol_mktime(0, 0, 0, GETPOSTINT('dlc'.$suffix.'month'), GETPOSTINT('dlc'.$suffix.'day'), GETPOSTINT('dlc'.$suffix.'year')); print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, 0, 0, 1, ''); print ''; - $dluodatesuffix = !empty($objd->eatby) ? dol_stringtotime($objd->eatby) : dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); + $dluodatesuffix = !empty($objd->eatby) ? dol_stringtotime($objd->eatby) : dol_mktime(0, 0, 0, GETPOSTINT('dluo'.$suffix.'month'), GETPOSTINT('dluo'.$suffix.'day'), GETPOSTINT('dluo'.$suffix.'year')); print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, 0, 0, 1, ''); print ''; - $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); + $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOSTINT('dlc'.$suffix.'month'), GETPOSTINT('dlc'.$suffix.'day'), GETPOSTINT('dlc'.$suffix.'year')); print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, 0, 0, 1, ''); print ''; - $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); + $dluodatesuffix = dol_mktime(0, 0, 0, GETPOSTINT('dluo'.$suffix.'month'), GETPOSTINT('dluo'.$suffix.'day'), GETPOSTINT('dluo'.$suffix.'year')); print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, 0, 0, 1, ''); print '
".$langs->trans('NextDateToExecution').""; if (empty($date_next_execution)) { - $date_next_execution = (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); + $date_next_execution = (GETPOST('rec_month') ? dol_mktime(12, 0, 0, GETPOSTINT('rec_month'), GETPOSTINT('rec_day'), GETPOSTINT('rec_year')) : -1); } - print $form->selectDate($date_next_execution, '', 1, 1, 0, "add", 1, 1); + print $form->selectDate($date_next_execution, 'rec_', 1, 1, 0, "add", 1, 1); print "
'.dol_escape_htmltag($file['expectedmd5']).''.dol_escape_htmltag($file['expectedmd5']).''.dol_escape_htmltag($file['md5']).'
'.$i.''.dol_escape_htmltag($file['filename']).''.$file['expectedmd5'].''.(array_key_exists('expectedmd5', $file) ? $file['expectedmd5'] : '').'
'.$i.''.dol_escape_htmltag($file['filename']).''.$file['expectedmd5'].''.$file['expectedmd5'].''.$file['md5'].'
' . "\n"; print ''; if ($mode_key == "economic") { diff --git a/htdocs/asset/tpl/depreciation_options_view.tpl.php b/htdocs/asset/tpl/depreciation_options_view.tpl.php index 8c4a0fc7caac1..7b35097b4c68b 100644 --- a/htdocs/asset/tpl/depreciation_options_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_view.tpl.php @@ -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($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']); diff --git a/htdocs/asset/tpl/depreciation_view.tpl.php b/htdocs/asset/tpl/depreciation_view.tpl.php index 12eaecd2cf986..9fcf366ae3ff5 100644 --- a/htdocs/asset/tpl/depreciation_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_view.tpl.php @@ -114,7 +114,7 @@ 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']); diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 6c46883797fec..b2936883c3b16 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ $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 @@ /* * 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) { diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 378c4c44d522f..c68cef5939f22 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -52,7 +52,7 @@ $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 diff --git a/htdocs/categories/info.php b/htdocs/categories/info.php index 53d6b56b92086..8d371d7887bbd 100644 --- a/htdocs/categories/info.php +++ b/htdocs/categories/info.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ $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 } /* diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 287cb9aff85fb..1929ec0953382 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -69,7 +69,7 @@ $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]; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index c1e4447209dac..2a46eff46baab 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -4,6 +4,7 @@ * Copyright (C) 2010-2016 Destailleur Laurent * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ $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 diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 4d123967b142a..3156ccf89b28e 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -100,7 +100,7 @@ $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); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index ba7237dba4237..53bc33241f85d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1826,13 +1826,13 @@ * @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 $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 */ diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 04c62142d86c6..e4b43bbddc89c 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -834,9 +834,9 @@ $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 @@ /** * 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 $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 $colorsbytype Array with colors by type * @param bool $var true or false for alternat style on tr/td * @return void */ diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index cb8e44d9d8c3e..ffe50ab8e4188 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -1146,14 +1146,14 @@ * @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 $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 $colorsbytype Array with colors by type * @param bool $var true or false for alternat style on tr/td * @return void */ diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index bf25225e64b7c..d0d5de04ae86d 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -403,7 +403,7 @@ 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 ''; } @@ -932,6 +932,7 @@ // Get list of files stored into database for same relative directory if ($relativedir) { completeFileArrayWithDatabaseInfo($file_list, $relativedir); + '@phan-var-force array $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 @@ // Get list of files stored into database for same relative directory if ($relativedir) { completeFileArrayWithDatabaseInfo($file_list, $relativedir); + '@phan-var-force array $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 @@ // Get list of files stored into database for same relative directory if ($relativedir) { completeFileArrayWithDatabaseInfo($file_list, $relativedir); + '@phan-var-force array $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 @@ // Get list of files stored into database for same relative directory if ($relativedir) { completeFileArrayWithDatabaseInfo($file_list, $relativedir); + '@phan-var-force array $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 @@ // Get list of files stored into database for same relative directory if ($relativedir) { completeFileArrayWithDatabaseInfo($file_list, $relativedir); + '@phan-var-force array $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 @@ // Get list of files stored into database for same relative directory if ($relativedir) { completeFileArrayWithDatabaseInfo($file_list, $relativedir); + '@phan-var-force array $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) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fbb4fc966420b..469f846470ed1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1400,7 +1400,7 @@ public function createFromClone(User $user, $fromid = 0) /** * 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 */ diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index d70cfcb18b757..ee21362e8e6c0 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2017 Pierre-Henry Favre * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ $arrayfields = array( - 'f.datef'=>array('label'=>"Date", 'checked'=>1), + 'f.datef' => array('label' => "Date", 'checked' => 1), //... ); @@ -261,12 +262,12 @@ // 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 diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index a8c42dd10ea1c..330f398feed83 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -367,7 +367,7 @@ /** * treeOutputForAbsoluteDir * - * @param array $sqltree Sqltree + * @param array $sqltree Sqltree * @param string $selecteddir Selected dir * @param string $fullpathselecteddir Full path of selected dir * @param string $modulepart Modulepart diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index c82dd322a3797..abe7725bfe0df 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -228,7 +228,7 @@ // 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 @@ * * @param TCPDF $pdf PDF handler * @param Translate $langs Language - * @param array $params Array of params + * @param array $params Array of params * @return void */ function dolPrintSignatureImage(TCPDF $pdf, $langs, $params) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 50ab5f50a7e6a..97ef613a1cfbc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9733,6 +9733,7 @@ public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow }*/ completeFileArrayWithDatabaseInfo($filearray, $relativedir); + '@phan-var-force array $filearray'; if (count($filearray)) { if ($sortfield && $sortorder) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f3e2ae6c6ffbb..b4dbbde178844 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -967,6 +967,7 @@ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, // Get list of files stored into database for same relative directory if ($relativedir) { completeFileArrayWithDatabaseInfo($file_list, $relativedir); + '@phan-var-force array $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 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '', // Get list of files stored into database for same relative directory if ($relativedir) { completeFileArrayWithDatabaseInfo($filearray, $relativedir); + '@phan-var-force array $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 @@ public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $para $relativepathfromroot = preg_replace('/'.preg_quote(DOL_DATA_ROOT.'/', '/').'/', '', $upload_dir); if ($relativepathfromroot) { completeFileArrayWithDatabaseInfo($filearray, $relativepathfromroot.'/%'); + '@phan-var-force array $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) diff --git a/htdocs/core/lib/customreports.lib.php b/htdocs/core/lib/customreports.lib.php index 9c2b390492095..0e549cc31b755 100644 --- a/htdocs/core/lib/customreports.lib.php +++ b/htdocs/core/lib/customreports.lib.php @@ -29,11 +29,11 @@ * @param mixed $object Any object * @param string $tablealias Alias of table * @param string $labelofobject Label of object - * @param array $arrayofmesures Array of measures already filled + * @param array $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 Array of measures + * @return array 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 $arrayofxaxis Array of xaxis already filled + * @param array $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 Array of xaxis + * @return array 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 $arrayofgroupby Array of groupby already filled + * @param array $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 Array of groupby + * @return array Array of groupby */ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroupby, $level = 0, &$count = 0, &$tablepath = '') { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 30c9a2fe43de6..9f246ceb8329f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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 + * @phan-template T of array * @param array $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 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) { diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php index 8179aaed99c9b..4c02ecad07e88 100644 --- a/htdocs/core/modules/member/modules_cards.php +++ b/htdocs/core/modules/member/modules_cards.php @@ -68,7 +68,7 @@ public static function liste_modeles($db, $maxfilenamelength = 0) * 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 $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 diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index 3faa66afc595d..9e11ea2bccdff 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -251,7 +251,7 @@ public function addSticker(&$pdf, $outputlangs, $param) /** * Function to build PDF on disk, then output on HTTP stream. * - * @param array|bool}> $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) + * @param Adherent|array|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 diff --git a/htdocs/holiday/card_group.php b/htdocs/holiday/card_group.php index ab330bb9cc131..10b0d02d497b2 100644 --- a/htdocs/holiday/card_group.php +++ b/htdocs/holiday/card_group.php @@ -414,7 +414,7 @@ break; } - setEventMessages($errors, null, 'errors'); + setEventMessages($errors, array(), 'errors'); } diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index 92c8c25ed3446..89eb1f374b500 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -298,7 +298,7 @@ * * 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 $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 $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 $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 $TSkill1 skill list of first column + * @param array $TSkill2 skill list of second column + * @return array */ 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 diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 845978f19f246..1e9d77989f4bb 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -894,7 +894,7 @@ } 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 @@ /** * Function to put the movable box of a source field * - * @param array $fieldssource List of source fields + * @param array,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 $fieldssource Array of field source + * @param array $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,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,position?:int}> */ function arrayInsert($array, $position, $insertArray) { diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index fba4a2f12cbb0..5748be601df90 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -151,6 +151,7 @@ // Search modules to edit $textforlistofdirs = ''."\n"; $listofmodules = array(); +'@phan-var-force array $listofmodules'; $i = 0; foreach ($dirsrootforscan as $tmpdirread) { $moduletype = 'external'; @@ -1981,7 +1982,7 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function getLicenceHeader($user, $langs, $now) 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 @@ function updateInputField() { 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)); diff --git a/htdocs/projet/ganttchart.inc.php b/htdocs/projet/ganttchart.inc.php index 204e383f98cb4..a887f6d24b571 100644 --- a/htdocs/projet/ganttchart.inc.php +++ b/htdocs/projet/ganttchart.inc.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ function reloadGraph() { $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 @@ function reloadGraph() { /** * 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,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 $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,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 $task_dependencies Task dependencies * @param int $level Level * @return void */ diff --git a/htdocs/takepos/admin/orderprinters.php b/htdocs/takepos/admin/orderprinters.php index bd36340096fdf..2d78a0ce4d4f0 100644 --- a/htdocs/takepos/admin/orderprinters.php +++ b/htdocs/takepos/admin/orderprinters.php @@ -6,6 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ $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 @@ // 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']; diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index bd85865ceee75..e90bb4c758210 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -135,7 +135,6 @@ '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'; diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 294d10f41303f..2dea9d176cfe5 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -267,7 +267,7 @@ * @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'; diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index ba07779693b6b..833d6b88e94e8 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -162,7 +162,7 @@ 'maxOccurs' => 'unbounded' ) ), - null, + array(), 'tns:line' ); @@ -226,7 +226,7 @@ 'maxOccurs' => 'unbounded' ) ), - null, + array(), 'tns:invoice' ); @@ -309,7 +309,7 @@ * @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; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index a599cb5b2a7f4..26ef230e0c5d2 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -377,7 +377,7 @@ * @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}} $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) { diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 8ce21e5ccda73..f8f23fb3518d5 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2012 JF FERRY * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ '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 @@ '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'), - - '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'), - - '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 - - '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') + '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_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'), + + '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'), + + 'dir' => array('name' => 'dir', 'type' => 'xsd:string'), + 'images' => array('name' => 'images', 'type' => 'tns:ImagesArray') ); @@ -174,7 +175,7 @@ $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 @@ '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 @@ '', 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 @@ $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( '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( '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( '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( '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( '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 @@ * @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} $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} $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 $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; diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index f504b7cc16fbe..4f9091a3df439 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2016 Ion Agorria * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ '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 @@ '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 @@ '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 @@ $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 @@ // 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 @@ } 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 @@ $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( '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 @@ * 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} $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; diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 102399a28be95..f7e0f3f32e5ea 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -246,7 +246,7 @@ * @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) { diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 9800b86a8b97d..c3060e27bbdfd 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -317,7 +317,7 @@ * @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 $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 = '') { diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 7567532ba990a..7caa707932002 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -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); From c24c49225bd72bf51f7d58900b008ffb88e36767 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 15:31:54 +0100 Subject: [PATCH 05/17] Debug v21 --- htdocs/comm/card.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index d0d5de04ae86d..0ef32d3547b16 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -397,13 +397,20 @@ if ($action == 'editcustomeraccountancycodegeneral' && $user->hasRight('societe', 'creer')) { print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->accountancy_code_customer_general, 'customeraccountancycodegeneral', 0, 1, '', 1); } else { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch(0, $object->accountancy_code_customer_general, 1); + if ($object->accountancy_code_customer_general > 0) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch(0, $object->accountancy_code_customer_general, 1); - print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + } + if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) { + if ($object->accountancy_code_customer_general > 0) { + print ' - '; + } + $accountingAccountByDefault = '' . $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) . ''; + print $accountingAccountByDefault; + } } - $accountingAccountByDefault = " (" . $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) . ")"; - print(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') ? $accountingAccountByDefault : ''); print ''; } From 18b334bdf16ca1d3b56c7c24d6a372aed151304b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 15:39:58 +0100 Subject: [PATCH 06/17] Clean code --- htdocs/core/lib/accounting.lib.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 54866caf71cf2..e3876491055e3 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -94,8 +94,6 @@ function clean_account($account) */ function length_accountg($account) { - global $conf; - if ($account < 0 || is_empty($account)) { return ''; } From 2fc0579defc8be9e606f65015015c67cd82dbe55 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 11 Nov 2024 17:38:41 +0100 Subject: [PATCH 07/17] NEW EPC QR CODE - Use bank owner account name instaed of company (#31735) Co-authored-by: Laurent Destailleur --- htdocs/core/class/commoninvoice.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index d465289f6016a..d4c29542916bc 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -1,10 +1,11 @@ - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2012-2014 Raphaël Doursenaud +/* Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 MDW + * Copyright (C) 2024 Alexandre Spangaro * * 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 @@ -1759,7 +1760,11 @@ public function buildEPCQrCodeString() if ($this->fk_account > 0) { $bankAccount->fetch($this->fk_account); $lines[] = $bankAccount->bic; //BIC (required) - $lines[] = $mysoc->name; //Name (required) + if (!empty($bankAccount->owner_name)) { + $lines[] = $bankAccount->owner_name; //Owner of the bank account, if present (required) + } else { + $lines[] = $mysoc->name; //Name (required) + } $lines[] = $bankAccount->iban; //IBAN (required) } else { $lines[] = ""; //BIC (required) From 10e18da5d72ed36722dc20200e9a84834fb06688 Mon Sep 17 00:00:00 2001 From: atm-lena <52402938+atm-lena@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:53:35 +0100 Subject: [PATCH 08/17] Develop new facture rec field societe rib management (#31698) * Add field "fk_societe_rib" in llx_facture_rec * Add field fk_societe_rib FactureRec * Management of new field "Bank Account Customer" in facture rec * Empty Value Management * Change method of hide/show field * Preselect RIB * Rename function * Edit structure formiban * fix merge conflict * Clean code * clean code * change translations * default rib preselected in invoice rec create * fix "==" * Update card-rec.php --------- Co-authored-by: atm-lena Co-authored-by: Laurent Destailleur --- htdocs/compta/facture/card-rec.php | 69 ++++++- .../facture/class/facture-rec.class.php | 13 +- htdocs/compta/facture/prelevement.php | 44 ++-- htdocs/core/class/html.form.class.php | 190 +++++++++++------- .../install/mysql/migration/20.0.0-21.0.0.sql | 2 + .../install/mysql/tables/llx_facture_rec.sql | 15 +- htdocs/langs/en_US/bills.lang | 2 + htdocs/societe/class/societe.class.php | 26 +++ 8 files changed, 258 insertions(+), 103 deletions(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 9fe72354ac737..c8f65f77e1543 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -248,6 +248,7 @@ $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); $object->cond_reglement_id = GETPOSTINT('cond_reglement_id'); + $object->fk_societe_rib = GETPOSTINT('accountcustomerid'); $object->frequency = $frequency; $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); @@ -331,7 +332,12 @@ } elseif ($action == 'setmode' && $usercancreate) { // Set mode $object->context['actionmsg'] = $langs->trans("FieldXModified", $langs->transnoentitiesnoconv("PaymentMode")); - $result = $object->setPaymentMethods(GETPOSTINT('mode_reglement_id')); + $object->setPaymentMethods(GETPOSTINT('mode_reglement_id')); + $object->setValueFrom('fk_societe_rib', 0); + + //Need to reload to display bank customer account field + header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id); + exit; } elseif ($action == 'classin' && $usercancreate) { // Set project $object->context['actionmsg'] = $langs->trans("FieldXModified", $langs->transnoentitiesnoconv("Project")); @@ -356,6 +362,11 @@ // Set bank account $object->context['actionmsg'] = $langs->trans("FieldXModified", $langs->transnoentitiesnoconv("Bank")); $result = $object->setBankAccount(GETPOSTINT('fk_account')); + } elseif ($action == 'setbankaccountcustomer' && $usercancreate) { + // Set bank account customer + $object->context['actionmsg'] = $langs->trans("FieldXModified", $langs->transnoentitiesnoconv("DebitBankAccount")); + $fk_societe_rib = (GETPOSTINT('accountcustomerid') != "-1") ? GETPOSTINT('accountcustomerid') : 0; + $result = $object->setValueFrom('fk_societe_rib', $fk_societe_rib); } elseif ($action == 'setfrequency' && $usercancreate) { // Set frequency and unit frequency $object->context['actionmsg'] = $langs->trans("FieldXModified", $langs->transnoentitiesnoconv("Frequency")); @@ -1009,6 +1020,7 @@ print load_fiche_titre($langs->trans("CreateRepeatableInvoice"), '', 'bill'); $object = new Facture($db); // Source invoice + $factureRec = new FactureRec($db); $product_static = new Product($db); if ($object->fetch($id, $ref) > 0) { @@ -1019,6 +1031,7 @@ print ''; print ''; + print dol_get_fiche_head([], '', '', 0); $rowspan = 4; @@ -1092,6 +1105,38 @@ //$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', '', 1); print ""; + // Customer Bank Account + print ""; + + print ''; + // Bank account if ($object->fk_account > 0) { print "'; + // Bank Account Customer + if ($object->mode_reglement_code == $object::PAYMENTCODETOEDITSOCIETERIB) { + print '"; + print ''; + } + // Bank Account print ''; - - print ''; + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + print ''; print ''; print ''; print ''; @@ -355,11 +362,10 @@ print '
'.$langs->trans($mode_info['label']).'
".$langs->trans('DebitBankAccount').""; + $defaultRibId = $object->thirdparty->getDefaultRib(); + $form->selectRib(GETPOSTISSET('accountcustomerid') ? GETPOSTINT('accountcustomerid') : $defaultRibId, 'accountcustomerid', 'fk_soc='.$object->socid, 1, '', 1); + print "
".$langs->trans('BankAccount').""; @@ -1408,6 +1453,28 @@ print '
'; + print ''; + } + print '
'; + print $langs->trans('DebitBankAccount'); + print ''; + + if (($action != 'editbankaccountcustomer') && $user->hasRight('facture', 'creer') && $object->statut == FactureRec::STATUS_DRAFT) { + print '' . img_edit($langs->trans('SetDebitBankAccount'), 1) . '
'; + print '
'; + + if ($action == 'editbankaccountcustomer') { + $form->formRib($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_societe_rib, 'accountcustomerid', 'fk_soc='.$object->socid, 1, 1); + } else { + $form->formRib($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_societe_rib, 'none', '', 0, 1); + } + print "
'; print ''; //print ''; + } elseif ($value == 'department_buyer') { + if ($context == 'edit') { + print ''; + } + } elseif ($value == 'department_buyer_id') { + if (!in_array('department_buyer', $fieldlist)) { // If there is already a field department buyer, we don't show department buyer id (avoid duplicate) + $department_buyer_id = (!empty($obj->{$value}) ? $obj->{$value} : 0); + print ''; + } } elseif ($value == 'lang') { print '\n"; - // les filtres à faire ensuite + // TODO filters if ($num > 0) { while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); + $fichinterrecstatic->id = $objp->id; + $fichinterrecstatic->ref = $objp->title; + $fichinterrecstatic->title = $objp->title; print ''; - print '\n"; + print '\n"; if ($objp->socid) { $companystatic->id = $objp->socid; $companystatic->name = $objp->name; @@ -919,7 +921,7 @@ if ($user->hasRight('ficheinter', 'creer')) { if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { print ''; + print '&socid='.$objp->socid.'&id='.$objp->id.'&token='.newToken().'">'; print $langs->trans("NewIntervention").''; } else { print $langs->trans("DateIsNotEnough"); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d8046af6f1633..33d4eda38055d 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -875,7 +875,7 @@ public function getTooltipContentArray($params) $langs->load('interventions'); $datas = []; - $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Intervention").''; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ShowIntervention").''; if (isset($this->status)) { $datas['picto'] .= ' '.$this->getLibStatut(5); } diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index c8fae403ec275..a623c2d72376e 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -640,7 +640,7 @@ public function set_auto($user, $freq, $courant) */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '') { - global $langs, $hookmanager; + global $action, $langs, $hookmanager; $result = ''; $label = $langs->trans("ShowInterventionModel").': '.$this->ref; @@ -651,13 +651,11 @@ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $m return $url; } - $picto = 'intervention'; - $link = ''; $linkend = ''; if ($withpicto) { - $result .= $link.img_object($label, $picto, 'class="classfortooltip"').$linkend; + $result .= $link.img_object($label, $this->picto, 'class="classfortooltip"').$linkend; } if ($withpicto && $withpicto != 2) { $result .= ' '; @@ -665,7 +663,7 @@ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $m if ($withpicto != 2) { $result .= $link.$this->ref.$linkend; } - global $action; + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks @@ -674,6 +672,7 @@ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $m } else { $result .= $hookmanager->resPrint; } + return $result; } diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 7129ed2e85c65..f4e3193bade85 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -31,10 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; - -if (!$user->hasRight('ficheinter', 'lire')) { - accessforbidden(); -} +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; /** * @var Conf $conf @@ -44,6 +41,10 @@ * @var User $user */ +if (!$user->hasRight('ficheinter', 'lire')) { + accessforbidden(); +} + // Load translation files required by the page $langs->load("interventions"); @@ -66,6 +67,7 @@ */ $fichinterstatic = new Fichinter($db); +$companystatic = new Societe($db); $form = new Form($db); $formfile = new FormFile($db); @@ -178,7 +180,7 @@ /* - * Draft orders + * Draft interventions */ if (isModEnabled('intervention')) { $sql = "SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid"; @@ -209,10 +211,14 @@ $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); + $fichinterstatic->id = $obj->rowid; + $fichinterstatic->ref = $obj->ref; print ''; - print '"; - print ''; + print ''; + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + print ''; + print ''; $i++; } } @@ -283,8 +289,9 @@ print '
'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 2ed18a031d4d4..e0c28539c6b09 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -198,6 +198,12 @@ class FactureRec extends CommonInvoice */ public $generate_pdf; // 1 to generate PDF on invoice generation (default) + /** + * @var int + */ + public $fk_societe_rib; + + const PAYMENTCODETOEDITSOCIETERIB = "PRE"; /** * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') @@ -267,6 +273,7 @@ class FactureRec extends CommonInvoice 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 210), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 215), 'suspended' => array('type' => 'integer', 'label' => 'Suspended', 'enabled' => 1, 'visible' => -1, 'position' => 225), + 'fk_societe_rib' => array('type' => 'integer', 'label' => 'Fk Societe RIB', 'enabled' => 'isModEnabled("bank")', 'visible' => -1, 'position' => 175), ); // END MODULEBUILDER PROPERTIES @@ -358,6 +365,7 @@ public function create($user, $facid, $notrigger = 0, $onlylines = array()) $sql .= ", multicurrency_code"; $sql .= ", multicurrency_tx"; $sql .= ", suspended"; + $sql .= ", fk_societe_rib"; $sql .= ") VALUES ("; $sql .= "'".$this->db->escape($this->titre ? $this->titre : $this->title)."'"; $sql .= ", ".((int) $this->socid); @@ -387,6 +395,7 @@ public function create($user, $facid, $notrigger = 0, $onlylines = array()) $sql .= ", '".$this->db->escape($facsrc->multicurrency_code)."'"; $sql .= ", ".((float) $facsrc->multicurrency_tx); $sql .= ", ".((int) $this->suspended); + $sql .= ", ".((int) $this->fk_societe_rib); $sql .= ")"; if ($this->db->query($sql)) { @@ -559,6 +568,7 @@ public function update(User $user, $notrigger = 0) $sql .= " localtax2 = ".((float) $this->total_localtax2).","; $sql .= " total_ht = ".((float) $this->total_ht).","; $sql .= " total_ttc = ".((float) $this->total_ttc); + $sql .= " fk_societe_rib = ".((int) $this->fk_societe_rib); // TODO Add missing fields $sql .= " WHERE rowid = ".((int) $this->id); @@ -612,7 +622,7 @@ public function fetch($rowid, $ref = '', $ref_ext = '', $noextrafields = 0, $nol $sql .= ', f.note_private, f.note_public, f.fk_user_author'; $sql .= ', f.modelpdf as model_pdf'; $sql .= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project'; - $sql .= ', f.fk_account'; + $sql .= ', f.fk_account, f.fk_societe_rib'; $sql .= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.usenewprice, f.auto_validate'; $sql .= ', f.generate_pdf'; $sql .= ", f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc"; @@ -663,6 +673,7 @@ public function fetch($rowid, $ref = '', $ref_ext = '', $noextrafields = 0, $nol $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; $this->fk_project = $obj->fk_project; $this->fk_account = $obj->fk_account; + $this->fk_societe_rib = $obj->fk_societe_rib; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->user_author = $obj->fk_user_author; // deprecated diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 63cbafcbb3559..69b68a1695d42 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -39,6 +39,9 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; + /** * @var Conf $conf @@ -125,16 +128,9 @@ $paymentservice = GETPOST('paymentservice'); // Get chosen iban id - $iban = explode(" / ", GETPOST('ribList'))[0]; - $sql = "SELECT rowid FROM ".$db->prefix()."societe_rib WHERE iban_prefix = '".$db->escape($iban)."'" ; - $resql = $object->db->query($sql); - if ($resql) { - if ($resql->num_rows) { - $selectedRibObj = $object->db->fetch_object($resql); - } - } + $iban = GETPOSTINT('accountcustomerid'); $amount = GETPOST('withdraw_request_amount', 'alpha'); - $result = $object->demande_prelevement($user, price2num($amount), $newtype, $sourcetype, 0, $selectedRibObj->rowid ?? 0); + $result = $object->demande_prelevement($user, price2num($amount), $newtype, $sourcetype, 0, $iban ?? 0); if ($result > 0) { $db->commit(); @@ -803,24 +799,26 @@ //print ''; - $ribList = $object->thirdparty->get_all_rib(); - $ribForSelection = []; - $defaultRib = ''; - foreach ($ribList as $rib) { - $ribString = $rib->iban . (($rib->iban && $rib->bic) ? ' / ' : '') . $rib->bic; - $ribForSelection[$rib->id] = $ribString; - if ($rib->default_rib == 1) { - $defaultRib = $ribString; + // if societe rib in model invoice, we preselect it + $selectedRib = ''; + if ($object->element == 'invoice' && $object->fk_fac_rec_source) { + $facturerec = new FactureRec($db); + $facturerec->fetch($object->fk_fac_rec_source); + if ($facturerec->fk_societe_rib) { + $companyBankAccount = new CompanyBankAccount($db); + $res = $companyBankAccount->fetch($facturerec->fk_societe_rib); + $selectedRib = $companyBankAccount->id; } } - $selectedRib= $defaultRib; - $listeOfRibs = GETPOST('ribList'); - $selectedRib = $form->formIban(!empty($listeOfRibs) ? $listeOfRibs: $defaultRib, 'ribList', 0, $type, 0, $ribForSelection); + $selectedRib = $form->selectRib($selectedRib, 'accountcustomerid', 'fk_soc='.$object->socid, 1, '', 1); - if (!empty($rib->iban)) { - if (!$rib->verif()) { - print img_warning('Error on default bank number for IBAN : '.$langs->trans($rib->error)); + $defaultRibId = $object->thirdparty->getDefaultRib(); + if ($defaultRibId) { + $companyBankAccount = new CompanyBankAccount($db); + $res = $companyBankAccount->fetch($defaultRibId); + if ($res > 0 && !$companyBankAccount->verif()) { + print img_warning('Error on default bank number for IBAN : '.$langs->trans($companyBankAccount->error)); } } elseif ($numopen || ($type != 'bank-transfer' && $object->mode_reglement_code == 'PRE') || ($type == 'bank-transfer' && $object->mode_reglement_code == 'VIR')) { print img_warning($langs->trans("NoDefaultIBANFound")); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8bd1a38431a06..c87b0e6cb79c0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4715,7 +4715,7 @@ public function select_types_paiements($selected = '', $htmlname = 'paiementtype } if ($format == 0) { - $out .= ''; - } - - foreach ($ribForSelection as $rib) { - $selectedAttribute = $selected == $rib ? 'selected' : ''; - $out .= ''; - } - $out .= ''; - $out .= ajax_combobox('select' . $htmlname); - - if (empty($nooutput)) { - print $out; - } else { - return $out; - } - } - /** * Selection HT or TTC @@ -5246,6 +5211,84 @@ public function select_comptes($selected = '', $htmlname = 'accountid', $status return $num; } + /** + * Return a HTML select list of bank accounts customer + * + * @param int|'' $selected Id account preselected + * @param string $htmlname Name of select zone + * @param string $filtre To filter the list. This parameter must not come from input of users + * @param int|string $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. + * @param string $moreattrib To add more attribute on select + * @param int $showibanbic Show iban/bic in label + * @param string $morecss More CSS + * @param int<0,1> $nooutput 1=Return string, do not send to output + * @return int|string If noouput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string. + */ + public function selectRib($selected = '', $htmlname = 'ribcompanyid', $filtre = '', $useempty = 0, $moreattrib = '', $showibanbic = 0, $morecss = '', $nooutput = 0) + { + // phpcs:enable + global $langs; + + $out = ''; + + $langs->load("admin"); + $num = 0; + + $sql = "SELECT rowid, label, bank, status, iban_prefix, bic"; + $sql .= " FROM " . $this->db->prefix() . "societe_rib"; + $sql.= " WHERE 1=1"; + if ($filtre) { // TODO Support USF + $sql .= " AND " . $filtre; + } + $sql .= " ORDER BY label"; + dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) { + $num = $this->db->num_rows($result); + $i = 0; + + $out .= '"; + $out .= ajax_combobox('select' . $htmlname); + } else { + dol_print_error($this->db); + } + + // Output or return + if (empty($nooutput)) { + print $out; + } else { + return $out; + } + + return $num; + } + /** * Return a HTML select list of establishment * @@ -5354,6 +5397,46 @@ public function formSelectAccount($page, $selected = '', $htmlname = 'fk_account } } + /** + * Display form to select bank customer account + * + * @param string $page Page + * @param string $selected Id of bank customer account + * @param string $htmlname Name of select html field + * @param string $filtre filtre for rib selected + * @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. + * @param int $showibanbic Show iban/bic in label + * @return void + */ + public function formRib($page, $selected = '', $htmlname = 'ribcompanyid', $filtre = '', $addempty = 0, $showibanbic = 0) + { + global $langs; + if ($htmlname != "none") { + print '
'; + print ''; + print ''; + $nbaccountfound = $this->selectRib($selected, $htmlname, $filtre, $addempty, '', $showibanbic); + if ($nbaccountfound > 0) { + print ''; + } + print '
'; + } else { + $langs->load('banks'); + + if ($selected) { + require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; + $bankstatic = new CompanyBankAccount($this->db); + $result = $bankstatic->fetch($selected); + if ($result) { + print $bankstatic->label; + if ($showibanbic) print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')'; + } + } else { + print " "; + } + } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** @@ -6338,41 +6421,6 @@ public function form_multicurrency_rate($page, $rate = 0.0, $htmlname = 'multicu } } - /** - * Show form with IBAN - * - * @param string $selected Id mode pre-selectionne - * @param string $htmlname Name of select html field - * @param int $addempty 1=Add empty entry - * @param string $type Type ('direct-debit' or 'bank-transfer') - * @param int $nooutput 1=Return string, no output - * @param string[] $ribForSelection Array of RIBs (IBAN / BIC)) - * @return string HTML output or '' - */ - public function formIban(string $selected = '', string $htmlname = 'ribList', int $addempty = 0, string $type = '', int $nooutput = 0, $ribForSelection = []) - { - $out = ''; - if ($htmlname != "none") { - $out .= ''; - if ($type) { - $out .= ''; - } - $out .= $this->selectTypesIban($selected, $htmlname, $addempty, 'minwidth100', 1, $ribForSelection); - } else { - if ($selected) { - $out .= $selected; - } else { - $out .= " "; - } - } - - if ($nooutput) { - return $out; - } - print $out; - return array_search($selected, $ribForSelection); - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 64306ab171b81..5d8523c0dac74 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -319,3 +319,5 @@ ALTER TABLE llx_supplier_proposaldet ADD COLUMN multicurrency_subprice_ttc doubl ALTER TABLE llx_c_tva ADD COLUMN fk_department_buyer integer DEFAULT NULL AFTER fk_pays; ALTER TABLE llx_c_tva ADD INDEX idx_tva_fk_department_buyer (fk_department_buyer); ALTER TABLE llx_c_tva ADD CONSTRAINT fk_tva_fk_department_buyer FOREIGN KEY (fk_department_buyer) REFERENCES llx_c_departements (rowid); + +ALTER TABLE llx_facture_rec ADD COLUMN fk_societe_rib integer DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index 88de4f40f44ec..0127bf5f04181 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -3,7 +3,7 @@ -- Copyright (C) 2012-2014 Laurent Destailleur -- Copyright (C) 2009 Regis Houssin -- Copyright (C) 2010 Juanjo Menent --- +-- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or @@ -30,12 +30,12 @@ create table llx_facture_rec tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date suspended integer DEFAULT 0, -- 1=suspended - + amount double(24,8) DEFAULT 0 NOT NULL, remise real DEFAULT 0, remise_percent real DEFAULT 0, remise_absolue real DEFAULT 0, - + vat_src_code varchar(10) DEFAULT '', -- TODO Remove this. Field is inside the table of lines total_tva double(24,8) DEFAULT 0, localtax1 double(24,8) DEFAULT 0, -- amount localtax1 @@ -46,13 +46,14 @@ create table llx_facture_rec fk_user_author integer, -- user creating fk_user_modif integer, -- user making last change - + fk_projet integer, -- projet auquel est associe la facture - + fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement fk_mode_reglement integer DEFAULT 0, -- mode de reglement (Virement, Prelevement) date_lim_reglement date, -- date limite de reglement fk_account integer, -- bank account id + fk_societe_rib integer, note_private text, note_public text, modelpdf varchar(255), @@ -66,8 +67,8 @@ create table llx_facture_rec usenewprice integer DEFAULT 0, -- update invoice with current price of product instead of recorded price frequency integer, -- frequency (for example: 3 for every 3 month) - unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ... - + unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ... + date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date) date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice) nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index a8e7cd2e5f6b3..4e6e1feef2208 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -497,6 +497,8 @@ IBANNumber=IBAN account number IBAN=IBAN CustomerIBAN=IBAN of customer SupplierIBAN=IBAN of vendor +DebitBankAccount = Direct debit bank account +SetDebitBankAccount = Define direct debit bank account BIC=BIC/SWIFT BICNumber=BIC/SWIFT code ExtraInfos=Extra infos diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bea3e62df54f8..d448016238236 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3528,6 +3528,32 @@ public function get_all_rib() } } + /** + * @return int + */ + public function getDefaultRib() + { + // phpcs:enable + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND default_rib = 1 AND fk_soc = ". (int) $this->id; + $resql = $this->db->query($sql); + if (!$resql) { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); + return -1; + } else { + $num_rows = $this->db->num_rows($resql); + $rib_array = array(); + if ($num_rows) { + while ($obj = $this->db->fetch_object($resql)) { + return $obj->rowid; + } + } + return 0; + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assigns a customer code from the code control module. From 6c9c1777630ae25add08675a27cd73a1cd2bca30 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Mon, 11 Nov 2024 17:57:32 +0100 Subject: [PATCH 09/17] NEW VAT by state (#31628) * NEW VAT by state * Fix global conf in looad tva function * Fix load vat rates in memory * Revert fk_tva column in state dict and load_tva function * NEW vat rate with department in dict * Fix isset not nullable * Fix order VAT rate desc to set as default --- htdocs/admin/dict.php | 59 +++++++++++++++++++++++++------ htdocs/core/lib/functions.lib.php | 43 +++++++++++++++------- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/companies.lang | 1 + 4 files changed, 82 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 9db282180de48..3eb837e7a5fe3 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -275,7 +275,7 @@ $tabsql[DICT_CHARGESOCIALES] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1"; $tabsql[DICT_TYPENT] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid"; $tabsql[DICT_CURRENCIES] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; -$tabsql[DICT_TVA] = "SELECT t.rowid, t.entity, t.code, t.type_vat, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid AND t.entity IN (".getEntity($tabname[DICT_TVA]).")"; +$tabsql[DICT_TVA] = "SELECT t.rowid, t.entity, t.code, t.type_vat, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.fk_department_buyer as department_buyer_id, db.nom as department_buyer, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t INNER JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_pays = c.rowid LEFT JOIN ".MAIN_DB_PREFIX."c_departements as db ON t.fk_department_buyer = db.rowid WHERE t.entity IN (".getEntity($tabname[DICT_TVA]).")"; $tabsql[DICT_TYPE_CONTACT] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; $tabsql[DICT_PAYMENT_TERM] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity IN (".getEntity($tabname[DICT_PAYMENT_TERM]).")"; $tabsql[DICT_PAIEMENT] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity IN (".getEntity($tabname[DICT_PAIEMENT]).")"; @@ -322,7 +322,7 @@ $tabsqlsort[DICT_CHARGESOCIALES] = "c.label ASC, a.code ASC, a.libelle ASC"; $tabsqlsort[DICT_TYPENT] = "country DESC,".(getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? ' t.position ASC,' : '')." libelle ASC"; $tabsqlsort[DICT_CURRENCIES] = "label ASC"; -$tabsqlsort[DICT_TVA] = "country ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC"; +$tabsqlsort[DICT_TVA] = "country ASC, department_buyer ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC"; $tabsqlsort[DICT_TYPE_CONTACT] = "t.element ASC, t.source ASC, t.position ASC, t.code ASC"; $tabsqlsort[DICT_PAYMENT_TERM] = "sortorder ASC, code ASC"; $tabsqlsort[DICT_PAIEMENT] = "code ASC"; @@ -369,7 +369,7 @@ $tabfield[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; $tabfield[DICT_TYPENT] = "code,libelle,country_id,country".(getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? ',position' : ''); $tabfield[DICT_CURRENCIES] = "code,label,unicode"; -$tabfield[DICT_TVA] = "country_id,country,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; +$tabfield[DICT_TVA] = "country_id,country,department_buyer_id,department_buyer,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[DICT_TYPE_CONTACT] = "element,source,code,libelle,position"; $tabfield[DICT_PAYMENT_TERM] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder"; $tabfield[DICT_PAIEMENT] = "code,libelle,type"; @@ -416,7 +416,7 @@ $tabfieldvalue[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; $tabfieldvalue[DICT_TYPENT] = "code,libelle,country".(getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? ',position' : ''); $tabfieldvalue[DICT_CURRENCIES] = "code,label,unicode"; -$tabfieldvalue[DICT_TVA] = "country,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; +$tabfieldvalue[DICT_TVA] = "country,department_buyer_id,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[DICT_TYPE_CONTACT] = "element,source,code,libelle,position"; $tabfieldvalue[DICT_PAYMENT_TERM] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder"; $tabfieldvalue[DICT_PAIEMENT] = "code,libelle,type"; @@ -463,7 +463,7 @@ $tabfieldinsert[DICT_CHARGESOCIALES] = "code,libelle,fk_pays,accountancy_code"; $tabfieldinsert[DICT_TYPENT] = "code,libelle,fk_country".(getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? ',position' : ''); $tabfieldinsert[DICT_CURRENCIES] = "code_iso,label,unicode"; -$tabfieldinsert[DICT_TVA] = "fk_pays,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note,entity"; +$tabfieldinsert[DICT_TVA] = "fk_pays,fk_department_buyer,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note,entity"; $tabfieldinsert[DICT_TYPE_CONTACT] = "element,source,code,libelle,position"; $tabfieldinsert[DICT_PAYMENT_TERM] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity"; $tabfieldinsert[DICT_PAIEMENT] = "code,libelle,type,entity"; @@ -810,6 +810,14 @@ if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { continue; // For some pages, country is not mandatory } + // Discard check of mandatory fields for department buyer id for some tables (only for add action) + if (GETPOST('actionadd') && $value == 'department_buyer_id' && $tablib[$id] == 'DictionaryVAT') { + continue; // For some pages, department buyer id is not mandatory + } + // Discard check of mandatory fields for department buyer for some tables + if ($value == 'department_buyer' && $tablib[$id] == 'DictionaryVAT') { + continue; // For some pages, department buyer is not mandatory + } // Discard check of mandatory fields for other fields if ($value == 'localtax1' && !GETPOST('localtax1_type')) { continue; @@ -928,6 +936,9 @@ if ((GETPOST("localtax2_type") || (GETPOST('localtax2_type') == '0')) && !GETPOST("localtax2")) { $_POST["localtax2"] = '0'; // If empty, we force to 0 } + if (GETPOST('department_buyer_id') <= 0) { + $_POST['department_buyer_id'] = ''; // If empty, we force to null + } if (GETPOST("accountancy_code") <= 0) { $_POST["accountancy_code"] = ''; // If empty, we force to null } @@ -1576,6 +1587,9 @@ } // For region page, we do not show the country input $valuetoshow = $langs->trans("Country"); } + if ($value == 'department_buyer') { + $valuetoshow = ''; + } if ($value == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $class = "center"; @@ -1601,7 +1615,7 @@ if ($value == 'unit' || $value == 'metric') { $valuetoshow = $langs->trans("MeasuringUnit"); } - if ($value == 'region_id' || $value == 'country_id') { + if ($value == 'region_id' || $value == 'country_id' || $value == 'department_buyer_id') { $valuetoshow = ''; } if ($value == 'accountancy_code') { @@ -1821,7 +1835,7 @@ } $showfield = 1; // By default - if ($value == 'region_id' || $value == 'country_id') { + if ($value == 'region_id' || $value == 'country_id' || $value == 'department_buyer_id') { $showfield = 0; } @@ -1860,7 +1874,7 @@ } $showfield = 1; // By default - if ($value == 'region_id' || $value == 'country_id') { + if ($value == 'region_id' || $value == 'country_id' || $value == 'department_buyer_id') { $showfield = 0; } @@ -2013,6 +2027,9 @@ if ($value == 'country') { $valuetoshow = $langs->trans("Country"); } + if ($value == 'department_buyer') { + $valuetoshow = $langs->trans('DepartmentBuyer'); + } if ($value == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $cssprefix = "center "; @@ -2153,7 +2170,7 @@ $valuetoshow = $langs->trans('Unit'); } - if ($value == 'region_id' || $value == 'country_id') { + if ($value == 'region_id' || $value == 'country_id' || $value == 'department_buyer_id') { $showfield = 0; } @@ -2428,7 +2445,7 @@ $langs->load('trips'); $key = $langs->trans(strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$value); - } elseif ($value == 'region_id' || $value == 'country_id') { + } elseif ($value == 'region_id' || $value == 'country_id' || $value == 'department_buyer_id') { $showfield = 0; } elseif ($value == 'unicode') { $valuetoshow = $langs->getCurrencySymbol($obj->code, 1); @@ -2474,6 +2491,9 @@ } $valuetoshow = length_accountg($valuetoshow); } elseif ($value == 'fk_tva') { + if (empty($form->cache_vatrates)) { + $form->load_tva('cache_fk_tva', '', $mysoc, new Societe($db), 0, 0, '', false, -1); + } foreach ($form->cache_vatrates as $key => $Tab) { if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow) { $valuetoshow = $form->cache_vatrates[$key]['label']; @@ -2747,6 +2767,25 @@ function dictFieldList($fieldlist, $obj = null, $tabname = '', $context = '') print '
'; print ''; print ''; + // show department buyer list + $country_code = (!empty($obj->country_code) ? $obj->country_code : ''); + $department_buyer_id = (!empty($obj->department_buyer_id) ? (int) $obj->department_buyer_id : 0); + if ($country_code != '') { + print img_picto('', 'state', 'class="pictofixedwidth"'); + print $formcompany->select_state($department_buyer_id, $country_code, 'department_buyer_id', 'minwidth100 maxwidth150 maxwidthonsmartphone'); + } + print ''; + print ''; + print ''; print $formadmin->select_language(getDolGlobalString('MAIN_LANG_DEFAULT'), 'lang'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9f246ceb8329f..a2ac4e4213ed3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7546,11 +7546,12 @@ function get_product_localtax_for_country($idprod, $local, $thirdpartytouse) /** * Function that return vat rate of a product line (according to seller, buyer and product vat rate) * VATRULE 1: If seller does not use VAT, default VAT is 0. End of rule. - * VATRULE 2: If the (seller country = buyer country) then the default VAT = VAT of the product sold. End of rule. - * VATRULE 3: If (seller and buyer in the European Community) and (property sold = new means of transport such as car, boat, plane) then VAT by default = 0 (VAT must be paid by the buyer to the tax center of his country and not to the seller). End of rule. - * VATRULE 4: If (seller and buyer in the European Community) and (buyer = individual) then VAT by default = VAT of the product sold. End of rule - * VATRULE 5: If (seller and buyer in European Community) and (buyer = company) then VAT by default=0. End of rule - * VATRULE 6: Otherwise the VAT proposed by default=0. End of rule. + * VATRULE 2: If buyer department has a VAT rule from vat rates dictionary then it's the default VAT rate. End of rule. + * VATRULE 3: If the (seller country = buyer country) then the default VAT = VAT of the product sold. End of rule. + * VATRULE 4: If (seller and buyer in the European Community) and (property sold = new means of transport such as car, boat, plane) then VAT by default = 0 (VAT must be paid by the buyer to the tax center of his country and not to the seller). End of rule. + * VATRULE 5: If (seller and buyer in the European Community) and (buyer = individual) then VAT by default = VAT of the product sold. End of rule + * VATRULE 6: If (seller and buyer in European Community) and (buyer = company) then VAT by default=0. End of rule + * VATRULE 7: Otherwise the VAT proposed by default=0. End of rule. * * @param Societe $thirdparty_seller Object Seller company * @param Societe $thirdparty_buyer Object Buyer company @@ -7561,7 +7562,7 @@ function get_product_localtax_for_country($idprod, $local, $thirdpartytouse) */ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod = 0, $idprodfournprice = 0) { - global $conf; + global $conf, $db; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -7601,17 +7602,35 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, return 0; } + // 'VATRULE 2' - Force VAT if a buyer department is defined on vat rates dictionary + if (!empty($thirdparty_buyer->state_id)) { + $sql = "SELECT d.rowid, t.taux as vat_default_rate, t.code as vat_default_code "; + $sql .= " FROM ".$db->prefix()."c_tva as t"; + $sql .= " INNER JOIN ".$db->prefix()."c_departements as d ON t.fk_department_buyer = d.rowid"; + $sql .= " WHERE d.rowid = ".((int) $thirdparty_buyer->state_id); + $sql .= " ORDER BY t.use_default DESC, t.taux DESC, t.code ASC, t.recuperableonly ASC"; + + $res = $db->query($sql); + if ($res) { + if ($db->num_rows($res)) { + $obj = $db->fetch_object($res); + return $obj->vat_default_rate.' ('.$obj->vat_default_code.')'; + } + $db->free($res); + } + } + // If the (seller country = buyer country) then the default VAT = VAT of the product sold. End of rule. if (($seller_country_code == $buyer_country_code) || (in_array($seller_country_code, array('FR', 'MC')) && in_array($buyer_country_code, array('FR', 'MC'))) || (in_array($seller_country_code, array('MQ', 'GP')) && in_array($buyer_country_code, array('MQ', 'GP'))) ) { // Warning ->country_code not always defined - //print 'VATRULE 2'; + //print 'VATRULE 3'; $tmpvat = get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); if ($seller_country_code == 'IN' && getDolGlobalString('MAIN_SALETAX_AUTOSWITCH_I_CS_FOR_INDIA')) { // Special case for india. - //print 'VATRULE 2b'; + //print 'VATRULE 3b'; $reg = array(); if (preg_match('/C+S-(\d+)/', $tmpvat, $reg) && $thirdparty_seller->state_id != $thirdparty_buyer->state_id) { // we must revert the C+S into I @@ -7626,7 +7645,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, } // If (seller and buyer in the European Community) and (property sold = new means of transport such as car, boat, plane) then VAT by default = 0 (VAT must be paid by the buyer to the tax center of his country and not to the seller). End of rule. - // 'VATRULE 3' - Not supported + // 'VATRULE 4' - Not supported // If (seller and buyer in the European Community) and (buyer = individual) then VAT by default = VAT of the product sold. End of rule // If (seller and buyer in European Community) and (buyer = company) then VAT by default=0. End of rule @@ -7640,10 +7659,10 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, } if (!$isacompany) { - //print 'VATRULE 4'; + //print 'VATRULE 5'; return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); } else { - //print 'VATRULE 5'; + //print 'VATRULE 6'; return 0; } } @@ -7660,7 +7679,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, // Otherwise the VAT proposed by default=0. End of rule. // Rem: This means that at least one of the 2 is outside the European Community and the country differs - //print 'VATRULE 6'; + //print 'VATRULE 7'; return 0; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8504fa7445f58..93102fb68a0e2 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1136,7 +1136,7 @@ BackToDictionaryList=Back to Dictionaries list TypeOfRevenueStamp=Type of tax stamp VATManagement=Sales Tax Management VATIsUsedStandard=When creating documents (proposals, invoices, orders...), the default Sales Tax rate is set according to the standard rules (depending on seller and buyer countries) -VATIsUsedDesc=By default when creating proposals, invoices, orders etc. the Sales Tax rate follows the active standard rule:
If the seller is not subject to Sales tax, then Sales tax defaults to 0. End of rule.
If the (seller's country = buyer's country), then the Sales tax by default equals the Sales tax of the product in the seller's country. End of rule.
If the seller and buyer are both in the European Community and goods are transport-related products (haulage, shipping, airline), the default VAT is 0. This rule is dependent on the seller's country - please consult with your accountant. The VAT should be paid by the buyer to the customs office in their country and not to the seller. End of rule.
If the seller and buyer are both in the European Community and the buyer is not a company (with a registered intra-Community VAT number) then the VAT defaults to the VAT rate of the seller's country. End of rule.
If the seller and buyer are both in the European Community and the buyer is a company (with a registered intra-Community VAT number), then the VAT is 0 by default. End of rule.
In any other case the proposed default is Sales tax=0. End of rule. +VATIsUsedDesc=By default when creating proposals, invoices, orders etc. the Sales Tax rate follows the active standard rule:
If the seller is not subject to Sales tax, then Sales tax defaults to 0. End of rule.
If buyer department has a VAT rule from vat rates dictionary then it's the default VAT rate. End of rule.
If the (seller's country = buyer's country), then the Sales tax by default equals the Sales tax of the product in the seller's country. End of rule.
If the seller and buyer are both in the European Community and goods are transport-related products (haulage, shipping, airline), the default VAT is 0. This rule is dependent on the seller's country - please consult with your accountant. The VAT should be paid by the buyer to the customs office in their country and not to the seller. End of rule.
If the seller and buyer are both in the European Community and the buyer is not a company (with a registered intra-Community VAT number) then the VAT defaults to the VAT rate of the seller's country. End of rule.
If the seller and buyer are both in the European Community and the buyer is a company (with a registered intra-Community VAT number), then the VAT is 0 by default. End of rule.
In any other case the proposed default is Sales tax=0. End of rule. VATIsNotUsedDesc=By default the proposed Sales tax is 0 which can be used for cases like associations, individuals or small companies. VATIsUsedExampleFR=In France, it means companies or organizations having a real fiscal system (Simplified real or normal real). A system in which VAT is declared. VATIsNotUsedExampleFR=In France, it means associations that are non Sales tax declared or companies, organizations or liberal professions that have chosen the micro enterprise fiscal system (Sales tax in franchise) and paid a franchise Sales tax without any Sales tax declaration. This choice will display the reference "Non applicable Sales tax - art-293B of CGI" on invoices. diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 864a582c7527d..f67f43988bde8 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -65,6 +65,7 @@ State=State/Province StateId=State ID StateCode=State/Province code StateShort=State +DepartmentBuyer=Buyer's department Region=Region Region-State=Region - State Country=Country From 273386f52ff4bda2c6c89f82a1c2a98924b87d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 11 Nov 2024 18:26:57 +0100 Subject: [PATCH 10/17] display fichinter rec link (#31767) * display fichinter rec link * display fichinter rec link * display fichinter rec link * display fichinter rec link * display fichinter rec link * display fichinter rec link --- build/phpstan/phpstan-baseline.neon | 20 ----------- dev/translation/ignore_translation_keys.lst | 1 - htdocs/fichinter/card-rec.php | 14 ++++---- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fichinter/class/fichinterrec.class.php | 9 +++-- htdocs/fichinter/index.php | 34 +++++++++++-------- htdocs/langs/en_US/interventions.lang | 1 + 7 files changed, 34 insertions(+), 47 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 834cef0ff2739..2252487db5785 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -9170,11 +9170,6 @@ 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 @@ -11470,11 +11465,6 @@ 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\\ given\\.$#" count: 1 @@ -14205,11 +14195,6 @@ parameters: count: 1 path: ../../htdocs/fichinter/index.php - - - message: "#^Variable \\$user might not be defined\\.$#" - count: 1 - path: ../../htdocs/fichinter/index.php - - message: "#^Ternary operator condition is always false\\.$#" count: 1 @@ -17955,11 +17940,6 @@ parameters: count: 1 path: ../../htdocs/opensurvey/class/opensurveysondage.class.php - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 1 - path: ../../htdocs/opensurvey/exportcsv.php - - message: "#^Empty array passed to foreach\\.$#" count: 1 diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst index 678efe4c096c1..d870ff1504b07 100644 --- a/dev/translation/ignore_translation_keys.lst +++ b/dev/translation/ignore_translation_keys.lst @@ -787,7 +787,6 @@ ShowEmailcollectorFilter ShowEvaluation ShowEvaluationdet ShowFichinter -ShowInterventionModel ShowInventory ShowJob ShowKnowledgeRecord diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 4447c9f1e1c34..93b6157ea1923 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -278,6 +278,7 @@ llxHeader('', $langs->trans("RepeatableIntervention"), $help_url, '', 0, 0, '', '', '', 'mod-fichinter page-card-rec'); $form = new Form($db); +$fichinterrecstatic = new FichinterRec($db); $companystatic = new Societe($db); if (isModEnabled('contract')) { $contratstatic = new Contrat($db); @@ -786,7 +787,7 @@ } else { // List mode - $sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.title,"; + $sql = "SELECT f.rowid as id, s.nom as name, s.rowid as socid, f.title,"; $sql .= " f.duree, f.fk_contrat, f.fk_projet as fk_project, f.frequency, f.nb_gen_done, f.nb_gen_max,"; $sql .= " f.date_last_gen, f.date_when, f.datec, f.status"; @@ -851,16 +852,17 @@ print "
'; - print img_object($langs->trans("ShowIntervention"), "intervention").' '.$objp->title; - print "'.$fichinterrecstatic->getNomUrl(1)."
'; - print "rowid."\">".img_object($langs->trans("ShowFichinter"), "intervention").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"), "company").' '.dol_trunc($obj->name, 24).'
'.$fichinterstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'customer').'
'; print '
'.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.''.$companystatic->getNomUrl(1, 'customer').''.dol_print_date($db->jdate($obj->datem), 'day').''.$fichinterstatic->LibStatut($obj->fk_statut, 5).'
'; print ''; - - print ''.img_object($langs->trans("ShowCompany"), "company").' '.dol_trunc($obj->name, 24).''; - + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + print ''.$companystatic->getNomUrl(1, 'customer').''; print ''.$fichinterstatic->LibStatut($obj->fk_statut, 5).''; - print ''; $i++; } diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index c52163a5e430d..1d7b2ada84fbc 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -85,3 +85,4 @@ TypeContact_fichinter_internal_INTERVENING=Intervenant TypeContact_fichinter_external_BILLING=Customer contact of intervention billing TypeContact_fichinter_external_CUSTOMER=Customer contact of intervention follow-up NotARecurringInterventionalTemplate=Not a recurring intervention template +ShowInterventionModel=Show intervention model From e127d3c04483636ebc4c091c45edaf874b634b3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 18:39:15 +0100 Subject: [PATCH 11/17] Debug v21 --- htdocs/core/upload_page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/upload_page.php b/htdocs/core/upload_page.php index 65b9463349cae..8f23b4d77f5b4 100644 --- a/htdocs/core/upload_page.php +++ b/htdocs/core/upload_page.php @@ -69,7 +69,7 @@ * Actions */ -if (!is_numeric(getDolGlobalString('MAIN_USE_TOP_MENU_IMPORT_FILE'))) { +if (getDolGlobalString('MAIN_USE_TOP_MENU_IMPORT_FILE') && !is_numeric(getDolGlobalString('MAIN_USE_TOP_MENU_IMPORT_FILE'))) { $urlforuploadpage = getDolGlobalString('MAIN_USE_TOP_MENU_IMPORT_FILE'); header("Location: ".$urlforuploadpage); From 9b68d78fe5f9aff95322aaf9afb7e25a6b5d1516 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 18:53:16 +0100 Subject: [PATCH 12/17] Debug v21 --- htdocs/core/actions_linkedfiles.inc.php | 5 +++-- htdocs/core/lib/files.lib.php | 14 ++++++++++++-- htdocs/core/upload_page.php | 4 ++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index b0de8759a93e6..fd2757c3f1df1 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -35,6 +35,7 @@ * @var string $upload_dir * @var string $upload_dirold * @var string $confirm + * @var string $forceFullTextIndexation */ // Protection to understand what happen when submitting files larger than post_max_size @@ -93,9 +94,9 @@ $allowoverwrite = (GETPOSTINT('overwritefile') ? 1 : 0); if (!empty($upload_dirold) && getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { - $result = dol_add_file_process($upload_dirold, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs, $object); + $result = dol_add_file_process($upload_dirold, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs, $object, $forceFullTextIndexation); } elseif (!empty($upload_dir)) { - $result = dol_add_file_process($upload_dir, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs, $object); + $result = dol_add_file_process($upload_dir, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs, $object, $forceFullTextIndexation); } } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index f53e655f6b1c7..cda577554b94c 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1887,10 +1887,11 @@ function dol_init_file_process($pathtoscan = '', $trackid = '') * @param string $trackid Track id (used to prefix name of session vars to avoid conflict) * @param int<0,1> $generatethumbs 1=Generate also thumbs for uploaded image files * @param ?Object $object Object used to set 'src_object_*' fields + * @param string $forceFullTestIndexation '1'=Force full text storage in database even if global option not set (consume a high level of data) * @return int Return integer <=0 if KO, >0 if OK * @see dol_remove_file_process() */ -function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionordb = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null) +function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionordb = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null, $forceFullTestIndexation = '') { global $db, $user, $conf, $langs; @@ -2127,9 +2128,10 @@ function dol_remove_file_process($filenb, $donotupdatesession = 0, $donotdeletef * @param string $mode How file was created ('uploaded', 'generated', ...) * @param int $setsharekey Set also the share key * @param Object $object Object used to set 'src_object_*' fields + * @param string $forceFullTextIndexation '1'=Force full text indexation even if global option not set * @return int Return integer <0 if KO, 0 if nothing done, >0 if OK */ -function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uploaded', $setsharekey = 0, $object = null) +function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uploaded', $setsharekey = 0, $object = null, $forceFullTextIndexation = '') { global $db, $user, $conf; @@ -2180,6 +2182,14 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo // Use a convertisser Doc to Text $useFullTextIndexation = getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION'); + if (empty($useFullTextIndexation) && $forceFullTextIndexation == '1') { + if (getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION_PDFTOTEXT')) { + $useFullTextIndexation = 'pdftotext'; + } elseif (getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION_DOCLING')) { + $useFullTextIndexation = 'docling'; + } + } + //$useFullTextIndexation = 1; if ($useFullTextIndexation) { $ecmfile->filepath = $rel_dir; diff --git a/htdocs/core/upload_page.php b/htdocs/core/upload_page.php index 8f23b4d77f5b4..eeafaaff78c8b 100644 --- a/htdocs/core/upload_page.php +++ b/htdocs/core/upload_page.php @@ -91,6 +91,10 @@ $permissiontoadd = $user->hasRight($module, $permlevel1, 'read'); $upload_dir = $dir_temp.'/import'; + $forceFullTextIndexation = '1'; + + // Set $object so entry file will be linked to object. + // TODO include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; } From b51dc54db83b074f8efe0f12429f08947ef4d186 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 20:32:02 +0100 Subject: [PATCH 13/17] FIX edit label of survey --- htdocs/opensurvey/card.php | 2 +- htdocs/opensurvey/wizard/choix_autre.php | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index ef27448e34a2b..282b077599ccb 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -255,7 +255,7 @@ $adresseadmin = $object->mail_admin; print $langs->trans("Title").''; if ($action == 'edit') { - print ''; + print ''; } else { print dol_htmlentities($object->title); } diff --git a/htdocs/opensurvey/wizard/choix_autre.php b/htdocs/opensurvey/wizard/choix_autre.php index 4c2e090094bef..448bd80d9333d 100644 --- a/htdocs/opensurvey/wizard/choix_autre.php +++ b/htdocs/opensurvey/wizard/choix_autre.php @@ -124,7 +124,7 @@ //partie creation du sondage dans la base SQL //On prépare les données pour les inserer dans la base -print '
'."\n"; +print ''."\n"; print ''; print load_fiche_titre($langs->trans("CreatePoll").' (2 / 2)'); @@ -143,6 +143,7 @@ } print ''.$langs->trans("TitleChoice").' '.$j.': '; $tmparray = array('checkbox' => $langs->trans("CheckBox"), 'yesno' => $langs->trans("YesNoList"), 'foragainst' => $langs->trans("PourContreList")); + print '   '.$langs->trans("Type").' '.$form->selectarray("typecolonne[]", $tmparray, $_SESSION["typecolonne$i"]); print ''."\n"; } @@ -151,7 +152,15 @@ //ajout de cases supplementaires print ''."\n"; -print ''."\n"; +print ''."\n"; print '
'.$langs->trans("5MoreChoices").''.$langs->trans("5MoreChoices").''; +if ($conf->use_javascript_ajax) { + print '
'; + print img_picto('', 'add', '', 0, 0, 0, '', 'fa-2x valignmiddle btnTitle-icon'); + print '
'; +} else { + print ''; +} +print '
'."\n"; print'
'."\n"; @@ -159,6 +168,15 @@ print ''."\n"; print ''."\n"; +print ''; + //fin du formulaire et bandeau de pied print '
'."\n"; From 0436458a8f535a11eee9b0880cda643d65bd3d9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 20:36:52 +0100 Subject: [PATCH 14/17] FIX Date of survey must be in future --- htdocs/opensurvey/wizard/create_survey.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index d4c7d6c32fd1a..116fd1e54f97a 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -66,6 +66,8 @@ // Jump to correct page if (!empty($creation_sondage_date) || !empty($creation_sondage_autre)) { + $error = 0; + $_SESSION["title"] = $title; $_SESSION["description"] = $description; @@ -88,19 +90,21 @@ } $testdate = false; - $champdatefin = dol_mktime(0, 0, 0, GETPOST('champdatefinmonth'), GETPOST('champdatefinday'), GETPOST('champdatefinyear')); + $champdatefin = dol_mktime(0, 0, 0, GETPOSTINT('champdatefinmonth'), GETPOSTINT('champdatefinday'), GETPOSTINT('champdatefinyear')); - if ($champdatefin && ($champdatefin > 0)) { // A date was provided + if (! $error && $champdatefin && ($champdatefin > 0)) { // A date was provided + $error++; // Expire date is not before today if ($champdatefin >= dol_now()) { $testdate = true; $_SESSION['champdatefin'] = dol_print_date($champdatefin, 'dayrfc'); } else { + $error++; $testdate = true; $_SESSION['champdatefin'] = dol_print_date($champdatefin, 'dayrfc'); //$testdate = false; //$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc'); - setEventMessages('ExpireDate', null, 'warnings'); + setEventMessages($langs->trans('ErrorDateMustBeInFuture'), null, 'errors'); } } @@ -108,7 +112,7 @@ setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("ExpireDate")), null, 'errors'); } - if ($title && $testdate) { + if (!$error && $title && $testdate) { if (!empty($creation_sondage_date)) { header("Location: choix_date.php"); exit(); From 8c1f823851adea7d73081cf289eec95797109b17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 21:22:18 +0100 Subject: [PATCH 15/17] Debug v21 --- htdocs/opensurvey/wizard/choix_autre.php | 42 ++++++++++++---------- htdocs/opensurvey/wizard/create_survey.php | 15 +++----- htdocs/opensurvey/wizard/index.php | 11 ++++++ 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/htdocs/opensurvey/wizard/choix_autre.php b/htdocs/opensurvey/wizard/choix_autre.php index 448bd80d9333d..09d179d84ab78 100644 --- a/htdocs/opensurvey/wizard/choix_autre.php +++ b/htdocs/opensurvey/wizard/choix_autre.php @@ -67,7 +67,9 @@ } if (GETPOST("ajoutcases") || GETPOST("ajoutcases_x")) { - $_SESSION["nbrecases"] += 5; + if ($_SESSION["nbrecases"] < 100) { + $_SESSION["nbrecases"] += 5; + } } // Create survey into database @@ -132,7 +134,8 @@ print '
'.$langs->trans("PollOnChoice").'

'."\n"; -print '
'."\n"; +print '
'."\n"; + print ''."\n"; //affichage des cases texte de formulaire @@ -144,7 +147,7 @@ print ''."\n"; } @@ -152,37 +155,38 @@ //ajout de cases supplementaires print '
'.$langs->trans("TitleChoice").' '.$j.': '; $tmparray = array('checkbox' => $langs->trans("CheckBox"), 'yesno' => $langs->trans("YesNoList"), 'foragainst' => $langs->trans("PourContreList")); - print '   '.$langs->trans("Type").' '.$form->selectarray("typecolonne[]", $tmparray, $_SESSION["typecolonne$i"]); + print '   '.$langs->trans("Type").' '.$form->selectarray("typecolonne[]", $tmparray, $_SESSION["typecolonne".$i]); print '
'."\n"; -print ''."\n"; print '
'.$langs->trans("5MoreChoices").''; +print ''.$langs->trans("5MoreChoices").'... '; if ($conf->use_javascript_ajax) { - print '
'; - print img_picto('', 'add', '', 0, 0, 0, '', 'fa-2x valignmiddle btnTitle-icon'); + print '
'; + print img_picto('', 'add', '', 0, 0, 0, '', 'valignmiddle btnTitle-icon cursorpointer'); print '
'; + + print ''; + print ''; } else { print ''; } +print '
'; print '
'."\n"; print'
'."\n"; -print ''."\n"; -print ''."\n"; -print '
'."\n"; - -print ''; +print ''."\n"; -//fin du formulaire et bandeau de pied print ''."\n"; print ''."\n"; print '


'."\n"; + print '
'."\n"; // End of page diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 116fd1e54f97a..a498ab0cf67f2 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -90,10 +90,9 @@ } $testdate = false; - $champdatefin = dol_mktime(0, 0, 0, GETPOSTINT('champdatefinmonth'), GETPOSTINT('champdatefinday'), GETPOSTINT('champdatefinyear')); + $champdatefin = dol_mktime(23, 59, 59, GETPOSTINT('champdatefinmonth'), GETPOSTINT('champdatefinday'), GETPOSTINT('champdatefinyear')); if (! $error && $champdatefin && ($champdatefin > 0)) { // A date was provided - $error++; // Expire date is not before today if ($champdatefin >= dol_now()) { $testdate = true; @@ -140,16 +139,17 @@ print load_fiche_titre($langs->trans("CreatePoll").' (1 / 2)'); -// debut du formulaire + print '
'."\n"; print ''; print dol_get_fiche_head(); -// Affichage des différents champs textes a remplir print ''."\n"; -print ''."\n"; +print ''; + +print ''."\n"; if (!$_SESSION["title"] && (GETPOST('creation_sondage_date') || GETPOST('creation_sondage_autre'))) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PollTitle")), null, 'errors'); } @@ -170,11 +170,6 @@ print dol_get_fiche_end(); -//focus javascript sur le premier champ -print ''."\n"; - print '
'."\n"; // Check or not diff --git a/htdocs/opensurvey/wizard/index.php b/htdocs/opensurvey/wizard/index.php index 0775adde83000..9da46f62f3fa1 100644 --- a/htdocs/opensurvey/wizard/index.php +++ b/htdocs/opensurvey/wizard/index.php @@ -78,6 +78,17 @@ print ''; print ''; +// Clean session variables + +$i = 0; +unset($_SESSION["nbrecases"]); +while ($i < 100) { + unset($_SESSION["choix".$i]); + unset($_SESSION["typecolonne".$i]); + $i++; +} + + // End of page llxFooter(); $db->close(); From 982c356493e36a5acf8e44bec7a0700f7e648304 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 21:28:21 +0100 Subject: [PATCH 16/17] Debug v21 --- htdocs/opensurvey/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 282b077599ccb..a792c21b204d7 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -246,7 +246,7 @@ // Type $type = ($object->format == "A") ? 'classic' : 'date'; -print ''; @@ -257,7 +257,7 @@ if ($action == 'edit') { print ''; } else { - print dol_htmlentities($object->title); + print dolPrintHTML($object->title); } print ''; From 40aca2803f1b329bb95d8d784d0c87eba2353362 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2024 21:51:51 +0100 Subject: [PATCH 17/17] Add std deviation in custom report --- htdocs/core/customreports.php | 3 +++ htdocs/core/lib/customreports.lib.php | 32 ++++++++++++--------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 3b4202d081ce6..59a9f25598cc5 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -788,6 +788,9 @@ } elseif (preg_match('/\-max$/', $val)) { $tmpval = preg_replace('/\-max$/', '', $val); $sql .= "MAX(".$db->ifsql($tmpval.' IS NULL', '0', $tmpval).") as y_".$key.", "; + } elseif (preg_match('/\-stddevpop$/', $val)) { + $tmpval = preg_replace('/\-stddevpop$/', '', $val); + $sql .= "STDDEV_POP(".$db->ifsql($tmpval.' IS NULL', '0', $tmpval).") as y_".$key.", "; } } $sql = preg_replace('/,\s*$/', '', $sql); diff --git a/htdocs/core/lib/customreports.lib.php b/htdocs/core/lib/customreports.lib.php index 0e549cc31b755..a94891c00d7b3 100644 --- a/htdocs/core/lib/customreports.lib.php +++ b/htdocs/core/lib/customreports.lib.php @@ -97,15 +97,13 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu 'table' => $object->table_element, 'tablefromt' => $tablepath ); - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $arrayofmesures[$tablealias.'.'.$key.'-stddevpop'] = array( - 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("StandardDeviationPop").')', - 'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']), - 'position' => ($position + ($count * 100000)).'.5', - 'table' => $object->table_element, - 'tablefromt' => $tablepath - ); - } + $arrayofmesures[$tablealias.'.'.$key.'-stddevpop'] = array( + 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("StandardDeviationPop").')', + 'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']), + 'position' => ($position + ($count * 100000)).'.5', + 'table' => $object->table_element, + 'tablefromt' => $tablepath + ); } } // Add extrafields to Measures @@ -142,15 +140,13 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu 'table' => $object->table_element, 'tablefromt' => $tablepath ); - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $arrayofmesures[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-stddevpop'] = array( - 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("StandardDeviationPop").')', - 'labelnohtml' => $labelofobject.': '.$langs->trans($val), - 'position' => ($position + ($count * 100000)).'.5', - 'table' => $object->table_element, - 'tablefromt' => $tablepath - ); - } + $arrayofmesures[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-stddevpop'] = array( + 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("StandardDeviationPop").')', + 'labelnohtml' => $labelofobject.': '.$langs->trans($val), + 'position' => ($position + ($count * 100000)).'.5', + 'table' => $object->table_element, + 'tablefromt' => $tablepath + ); } } }
'.$langs->trans("PollTitle").'
'.$langs->trans("PollTitle").'
'.$langs->trans("Type").''; +print '
'.$langs->trans("Type").''; print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1); print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate").'