diff --git a/.travis.yml b/.travis.yml index fb6a13309a2..98182c9eda0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -112,8 +112,8 @@ before_install: #ps fauxww | grep postgres ls /etc/postgresql/13/main/ - sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/13/main/pg_hba.conf - sudo cat /etc/postgresql/13/main/pg_hba.conf + sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/14/main/pg_hba.conf + sudo cat /etc/postgresql/14/main/pg_hba.conf sudo service postgresql restart diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 4f859419958..fe93cf61878 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -36,6 +36,12 @@ parameters: count: 1 path: ../../../htdocs/accountancy/admin/journals_list.php + - + message: '#^If condition is always true\.$#' + identifier: if.alwaysTrue + count: 1 + path: ../../../htdocs/accountancy/admin/productaccount.php + - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue @@ -138,18 +144,6 @@ parameters: count: 1 path: ../../../htdocs/accountancy/class/accountancyexport.class.php - - - message: '#^Variable \$invoice might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/accountancy/class/accountancyexport.class.php - - - - message: '#^Call to function array_key_exists\(\) with ''error'' and array\{ref\: mixed, label\: mixed, acquisition_value_ht\: mixed, depreciation\: non\-empty\-array\, disposal\?\: array\{date\: mixed, amount\: mixed, subject_to_vat\: bool\}\} will always evaluate to false\.$#' - identifier: function.impossibleType - count: 1 - path: ../../../htdocs/accountancy/class/accountingjournal.class.php - - message: '#^Parameter \#2 \$callback of function array_filter expects \(callable\(string\)\: bool\)\|null, ''strlen'' given\.$#' identifier: argument.type @@ -168,18 +162,6 @@ parameters: count: 1 path: ../../../htdocs/accountancy/class/lettering.class.php - - - message: '#^Variable \$save_element_by_link might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/accountancy/class/lettering.class.php - - - - message: '#^Variable \$save_link_by_element might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/accountancy/class/lettering.class.php - - message: '#^Parameter \#2 \$callback of function array_filter expects \(callable\(string\)\: bool\)\|null, ''strlen'' given\.$#' identifier: argument.type @@ -192,12 +174,6 @@ parameters: count: 2 path: ../../../htdocs/accountancy/closure/index.php - - - message: '#^Variable \$current_fiscal_period in isset\(\) always exists and is not nullable\.$#' - identifier: isset.variable - count: 4 - path: ../../../htdocs/accountancy/closure/index.php - - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue @@ -318,12 +294,6 @@ parameters: count: 1 path: ../../../htdocs/accountancy/journal/expensereportsjournal.php - - - message: '#^Variable \$def_tva might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/accountancy/journal/expensereportsjournal.php - - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue @@ -774,12 +744,24 @@ parameters: count: 1 path: ../../../htdocs/admin/modules.php + - + message: '#^Loose comparison using \=\= between ''common''\|''commonkanban'' and ''expdev'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 1 + path: ../../../htdocs/admin/modules.php + - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue count: 1 path: ../../../htdocs/admin/modules.php + - + message: '#^Result of && is always false\.$#' + identifier: booleanAnd.alwaysFalse + count: 2 + path: ../../../htdocs/admin/modules.php + - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue @@ -870,6 +852,18 @@ parameters: count: 5 path: ../../../htdocs/admin/sms.php + - + message: '#^Loose comparison using \=\= between ''add'' and ''add'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/admin/spip.php + + - + message: '#^Result of \|\| is always true\.$#' + identifier: booleanOr.alwaysTrue + count: 1 + path: ../../../htdocs/admin/spip.php + - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -906,18 +900,6 @@ parameters: count: 1 path: ../../../htdocs/admin/system/dolibarr.php - - - message: '#^If condition is always true\.$#' - identifier: if.alwaysTrue - count: 1 - path: ../../../htdocs/admin/system/filecheck.php - - - - message: '#^Left side of && is always true\.$#' - identifier: booleanAnd.leftAlwaysTrue - count: 1 - path: ../../../htdocs/admin/system/filecheck.php - - message: '#^Loose comparison using \!\= between '''' and ''kanban'' will always evaluate to true\.$#' identifier: notEqual.alwaysTrue @@ -1662,6 +1644,18 @@ parameters: count: 1 path: ../../../htdocs/categories/card.php + - + message: '#^Loose comparison using \=\= between ''hierarchy'' and ''common'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 1 + path: ../../../htdocs/categories/categorie_list.php + + - + message: '#^Loose comparison using \=\= between ''hierarchy'' and ''hierarchy'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/categories/categorie_list.php + - message: '#^Method Categorie\:\:get_full_arbo\(\) should return \-1\|array\ but returns array\\.$#' identifier: return.type @@ -1842,6 +1836,12 @@ parameters: count: 1 path: ../../../htdocs/comm/action/index.php + - + message: '#^Parameter \#16 \$usergroupid of function print_actions_filter expects array\\|int, string given\.$#' + identifier: argument.type + count: 3 + path: ../../../htdocs/comm/action/index.php + - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue @@ -1902,12 +1902,6 @@ parameters: count: 1 path: ../../../htdocs/comm/action/pertype.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 1 - path: ../../../htdocs/comm/action/pertype.php - - message: '#^Loose comparison using \!\= between ''show_pertype'' and ''show_day'' will always evaluate to true\.$#' identifier: notEqual.alwaysTrue @@ -2220,6 +2214,30 @@ parameters: count: 4 path: ../../../htdocs/comm/mailing/targetemailing.php + - + message: '#^Loose comparison using \=\= between ''setemail_errorsto''\|''setevenunsubscribe''\|''setreplyto'' and ''setemail_replyto'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 1 + path: ../../../htdocs/comm/mailing/targetemailing.php + + - + message: '#^Loose comparison using \=\= between ''setevenunsubscribe''\|''setreplyto'' and ''setfrom'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 1 + path: ../../../htdocs/comm/mailing/targetemailing.php + + - + message: '#^Loose comparison using \=\= between ''setevenunsubscribe''\|''setreplyto'' and ''settitle'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 1 + path: ../../../htdocs/comm/mailing/targetemailing.php + + - + message: '#^Result of && is always false\.$#' + identifier: booleanAnd.alwaysFalse + count: 2 + path: ../../../htdocs/comm/mailing/targetemailing.php + - message: '#^Variable \$filter might not be defined\.$#' identifier: variable.undefined @@ -2307,7 +2325,7 @@ parameters: - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable - count: 1 + count: 3 path: ../../../htdocs/commande/list.php - @@ -2370,6 +2388,18 @@ parameters: count: 1 path: ../../../htdocs/compta/accounting-files.php + - + message: '#^Parameter \#1 \$array of function array_sum expects array, string given\.$#' + identifier: argument.type + count: 2 + path: ../../../htdocs/compta/ajaxpayment.php + + - + message: '#^Parameter \#2 \$array of function array_key_exists expects array, string given\.$#' + identifier: argument.type + count: 1 + path: ../../../htdocs/compta/ajaxpayment.php + - message: '#^Variable \$ve might not be defined\.$#' identifier: variable.undefined @@ -2406,6 +2436,12 @@ parameters: count: 1 path: ../../../htdocs/compta/bank/bankentries_list.php + - + message: '#^Ternary operator condition is always true\.$#' + identifier: ternary.alwaysTrue + count: 2 + path: ../../../htdocs/compta/bank/bankentries_list.php + - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -2694,6 +2730,48 @@ parameters: count: 1 path: ../../../htdocs/compta/cashcontrol/cashcontrol_card.php + - + message: '#^Loose comparison using \=\= between ''close'' and ''close'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 4 + path: ../../../htdocs/compta/cashcontrol/cashcontrol_card.php + + - + message: '#^Loose comparison using \=\= between ''close'' and ''start'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 4 + path: ../../../htdocs/compta/cashcontrol/cashcontrol_card.php + + - + message: '#^Loose comparison using \=\= between ''create''\|''start'' and ''close'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 2 + path: ../../../htdocs/compta/cashcontrol/cashcontrol_card.php + + - + message: '#^Loose comparison using \=\= between ''start'' and ''close'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 2 + path: ../../../htdocs/compta/cashcontrol/cashcontrol_card.php + + - + message: '#^Loose comparison using \=\= between ''start'' and ''start'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/compta/cashcontrol/cashcontrol_card.php + + - + message: '#^Result of && is always false\.$#' + identifier: booleanAnd.alwaysFalse + count: 6 + path: ../../../htdocs/compta/cashcontrol/cashcontrol_card.php + + - + message: '#^Result of \|\| is always true\.$#' + identifier: booleanOr.alwaysTrue + count: 1 + path: ../../../htdocs/compta/cashcontrol/cashcontrol_card.php + - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -3084,6 +3162,12 @@ parameters: count: 2 path: ../../../htdocs/compta/facture/list.php + - + message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' + identifier: empty.variable + count: 2 + path: ../../../htdocs/compta/facture/list.php + - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -3468,12 +3552,24 @@ parameters: count: 1 path: ../../../htdocs/compta/prelevement/create.php + - + message: '#^Loose comparison using \!\= between ''''\|''0''\|''direct\-debit'' and ''bank\-transfer'' will always evaluate to true\.$#' + identifier: notEqual.alwaysTrue + count: 1 + path: ../../../htdocs/compta/prelevement/create.php + - message: '#^Variable \$massaction might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/compta/prelevement/demandes.php + - + message: '#^Loose comparison using \=\= between ''bank\-transfer'' and ''bank\-transfer'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/compta/prelevement/list.php + - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -3492,6 +3588,12 @@ parameters: count: 1 path: ../../../htdocs/compta/recap-compta.php + - + message: '#^Loose comparison using \=\= between ''RECETTES\-DEPENSES'' and ''CREANCES\-DETTES'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 1 + path: ../../../htdocs/compta/resultat/clientfourn.php + - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined @@ -3510,12 +3612,6 @@ parameters: count: 1 path: ../../../htdocs/compta/resultat/index.php - - - message: '#^Variable \$sql might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../../htdocs/compta/resultat/index.php - - message: '#^Call to function is_array\(\) with non\-empty\-array\\}\> will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -3798,12 +3894,24 @@ parameters: count: 1 path: ../../../htdocs/compta/stats/index.php + - + message: '#^Loose comparison using \=\= between ''BOOKKEEPINGCOLLECTED''\|''RECETTES\-DEPENSES'' and ''RECETTES\-DEPENSES'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/compta/stats/supplier_turnover.php + - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse count: 1 path: ../../../htdocs/compta/stats/supplier_turnover.php + - + message: '#^Ternary operator condition is always true\.$#' + identifier: ternary.alwaysTrue + count: 1 + path: ../../../htdocs/compta/stats/supplier_turnover.php + - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined @@ -4101,7 +4209,7 @@ parameters: - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable - count: 1 + count: 6 path: ../../../htdocs/contact/list.php - @@ -9198,12 +9306,6 @@ parameters: count: 3 path: ../../../htdocs/exports/export.php - - - message: '#^Variable \$heightforframes might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/externalsite/frames.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -9924,6 +10026,12 @@ parameters: count: 3 path: ../../../htdocs/holiday/define_holiday.php + - + message: '#^Parameter \#1 \$array of function array_keys expects array, string given\.$#' + identifier: argument.type + count: 1 + path: ../../../htdocs/holiday/define_holiday.php + - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -10248,6 +10356,12 @@ parameters: count: 1 path: ../../../htdocs/hrm/compare.php + - + message: '#^Loose comparison using \=\= between ''edit'' and ''edit'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/hrm/establishment/card.php + - message: '#^Variable \$k might not be defined\.$#' identifier: variable.undefined @@ -10968,6 +11082,12 @@ parameters: count: 1 path: ../../../htdocs/modulebuilder/index.php + - + message: '#^Loose comparison using \=\= between ''objects'' and ''specifications'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 1 + path: ../../../htdocs/modulebuilder/index.php + - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -11574,6 +11694,18 @@ parameters: count: 1 path: ../../../htdocs/opensurvey/results.php + - + message: '#^Parameter \#5 \$day of function dol_mktime expects int, string given\.$#' + identifier: argument.type + count: 2 + path: ../../../htdocs/opensurvey/wizard/choix_date.php + + - + message: '#^Parameter \#5 \$day of function mktime expects int\|null, string given\.$#' + identifier: argument.type + count: 2 + path: ../../../htdocs/opensurvey/wizard/choix_date.php + - message: '#^Left side of && is always false\.$#' identifier: booleanAnd.leftAlwaysFalse @@ -12162,6 +12294,12 @@ parameters: count: 2 path: ../../../htdocs/product/list.php + - + message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' + identifier: empty.variable + count: 1 + path: ../../../htdocs/product/list.php + - message: '#^Loose comparison using \=\= between ''add_customer_price'' and ''add_customer_price'' will always evaluate to true\.$#' identifier: equal.alwaysTrue @@ -12828,6 +12966,12 @@ parameters: count: 1 path: ../../../htdocs/projet/agenda.php + - + message: '#^Loose comparison using \=\= between ''gettasks'' and ''gettasks'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/projet/ajax/projects.php + - message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -13167,7 +13311,7 @@ parameters: - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable - count: 1 + count: 2 path: ../../../htdocs/projet/list.php - @@ -13296,12 +13440,6 @@ parameters: count: 5 path: ../../../htdocs/projet/tasks/list.php - - - message: '#^Loose comparison using \=\= between ''0''\|array\{\} and '''' will always evaluate to false\.$#' - identifier: equal.alwaysFalse - count: 1 - path: ../../../htdocs/projet/tasks/list.php - - message: '#^Loose comparison using \=\= between 0 and 0 will always evaluate to true\.$#' identifier: equal.alwaysTrue @@ -13662,6 +13800,12 @@ parameters: count: 1 path: ../../../htdocs/public/onlinesign/newonlinesign.php + - + message: '#^Loose comparison using \=\= between ''expedition'' and ''expedition'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/public/onlinesign/newonlinesign.php + - message: '#^Negated boolean expression is always false\.$#' identifier: booleanNot.alwaysFalse @@ -14340,12 +14484,6 @@ parameters: count: 1 path: ../../../htdocs/reception/class/reception.class.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../../htdocs/reception/class/receptionlinebatch.class.php - - message: '#^Property ReceptionLineBatch\:\:\$batch \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15168,6 +15306,12 @@ parameters: count: 1 path: ../../../htdocs/societe/consumption.php + - + message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' + identifier: empty.variable + count: 5 + path: ../../../htdocs/societe/list.php + - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -15595,7 +15739,7 @@ parameters: path: ../../../htdocs/takepos/printbox.php - - message: '#^Loose comparison using \!\= between mixed and '''' will always evaluate to true\.$#' + message: '#^Loose comparison using \!\= between non\-empty\-string and '''' will always evaluate to true\.$#' identifier: notEqual.alwaysTrue count: 1 path: ../../../htdocs/takepos/receipt.php @@ -16404,6 +16548,12 @@ parameters: count: 1 path: ../../../htdocs/webhook/target_list.php + - + message: '#^Variable \$mode in empty\(\) always exists and is not falsy\.$#' + identifier: empty.variable + count: 1 + path: ../../../htdocs/webhook/target_list.php + - message: '#^Loose comparison using \=\= between ''auto'' and ''auto'' will always evaluate to true\.$#' identifier: equal.alwaysTrue @@ -16674,12 +16824,42 @@ parameters: count: 2 path: ../../../htdocs/website/index.php + - + message: '#^Loose comparison using \!\= between ''editcss'' and ''createcontainer'' will always evaluate to true\.$#' + identifier: notEqual.alwaysTrue + count: 1 + path: ../../../htdocs/website/index.php + + - + message: '#^Loose comparison using \=\= between ''createcontainer'' and ''createcontainer'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/website/index.php + + - + message: '#^Loose comparison using \=\= between ''createsite'' and ''createcontainer'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 1 + path: ../../../htdocs/website/index.php + + - + message: '#^Loose comparison using \=\= between ''createsite'' and ''createsite'' will always evaluate to true\.$#' + identifier: equal.alwaysTrue + count: 1 + path: ../../../htdocs/website/index.php + - message: '#^Negated boolean expression is always false\.$#' identifier: booleanNot.alwaysFalse count: 1 path: ../../../htdocs/website/index.php + - + message: '#^Result of \|\| is always true\.$#' + identifier: booleanOr.alwaysTrue + count: 2 + path: ../../../htdocs/website/index.php + - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index 430f8c90946..c433043b6c5 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -221,13 +221,13 @@ foreach (array('proj', 'dep') as $source) { $arrayofmetrics[$source]['Bytes'] = $reg[1]; } - if (preg_match('/^(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/', $line, $reg)) { - $arrayoflineofcode[$source][$reg[1]]['Files'] = $reg[2]; - $arrayoflineofcode[$source][$reg[1]]['Lines'] = $reg[3]; - $arrayoflineofcode[$source][$reg[1]]['Blanks'] = $reg[4]; - $arrayoflineofcode[$source][$reg[1]]['Comments'] = $reg[5]; - $arrayoflineofcode[$source][$reg[1]]['Code'] = $reg[6]; - $arrayoflineofcode[$source][$reg[1]]['Complexity'] = $reg[7]; + if (preg_match('/^(.*)\s+([\d,]+)\s+([\d,]+)\s+([\d,]+)\s+([\d,]+)\s+([\d,]+)\s+([\d,]+)$/', $line, $reg)) { + $arrayoflineofcode[$source][$reg[1]]['Files'] = str_replace(array(',', ' '), array('', ''), $reg[2]); + $arrayoflineofcode[$source][$reg[1]]['Lines'] = str_replace(array(',', ' '), array('', ''), $reg[3]); + $arrayoflineofcode[$source][$reg[1]]['Blanks'] = str_replace(array(',', ' '), array('', ''), $reg[4]); + $arrayoflineofcode[$source][$reg[1]]['Comments'] = str_replace(array(',', ' '), array('', ''), $reg[5]); + $arrayoflineofcode[$source][$reg[1]]['Code'] = str_replace(array(',', ' '), array('', ''), $reg[6]); + $arrayoflineofcode[$source][$reg[1]]['Complexity'] = str_replace(array(',', ' '), array('', ''), $reg[7]); } } diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 83a5ac69b64..49e773712bf 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -8,7 +8,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024 Frédéric France * * 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 @@ -69,7 +69,6 @@ $formSetup = new FormSetup($db); // Main options $formSetup->newItem('BANK_DISABLE_DIRECT_INPUT')->setAsYesNo(); - $formSetup->newItem('ACCOUNTANCY_COMBO_FOR_AUX')->setAsYesNo(); $item = $formSetup->newItem('ACCOUNTING_MANAGE_ZERO')->setAsYesNo(); @@ -177,20 +176,27 @@ if ($action == 'updatemode') { } } -if ($action == 'update2') { +if ($action == 'update') { $error = 0; foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); + if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error++; } } - if ($error) { + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } +} + +if ($action == 'update_binding') { + $error = 0; - // option in section binding foreach ($list_binding as $constname) { $constvalue = GETPOST($constname, 'alpha'); @@ -203,16 +209,39 @@ if ($action == 'update2') { } } - // options in section other + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +if ($action == 'update_advanced') { + $error = 0; + if (GETPOSTISSET('ACCOUNTING_LETTERING_NBLETTERS')) { if (!dolibarr_set_const($db, 'ACCOUNTING_LETTERING_NBLETTERS', GETPOST('ACCOUNTING_LETTERING_NBLETTERS'), 'chaine', 0, '', $conf->entity)) { $error++; } } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +if ($action == 'update_export') { + $error = 0; + // Export options $modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV'); + // reload + $configuration = $accountancyexport->getTypeConfig(); + $listparam = $configuration['param']; + if (!empty($modelcsv)) { if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { $error++; @@ -243,12 +272,6 @@ if ($action == 'update2') { } } - if (!$error) { - // reload - $configuration = $accountancyexport->getTypeConfig(); - $listparam = $configuration['param']; - } - if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -483,20 +506,19 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) { print ''; - print '


'; + print '

'; } -// Show form for main parameters +// Show form main options print $formSetup->generateOutput(true); - -print '


'; +print '

'; print '
'; print ''; -print ''; +print ''; print ''; // Binding params @@ -631,12 +653,11 @@ print ''; print ''; print ''; -print '
'; - +print '
'; +print '
'; // Show numbering options -print '


'; - +print '

'; // Accountancy Numbering model $dirmodels = array_merge(array('/'), $conf->modules_parts['models']); @@ -751,13 +772,12 @@ print ''; print ''; // Show advanced options -print '


'; - +print '

'; // Advanced params print '
'; print ''; -print ''; +print ''; print ''; print '
'; @@ -847,12 +867,17 @@ print '
'; print '
'; +print '
'; -print '


'; +print '

'; // Export options +print '
'; +print ''; +print ''; +print ''; print "\n".''."\n"; -// Main Options - print ''; print ''; print ''; @@ -961,7 +984,6 @@ if ($num2) { print '
'; - print ''; // End of page diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f2c11adb4db..463c5cee16d 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -451,44 +451,14 @@ if (empty($reshook)) { } } - if ($action == 'clonebookkeepingwriting' && $permissiontoadd) { + if ($action == 'clonebookkeepingwriting' && $confirm == "yes" && $permissiontoadd) { + // Reread the values sent by the validated form $piece_num = GETPOST('piece_num', 'alpha'); - $formaccounting = new FormAccounting($db); + $journal_code = GETPOST('code_journal', 'alpha'); - $form = new Form($db); - $input1 = $form->selectDate('', 'clonedate', 0, 0, 0, "create_mvt", 1, 1); - $input2 = $formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1).''; - $inputHidden = ''; + // Reconstruct the selected date + $clonedate = dol_mktime(0, 0, 0, GETPOSTINT('clonedatemonth'), GETPOSTINT('clonedateday'), GETPOSTINT('clonedateyear')); - $formquestion = array( - array( - 'type' => 'date', - 'name' => 'clonedate', - 'label' => '' . $langs->trans("Docdate") . '', - 'value' => $input1 - ) - ); - - if (getDolGlobalString('ACCOUNTING_CLONING_ENABLE_INPUT_JOURNAL')) { - $formquestion[] = array( - 'type' => 'text', - 'name' => 'code_journal', - 'label' => '' . $langs->trans("Codejournal") . '', - 'value' => $input2 - ); - } - - print $form->formconfirm( - $_SERVER["PHP_SELF"], - $langs->trans("ConfirmMassCloneBookkeepingWriting"), - $langs->trans("ConfirmMassCloneBookkeepingWritingQuestion", count($toselect)), - "clonebookkeepingwriting", - $formquestion, - '', 0, 300, 1000, 1 - ); - } - - if ($action == 'preclonebookkeepingwriting' && $confirm == "yes" && $permissiontoadd) { $result = $object->newClone($piece_num, $journal_code, $clonedate); if ($result == -1) { @@ -497,7 +467,7 @@ if (empty($reshook)) { if (!$error) { $db->commit(); - header("Location: " . $_SERVER['PHP_SELF'] . "?piece_num=" . $object->getNextNumMvt() - 1); + header("Location: " . $_SERVER['PHP_SELF'] . "?piece_num=" . ($object->getNextNumMvt() - 1)); exit(); } else { $db->rollback(); @@ -635,6 +605,7 @@ if ($action == 'create') { }*/ $head = accounting_transaction_prepare_head($object, $mode, $type, $backtopage); + print dol_get_fiche_head($head, 'transaction', '', -1); //$object->label = $object->doc_ref; @@ -651,6 +622,46 @@ if ($action == 'create') { dol_banner_tab($object, 'ref', $backlink, 1, 'piece_num', 'piece_num', $morehtmlref); + + if ($action == 'clonebookkeepingwriting' && $confirm != 'yes' && $permissiontoadd) { + $piece_num = GETPOST('piece_num', 'alpha'); + $formaccounting = new FormAccounting($db); + + $form = new Form($db); + $input1 = $form->selectDate('', 'clonedate', 0, 0, 0, "", 1, 1); + $input2 = $formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1); + + $formquestion = array( + array( + 'type' => 'other', + 'name' => 'clonedate', + 'label' => '' . $langs->trans("Docdate") . '', + 'value' => $input1 + ) + ); + + $formquestion[] = array('type' => 'hidden', 'name' => 'piece_num', 'value' => $piece_num); + + if (getDolGlobalString('ACCOUNTING_CLONING_ENABLE_INPUT_JOURNAL')) { + $formquestion[] = array( + 'type' => 'text', + 'name' => 'code_journal', + 'label' => '' . $langs->trans("Codejournal") . '', + 'value' => $input2 + ); + } + + print $form->formconfirm( + $_SERVER["PHP_SELF"], + $langs->trans("ConfirmMassCloneBookkeepingWriting"), + $langs->trans("ConfirmMassCloneBookkeepingWritingQuestion", 1), + "clonebookkeepingwriting", + $formquestion, + '', 0, 300, 1000, 0 + ); + } + + print '
'; print '
'; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 18d40dbf836..be93a257d05 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1371,9 +1371,9 @@ class AccountancyExport $end_line = "\n"; // parcours du tableau pour recuperation des numero de compte des tiers pour pouvoir les fournir dans la bonne ligne pour istea - $tiers=[]; + $tiers = []; foreach ($objectLines as $line) { - if ( $line->subledger_account && substr($line->subledger_account, 0, 1) == '4' ) { + if ($line->subledger_account && substr($line->subledger_account, 0, 1) == '4') { $tiers[$line->piece_num] = $line->subledger_label; } } @@ -1394,11 +1394,11 @@ class AccountancyExport $tab[] = $line->piece_num; // colonne 1 : numero de piece ISTEA $tab[] = $date_document; // colonne 2 : date ISTEA $tab[] = $line->doc_ref; // colonne 3 : reference piece ISTEA - $tab[] = array_key_exists($line->piece_num, $tiers)?$tiers[$line->piece_num]:''; // colonne 4 : nom tiers ISTEA - $tab[] = length_accountg(($line->subledger_account && ( substr($line->subledger_account, 0, 2) == substr($line->numero_compte, 0, 2) ) )?$line->subledger_account:$line->numero_compte); // colonne 5 : numero de compte ISTEA - $tab[] = length_accountg($line->subledger_account?$line->subledger_account:$line->numero_compte); // colonne 6 : numero de compte - $tab[] = length_accountg($line->subledger_account?$line->numero_compte:''); // G // colonne 7 : numero de compte principal (divers paiement ou 40100000 ou 41100000) - $tab[] = ($line->doc_type == 'bank')?$label_operation:($line->subledger_account?$line->subledger_label:$line->label_compte); // colonne 8 : label de l'operation ISTEA + $tab[] = array_key_exists($line->piece_num, $tiers) ? $tiers[$line->piece_num] : ''; // colonne 4 : nom tiers ISTEA + $tab[] = length_accountg(($line->subledger_account && (substr($line->subledger_account, 0, 2) == substr($line->numero_compte, 0, 2))) ? $line->subledger_account : $line->numero_compte); // colonne 5 : numero de compte ISTEA + $tab[] = length_accountg($line->subledger_account ? $line->subledger_account : $line->numero_compte); // colonne 6 : numero de compte + $tab[] = length_accountg($line->subledger_account ? $line->numero_compte : ''); // G // colonne 7 : numero de compte principal (divers paiement ou 40100000 ou 41100000) + $tab[] = ($line->doc_type == 'bank') ? $label_operation : ($line->subledger_account ? $line->subledger_label : $line->label_compte); // colonne 8 : label de l'operation ISTEA $tab[] = $label_operation; // colonne 9 : label de l'operation (semble non prise en compte par ISTEA) $tab[] = price2num($line->debit); // colonne 10 : debit ISTEA $tab[] = price2num($line->credit); // colonne 11 : credit ISTEA @@ -1474,6 +1474,7 @@ class AccountancyExport $date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d'); $refInvoice = ''; + $invoice = null; if ($line->doc_type == 'customer_invoice') { // Customer invoice require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -1576,10 +1577,9 @@ class AccountancyExport if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_EXPENSEREPORT_SOURCE_FILE')) { $objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output; } - } elseif ($line->doc_type == 'supplier_invoice') { + } elseif ($line->doc_type == 'supplier_invoice' && $invoice instanceof FactureFournisseur) { if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) { '@phan-var-force FactureFournisseur $invoice'; - /** @var FactureFournisseur $invoice */ $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; $objectDirPath .= '/' . rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); } @@ -1694,6 +1694,7 @@ class AccountancyExport $date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d'); $refInvoice = ''; + $invoice = null; if ($line->doc_type == 'customer_invoice') { // Customer invoice require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -1796,10 +1797,9 @@ class AccountancyExport if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_EXPENSEREPORT_SOURCE_FILE')) { $objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output; } - } elseif ($line->doc_type == 'supplier_invoice') { + } elseif ($line->doc_type == 'supplier_invoice' && $invoice instanceof FactureFournisseur) { if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) { '@phan-var-force FactureFournisseur $invoice'; - /** @var FactureFournisseur $invoice */ $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; $objectDirPath .= '/' . rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); } diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 1fc23654779..6f7b9bc29d9 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -378,15 +378,21 @@ class AccountingJournal extends CommonObject case 1: // Various Journal if (isModEnabled('asset') && !getDolGlobalInt('ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS')) { $tmp = $this->getAssetData($user, $type, $date_start, $date_end, $in_bookkeeping); - if (is_array($tmp)) $data = array_merge($data, $tmp); + if (is_array($tmp)) { + $data = array_merge($data, $tmp); + } } if (isModEnabled('invoice') && !getDolGlobalInt('ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS')) { $tmp = $this->getDiscountCustomer($user, $type, $date_start, $date_end, $in_bookkeeping); - if (is_array($tmp)) $data = array_merge($data, $tmp); + if (is_array($tmp)) { + $data = array_merge($data, $tmp); + } } if (isModEnabled('supplier_invoice') && !getDolGlobalInt('ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS')) { $tmp = $this->getDiscountSupplier($user, $type, $date_start, $date_end, $in_bookkeeping); - if (is_array($tmp)) $data = array_merge($data, $tmp); + if (is_array($tmp)) { + $data = array_merge($data, $tmp); + } } break; // case 2: // Sells Journal @@ -520,7 +526,7 @@ class AccountingJournal extends CommonObject $element = array( 'ref' => dol_trunc($element_static->ref, 16, 'right', 'UTF-8', 1), - 'error' => array_key_exists('error', $pre_data_info) ? $pre_data_info['error'] : '', + 'error' => array_key_exists('error', $pre_data_info) ? $pre_data_info['error'] : '', // @phpstan-ignore-line 'blocks' => array(), ); @@ -745,8 +751,12 @@ class AccountingJournal extends CommonObject $langs->loadLangs(array('bills')); // Clean parameters - if (empty($type)) $type = 'view'; - if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; + if (empty($type)) { + $type = 'view'; + } + if (empty($in_bookkeeping)) { + $in_bookkeeping = 'notyet'; + } // Build SQL - Customer invoices closed by discount $sql = "SELECT f.rowid, f.ref, f.datef, f.fk_soc, f.total_ttc"; @@ -794,7 +804,9 @@ class AccountingJournal extends CommonObject $acc_vat_coll_def = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT'); // Normal to apply vat default account for buy with customer's discount while ($obj = $this->db->fetch_object($resql)) { - if ($invoice_static->fetch((int) $obj->rowid) <= 0) continue; + if ($invoice_static->fetch((int) $obj->rowid) <= 0) { + continue; + } $customer_static->fetch($invoice_static->socid); $account_customer_general = !empty($customer_static->accountancy_code_customer_general) ? $customer_static->accountancy_code_customer_general : getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); @@ -808,18 +820,25 @@ class AccountingJournal extends CommonObject $useddep = (float) price2num($invoice_static->getSumDepositsUsed(), 'MT'); $ttc_inv = (float) price2num($invoice_static->total_ttc, 'MT'); $escompte_ttc = (float) price2num(max(0, $ttc_inv - $paid - $usedcn - $useddep), 'MT'); - if ($escompte_ttc <= 0) continue; + if ($escompte_ttc <= 0) { + continue; + } $bookkeeping_static = new BookKeeping($this->db); $label_discount = $bookkeeping_static->accountingLabelForOperation($customer_static->getNomUrl(1, 'customer'), $invoice_static->ref, $langs->trans('DiscountGranted')); // Distribution including VAT by rate - $ttcByRate = array(); $totalTTC = 0.0; + $ttcByRate = array(); + $totalTTC = 0.0; foreach ((array) $invoice_static->lines as $li) { $ttc = (float) $li->total_ttc; - if (!$ttc) continue; + if (!$ttc) { + continue; + } $key = number_format((float) $li->tva_tx, 3, '.', ''); - if (!isset($ttcByRate[$key])) $ttcByRate[$key] = 0.0; + if (!isset($ttcByRate[$key])) { + $ttcByRate[$key] = 0.0; + } $ttcByRate[$key] += $ttc; $totalTTC += $ttc; } @@ -831,7 +850,7 @@ class AccountingJournal extends CommonObject $element = array( 'ref' => dol_trunc($invoice_static->ref, 16, 'right', 'UTF-8', 1), 'error' => '', - 'blocks'=> array(), + 'blocks' => array(), ); $docdate = $this->db->jdate($obj->datef); @@ -853,10 +872,11 @@ class AccountingJournal extends CommonObject } if ($rate > 0) { - $ht_part = (float) price2num($ttc_part / (1 + $rate/100), 'MT'); + $ht_part = (float) price2num($ttc_part / (1 + $rate / 100), 'MT'); $tva_part = (float) price2num($ttc_part - $ht_part, 'MT'); } else { - $ht_part = $ttc_part; $tva_part = 0.0; + $ht_part = $ttc_part; + $tva_part = 0.0; } // VAT deductible account (by rate if available) @@ -1035,8 +1055,12 @@ class AccountingJournal extends CommonObject $langs->loadLangs(array('suppliers')); // Clean parameters - if (empty($type)) $type = 'view'; - if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; + if (empty($type)) { + $type = 'view'; + } + if (empty($in_bookkeeping)) { + $in_bookkeeping = 'notyet'; + } // SQL - Supplier invoices closed by discount $sql = "SELECT ff.rowid, ff.ref, ff.datef, ff.fk_soc, ff.total_ttc"; @@ -1084,7 +1108,9 @@ class AccountingJournal extends CommonObject $acc_vat_ded_def = getDolGlobalString('ACCOUNTING_VAT_SOLD_ACCOUNT'); // Normal to apply vat default account for sold with supplier's discount while ($obj = $this->db->fetch_object($resql)) { - if ($invoicesupplier_static->fetch((int) $obj->rowid) <= 0) continue; + if ($invoicesupplier_static->fetch((int) $obj->rowid) <= 0) { + continue; + } $supplier_static->fetch($invoicesupplier_static->socid); $account_supplier_general = !empty($supplier_static->accountancy_code_supplier_general) ? $supplier_static->accountancy_code_supplier_general : getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); @@ -1098,33 +1124,45 @@ class AccountingJournal extends CommonObject $useddep = (float) price2num($invoicesupplier_static->getSumDepositsUsed(), 'MT'); $ttc_inv = (float) price2num($invoicesupplier_static->total_ttc, 'MT'); $escompte_ttc = (float) price2num(max(0, $ttc_inv - $paid - $usedcn - $useddep), 'MT'); - if ($escompte_ttc <= 0) continue; + if ($escompte_ttc <= 0) { + continue; + } $bookkeeping_static = new BookKeeping($this->db); $label_discount = $bookkeeping_static->accountingLabelForOperation($supplier_static->getNomUrl(1, 'supplier'), $invoicesupplier_static->ref, $langs->trans('DiscountReceived')); // Distribution including VAT by rate - $ttcByRate = array(); $totalTTC = 0.0; + $ttcByRate = array(); + $totalTTC = 0.0; foreach ((array) $invoicesupplier_static->lines as $li) { $ttc = (float) $li->total_ttc; - if (!$ttc) continue; + if (!$ttc) { + continue; + } $key = number_format((float) $li->tva_tx, 3, '.', ''); - if (!isset($ttcByRate[$key])) $ttcByRate[$key] = 0.0; + if (!isset($ttcByRate[$key])) { + $ttcByRate[$key] = 0.0; + } $ttcByRate[$key] += $ttc; $totalTTC += $ttc; } - if ($totalTTC <= 0) { $ttcByRate = array("0.000" => $escompte_ttc); $totalTTC = $escompte_ttc; } + if ($totalTTC <= 0) { + $ttcByRate = array("0.000" => $escompte_ttc); + $totalTTC = $escompte_ttc; + } $element = array( 'ref' => dol_trunc($invoicesupplier_static->ref, 16, 'right', 'UTF-8', 1), 'error' => '', - 'blocks'=> array(), + 'blocks' => array(), ); $docdate = $this->db->jdate($obj->datef); $docdate_fmt = dol_print_date($docdate, 'day'); - $sumTTC = 0.0; $i = 0; $n = count($ttcByRate); + $sumTTC = 0.0; + $i = 0; + $n = count($ttcByRate); foreach ($ttcByRate as $rateStr => $ttcRateOnInvoice) { $i++; $rate = (float) $rateStr; @@ -1138,9 +1176,12 @@ class AccountingJournal extends CommonObject } if ($rate > 0) { - $ht_part = (float) price2num($ttc_part / (1 + $rate/100), 'MT'); + $ht_part = (float) price2num($ttc_part / (1 + $rate / 100), 'MT'); $tva_part = (float) price2num($ttc_part - $ht_part, 'MT'); - } else { $ht_part = $ttc_part; $tva_part = 0.0; } + } else { + $ht_part = $ttc_part; + $tva_part = 0.0; + } // VAT collected account (by rate if available) // TODO write function to search the same vat code like the supplier invoice @@ -1273,9 +1314,11 @@ class AccountingJournal extends CommonObject } } else { // si TVA = 0, pousser les 2 lignes view/bookkeeping déjà constituées - if ($type == 'view') $element['blocks'][] = $lines_view; - elseif ($type == 'bookkeeping') $element['blocks'][] = $lines_book; - else { // csv + if ($type == 'view') { + $element['blocks'][] = $lines_view; + } elseif ($type == 'bookkeeping') { + $element['blocks'][] = $lines_book; + } else { // csv $element['blocks'][] = array($docdate, $invoicesupplier_static->ref, length_accountg($account_supplier_general), $label_discount.' - '.$langs->transnoentitiesnoconv('Supplier'), price($ttc_part), ''); $element['blocks'][] = array($docdate, $invoicesupplier_static->ref, length_accountg($acc_disc_recv), $label_discount.' ('.$rateStr.'%)', '', price($ht_part)); } diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 068b23b9333..dc65a7cf877 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -929,6 +929,10 @@ class Lettering extends BookKeeping // Save list when is the first step of the recursive recursive function $save_link_by_element = $link_by_element; $save_element_by_link = $element_by_link; + } else { + // To satisfy static analysis (phpstan) + $save_link_by_element = null; + $save_element_by_link = null; } do { diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 44a5031b90a..3d0738f811b 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -146,7 +146,7 @@ if (empty($reshook)) { if ($result > 0) { setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs'); - header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : '')); + header("Location: " . $_SERVER['PHP_SELF'] . '?fiscal_period_id=' . $current_fiscal_period['id']); exit; } else { setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors'); @@ -176,7 +176,7 @@ if (empty($reshook)) { } else { setEventMessages($langs->trans("AccountancyClosureCloseSuccessfully"), null, 'mesgs'); - header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : '')); + header("Location: " . $_SERVER['PHP_SELF'] . '?fiscal_period_id=' . $current_fiscal_period['id']); exit; } } @@ -192,7 +192,7 @@ if (empty($reshook)) { } else { setEventMessages($langs->trans("AccountancyClosureInsertAccountingReversalSuccessfully"), null, 'mesgs'); - header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : '')); + header("Location: " . $_SERVER['PHP_SELF'] . '?fiscal_period_id=' . $current_fiscal_period['id']); exit; } } @@ -345,7 +345,7 @@ $fiscal_period_nav_text = $langs->trans("FiscalPeriod"); $fiscal_period_nav_text .= ' ' . img_previous() . ''; $fiscal_period_nav_text .= ' ' . img_next() . ''; if (!empty($current_fiscal_period)) { - $fiscal_period_nav_text .= $current_fiscal_period['label'].'  (' . (isset($current_fiscal_period) ? dol_print_date($current_fiscal_period['date_start'], 'day') . ' - ' . dol_print_date($current_fiscal_period['date_end'], 'day') . ')' : ''); + $fiscal_period_nav_text .= $current_fiscal_period['label'].'  (' . dol_print_date($current_fiscal_period['date_start'], 'day') . ' - ' . dol_print_date($current_fiscal_period['date_end'], 'day') . ')'; } print load_fiche_titre($langs->trans("Closure") . " - " . $fiscal_period_nav_text, '', 'title_accountancy'); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 286bfa61852..892c80528d8 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -583,7 +583,7 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! print '"'.$date.'"'.$sep; print '"'.$val["ref"].'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; - print '"'.csvClean($bookkeepingstatic->accountingLabelForOperation($userstatic->name, '', $langs->trans("VAT").implode($def_tva[$key][$k]).' %')).'"'.$sep; + print '"'.csvClean($bookkeepingstatic->accountingLabelForOperation($userstatic->name, '', $langs->trans("VAT").(isset($def_tva[$key]) ? implode($def_tva[$key][$k]) : '').' %')).'"'.$sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'; print "\n"; diff --git a/htdocs/accountancy/journal/treasuryjournal.php b/htdocs/accountancy/journal/treasuryjournal.php index f0719747b83..f780a1c26f9 100644 --- a/htdocs/accountancy/journal/treasuryjournal.php +++ b/htdocs/accountancy/journal/treasuryjournal.php @@ -10,6 +10,7 @@ * Copyright (C) 2017-2025 Frédéric France * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2025 Hannes Hieronimi + * Copyright (C) 2025 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 @@ -1206,15 +1207,15 @@ if ($action == 'writebookkeeping' /* && $user->hasRight('accounting', 'bind', 'w $accountingAccountInfos = $tabaccountingaccount[$accountancy_code]; if ($idx < $nb_operation) { $amount = price2num($payment_total_ht * $operation['total_ht'] / $objectInfos['total_ht'], 'MT'); - $total_operation += $amount; + $total_operation += (float) $amount; } else { $amount = $payment_total_ht - $total_operation; } - $total_check -= $amount; + $total_check -= (float) $amount; $bookkeepingToCreate = new BookKeeping($db); //$result = $bookkeepingToCreate->createFromValues($payment["date"], $objectInfos['ref'], 'bank', $payment_id, $objectInfos['id'], $accountancy_code, $accountingAccountInfos['label'], (!empty($operation['label']) ? $operation['label'] : $accountingAccountInfos['label']), -$amount, $journal, $journal_label, ''); - $result = $bookkeepingToCreate->createFromValues($payment["date"], $objectInfos['ref'], 'bank', $payment_id, 0, $accountancy_code, $accountingAccountInfos['label'], (!empty($operation['label']) ? $operation['label'] : $accountingAccountInfos['label']), -$amount, $journal, $journal_label, ''); + $result = $bookkeepingToCreate->createFromValues($payment["date"], $objectInfos['ref'], 'bank', $payment_id, 0, $accountancy_code, $accountingAccountInfos['label'], (!empty($operation['label']) ? $operation['label'] : $accountingAccountInfos['label']), - (float) $amount, $journal, $journal_label, ''); if ($result < 0) { $errorforline++; @@ -1482,11 +1483,11 @@ if (empty($action) || $action == 'view') { if (!empty($operation['total_ht'])) { if ($idx < $nb_operation) { $value = price2num($payment_total_ht * $operation['total_ht'] / $objectInfos['total_ht'], 'MT'); - $total_operation += $value; + $total_operation += (float) $value; } else { $value = $payment_total_ht - $total_operation; } - FormAccounting::printJournalLine($langs, $date, $objectInfos['url'], $accountancy_code, (!empty($operation['label']) ? $operation['label'] : $accountingAccountInfos['label']), $payment['type_payment'], -$value); + FormAccounting::printJournalLine($langs, $date, $objectInfos['url'], $accountancy_code, (!empty($operation['label']) ? $operation['label'] : $accountingAccountInfos['label']), $payment['type_payment'], - (float) $value); } $idx++; } diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index f35d7703d97..8f1ed6549f3 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -98,7 +98,7 @@ class Subscription extends CommonObject public $fk_bank; /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/admin/remotestore/class/externalModules.class.php b/htdocs/admin/remotestore/class/externalModules.class.php index a7ca35f2f85..6a9d38dbe0d 100644 --- a/htdocs/admin/remotestore/class/externalModules.class.php +++ b/htdocs/admin/remotestore/class/externalModules.class.php @@ -105,6 +105,11 @@ class ExternalModules */ public $githubFileError; + /** + * @var string + */ + public $error; + /** * @var int // number of online providers */ @@ -130,11 +135,6 @@ class ExternalModules */ public $numberOfProducts; - /** - * @var string - */ - public $error; - /** * Constructor * diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index 134411cba77..daa18c7cfb7 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * 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 @@ -60,8 +60,14 @@ if (!$user->admin) { } $moduledir = 'workstation'; -$myTmpObjects = array(); -$myTmpObjects['workstation'] = array('label' => 'Workstation', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'Workstation'); +$myTmpObjects = [ + 'workstation' => [ + 'label' => 'Workstation', + 'includerefgeneration' => 1, + 'includedocgeneration' => 0, + 'class' => 'Workstation', + ], +]; $tmpobjectkey = GETPOST('object', 'aZ09'); if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) { @@ -97,9 +103,7 @@ if ($action == 'updateMask') { } elseif ($action == 'specimen') { $modele = GETPOST('module', 'alpha'); - $nameofclass = ucfirst($tmpobjectkey); - $tmpobject = new $nameofclass($db); - '@phan-var-force Workstation $tmpobject'; + $tmpobject = new Workstation($db); $tmpobject->initAsSpecimen(); // Search template files @@ -359,6 +363,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { require_once $dir.'/'.$file; $module = new $classname($db); '@phan-var-force ModelePDFWorkstation $module'; + /** @var ModelePDFWorkstation $module */ $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -441,9 +446,6 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } } -/*if (empty($setupnotempty)) { - print '
'.$langs->trans("NothingToSetup"); -}*/ // Page end print dol_get_fiche_end(); diff --git a/htdocs/api/index.php b/htdocs/api/index.php index b4919f3d038..214f6fd9c64 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -255,6 +255,8 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $ $modulenameforenabled = 'supplier_proposal'; } elseif ($module == 'ficheinter') { $modulenameforenabled = 'intervention'; + } elseif ($module == 'product' && !isModEnabled('product') && isModEnabled('service')) { + $modulenameforenabled = 'service'; } dol_syslog("Found module file ".$file." - module=".$module." - modulenameforenabled=".$modulenameforenabled." - moduledirforclass=".$moduledirforclass); diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 8da8096ac7a..0d639faa994 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -103,7 +103,7 @@ class Asset extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index 437ecb7d56e..422254ef056 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Jose * Copyright (C) 2025 Frédéric France * @@ -67,7 +67,7 @@ class AssetDepreciationOptions extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index a53e838dfe6..6b62ba7532f 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Open-Dsi * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -89,7 +89,7 @@ class AssetModel extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/blockedlog/admin/filecheck.php b/htdocs/blockedlog/admin/filecheck.php index 4133ccebc21..6e63934c90f 100644 --- a/htdocs/blockedlog/admin/filecheck.php +++ b/htdocs/blockedlog/admin/filecheck.php @@ -61,7 +61,13 @@ llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-admin page-system_filecheck'); print load_fiche_titre($langs->trans("FileCheckDolibarr"), '', 'title_setup'); -print '
'.$langs->trans("FileCheckDesc").'


'; +print '
'.$langs->trans("FileCheckDesc"); +if (isModEnabled('blockedlog')) { + $s = $langs->trans("DataIntegrityDesc", '{s}'); + $s = str_replace('{s}', DOL_URL_ROOT.'/blockedlog/admin/blockedlog_list.php', $s); + print '
'.$s; +} +print'


'; // Version print '
'; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 8f2e49d4c3d..640df709400 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -105,7 +105,7 @@ class BOM extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/bom/class/bomline.class.php b/htdocs/bom/class/bomline.class.php index 9543ff6825b..83e0ed88e37 100644 --- a/htdocs/bom/class/bomline.class.php +++ b/htdocs/bom/class/bomline.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2023 Benjamin Falière * Copyright (C) 2023 Charlene Benke * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify @@ -80,7 +80,7 @@ class BOMLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'LineID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index 74860e5f3c6..0b3bc287e5e 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -49,7 +49,7 @@ class Availabilities extends CommonObject public $TRIGGER_PREFIX = 'AVAILABILITIES'; /** - * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. + * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. */ public $table_element = 'bookcal_availabilities'; @@ -105,7 +105,7 @@ class Availabilities extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index 42e155310e7..94c47006ada 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -105,7 +105,7 @@ class Calendar extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'right', 'comment' => "Id"), diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 14e776d0cd2..f54566d6cdd 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -177,8 +177,8 @@ class Categorie extends CommonObject 'invoice' => 'Facture', 'supplier_order' => 'CommandeFournisseur', 'supplier_invoice' => 'FactureFournisseur', - 'supplier_proposal' => 'SupplierProposal', - 'propal' => 'Propal', + 'supplier_proposal' => 'SupplierProposal', + 'propal' => 'Propal' ); /** @@ -205,8 +205,8 @@ class Categorie extends CommonObject 'invoice' => 'Invoices', 'supplier_order' => 'SuppliersOrders', 'supplier_invoice' => 'SuppliersInvoices', - 'propal' => 'Proposals', - 'supplier_proposal' => 'SupplierProposals', + 'propal' => 'Proposals', + 'supplier_proposal' => 'SupplierProposals' ); /** diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 68d90d58c6c..93f2468e0f4 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -71,7 +71,7 @@ class ActionCommReminder extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 67eb7d3b6d0..75b7377d456 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -54,7 +54,8 @@ require_once DOL_DOCUMENT_ROOT.'/subtotals/class/commonsubtotal.class.php'; */ class Propal extends CommonObject { - use CommonIncoterm, CommonSubtotal; + use CommonIncoterm; + use CommonSubtotal; /** * @var string code @@ -364,7 +365,7 @@ class Propal extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5d4654807fb..c1c5e4e67b4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -319,7 +319,7 @@ class Commande extends CommonOrder // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -3806,7 +3806,7 @@ class Commande extends CommonOrder 'mode' => $mode, 'billed' => $billed, 'donotshowbilled' => $donotshowbilled, - 'paramsBadge' =>& $paramsBadge + 'paramsBadge' => & $paramsBadge ); $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook diff --git a/htdocs/commande/class/orderline.class.php b/htdocs/commande/class/orderline.class.php index 93de4c0c425..09faf3fbcfb 100644 --- a/htdocs/commande/class/orderline.class.php +++ b/htdocs/commande/class/orderline.class.php @@ -154,7 +154,7 @@ class OrderLine extends CommonOrderLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 3302870c7f6..8cd8008bee6 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -486,17 +486,14 @@ if ($search_status != '') { $sql .= ' AND c.fk_statut = '.((int) $search_status); // draft, validated, in process or canceled } } - if ($search_status == -2) { // To process + if ($search_status == -2) { // "validated + in progress" //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; - $sql .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected + $sql .= " AND c.fk_statut IN (1,2)"; } - if ($search_status == -3) { // To bill + if ($search_status == -3) { // "validated + in progress + shipped" //$sql.= ' AND c.fk_statut in (1,2,3)'; //$sql.= ' AND c.facture = 0'; // invoice not created - $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed - } - if ($search_status == -4) { // "validate and in progress" - $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process + $sql .= ' AND c.fk_statut IN (1,2,3)'; // validated, in process or closed } } @@ -729,9 +726,6 @@ if ($resql) { if ($search_status == -3) { $title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('shipping') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); } - if ($search_status == -4) { - $title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"); - } $num = $db->num_rows($resql); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index b023e240dc7..285a861ebfb 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -348,7 +348,7 @@ class Account extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 24dd0668443..944e24be9a0 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -198,7 +198,7 @@ class PaymentVarious extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( // TODO: fill this array diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 47f8dc8da9a..676f2a1293f 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -406,7 +406,7 @@ if ($resql) { print '
'; print '
'.price($cash).'
'; } - if (!$summaryonly && $object->status == $object::STATUS_VALIDATED && $newcash != $object->cash) { + if (!$summaryonly && $object->status == $object::STATUS_VALIDATED && price2num($newcash) != price2num($object->cash)) { print '
<> '.$langs->trans("Declared").': '.price($object->cash).'
'; } print "
"; @@ -415,7 +415,7 @@ if ($resql) { print $langs->trans("PaymentTypeCHQ").(!empty($transactionspertype['CHQ']) ? ' ('.$transactionspertype['CHQ'].' '.$langs->trans("Articles").')' : '').' : '; print '
'; print '
'.price($cheque).'
'; - if (!$summaryonly && $object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) { + if (!$summaryonly && $object->status == $object::STATUS_VALIDATED && price2num($cheque) != price2num($object->cheque)) { print '
<> '.$langs->trans("Declared").' : '.price($object->cheque).'
'; } print "
"; @@ -424,7 +424,7 @@ if ($resql) { print $langs->trans("PaymentTypeCB").(!empty($transactionspertype['CB']) ? ' ('.$transactionspertype['CB'].' '.$langs->trans("Articles").')' : '').' : '; print '
'; print '
'.price($bank).'
'; - if (!$summaryonly && $object->status == $object::STATUS_VALIDATED && $bank != $object->card) { + if (!$summaryonly && $object->status == $object::STATUS_VALIDATED && price2num($bank) != price2num($object->card)) { print '
<> '.$langs->trans("Declared").': '.price($object->card).'
'; } print "
"; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 1fd4776213c..2e91b4e2c7a 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -395,6 +395,7 @@ class Invoices extends DolibarrApi * * @throws RestException 400 * @throws RestException 401 + * @throws RestException 403 Access not allowed for login * @throws RestException 404 * @throws RestException 405 */ @@ -411,6 +412,9 @@ class Invoices extends DolibarrApi if (empty($orderid)) { throw new RestException(400, 'Order ID is mandatory'); } + if (!DolibarrApi::_checkAccessToResource('commande', $orderid)) { + throw new RestException(403, 'Access not allowed on order for login '.DolibarrApiAccess::$user->login); + } $order = new Commande($this->db); $result = $order->fetch($orderid); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 2cc31821a3e..9c61b02b7a3 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -248,7 +248,7 @@ class FactureRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fc803820783..755459a8529 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -310,7 +310,7 @@ class Facture extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 1), @@ -4226,7 +4226,7 @@ class Facture extends CommonInvoice if (empty($fk_prev_id)) { $fk_prev_id = 'null'; } - if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { + if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') { // INVOICE_USE_SITUATION = 2 - Lines situation percent on new lines must be 0 (No cumulative) if ($this->isSituationInvoice() && getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { $situation_percent = 0; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index ebcd51defc6..d3875eed102 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -868,6 +868,7 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Status if (!empty($arrayfields['p.statut']['checked'])) { print '
'; - if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { - if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT p.rowid as rowid, p.ref as project_ref, sum(d.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON d.fk_projet = p.rowid"; - $sql .= " WHERE d.entity IN (".getEntity('donation').")"; - $sql .= " AND d.fk_statut in (1,2)"; - } else { - $sql = "SELECT p.rowid as rowid, p.ref as project_ref, sum(d.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = d.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON d.fk_projet = p.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; - $sql .= " WHERE d.entity IN (".getEntity('donation').")"; - $sql .= " AND d.fk_statut >= 2"; - } - if (!empty($date_start)) { - $sql .= " AND d.datedon >= '".$db->idate($date_start)."'"; - } - if (!empty($date_end)) { - $sql .= " AND d.datedon <= '".$db->idate($date_end)."'"; - } + if ($modecompta == 'CREANCES-DETTES') { + $sql = "SELECT p.rowid as rowid, p.ref as project_ref, sum(d.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON d.fk_projet = p.rowid"; + $sql .= " WHERE d.entity IN (".getEntity('donation').")"; + $sql .= " AND d.fk_statut in (1,2)"; + } else { + $sql = "SELECT p.rowid as rowid, p.ref as project_ref, sum(d.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = d.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON d.fk_projet = p.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; + $sql .= " WHERE d.entity IN (".getEntity('donation').")"; + $sql .= " AND d.fk_statut >= 2"; + } + if (!empty($date_start)) { + $sql .= " AND d.datedon >= '".$db->idate($date_start)."'"; + } + if (!empty($date_end)) { + $sql .= " AND d.datedon <= '".$db->idate($date_end)."'"; } $sql .= " GROUP BY p.rowid, p.ref"; $newsortfield = $sortfield; @@ -635,57 +632,54 @@ if (isModEnabled('invoice') && ($modecompta == 'CREANCES-DETTES' || $modecompta /* * Salaries */ - if (isModEnabled('salaries')) { echo ''; - if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { - if ($modecompta == 'CREANCES-DETTES') { - $column = 's.dateep'; // We use the date of end of period of salary + if ($modecompta == 'CREANCES-DETTES') { + $column = 's.dateep'; // We use the date of end of period of salary - $sql = "SELECT p.rowid as rowid, p.ref as project_ref, sum(s.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."salary as s"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON s.fk_projet = p.rowid"; - $sql .= " WHERE s.entity IN (".getEntity('salary').")"; - if (!empty($date_start)) { - $sql .= " AND ".$db->sanitize($column)." >= '".$db->idate($date_start)."'"; - } - if (!empty($date_end)) { - $sql .= " AND ".$db->sanitize($column)." <= '".$db->idate($date_end)."'"; - } - } else { - $column = 'ps.datep'; + $sql = "SELECT p.rowid as rowid, p.ref as project_ref, sum(s.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON s.fk_projet = p.rowid"; + $sql .= " WHERE s.entity IN (".getEntity('salary').")"; + if (!empty($date_start)) { + $sql .= " AND ".$db->sanitize($column)." >= '".$db->idate($date_start)."'"; + } + if (!empty($date_end)) { + $sql .= " AND ".$db->sanitize($column)." <= '".$db->idate($date_end)."'"; + } + } else { + $column = 'ps.datep'; - $sql = "SELECT pr.rowid as rowid, pr.ref as project_ref, sum(ps.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as ps"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid = ps.fk_salary"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON s.fk_projet = pr.rowid"; - $sql .= " WHERE ps.entity IN (".getEntity('payment_salary').")"; - if (!empty($date_start)) { - $sql .= " AND ".$db->sanitize($column)." >= '".$db->idate($date_start)."'"; - } - if (!empty($date_end)) { - $sql .= " AND ".$db->sanitize($column)." <= '".$db->idate($date_end)."'"; - } + $sql = "SELECT pr.rowid as rowid, pr.ref as project_ref, sum(ps.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as ps"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid = ps.fk_salary"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON s.fk_projet = pr.rowid"; + $sql .= " WHERE ps.entity IN (".getEntity('payment_salary').")"; + if (!empty($date_start)) { + $sql .= " AND ".$db->sanitize($column)." >= '".$db->idate($date_start)."'"; } - - - $sql .= " GROUP BY rowid, project_ref"; - $newsortfield = $sortfield; - if ($newsortfield == 's.nom, s.rowid') { - $newsortfield = 'project_ref'; + if (!empty($date_end)) { + $sql .= " AND ".$db->sanitize($column)." <= '".$db->idate($date_end)."'"; } - if ($newsortfield == 'amount_ht') { - $newsortfield = 'amount'; - } - if ($newsortfield == 'amount_ttc') { - $newsortfield = 'amount'; - } - $sql .= $db->order($newsortfield, $sortorder); } + + $sql .= " GROUP BY rowid, project_ref"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') { + $newsortfield = 'project_ref'; + } + if ($newsortfield == 'amount_ht') { + $newsortfield = 'amount'; + } + if ($newsortfield == 'amount_ttc') { + $newsortfield = 'amount'; + } + $sql .= $db->order($newsortfield, $sortorder); + dol_syslog("by project, get salaries"); $result = $db->query($sql); $subtotal_ht = 0; @@ -750,44 +744,41 @@ if (isModEnabled('invoice') && ($modecompta == 'CREANCES-DETTES' || $modecompta /* * Expense report */ - if (isModEnabled('expensereport')) { - if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { - $langs->load('trips'); - if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT ed.rowid as rowid, ed.fk_projet, p.rowid as project_rowid, p.ref as project_ref, sum(ed.total_ht) as amount_ht, sum(ed.total_ttc) as amount_ttc"; - $sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as ed"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport as e ON ed.fk_expensereport = e.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON ed.fk_projet = p.rowid"; - $sql .= " WHERE e.entity IN (".getEntity('expensereport').")"; - $sql .= " AND e.fk_statut >= 5"; + $langs->load('trips'); + if ($modecompta == 'CREANCES-DETTES') { + $sql = "SELECT ed.rowid as rowid, ed.fk_projet, p.rowid as project_rowid, p.ref as project_ref, sum(ed.total_ht) as amount_ht, sum(ed.total_ttc) as amount_ttc"; + $sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as ed"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport as e ON ed.fk_expensereport = e.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON ed.fk_projet = p.rowid"; + $sql .= " WHERE e.entity IN (".getEntity('expensereport').")"; + $sql .= " AND e.fk_statut >= 5"; - $column = 'e.date_valid'; - } else { - $sql = "SELECT ed.rowid as rowid, ed.fk_projet, p.rowid as project_rowid, p.ref as project_ref, sum(DISTINCT pe.amount) as amount_ht, sum(DISTINCT pe.amount) as amount_ttc"; - $sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as ed"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport as e ON ed.fk_expensereport = e.rowid"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = e.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON ed.fk_projet = p.rowid"; - $sql .= " WHERE e.entity IN (".getEntity('expensereport').")"; - $sql .= " AND e.fk_statut >= 5"; + $column = 'e.date_valid'; + } else { + $sql = "SELECT ed.rowid as rowid, ed.fk_projet, p.rowid as project_rowid, p.ref as project_ref, sum(DISTINCT pe.amount) as amount_ht, sum(DISTINCT pe.amount) as amount_ttc"; + $sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as ed"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport as e ON ed.fk_expensereport = e.rowid"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = e.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON ed.fk_projet = p.rowid"; + $sql .= " WHERE e.entity IN (".getEntity('expensereport').")"; + $sql .= " AND e.fk_statut >= 5"; - $column = 'pe.datep'; - } - if (!empty($date_start)) { - $sql .= " AND ".$db->sanitize($column)." >= '".$db->idate($date_start)."'"; - } - if (!empty($date_end)) { - $sql .= " AND ".$db->sanitize($column)." <= '".$db->idate($date_end)."'"; - } - - $sql .= " GROUP BY ed.rowid, ed.fk_projet, p.rowid, p.ref"; - $newsortfield = $sortfield; - if ($newsortfield == 's.nom, s.rowid') { - $newsortfield = 'project_ref'; - } - $sql .= $db->order($newsortfield, $sortorder); + $column = 'pe.datep'; } + if (!empty($date_start)) { + $sql .= " AND ".$db->sanitize($column)." >= '".$db->idate($date_start)."'"; + } + if (!empty($date_end)) { + $sql .= " AND ".$db->sanitize($column)." <= '".$db->idate($date_end)."'"; + } + + $sql .= " GROUP BY ed.rowid, ed.fk_projet, p.rowid, p.ref"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') { + $newsortfield = 'project_ref'; + } + $sql .= $db->order($newsortfield, $sortorder); echo ''; @@ -860,8 +851,7 @@ if (isModEnabled('invoice') && ($modecompta == 'CREANCES-DETTES' || $modecompta * Various Payments */ //$conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY = 1; - - if (getDolGlobalString('ACCOUNTING_REPORTS_INCLUDE_VARPAY') && isModEnabled("bank") && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { + if (getDolGlobalString('ACCOUNTING_REPORTS_INCLUDE_VARPAY') && isModEnabled("bank")) { $subtotal_ht = 0; $subtotal_ttc = 0; @@ -953,8 +943,7 @@ if (isModEnabled('invoice') && ($modecompta == 'CREANCES-DETTES' || $modecompta /* * Payment Loan */ - - if (getDolGlobalString('ACCOUNTING_REPORTS_INCLUDE_LOAN') && isModEnabled('don') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { + if (getDolGlobalString('ACCOUNTING_REPORTS_INCLUDE_LOAN') && isModEnabled('don')) { $subtotal_ht = 0; $subtotal_ttc = 0; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 67cfffcf8f5..851f4d86ea2 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2017 Olivier Geffroy - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 Benjamin B. * Copyright (C) 2024 MDW * diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 3a8186043ed..c190825cb24 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -257,7 +257,7 @@ class Contrat extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -1271,7 +1271,9 @@ class Contrat extends CommonObject // Delete record into ECM index and physically if (!$error) { $res = $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive - if ($res) $res = $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive + if ($res) { + $res = $this->deleteEcmFiles(1); + } // Deleting files physically is done later with the dol_delete_dir_recursive if (!$res) { $error++; } diff --git a/htdocs/contrat/class/contratligne.class.php b/htdocs/contrat/class/contratligne.class.php index 18c36bcc622..5a670089b9f 100644 --- a/htdocs/contrat/class/contratligne.class.php +++ b/htdocs/contrat/class/contratligne.class.php @@ -202,7 +202,7 @@ class ContratLigne extends CommonObjectLine public $fk_remise_except; /** - * @var float $subprice Unit price before taxes + * @var float Unit price before taxes */ public $subprice; @@ -280,7 +280,7 @@ class ContratLigne extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 905065b041a..6a212ce5358 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -63,7 +63,7 @@ class Ccountry extends CommonDict /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> */ public $fields = array( 'label' => array('type' => 'varchar(250)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 15, 'notnull' => -1, 'showoncombobox' => 1) diff --git a/htdocs/core/class/cemailtemplate.class.php b/htdocs/core/class/cemailtemplate.class.php index f40791085e4..187b09603b2 100644 --- a/htdocs/core/class/cemailtemplate.class.php +++ b/htdocs/core/class/cemailtemplate.class.php @@ -45,7 +45,7 @@ class CEmailTemplate extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( "rowid" => array("type" => "integer", "label" => "TechnicalID", 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => -1,), @@ -280,7 +280,7 @@ class CEmailTemplate extends CommonObject $sql .= " ".((int) $this->datec).","; } $sql .= " '".$this->db->escape($this->label)."',"; - $sql .= " ".((int) $this->position).", ".((int) $this->defaultfortype ).","; + $sql .= " ".((int) $this->position).", ".((int) $this->defaultfortype).","; if (is_null($this->enabled)) { $sql .= " 1,"; } else { @@ -497,7 +497,7 @@ class CEmailTemplate extends CommonObject public function apifetch($id, $label = '') { // Check parameters - if (($id ==0 || empty($id)) && empty($label)) { + if (($id == 0 || empty($id)) && empty($label)) { dol_syslog(get_class($this)."::apifetch id and label are empty", LOG_DEBUG); $this->error = 'id='.$id.' and label are empty'; return -1; diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index 02ac56013cd..779da1866c9 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Florian HENRY * Copyright (C) 2021-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -76,7 +76,7 @@ class DefaultValues extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 87e4502fc9d..e6f55b92f7c 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -87,7 +87,7 @@ class EmailSenderProfile extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 1a581c464e6..9db9ad014c4 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2023 William Mead * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -127,7 +127,7 @@ class Events // extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e8855c426ce..1fde2676b91 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3046,8 +3046,9 @@ class Form $out .= ''; // it's needed when to get parent value when extra-field list depend on parent extra-field list } print ''; diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index d8f9c426919..dd37af32adc 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -204,7 +204,7 @@ if (!empty($captcha)) { } // List of directories where we can find captcha handlers - $dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), is_array($conf->modules_parts['captcha']) ? $conf->modules_parts['captcha'] : array()); + $dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), ((isset($conf->modules_parts['captcha']) && is_array($conf->modules_parts['captcha'])) ? $conf->modules_parts['captcha'] : array())); $fullpathclassfile = ''; foreach ($dirModCaptcha as $dir) { $fullpathclassfile = dol_buildpath($dir."modCaptcha".ucfirst($captcha).'.class.php', 0, 2); diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index 13087a12914..3d7b1a3f1ff 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2008-2017 Laurent Destailleur * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2015-2024 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -135,7 +135,7 @@ if ($action == 'add' && $permissiontoadd) { header("Location: ".$backtopage); exit; } else { - header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'.($module ? '&module='.$module : '')); + header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager&module='.$module); exit; } } diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index 9f04478effe..97e3ce04f99 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -50,9 +50,9 @@ $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); -$module = GETPOST('module', 'alpha'); +$module = GETPOST('module', 'alpha'); $website = GETPOST('website', 'alpha'); -$pageid = GETPOSTINT('pageid'); +$pageid = GETPOSTINT('pageid'); if (empty($module)) { $module = 'ecm'; } @@ -465,16 +465,16 @@ if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') { print '
'; if ($permissiontoadd) { - print ''.$langs->trans('Edit').''; + print ''.$langs->trans('Edit').''; } if ($permissiontoadd) { - print ''.$langs->trans('ECMAddSection').''; + print ''.$langs->trans('ECMAddSection').''; } else { print ''.$langs->trans('ECMAddSection').''; } - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().($module ? '&module='.urlencode($module) : '').'§ion='.urlencode($section).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&module='.urlencode($module).'§ion='.urlencode($section).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), '', $permissiontoadd); print '
'; } @@ -497,7 +497,7 @@ if ($action == 'delete' || $action == 'delete_dir') { ); } - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST('section', 'alpha')).($module ? '&module='.$module : '').($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST('section', 'alpha')).'&module='.$module.($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1); } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 201f049e891..481d9aa7b84 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -110,7 +110,7 @@ class EmailCollector extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -2, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1), diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index f98f4bc2f40..0d4ce65ae4f 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2025 Vincent de Grandpré * * This program is free software; you can redistribute it and/or modify @@ -70,7 +70,7 @@ class EmailCollectorAction extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 1783e490d7e..6b739da1309 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2025 Vincent de Grandpré * * This program is free software; you can redistribute it and/or modify @@ -72,7 +72,7 @@ class EmailCollectorFilter extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index bf4f22327f3..6ffb6ee6662 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -100,7 +100,7 @@ class ConferenceOrBooth extends ActionComm // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'id' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index ae36ded4b35..47ed31e66f7 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -86,7 +86,7 @@ class ConferenceOrBoothAttendee extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 4edefe33147..f28cda8d996 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -88,7 +88,7 @@ class Expedition extends CommonObject /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -565,7 +565,9 @@ class Expedition extends CommonObject if ($line_id <= 0) { $error++; } - if (isset($kits_list[$line->fk_product])) $kits_id_cached[$line->fk_product] = $line_id; + if (isset($kits_list[$line->fk_product])) { + $kits_id_cached[$line->fk_product] = $line_id; + } } else { // with batch management if ($this->create_line_batch($line, $line->array_options) <= 0) { $error++; @@ -1045,9 +1047,9 @@ class Expedition extends CommonObject // Change status of order to "shipment in process" $triggerKey = 'SHIPPING_'; // Because when the trigger is fired the object is a shipping and not the real target object, so I add a prefix like SHIPPING_ to avoid confusion if ($this->origin == 'commande') { - $triggerKey.= 'ORDER_SHIPMENTONPROCESS'; + $triggerKey .= 'ORDER_SHIPMENTONPROCESS'; } else { - $triggerKey.= strtoupper($this->origin).'_SHIPMENTONPROCESS'; + $triggerKey .= strtoupper($this->origin).'_SHIPMENTONPROCESS'; } // TODO : load the origin object to trigger the right setStatus according to origin object @@ -1276,7 +1278,7 @@ class Expedition extends CommonObject } /** - * Add a simple expedition line. + * Add a simple expedition line. * * @param float $qty Quantity * @param string $element_type Element type @@ -2809,7 +2811,7 @@ class Expedition extends CommonObject if ($resql) { while ($obj = $this->db->fetch_object($resql)) { $label = $langs->trans('SendingMethod'.$obj->code); - $this->listmeths[$i]= [ + $this->listmeths[$i] = [ 'rowid' => (int) $obj->rowid, 'code' => $obj->code, 'libelle' => ($label != 'SendingMethod'.$obj->code ? $label : $obj->label), diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 42e8c4abd46..dcde04cc373 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2017 Pierre-Henry Favre - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -73,7 +73,7 @@ class ExpenseReportIk extends CommonObject /** * Attribute object linked with database - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'index' => 1, 'visible' => -1, 'position' => 10), diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index 61d087300ec..4e124922f34 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2017 Pierre-Henry Favre - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -110,7 +110,7 @@ class ExpenseReportRule extends CommonObject /** * Attribute object linked with database - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'index' => 1, 'label' => 'ID', 'enabled' => 1, 'visible' => -1, 'position' => 10), diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 55dd1e3f7b4..3822d62ce7b 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -265,7 +265,7 @@ class FactureFournisseurRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 05c62e8384e..fec0574aea8 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -730,6 +730,11 @@ while ($i < $imaxinloop) { } } + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print '
'."\n"; } + $i++; } diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 93f0ee57bcb..343a016f596 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -92,7 +92,7 @@ class Evaluation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index d6eae5b9c20..8b084caf91e 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -96,7 +96,7 @@ class EvaluationLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 3f8efdc3034..cd8a20cddd5 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -90,7 +90,7 @@ class Job extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index d3a1269f5df..38f424f3281 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -89,7 +89,7 @@ class Position extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 1f526971c5f..622009faf3c 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -95,7 +95,7 @@ class Skill extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 40f3d764fab..5026346d386 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -99,7 +99,7 @@ class Skilldet extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 4bbbf20d460..1b2637d3166 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -93,7 +93,7 @@ class SkillRank extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index 4e7206d0338..db729c5e4e8 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -156,7 +156,7 @@ if (empty($reshook)) { $ret = -1; foreach ($TSkillsToAdd as $k => $v) { $skillAdded = new SkillRank($db); - $skillAdded->fk_skill = $v; + $skillAdded->fk_skill = (int) $v; $skillAdded->fk_object = $id; $skillAdded->objecttype = $objecttype; $ret = $skillAdded->create($user); @@ -177,7 +177,7 @@ if (empty($reshook)) { $objEval = $db->fetch_object($result); $line = new EvaluationLine($db); $line->fk_evaluation = $objEval->rowid; - $line->fk_skill = $v; + $line->fk_skill = (int) $v; $line->required_rank = 0; $line->fk_rank = 0; diff --git a/htdocs/index.php b/htdocs/index.php index 92b52adc521..b0917d87e9e 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -113,7 +113,7 @@ if (getDolGlobalString('MAIN_MOTD')) { */ // Specific warning to propose to upgrade invoice situation to progressive mode -if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { +if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { // Note that we must also be in v22 or +, but this is the case now in this branch $langs->loadLangs(array("admin")); print info_admin($langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org')); //print "
"; diff --git a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql index d7c25d3fa82..bc298783f53 100644 --- a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql +++ b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql @@ -44,6 +44,21 @@ ALTER TABLE llx_opensurvey_user_studs ADD COLUMN tms timestamp DEFAULT CURRENT_T -- V23 migration ALTER TABLE llx_usergroup ADD color VARCHAR(6) AFTER tms; +create table llx_categorie_project_task ( + fk_categorie integer NOT NULL, + fk_project_task integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; + +--noqa:disable=PRS +ALTER TABLE llx_categorie_project_task ADD PRIMARY KEY pk_categorie_propal (fk_categorie, fk_task); +--noqa:enable=PRS +ALTER TABLE llx_categorie_project_task ADD INDEX idx_categorie_project_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_project_task ADD INDEX idx_categorie_project_fk_task (fk_task); + +ALTER TABLE llx_categorie_project_task ADD CONSTRAINT fk_categorie_project_task_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_project_task ADD CONSTRAINT fk_categorie_project_task_rowid FOREIGN KEY (fk_task) REFERENCES llx_projet (rowid); + UPDATE llx_actioncomm SET elementtype = 'project_task' WHERE elementtype = 'task'; ALTER TABLE llx_document_model ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; @@ -153,6 +168,7 @@ ALTER TABLE llx_user DROP COLUMN egroupware_id; ALTER TABLE llx_adherent ADD COLUMN birth_place varchar(64) after birth; ALTER TABLE llx_societe ADD COLUMN birth date DEFAULT NULL after fk_forme_juridique; +ALTER TABLE llx_societe ADD vatexemptcode varchar(24) DEFAULT NULL; DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def WHERE module = 'webhook' AND perms = 'webhook_target'); DELETE FROM llx_usergroup_rights WHERE fk_id IN (SELECT id FROM llx_rights_def WHERE module = 'webhook' AND perms = 'webhook_target'); diff --git a/htdocs/install/mysql/tables/llx_categorie_project_task-project.key.sql b/htdocs/install/mysql/tables/llx_categorie_project_task-project.key.sql new file mode 100644 index 00000000000..30d4a4853d6 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_project_task-project.key.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2025 Charlene Benke +-- +-- 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 +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +ALTER TABLE llx_categorie_project_task ADD PRIMARY KEY pk_categorie_project (fk_categorie, fk_task); +ALTER TABLE llx_categorie_project_task ADD INDEX idx_categorie_project_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_project_task ADD INDEX idx_categorie_project_fk_task (fk_task); + +ALTER TABLE llx_categorie_project_task ADD CONSTRAINT fk_categorie_project_task_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_project_task ADD CONSTRAINT fk_categorie_project_task_rowid FOREIGN KEY (fk_task) REFERENCES llx_projet (rowid); diff --git a/htdocs/install/mysql/tables/llx_categorie_project_task-project.sql b/htdocs/install/mysql/tables/llx_categorie_project_task-project.sql new file mode 100644 index 00000000000..fe00efe24f7 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_project_task-project.sql @@ -0,0 +1,26 @@ +-- ============================================================================ +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2012 Juanjo Menent +-- Copyright (C) 2025 Charlene Benke +-- +-- 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 +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +create table llx_categorie_project_task +( + fk_categorie integer NOT NULL, + fk_project_task integer NOT NULL, + import_key varchar(14) +)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 5e7dde2cd37..7c30cc2ca5d 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -81,8 +81,8 @@ create table llx_societe fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial status note_private text, -- note_public text, -- - model_pdf varchar(255), - last_main_doc varchar(255), -- relative filepath+filename of last main generated document + model_pdf varchar(255), -- the last tempate used to generate a document + last_main_doc varchar(255), -- relative filepath+filename of the last main generated document prefix_comm varchar(5), -- prefix commercial (deprecated) client tinyint DEFAULT 0, -- client 0/1/2 fournisseur tinyint DEFAULT 0, -- fournisseur 0/1 @@ -103,8 +103,9 @@ create table llx_societe cond_reglement_supplier tinyint, -- payment term supplier transport_mode_supplier tinyint, -- transport mode supplier (Intracomm report) fk_shipping_method integer, -- preferred shipping method id - tva_assuj tinyint DEFAULT 1, -- assujetti ou non a la TVA - vat_reverse_charge tinyint DEFAULT 0, -- By default, company not concerned by vat reverse charge + tva_assuj tinyint DEFAULT 1, -- if company using VAT or is exempted + vatexemptcode varchar(24), -- if company is exempted, the VAT reason code of exemption + vat_reverse_charge tinyint DEFAULT 0, -- By default, company is not concerned by vat reverse charge localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1 localtax1_value double(7,4), localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2 diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 38ae7402bae..b85d34f761e 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -87,8 +87,8 @@ $error = 0; // This page can be long. We increase the allowed delay, but this does not work when we are in safe_mode. $err = error_reporting(); error_reporting(0); -if (getDolGlobalString('MAIN_OVERRIDE_TIME_LIMIT')) { - @set_time_limit((int) $conf->global->MAIN_OVERRIDE_TIME_LIMIT); +if (getDolGlobalInt('MAIN_OVERRIDE_TIME_LIMIT')) { + @set_time_limit(getDolGlobalInt('MAIN_OVERRIDE_TIME_LIMIT')); } else { @set_time_limit(600); } @@ -200,6 +200,53 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $conf->setValues($db); + // Reforce log activation (samecode than into the inc.php) + $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; + $conf->modules['syslog'] = 'syslog'; + $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); + if (!defined('SYSLOG_HANDLERS')) { + define('SYSLOG_HANDLERS', '["mod_syslog_file"]'); + } + if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined + if (@is_writable('/tmp')) { + define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); + } elseif (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) { + define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log'); + } elseif (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) { + define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log'); + } elseif (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) { + define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp + } elseif (@is_writable('../../')) { + define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others + } + //print 'SYSLOG_FILE='.SYSLOG_FILE;exit; + } + if (defined('SYSLOG_FILE')) { + $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); + } + if (!defined('SYSLOG_FILE_NO_ERROR')) { + define('SYSLOG_FILE_NO_ERROR', 1); + } + // We init log handler for install + $handlers = array('mod_syslog_file'); + foreach ($handlers as $handler) { + $file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php'; + if (!file_exists($file)) { + throw new Exception('Missing log handler file '.$handler.'.php'); + } + + require_once $file; + $loghandlerinstance = new $handler(); + if (!$loghandlerinstance instanceof LogHandler) { + throw new Exception('Log handler does not extend LogHandler'); + } + + if (empty($conf->loghandlers[$handler])) { + $conf->loghandlers[$handler] = $loghandlerinstance; + } + } + + $listofentities = array(1); // Create the global $hookmanager object @@ -4323,7 +4370,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $user = new User($db); // To avoid error during migration } - dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".implode(',', array_keys($listofmodule))); + dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".implode(',', array_keys($listofmodule)), LOG_NOTICE); $reloadactionformodules = array( 'MAIN_MODULE_AGENDA' => array('class' => 'modAgenda', 'remove' => 1), @@ -4392,7 +4439,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $moduletoreloadshort = $reg[1]; } - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ".$moduletoreloadshort." with mode ".$reloadmode." (generic code)"); + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ".$moduletoreloadshort." with mode ".$reloadmode." (generic code)", LOG_NOTICE); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/mod'.$moduletoreloadshort.'.class.php'; if ($res) { @@ -4404,7 +4451,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->delete_menus(); // We must delete to be sure it is inserted with new values $mod->init($reloadmode); } else { - dolibarr_install_syslog('Failed to include '.DOL_DOCUMENT_ROOT.'/core/modules/mod'.$moduletoreloadshort.'.class.php'); + dolibarr_install_syslog('Failed to include '.DOL_DOCUMENT_ROOT.'/core/modules/mod'.$moduletoreloadshort.'.class.php', LOG_ERR); $res = @dol_include_once(strtolower($moduletoreloadshort).'/core/modules/mod'.$moduletoreloadshort.'.class.php'); if ($res) { diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index c5921ac4c73..fd1b343c726 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -101,7 +101,7 @@ class IntracommReport extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array of properties of field to show + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array of properties of field to show */ public $fields = array( "rowid" => array("type" => "integer", "label" => "TechnicalID", "enabled" => 1, 'position' => 10, 'notnull' => 1, "visible" => "0",), diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 22e5ed1a570..44e4fedb525 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -88,7 +88,7 @@ class KnowledgeRecord extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index e3c315f70e6..c147a129589 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -98,7 +98,7 @@ if ($id > 0 || !empty($ref)) { //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); $permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 57fa240114d..ec19405e0f4 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -1,7 +1,8 @@ +/* Copyright (C) 2017-2021 Laurent Destailleur * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 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 @@ -96,7 +97,7 @@ $upload_dir = $conf->knowledgemanagement->multidir_output[isset($object->entity) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); //if (empty($conf->knowledgemanagement->enabled)) accessforbidden(); //if (empty($permissiontoread)) accessforbidden(); @@ -516,8 +517,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontoadd) { if ($object->status == $object::STATUS_VALIDATED) { print ''.$langs->trans("SetObsolete").''."\n"; - } else { - print ''.$langs->trans("Re-Open").''."\n"; + } elseif ($object->status == $object::STATUS_CANCELED) { + print ''.$langs->trans("ReOpen").''."\n"; } } diff --git a/htdocs/knowledgemanagement/knowledgerecord_contact.php b/htdocs/knowledgemanagement/knowledgerecord_contact.php index 02df2c7d14a..a7cad0e5105 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_contact.php +++ b/htdocs/knowledgemanagement/knowledgerecord_contact.php @@ -63,7 +63,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'inclu //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); $permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); diff --git a/htdocs/knowledgemanagement/knowledgerecord_document.php b/htdocs/knowledgemanagement/knowledgerecord_document.php index 48a88f8384c..9f9709b502a 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_document.php +++ b/htdocs/knowledgemanagement/knowledgerecord_document.php @@ -88,7 +88,7 @@ if ($id > 0 || !empty($ref)) { //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); $permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index bfa07c23806..76fe593fab7 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -26,14 +26,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -41,6 +33,13 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "other")); @@ -154,12 +153,12 @@ $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $pe if (empty($conf->knowledgemanagement->enabled)) { accessforbidden('Module not enabled'); } -$socid = 0; +//$socid = 0; if ($user->socid > 0) { // Protection if external user //$socid = $user->socid; accessforbidden(); } -$result = restrictedArea($user, 'knowledgemanagement', 0, '', 'knowledgerecord'); +restrictedArea($user, 'knowledgemanagement', 0, '', 'knowledgerecord'); //if (!$permissiontoread) accessforbidden(); @@ -195,6 +194,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } + $search_all = ''; $toselect = array(); $search_array_options = array(); } @@ -400,7 +400,6 @@ if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $s llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-knowledgemanagement page-list bodyforlist'); - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index 6ad64a52c2c..dd3e38764c6 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -68,7 +68,7 @@ $permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'wr //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); /* diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a9f283f163a..1f43fc0d341 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2111,7 +2111,7 @@ ExpectedChecksum=Expected Checksum CurrentChecksum=Current Checksum ExpectedSize=Expected size CurrentSize=Current size -ForcedConstants=Required constant values +ForcedConstants=Required setup MailToSendProposal=Customer proposals MailToSendOrder=Sales orders MailToSendInvoice=Customer invoices @@ -2669,6 +2669,7 @@ SensitiveData=Sensitive data ToolToDecryptAString=Tool to decrypt a string Decrypt=Decrypt FilesIntegrityDesc=If you want to check the integrity of files instead of database, you can do it by using this tool. +DataIntegrityDesc=If you want to check the integrity of unalterable data, you can do it by using this tool. AttributeCodeHelp=A code of your choice (without special chars and spaces) to identify the property.
Note that if an object B is created from an existing object A that has a different type (for example creation of an invoice from an order), the value of the complementary attributes of A are also copied into the complementary attributes of B when the code of the attribute is the same. ThereIsMoreThanXAnswers=There is more than %s answers with your filter. Please add more filters... PdfAddTermOfSaleHelp=You can upload the file at the bottom of this setup page diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index c56c49e4987..d88f8ad1d9d 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -2,7 +2,7 @@ BlockedLog=Unalterable Logs BlockedLogDesc=This module tracks some events into an unalterable log (that you can't modify once recorded) into a block chain, in real time. This module provides compatibility with requirements of laws of some countries (like France with the law Finance 2016 - Norme NF525). Fingerprints=Archived events and fingerprints FingerprintsDesc=This is the tool to browse or extract the unalterable logs. Unalterable logs are generated and store into a dedicated table of the systel, in real time when a business event appears. You can use this tool to export this into archive files to store them an external support. -UnalterableLogTool1=Some countries law (like France), ask that you do it on a regular basis. +UnalterableLogTool1=The law of some countries (like in France when doing B2C), ask that you do it on a regular basis. UnalterableLogTool1FR=In france, you MUST do it at least, once every year, we recommand to do it once per month. UnalterableLogTool2=It is recommended to store the exported archive files in different places (Secured cloud, External USB drive, ...). UnalterableLogTool3=Note that, there is no feature to purge this log and every change tried to be done directly into this log (by a hacker for example) will be reported with a non-valid fingerprint. diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index bb775265cbb..ec06f3660d6 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -82,7 +82,7 @@ class Mo extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index b591c0dceed..be11af238e5 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -113,7 +113,7 @@ class Opensurveysondage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'id_sondage' => array('type' => 'varchar(16)', 'label' => 'Idsondage', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => -1,), diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 16c044ce714..3a6963e5071 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -99,7 +99,7 @@ class Partnership extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index a0c7f8b2da8..7d7d407a467 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -22,13 +22,13 @@ use Luracast\Restler\RestException; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; -require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php'; -require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; -require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductAttribute.class.php'; +require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductAttributeValue.class.php'; +require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductCombination.class.php'; +require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductCombination2ValuePair.class.php'; /** * API class for products @@ -207,27 +207,27 @@ class Products extends DolibarrApi $socid = DolibarrApiAccess::$user->socid ?: ''; $sql = "SELECT t.rowid, t.ref, t.ref_ext"; - $sql .= " FROM ".$this->db->prefix()."product as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields AS ef ON ef.fk_object = t.rowid"; // So we will be able to filter on extrafields + $sql .= " FROM " . $this->db->prefix() . "product as t"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_extrafields AS ef ON ef.fk_object = t.rowid"; // So we will be able to filter on extrafields if ($category > 0) { - $sql .= ", ".$this->db->prefix()."categorie_product as c"; + $sql .= ", " . $this->db->prefix() . "categorie_product as c"; } - $sql .= ' WHERE t.entity IN ('.getEntity('product').')'; + $sql .= ' WHERE t.entity IN (' . getEntity('product') . ')'; if ($variant_filter == 1) { - $sql .= ' AND NOT EXISTS (select pac.rowid FROM '.$this->db->prefix().'product_attribute_combination as pac WHERE pac.fk_product_parent = t.rowid)'; - $sql .= ' AND NOT EXISTS (select pac.rowid FROM '.$this->db->prefix().'product_attribute_combination as pac WHERE pac.fk_product_child = t.rowid)'; + $sql .= ' AND NOT EXISTS (select pac.rowid FROM ' . $this->db->prefix() . 'product_attribute_combination as pac WHERE pac.fk_product_parent = t.rowid)'; + $sql .= ' AND NOT EXISTS (select pac.rowid FROM ' . $this->db->prefix() . 'product_attribute_combination as pac WHERE pac.fk_product_child = t.rowid)'; } if ($variant_filter == 2) { - $sql .= ' AND EXISTS (select pac.rowid FROM '.$this->db->prefix().'product_attribute_combination as pac WHERE pac.fk_product_parent = t.rowid)'; + $sql .= ' AND EXISTS (select pac.rowid FROM ' . $this->db->prefix() . 'product_attribute_combination as pac WHERE pac.fk_product_parent = t.rowid)'; } if ($variant_filter == 3) { - $sql .= ' AND EXISTS (select pac.rowid FROM '.$this->db->prefix().'product_attribute_combination as pac WHERE pac.fk_product_child = t.rowid)'; + $sql .= ' AND EXISTS (select pac.rowid FROM ' . $this->db->prefix() . 'product_attribute_combination as pac WHERE pac.fk_product_child = t.rowid)'; } // Select products of given category if ($category > 0) { - $sql .= " AND c.fk_categorie = ".((int) $category); + $sql .= " AND c.fk_categorie = " . ((int) $category); $sql .= " AND c.fk_product = t.rowid"; } if ($mode == 1) { @@ -243,7 +243,7 @@ class Products extends DolibarrApi $errormessage = ''; $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage); if ($errormessage) { - throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> ' . $errormessage); } } @@ -293,7 +293,7 @@ class Products extends DolibarrApi $i++; } } else { - throw new RestException(503, 'Error when retrieve product list : '.$this->db->lasterror()); + throw new RestException(503, 'Error when retrieve product list : ' . $this->db->lasterror()); } //if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit) @@ -351,7 +351,7 @@ class Products extends DolibarrApi if (getDolGlobalString('PRODUIT_MULTIPRICES')) { $key_max = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT'); - for ($key = 1; $key <= $key_max ; $key++) { + for ($key = 1; $key <= $key_max; $key++) { $newvat = $this->product->multiprices_tva_tx[$key]; $newnpr = 0; $newvatsrccode = $this->product->default_vat_code; @@ -404,7 +404,7 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $oldproduct = dol_clone($this->product, 2); @@ -492,7 +492,7 @@ class Products extends DolibarrApi if ($result > 0 && getDolGlobalString('PRODUIT_MULTIPRICES')) { $key_max = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT'); - for ($key = 1; $key <= $key_max ; $key++) { + for ($key = 1; $key <= $key_max; $key++) { $pricemodified = false; if ($this->product->multiprices_base_type[$key] != $oldproduct->multiprices_base_type[$key]) { $pricemodified = true; @@ -566,7 +566,7 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } // The Product::delete() method uses the global variable $user. @@ -611,7 +611,7 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $childrenArbo = $this->product->getChildsArbo($id, 1); @@ -651,7 +651,7 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $result = $this->product->add_sousproduit($id, $subproduct_id, $qty, $incdec); @@ -684,7 +684,7 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $result = $this->product->del_sousproduit($id, $subproduct_id); @@ -723,7 +723,7 @@ class Products extends DolibarrApi $result = $categories->getListForItem($id, 'product', $sortfield, $sortorder, $limit, $page); if ($result < 0) { - throw new RestException(503, 'Error when retrieve category list : '.implode(',', array_merge(array($categories->error), $categories->errors))); + throw new RestException(503, 'Error when retrieve category list : ' . implode(',', array_merge(array($categories->error), $categories->errors))); } return $result; @@ -760,7 +760,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.implode(',', array_merge(array($this->product->error), $this->product->errors))); + throw new RestException(503, 'Error when retrieve prices list : ' . implode(',', array_merge(array($this->product->error), $this->product->errors))); } return array( @@ -802,7 +802,7 @@ class Products extends DolibarrApi $socid = DolibarrApiAccess::$user->socid ?: ''; if ($socid > 0 && $socid != $thirdparty_id) { - throw new RestException(403, 'Getting prices for all customers or for the customer ID '.$thirdparty_id.' is not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Getting prices for all customers or for the customer ID ' . $thirdparty_id . ' is not allowed for login ' . DolibarrApiAccess::$user->login); } $result = $this->product->fetch($id); @@ -811,7 +811,7 @@ class Products extends DolibarrApi } if ($result > 0) { - require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; $prodcustprice = new ProductCustomerPrice($this->db); $filter = array(); $filter['t.fk_product'] = (string) $id; @@ -859,7 +859,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.implode(',', array_merge(array($this->product->error), $this->product->errors))); + throw new RestException(503, 'Error when retrieve prices list : ' . implode(',', array_merge(array($this->product->error), $this->product->errors))); } return array( @@ -918,17 +918,17 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $this->productsupplier->id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $socid = DolibarrApiAccess::$user->socid ?: ''; if ($socid > 0 && $socid != $fourn_id) { - throw new RestException(403, 'Adding purchase price for the supplier ID '.$fourn_id.' is not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Adding purchase price for the supplier ID ' . $fourn_id . ' is not allowed for login ' . DolibarrApiAccess::$user->login); } $result = $this->productsupplier->add_fournisseur(DolibarrApiAccess::$user, $fourn_id, $ref_fourn, $qty); if ($result < 0) { - throw new RestException(500, "Error adding supplier to product : ".$this->db->lasterror()); + throw new RestException(500, "Error adding supplier to product : " . $this->db->lasterror()); } $fourn = new Fournisseur($this->db); @@ -945,7 +945,7 @@ class Products extends DolibarrApi $result = $this->productsupplier->update_buyprice($qty, $buyprice, DolibarrApiAccess::$user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges, $remise_percent, $remise, $newnpr, $delivery_time_days, $supplier_reputation, $localtaxes_array, $newdefaultvatcode, $multicurrency_buyprice, $multicurrency_price_base_type, $multicurrency_tx, $multicurrency_code, $desc_fourn, $barcode, $fk_barcode_type); if ($result <= 0) { - throw new RestException(500, "Error updating buy price : ".$this->db->lasterror()); + throw new RestException(500, "Error updating buy price : " . $this->db->lasterror()); } return (int) $this->productsupplier->product_fourn_price_id; } @@ -976,7 +976,7 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $this->productsupplier->id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $resultsupplier = 0; @@ -1022,30 +1022,30 @@ class Products extends DolibarrApi $socid = DolibarrApiAccess::$user->socid ?: ''; if ($socid > 0) { if ($supplier != $socid || empty($supplier)) { - throw new RestException(403, 'As an external user, you can request only for your supplier id = '.$socid); + throw new RestException(403, 'As an external user, you can request only for your supplier id = ' . $socid); } } $sql = "SELECT t.rowid, t.ref, t.ref_ext"; - $sql .= " FROM ".MAIN_DB_PREFIX."product AS t LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields + $sql .= " FROM " . MAIN_DB_PREFIX . "product AS t LEFT JOIN " . MAIN_DB_PREFIX . "product_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields if ($category > 0) { - $sql .= ", ".$this->db->prefix()."categorie_product as c"; + $sql .= ", " . $this->db->prefix() . "categorie_product as c"; } - $sql .= ", ".$this->db->prefix()."product_fournisseur_price as s"; + $sql .= ", " . $this->db->prefix() . "product_fournisseur_price as s"; - $sql .= ' WHERE t.entity IN ('.getEntity('product').')'; + $sql .= ' WHERE t.entity IN (' . getEntity('product') . ')'; if ($supplier > 0) { - $sql .= " AND s.fk_soc = ".((int) $supplier); + $sql .= " AND s.fk_soc = " . ((int) $supplier); } if ($socid > 0) { // if external user - $sql .= " AND s.fk_soc = ".((int) $socid); + $sql .= " AND s.fk_soc = " . ((int) $socid); } $sql .= " AND s.fk_product = t.rowid"; // Select products of given category if ($category > 0) { - $sql .= " AND c.fk_categorie = ".((int) $category); + $sql .= " AND c.fk_categorie = " . ((int) $category); $sql .= " AND c.fk_product = t.rowid"; } if ($mode == 1) { @@ -1060,7 +1060,7 @@ class Products extends DolibarrApi $errormessage = ''; $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage); if ($errormessage) { - throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> ' . $errormessage); } } @@ -1092,7 +1092,7 @@ class Products extends DolibarrApi $i++; } } else { - throw new RestException(503, 'Error when retrieve product list : '.$this->db->lasterror()); + throw new RestException(503, 'Error when retrieve product list : ' . $this->db->lasterror()); } return $obj_ret; @@ -1140,7 +1140,7 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $product_fourn_list = array(); @@ -1185,15 +1185,15 @@ class Products extends DolibarrApi } $sql = "SELECT t.rowid, t.ref, t.ref_ext, t.label, t.position, t.entity"; - $sql .= " FROM ".$this->db->prefix()."product_attribute as t"; - $sql .= ' WHERE t.entity IN ('.getEntity('product').')'; + $sql .= " FROM " . $this->db->prefix() . "product_attribute as t"; + $sql .= ' WHERE t.entity IN (' . getEntity('product') . ')'; // Add sql filters if ($sqlfilters) { $errormessage = ''; $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage); if ($errormessage) { - throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> ' . $errormessage); } } @@ -1210,7 +1210,7 @@ class Products extends DolibarrApi $resql = $this->db->query($sql); if (!$resql) { - throw new RestException(503, 'Error when retrieving product attribute list : '.$this->db->lasterror()); + throw new RestException(503, 'Error when retrieving product attribute list : ' . $this->db->lasterror()); } $return = array(); @@ -1263,9 +1263,9 @@ class Products extends DolibarrApi } } - $sql = "SELECT COUNT(*) as nb FROM ".$this->db->prefix()."product_attribute_combination2val as pac2v"; - $sql .= " JOIN ".$this->db->prefix()."product_attribute_combination as pac ON pac2v.fk_prod_combination = pac.rowid"; - $sql .= " WHERE pac2v.fk_prod_attr = ".((int) $prodattr->id)." AND pac.entity IN (".getEntity('product').")"; + $sql = "SELECT COUNT(*) as nb FROM " . $this->db->prefix() . "product_attribute_combination2val as pac2v"; + $sql .= " JOIN " . $this->db->prefix() . "product_attribute_combination as pac ON pac2v.fk_prod_combination = pac.rowid"; + $sql .= " WHERE pac2v.fk_prod_attr = " . ((int) $prodattr->id) . " AND pac.entity IN (" . getEntity('product') . ")"; $resql = $this->db->query($sql); $obj = $this->db->fetch_object($resql); @@ -1297,7 +1297,7 @@ class Products extends DolibarrApi $ref = trim($ref); - $sql = "SELECT rowid, ref, ref_ext, label, position, entity FROM ".$this->db->prefix()."product_attribute WHERE ref LIKE '".$this->db->escape($ref)."' AND entity IN (".getEntity('product').")"; + $sql = "SELECT rowid, ref, ref_ext, label, position, entity FROM " . $this->db->prefix() . "product_attribute WHERE ref LIKE '" . $this->db->escape($ref) . "' AND entity IN (" . getEntity('product') . ")"; $query = $this->db->query($sql); @@ -1316,9 +1316,9 @@ class Products extends DolibarrApi $attr['position'] = (int) $result->position; $attr['entity'] = (string) $result->entity; - $sql = "SELECT COUNT(*) as nb FROM ".$this->db->prefix()."product_attribute_combination2val as pac2v"; - $sql .= " JOIN ".$this->db->prefix()."product_attribute_combination as pac ON pac2v.fk_prod_combination = pac.rowid"; - $sql .= " WHERE pac2v.fk_prod_attr = ".((int) $result->rowid)." AND pac.entity IN (".getEntity('product').")"; + $sql = "SELECT COUNT(*) as nb FROM " . $this->db->prefix() . "product_attribute_combination2val as pac2v"; + $sql .= " JOIN " . $this->db->prefix() . "product_attribute_combination as pac ON pac2v.fk_prod_combination = pac.rowid"; + $sql .= " WHERE pac2v.fk_prod_attr = " . ((int) $result->rowid) . " AND pac.entity IN (" . getEntity('product') . ")"; $resql = $this->db->query($sql); $obj = $this->db->fetch_object($resql); @@ -1351,7 +1351,7 @@ class Products extends DolibarrApi $ref_ext = trim($ref_ext); - $sql = "SELECT rowid, ref, ref_ext, label, position, entity FROM ".$this->db->prefix()."product_attribute WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."' AND entity IN (".getEntity('product').")"; + $sql = "SELECT rowid, ref, ref_ext, label, position, entity FROM " . $this->db->prefix() . "product_attribute WHERE ref_ext LIKE '" . $this->db->escape($ref_ext) . "' AND entity IN (" . getEntity('product') . ")"; $query = $this->db->query($sql); @@ -1370,9 +1370,9 @@ class Products extends DolibarrApi $attr['position'] = (int) $result->position; $attr['entity'] = (string) $result->entity; - $sql = "SELECT COUNT(*) as nb FROM ".$this->db->prefix()."product_attribute_combination2val as pac2v"; - $sql .= " JOIN ".$this->db->prefix()."product_attribute_combination as pac ON pac2v.fk_prod_combination = pac.rowid"; - $sql .= " WHERE pac2v.fk_prod_attr = ".((int) $result->rowid)." AND pac.entity IN (".getEntity('product').")"; + $sql = "SELECT COUNT(*) as nb FROM " . $this->db->prefix() . "product_attribute_combination2val as pac2v"; + $sql .= " JOIN " . $this->db->prefix() . "product_attribute_combination as pac ON pac2v.fk_prod_combination = pac.rowid"; + $sql .= " WHERE pac2v.fk_prod_attr = " . ((int) $result->rowid) . " AND pac.entity IN (" . getEntity('product') . ")"; $resql = $this->db->query($sql); $obj = $this->db->fetch_object($resql); @@ -1525,7 +1525,7 @@ class Products extends DolibarrApi throw new RestException(403); } - $sql = "SELECT rowid, fk_product_attribute, ref, value FROM ".$this->db->prefix()."product_attribute_value WHERE rowid = ".(int) $id." AND entity IN (".getEntity('product').")"; + $sql = "SELECT rowid, fk_product_attribute, ref, value FROM " . $this->db->prefix() . "product_attribute_value WHERE rowid = " . (int) $id . " AND entity IN (" . getEntity('product') . ")"; $query = $this->db->query($sql); @@ -1572,8 +1572,8 @@ class Products extends DolibarrApi $ref = trim($ref); - $sql = "SELECT rowid, fk_product_attribute, ref, value FROM ".$this->db->prefix()."product_attribute_value"; - $sql .= " WHERE ref LIKE '".$this->db->escape($ref)."' AND fk_product_attribute = ".((int) $id)." AND entity IN (".getEntity('product').")"; + $sql = "SELECT rowid, fk_product_attribute, ref, value FROM " . $this->db->prefix() . "product_attribute_value"; + $sql .= " WHERE ref LIKE '" . $this->db->escape($ref) . "' AND fk_product_attribute = " . ((int) $id) . " AND entity IN (" . getEntity('product') . ")"; $query = $this->db->query($sql); @@ -1616,8 +1616,8 @@ class Products extends DolibarrApi $ref = trim($ref); - $sql = "SELECT rowid FROM ".$this->db->prefix()."product_attribute_value"; - $sql .= " WHERE ref LIKE '".$this->db->escape($ref)."' AND fk_product_attribute = ".((int) $id)." AND entity IN (".getEntity('product').")"; + $sql = "SELECT rowid FROM " . $this->db->prefix() . "product_attribute_value"; + $sql .= " WHERE ref LIKE '" . $this->db->escape($ref) . "' AND fk_product_attribute = " . ((int) $id) . " AND entity IN (" . getEntity('product') . ")"; $query = $this->db->query($sql); if (!$query) { @@ -1701,8 +1701,8 @@ class Products extends DolibarrApi $return = array(); $sql = "SELECT "; - $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM ".$this->db->prefix()."product_attribute_value as v"; - $sql .= " WHERE v.fk_product_attribute IN (SELECT rowid FROM ".$this->db->prefix()."product_attribute WHERE ref LIKE '".$this->db->escape($ref)."')"; + $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM " . $this->db->prefix() . "product_attribute_value as v"; + $sql .= " WHERE v.fk_product_attribute IN (SELECT rowid FROM " . $this->db->prefix() . "product_attribute WHERE ref LIKE '" . $this->db->escape($ref) . "')"; $resql = $this->db->query($sql); @@ -1965,10 +1965,10 @@ class Products extends DolibarrApi $cleanedFeatures = array(); foreach ($features as $id_attr => $id_value) { if ($prodattr->fetch((int) $id_attr) < 0) { - throw new RestException(400, 'Invalid attribute ID: '.$id_attr); + throw new RestException(400, 'Invalid attribute ID: ' . $id_attr); } if ($prodattr_val->fetch((int) $id_value) < 0) { - throw new RestException(400, 'Invalid attribute value ID: '.$id_value); + throw new RestException(400, 'Invalid attribute value ID: ' . $id_value); } $cleanedFeatures[(int) $id_attr] = (int) $id_value; } @@ -2151,7 +2151,7 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $product_model = new Product($this->db); @@ -2173,6 +2173,141 @@ class Products extends DolibarrApi return $obj_ret; } + /** + * Get contacts of a given product + * + * Return an array with contact information + * + * @param int $id ID of product + * @param string $type Type of the contact ('BILLING', 'SHIPPING', 'CUSTOMER', ...) + * @return array|mixed Array of contacts + * + * @url GET {id}/contacts + * + * @throws RestException + */ + public function getContacts($id, $type = '') + { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { + throw new RestException(403); + } + + $result = $this->product->fetch($id); + if (!$result) { + throw new RestException(404, 'Product not found'); + } + + if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) { + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + // Récupérer les contacts externes et internes + $contacts = $this->product->liste_contact(-1, 'external', 0, $type); + $socpeoples = $this->product->liste_contact(-1, 'internal', 0, $type); + + $contacts = array_merge($contacts, $socpeoples); + + return $contacts; + } + + /** + * Add a contact type of given product + * + * @param int $id Id of product to update + * @param int $contactid Id of contact to add + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER) + * @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) + * @param int $notrigger Disable all triggers + * @return array + * + * @url POST {id}/contact/{contactid}/{type} + * + * @throws RestException 401 + * @throws RestException 404 + */ + public function postContact($id, $contactid, $type, $source = "external", $notrigger = 0) + { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { + throw new RestException(403); + } + + $result = $this->product->fetch($id); + if (!$result) { + throw new RestException(404, 'Product not found'); + } + + if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) { + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + $result = $this->product->add_contact($contactid, $type, $source, $notrigger); + + if ($result < 0) { + throw new RestException(500, 'Error when added the contact'); + } + + if ($result == 0) { + throw new RestException(304, 'contact already added'); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Contact linked to the product' + ) + ); + } + + /** + * Unlink a contact type of given product + * + * @param int $id Id of product to update + * @param int $contactid Id of contact + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER) + * + * @url DELETE {id}/contact/{contactid}/{type} + * + * @return array + * + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 System error + */ + public function deleteContact($id, $contactid, $type) + { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { + throw new RestException(403); + } + + $result = $this->product->fetch($id); + if (!$result) { + throw new RestException(404, 'Product not found'); + } + + if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) { + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + foreach (array('internal', 'external') as $source) { + $contacts = $this->product->liste_contact(-1, $source); + foreach ($contacts as $contact) { + if ($contact['id'] == $contactid && $contact['code'] == $type) { + $result = $this->product->delete_contact($contact['rowid']); + + if (!$result) { + throw new RestException(500, 'Error when deleting the contact ' . $contact['rowid']); + } + } + } + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Contact unlinked from product' + ) + ); + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensitive object data @@ -2302,7 +2437,7 @@ class Products extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } if (!empty($includestockdata) && DolibarrApiAccess::$user->hasRight('stock', 'lire')) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e01246c1dfc..6c2023a6ed0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -858,7 +858,7 @@ class Product extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), @@ -3080,8 +3080,8 @@ class Product extends CommonObject $this->duration = $obj->duration; $matches = []; - preg_match('/(\d+)(\w+)/', $obj->duration, $matches); - $this->duration_value = !empty($matches[1]) ? (int) $matches[1] : 0; + preg_match('/([\d.]+)(\w+)/', $obj->duration, $matches); + $this->duration_value = !empty($matches[1]) ? (float) $matches[1] : 0; $this->duration_unit = !empty($matches[2]) ? (string) $matches[2] : null; $this->canvas = $obj->canvas; $this->net_measure = $obj->net_measure; diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 2c4e0edeee2..34aa0335864 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; class ProductCustomerPrice extends CommonObject { /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 4, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'showoncombobox' => 1, 'noteditable' => 1), @@ -182,9 +182,15 @@ class ProductCustomerPrice extends CommonObject $sql .= " OR t.date_begin = '" . $this->db->idate($this->date_end) . "' OR t.date_end = '" . $this->db->idate($this->date_end) . "'"; $sql .= " OR (t.date_begin <= '" . $this->db->idate($this->date_begin) . "' AND '" . $this->db->idate($this->date_begin) . "' <= t.date_end)"; $sql .= " OR (t.date_begin <= '" . $this->db->idate($this->date_end) . "' AND '" . $this->db->idate($this->date_end) . "' <= t.date_end))"; - if ($this->fk_product > 0) $sql .= " AND t.fk_product = " . ((int) $this->fk_product); - if ($this->fk_soc > 0) $sql .= " AND t.fk_soc = " . ((int) $this->fk_soc); - if ($this->id > 0) $sql .= " AND t.rowid != " . ((int) $this->id); + if ($this->fk_product > 0) { + $sql .= " AND t.fk_product = " . ((int) $this->fk_product); + } + if ($this->fk_soc > 0) { + $sql .= " AND t.fk_soc = " . ((int) $this->fk_soc); + } + if ($this->id > 0) { + $sql .= " AND t.rowid != " . ((int) $this->id); + } dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 87c1816af2c..e513c461877 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Alexis LAURIER * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -81,7 +81,7 @@ class ProductFournisseurPrice extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 0,), diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 50fe4f7de82..6303f7520e8 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -86,7 +86,7 @@ class Inventory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), @@ -827,7 +827,7 @@ class InventoryLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index f5c415df9d8..26b47c10417 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -1194,7 +1194,7 @@ if ($resql) { if ($permissiontoupdatestock) { print ''.img_delete().''; } - $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; + $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp"), 'MS') >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; print ''; print ''; } else { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index ac02d5c95dc..836b6b058ea 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2016 Francis Appels * Copyright (C) 2021 Noé Cendrier * Copyright (C) 2021-2025 Frédéric France - * Copyright (C) 2022-2023 Charlene Benke + * Copyright (C) 2022-2025 Charlene Benke * Copyright (C) 2023 Christian Foellmann * Copyright (C) 2024-2025 MDW * @@ -661,15 +661,16 @@ if ($action == 'create') { $totalarray['pos'][$totalarray['nbfield']] = 'units'; $totalarray['type'][$totalarray['nbfield']] = 'string'; } + $usercancreadsupplierprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_supplier_prices') : $user->hasRight('product', 'read'); + if ($usercancreadsupplierprice) { + print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; - print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - - print_liste_field_titre("EstimatedStockValueShort", "", "svalue", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - $totalarray['pos'][$totalarray['nbfield']] = 'totalvalue'; - $totalarray['type'][$totalarray['nbfield']] = ''; - + print_liste_field_titre("EstimatedStockValueShort", "", "svalue", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; + $totalarray['pos'][$totalarray['nbfield']] = 'totalvalue'; + $totalarray['type'][$totalarray['nbfield']] = ''; + } if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { print_liste_field_titre("SellPriceMin", "", "p.price", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); @@ -832,14 +833,14 @@ if ($action == 'create') { print $productstatic->getLabelOfUnit('long', $langs); print ''; } + if ($usercancreadsupplierprice) { + // Price buy PMP + print '
'; - // Price buy PMP - print ''; - - // Total PMP - print ''; - $totalvalue += price2num($objp->ppmp * $objp->value, 'MT'); - + // Total PMP + print ''; + $totalvalue += price2num($objp->ppmp * $objp->value, 'MT'); + } $pricemin = 0; // Price sell min if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 6b92d2607d8..a0ee0e5fc17 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -168,7 +168,7 @@ class Entrepot extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index f51eec1c97d..a5f37b0f47f 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -144,7 +144,7 @@ class Productlot extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index e7a20b47359..dbce7207a4a 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -296,7 +296,7 @@ if (!empty($search_fk_warehouse)) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; @@ -305,7 +305,7 @@ if (!empty($search_fk_warehouse)) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; if ($productid > 0) { @@ -323,8 +323,24 @@ if ($search_ref) { if ($search_nom) { $sql .= natural_search('p.label', $search_nom); } -$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; -$sql .= ' p.tms, p.duration, p.tobuy, p.stock'; + +$sqlGroupBy = ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; +$sqlGroupBy .= ' p.tms, p.duration, p.tobuy, p.stock'; + +$parameters = array('sqlGroupBy' => $sqlGroupBy); +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + +if ($reshook == 0) { + // Allows the hook to add things (old behavior) + $sql .= $hookmanager->resPrint; + // Allows the hook to REPLACE the clause (new behavior) + if (!empty($hookmanager->resArray['sqlGroupBy'])) { + $sqlGroupBy = $hookmanager->resArray['sqlGroupBy']; + } +} + +$sql .= $sqlGroupBy; + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index 6ab733da18a..9824b3ca8cd 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2022-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -140,7 +140,7 @@ class StockTransfer extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index c62f365936a..b421b6a960c 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -81,7 +81,7 @@ class StockTransferLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 480473661b0..47df8d65bb7 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -339,7 +339,7 @@ class Project extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 45762c62212..4d344669747 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -869,6 +869,7 @@ if (isModEnabled('stock')) { $langs->load('stocks'); } +print ''; print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy'); print '
'.$langs->trans('ExportOptions').''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 82c122dabdb..b5318042459 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -206,7 +206,7 @@ class BonPrelevement extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 0,), diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 644e64adfa1..4ac7a4b7312 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -5,7 +5,7 @@ * Copyright (C) 2014-2016 Ferran Marcet * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Florian Henry - * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2024 MDW * diff --git a/htdocs/compta/resultat/projects.php b/htdocs/compta/resultat/projects.php index 08224b855ff..7c69b13562e 100644 --- a/htdocs/compta/resultat/projects.php +++ b/htdocs/compta/resultat/projects.php @@ -7,7 +7,7 @@ * Copyright (C) 2014-2016 Ferran Marcet * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Florian Henry - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2021-2024 Alexandre Spangaro * Copyright (C) 2024 Yoan Mollard @@ -424,32 +424,29 @@ if (isModEnabled('invoice') && ($modecompta == 'CREANCES-DETTES' || $modecompta /* * Donations */ - if (isModEnabled('don')) { echo '
'.$langs->trans("Donations").'
'.$langs->trans("Salaries").'
'.$langs->trans("ExpenseReport").'
'; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined @@ -747,6 +752,7 @@ while ($i < $imaxinloop) { print '
'.price(price2num($objp->ppmp, 'MU')).''.price(price2num($objp->ppmp, 'MU')).''.price(price2num($objp->ppmp * $objp->value, 'MT')).''.price(price2num($objp->ppmp * $objp->value, 'MT')).'
'; @@ -1079,7 +1080,8 @@ foreach ($listofreferent as $key => $value) { print ''; // Module - print ''; + print ''; + print ''; // Nb print ''; // Amount HT @@ -1148,6 +1150,7 @@ if ($total_revenue_ht) { } print "
'.$name.''.$name.''.$i.'
"; +print ''; print '

'; @@ -1288,6 +1291,7 @@ foreach ($listofreferent as $key => $value) { '; } + print ''; print load_fiche_titre($langs->trans($title), $addform, ''); print "\n".''."\n"; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index ffd9e40f4af..b4b44affe4a 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -272,9 +272,10 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } -if (empty($search_projectstatus) && $search_projectstatus == '') { - $search_projectstatus = 1; -} +// already done at line 85 +// if (empty($search_projectstatus) && $search_projectstatus == '') { +// $search_projectstatus = 1; +// } /* * View diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index ad7dfa7e3f2..44eeee4878b 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -13,6 +13,7 @@ * Copyright (C) 2018 Quentin Vial-Gouteyron * Copyright (C) 2022-2025 Frédéric France * Copyright (C) 2024-2025 MDW + * Copyright (C) 2025 Nick Fragoulis * * 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,15 +65,23 @@ class Reception extends CommonObject public $code = ""; /** - * @var string element name + * @var string ID to identify managed object */ public $element = "reception"; /** - * @var string Fieldname with ID of parent key if this field has a parent + * @var string Field with ID of parent key if this field has a parent */ public $fk_element = "fk_reception"; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element = "reception"; + + /** + * @var string Name of subtable line + */ public $table_element_line = "receptiondet_batch"; /** @@ -213,10 +222,11 @@ class Reception extends CommonObject $this->db = $db; $this->ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + $this->isextrafieldmanaged = 1; } /** - * Return next contract ref + * Return next reception ref * * @param Societe $soc Thirdparty object * @return string Free reference for contract @@ -266,7 +276,7 @@ class Reception extends CommonObject } /** - * Create reception en base + * Create reception * * @param User $user Object du user qui cree * @param int $notrigger 1=Does not execute triggers, 0= execute triggers @@ -292,6 +302,11 @@ class Reception extends CommonObject if (empty($this->size_units)) { $this->size_units = 0; } + if (empty($this->date_creation)) { + $this->date_creation = $now; + } + + $this->entity = setEntity($this); $this->user = $user; @@ -323,12 +338,12 @@ class Reception extends CommonObject $sql .= "'(PROV)'"; $sql .= ", ".((int) $conf->entity); $sql .= ", ".($this->ref_supplier ? "'".$this->db->escape($this->ref_supplier)."'" : "null"); - $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ", '".$this->db->idate($this->date_creation)."'"; $sql .= ", ".((int) $user->id); $sql .= ", ".($this->date_reception > 0 ? "'".$this->db->idate($this->date_reception)."'" : "null"); $sql .= ", ".($this->date_delivery > 0 ? "'".$this->db->idate($this->date_delivery)."'" : "null"); - $sql .= ", ".((int) $this->socid); - $sql .= ", ".((int) $this->fk_project); + $sql .= ", ".($this->socid > 0 ? ((int) $this->socid) : "null"); + $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); $sql .= ", ".($this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : "null"); $sql .= ", '".$this->db->escape($this->tracking_number)."'"; $sql .= ", ".(is_null($this->weight) ? "NULL" : ((float) $this->weight)); @@ -351,8 +366,14 @@ class Reception extends CommonObject if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."reception"); + // update ref + $initialref = '(PROV'.$this->id.')'; + if (!empty($this->ref)) { + $initialref = $this->ref; + } + $sql = "UPDATE ".MAIN_DB_PREFIX."reception"; - $sql .= " SET ref = '(PROV".((int) $this->id).")'"; + $sql .= " SET ref = '".$this->db->escape($initialref)."'"; $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -416,7 +437,46 @@ class Reception extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Create a reception line + * + * @param int $entrepot_id Id of warehouse + * @param int $origin_line_id Id of source line + * @param float $qty Quantity + * @param int $rang Rang + * @param array $array_options extrafields array + * @param int $parent_line_id Id of parent line for virtual products + * @param int $product_id Id of product (child of virtual product) + * @return int Return integer <0 if KO, line_id if OK + */ + public function create_line($entrepot_id, $origin_line_id, $qty, $rang = 0, $array_options = [], $parent_line_id = 0, $product_id = 0) + { + //phpcs:enable + global $user; + $receptionline = new ReceptionLineBatch($this->db); + $receptionline->fk_reception = $this->id; + $receptionline->entrepot_id = $entrepot_id; + $receptionline->fk_elementdet = $origin_line_id; + $receptionline->element_type = $this->origin; + $receptionline->fk_parent = $parent_line_id; + $receptionline->fk_product = $product_id; + $receptionline->qty = $qty; + $receptionline->rang = $rang; + $receptionline->array_options = $array_options; + + if (!($receptionline->fk_product > 0)) { + $order_line = new CommandeFournisseurLigne($this->db); + $order_line->fetch($receptionline->fk_elementdet); + $receptionline->fk_product = $order_line->fk_product; + } + + if (($lineId = $receptionline->insert($user)) < 0) { + $this->errors[] = $receptionline->error; + } + return $lineId; + } /** * Get object and lines from database @@ -531,7 +591,11 @@ class Reception extends CommonObject /* * Lines */ - $result = $this->fetch_lines(); + if (empty($obj->origin_id)) { + $result = $this->fetch_lines_free(); + } else { + $result = $this->fetch_lines(); + } if ($result < 0) { return -3; } @@ -973,6 +1037,239 @@ class Reception extends CommonObject return $num; } + /** + * Add a simple reception line. + * + * @param float $qty Quantity + * @param string $element_type Element type + * @param int $fk_product Id of product + * @param int|null $fk_unit Code of the unit to use. + * @param int $rang Position of line + * @param string $description Description of line product + * @param array $array_options extrafields array + * @return int Return integer <0 if KO, >0 if OK + */ + public function addlinefree($qty, $element_type, $fk_product, $fk_unit, $rang, $description, $array_options = []) + { + global $mysoc, $langs, $user; + + if ($this->status == self::STATUS_DRAFT) { + if (empty($rang)) { + $rang = 0; + } + + $qty = (float) price2num($qty); + + $this->db->begin(); + + // Rank to use + $ranktouse = $this->rang; + if ($ranktouse == -1) { + $rangmax = $this->line_max($this->fk_reception); + $ranktouse = $rangmax + 1; + } + + // Insert line + $this->line = new ReceptionLineBatch($this->db); + $this->line->fk_reception = $this->id; + $this->line->element_type = $element_type; + $this->line->fk_product = $fk_product; + $this->line->description = $description; + + $this->line->qty = (float) $qty; + $this->line->fk_unit = $fk_unit; + $this->line->rang = $ranktouse; + + if (is_array($array_options) && count($array_options) > 0) { + $this->line->array_options = $array_options; + } + + $result = $this->line->insert($user); + if ($result > 0) { + if (!isset($this->context['createfromclone'])) { + if ($this->fk_reception) { + $this->line_order(true, 'DESC'); + } elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { + $linecount = count($this->lines); + for ($ii = $ranktouse; $ii <= $linecount; $ii++) { + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); + } + } + $this->lines[] = $this->line; + } + + $this->db->commit(); + return $this->line->id; + } else { + $this->error = $this->line->error; + dol_syslog(get_class($this)."::addlinefree error=".$this->error, LOG_ERR); + $this->db->rollback(); + return -2; + } + } else { + dol_syslog(get_class($this)."::addlinefree status of reception must be Draft to allow use of ->addlinefree()", LOG_ERR); + return -3; + } + } + + /** + * Update a simple reception line. + * + * @param int $rowid ID of line + * @param float $qty Quantity + * @param string $element_type Element type + * @param int $fk_product Id of product + * @param ?int $fk_unit Code of the unit to use. + * @param int $rang Position of line + * @param string $description Description of line product + * @param int $notrigger disable line update trigger + * @param array $array_options extrafields array + * @return int Return integer <0 if KO, >0 if OK + */ + public function updatelinefree($rowid, $qty, $element_type, $fk_product, $fk_unit, $rang, $description, $notrigger, $array_options = array()) + { + global $mysoc, $langs, $user; + + if ($this->statut == self::STATUS_DRAFT) { + $this->db->begin(); + + if (empty($qty)) { + $qty = 0; + } + if (empty($rang)) { + $rang = 0; + } + + $qty = (float) $qty; + $description = trim($description); + + // Fetch current line from the database and then clone the object and set it in $oldline property + $line = new ReceptionLineBatch($this->db); + + $line->fetch($rowid); + $line->fetch_optionals(); + + if (!empty($line->fk_product)) { + $product = new Product($this->db); + $result = $product->fetch($line->fk_product); + $product_type = $product->type; + } + + $staticline = clone $line; + + $line->oldline = $staticline; + $this->line = $line; + $this->line->context = $this->context; + $this->line->rang = $rang; + $this->line->fk_reception = $this->id; + $this->line->element_type = $element_type; + $this->line->fk_product = $line->fk_product; + $this->line->qty = $qty; + $this->line->fk_unit = $fk_unit; + $this->line->description = $description; + + if (is_array($array_options) && count($array_options) > 0) { + // We replace values in this->line->array_options only for entries defined into $array_options + foreach ($array_options as $key => $value) { + $this->line->array_options[$key] = $array_options[$key]; + } + } + + + $result = $this->line->update($user, $notrigger); + if ($result > 0) { + // Reorder if child line + + + $this->db->commit(); + return $result; + } else { + $this->error = $this->line->error; + + $this->db->rollback(); + return -1; + } + } else { + $this->error = get_class($this)."::updatelinefree reception status makes operation forbidden"; + $this->errors = array('ReceptionStatusMakeOperationForbidden'); + return -2; + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load lines of simple reception + * + * @return int >0 if OK, Otherwise if KO + */ + public function fetch_lines_free() + { + // phpcs:enable + global $mysoc; + + $this->lines = array(); + + $sql = 'SELECT rc.rowid, rc.fk_reception, rc.fk_entrepot, rc.fk_product, rc.fk_unit, rc.description, rc.fk_elementdet, rc.fk_element, rc.element_type, rc.qty, rc.rang'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'receptiondet_batch as rc'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = rc.fk_product)'; + $sql .= ' WHERE rc.fk_reception = '.((int) $this->id); + + $sql .= ' ORDER BY rc.rang, rc.rowid'; + + dol_syslog(get_class($this)."::fetch_lines_free", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) { + $num = $this->db->num_rows($result); + + $i = 0; + while ($i < $num) { + $objp = $this->db->fetch_object($result); + + $line = new ReceptionLineBatch($this->db); + + $line->rowid = $objp->rowid; + $line->id = $objp->rowid; + $line->fk_reception = $this->id; + + $line->description = $objp->description; + $line->qty = $objp->qty; + $line->fk_entrepot = $objp->fk_entrepot; + $line->fk_product = $objp->fk_product; + + $line->rang = $objp->rang; + + + $line->fk_element = $objp->fk_element; + $line->fk_unit = $objp->fk_unit; + $line->fk_elementdet = $objp->fk_elementdet; + $line->fk_element_type = $objp->element_type; + $line->fetch_optionals(); + + + + $this->lines[$i] = $line; + + $i++; + } + + $this->db->free($result); + + return 1; + } else { + $this->error = $this->db->error(); + return -3; + } + } + + /** + * Create an array of reception lines + * + * @return int >0 if OK, <0 if KO + */ + public function getLinesArray() + { + return $this->fetch_lines_free(); + } /** * Update database diff --git a/htdocs/reception/class/receptionlinebatch.class.php b/htdocs/reception/class/receptionlinebatch.class.php index 6cfb7f9c3e3..a8e3ab2613c 100644 --- a/htdocs/reception/class/receptionlinebatch.class.php +++ b/htdocs/reception/class/receptionlinebatch.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Christophe Battarel * Copyright (C) 2024 MDW + * Copyright (C) 2025 Nick Fragoulis * * 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 @@ -173,8 +174,10 @@ class ReceptionLineBatch extends CommonObjectLine * @var int|float */ public $cost_price = 0; - - + /** + * @var int rang of line + */ + public $rang; /** @@ -249,6 +252,18 @@ class ReceptionLineBatch extends CommonObjectLine return -1; } + + if (empty($this->rang)) { + $this->rang = 0; + } + + // Rank to use + $ranktouse = $this->rang; + if ($ranktouse == -1) { + $rangmax = $this->line_max($this->fk_reception); + $ranktouse = $rangmax + 1; + } + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; $sql .= "fk_product,"; @@ -264,6 +279,9 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= "batch,"; $sql .= "eatby,"; $sql .= "sellby,"; + $sql .= ", fk_unit"; + $sql .= ", description"; + $sql .= ", rang"; $sql .= "fk_reception,"; $sql .= "cost_price"; $sql .= ") VALUES ("; @@ -280,6 +298,9 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").","; $sql .= " ".(!isset($this->eatby) || dol_strlen((string) $this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").","; $sql .= " ".(!isset($this->sellby) || dol_strlen((string) $this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").","; + $sql .= ", ".((int) $this->fk_unit); + $sql .= ", '".(empty($this->description) ? '' : $this->db->escape($this->description))."'"; + $sql .= ", ".((int) $ranktouse).","; $sql .= " ".((int) $this->fk_reception).","; $sql .= " ".(!isset($this->cost_price) ? '0' : (float) $this->cost_price); $sql .= ")"; @@ -329,6 +350,110 @@ class ReceptionLineBatch extends CommonObjectLine } + /** + * Insert line into database + * + * @param User $user User that modify + * @param int $notrigger 1 = disable triggers + * @return int Return integer <0 if KO, line id >0 if OK + */ + public function insert($user = null, $notrigger = 0) + { + global $langs; + $error = 0; + + // Check parameters + $origin_id = $this->origin_id; + if ($origin_id > 0) { + if ((empty($this->fk_reception) + || (empty($this->fk_elementdet)) + || !is_numeric($this->qty))) { + $langs->load('errors'); + $this->errors[] = $langs->trans('ErrorMandatoryParametersNotProvided'); + return -1; + } + } else { + if (empty($this->fk_reception) || !is_numeric($this->qty)) { + $langs->load('errors'); + $this->errors[] = $langs->trans('ErrorMandatoryParametersNotProvided'); + return -1; + } + } + $this->db->begin(); + + if (empty($this->rang)) { + $this->rang = 0; + } + + // Rank to use + $ranktouse = $this->rang; + if ($ranktouse == -1) { + $rangmax = $this->line_max($this->fk_reception); + $ranktouse = $rangmax + 1; + } + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."receptiondet_batch ("; + $sql .= "fk_reception"; + $sql .= ", fk_entrepot"; + $sql .= ", fk_elementdet"; + $sql .= ", fk_product"; + $sql .= ", element_type"; + $sql .= ", qty"; + $sql .= ", fk_unit"; + $sql .= ", description"; + $sql .= ", rang"; + $sql .= ") VALUES ("; + $sql .= $this->fk_reception; + $sql .= ", ".(empty($this->fk_entrepot) ? 'NULL' : $this->fk_entrepot); + $sql .= ", ".(empty($this->fk_elementdet) ? 'NULL' : $this->fk_elementdet); + $sql .= ", ".(empty($this->fk_product) ? 'NULL' : $this->fk_product); + $sql .= ", '".(empty($this->element_type) ? 'order' : $this->db->escape($this->element_type))."'"; + $sql .= ", ".price2num($this->qty, 'MS'); + $sql .= ", ".((int) $this->fk_unit); + $sql .= ", '".(empty($this->description) ? '' : $this->db->escape($this->description))."'"; + $sql .= ", ".((int) $ranktouse); + $sql .= ")"; + + dol_syslog(get_class($this)."::insert", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."receptiondet_batch"); + + + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } + + + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('LINERECEPTION_INSERT', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + + if ($error) { + foreach ($this->errors as $errmsg) { + dol_syslog(__METHOD__.' '.$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + } + } else { + $error++; + } + + if ($error) { + $this->db->rollback(); + return -1; + } else { + $this->db->commit(); + return $this->id; + } + } + /** * Load object in memory from the database * @@ -354,6 +479,9 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= " t.batch,"; $sql .= " t.eatby,"; $sql .= " t.sellby,"; + $sql .= " t.fk_unit,"; + $sql .= " t.description,"; + $sql .= " t.rang,"; $sql .= " t.fk_reception"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; if ($ref) { @@ -376,7 +504,6 @@ class ReceptionLineBatch extends CommonObjectLine $this->origin_line_id = $obj->fk_elementdet; $this->element_type = $obj->element_type; $this->origin_type = $obj->element_type; - $this->fk_product = $obj->fk_product; $this->qty = $obj->qty; $this->fk_entrepot = $obj->fk_entrepot; @@ -388,6 +515,9 @@ class ReceptionLineBatch extends CommonObjectLine $this->batch = $obj->batch; $this->eatby = $this->db->jdate($obj->eatby); $this->sellby = $this->db->jdate($obj->sellby); + $this->description = $obj->description; + $this->fk_unit = $obj->fk_unit; + $this->rang = $obj->rang; $this->fk_reception = $obj->fk_reception; $this->fetch_optionals(); @@ -444,7 +574,6 @@ class ReceptionLineBatch extends CommonObjectLine } - // Check parameters // Put here code to add a control on parameters values @@ -462,7 +591,8 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").","; $sql .= " eatby=".(dol_strlen((string) $this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').","; - $sql .= " sellby=".(dol_strlen((string) $this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null'); + $sql .= " sellby=".(dol_strlen((string) $this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').","; + $sql .= " fk_unit = ".((int) $this->fk_unit); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -521,17 +651,16 @@ class ReceptionLineBatch extends CommonObjectLine $this->db->begin(); - if (!$error) { - if (!$notrigger) { - // Call triggers - $result = $this->call_trigger('LINERECEPTION_DELETE', $user); - if ($result < 0) { - $error++; - } - // End call triggers + if (!$notrigger) { + // Call triggers + $result = $this->call_trigger('LINERECEPTION_DELETE', $user); + if ($result < 0) { + $error++; } + // End call triggers } + // Remove extrafields if (!$error) { $result = $this->deleteExtraFields(); @@ -618,7 +747,6 @@ class ReceptionLineBatch extends CommonObjectLine } - /** * Return label of the status of object * @@ -706,6 +834,7 @@ class ReceptionLineBatch extends CommonObjectLine return 1; } + /** * Load object in memory from the database * @@ -735,7 +864,10 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= " t.tms,"; $sql .= " t.batch,"; $sql .= " t.eatby,"; - $sql .= " t.sellby"; + $sql .= " t.sellby,"; + $sql .= " t.fk_unit,"; + $sql .= " t.description,"; + $sql .= " t.rang"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; // Manage filter @@ -800,6 +932,9 @@ class ReceptionLineBatch extends CommonObjectLine $line->batch = $obj->batch; $line->eatby = $this->db->jdate($obj->eatby); $line->sellby = $this->db->jdate($obj->sellby); + $line->description = $obj->description; + $line->fk_unit = $obj->fk_unit; + $line->rang = $obj->rang; $line->fetch_optionals(); $this->lines[$line->id] = $line; diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index f48913adb5d..e48e3a597e0 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -97,7 +97,7 @@ class RecruitmentCandidature extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 7f80ddce7c4..d726c1ea48a 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -102,7 +102,7 @@ class RecruitmentJobPosition extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index c4c2b344af3..dfa29be6696 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -94,6 +94,8 @@ if (empty($sortfield)) { $sortfield = "t.ref"; } +$search_all = trim(GETPOST('search_all', 'alphanohtml')); + // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; @@ -367,7 +369,7 @@ if (!$resql) { $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && !$page) { +if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".dol_buildpath('/resource/card.php', 1).'?id='.$id); @@ -480,9 +482,10 @@ print ''."\n"; // Fields title search print ''; +// Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } @@ -559,6 +562,7 @@ $totalarray['nbfield'] = 0; // Fields title label print ''; +// Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); } @@ -626,7 +630,7 @@ while ($i < $imaxinloop) { $objectstatic->max_users = $obj->max_users; $objectstatic->url = $obj->url; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index ff5f5e24c04..cc3ef4c3e6f 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -150,7 +150,7 @@ class PaymentSalary extends CommonObject public $datev = ''; /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 220efd493b7..9d80e0614b2 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -197,6 +197,7 @@ class Salary extends CommonObject $this->db = $db; $this->element = 'salary'; $this->table_element = 'salary'; + $this->isextrafieldmanaged = 1; $this->fields['ref_ext']['visible'] = getDolGlobalInt('MAIN_LIST_SHOW_REF_EXT'); } diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index cf33578ae17..9b5b7adb798 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -92,7 +92,7 @@ class CompanyBankAccount extends Account // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => -1,), diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index f396eedb578..c76d530f39f 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -72,7 +72,7 @@ class CompanyPaymentMode extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'Rowid', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 0dbff0b0854..156b70d742a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -179,7 +179,7 @@ class Societe extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), @@ -1329,10 +1329,13 @@ class Societe extends CommonObject $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'TVA_INTRA', 'ACCOUNTANCY_CODE_CUSTOMER', 'ACCOUNTANCY_CODE_SUPPLIER'); foreach ($array_to_check as $key) { $keymin = strtolower($key); + $keyfield_db = $keymin; if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') { $keymin = 'code_compta_client'; + $keyfield_db = 'code_compta'; } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER') { $keymin = 'code_compta_fournisseur'; + $keyfield_db = 'code_compta_fournisseur'; } $i = (int) preg_replace('/[^0-9]/', '', $key); $vallabel = $this->$keymin; @@ -1392,7 +1395,7 @@ class Societe extends CommonObject } elseif ($key == 'ACCOUNTANCY_CODE_CUSTOMER' && !empty($this->client)) { // Check for unicity if ($vallabel && getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_UNIQUE')) { - if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { + if ($this->id_prof_exists($keyfield_db, $vallabel, ($this->id > 0 ? $this->id : 0))) { $langs->loadLangs(array("errors", 'compta')); $error++; $this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; @@ -1408,7 +1411,7 @@ class Societe extends CommonObject } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) { // Check for unicity if ($vallabel && getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_UNIQUE')) { - if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { + if ($this->id_prof_exists($keyfield_db, $vallabel, ($this->id > 0 ? $this->id : 0))) { $langs->loadLangs(array("errors", 'compta')); $error++; $this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index fa6ab676a01..3f90bc8e728 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -94,7 +94,7 @@ class SocieteAccount extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index a4cb0bd222f..7a8c57545ec 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -87,7 +87,7 @@ class CTicketCategory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -144,7 +144,7 @@ class CTicketCategory extends CommonObject public $fk_user_modif; /** - * @var string public $last_main_doc + * @var string public */ public $last_main_doc; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 2cabb21a3e7..e21d0aced86 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -711,7 +711,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFailedToSetNewPassword"), null, 'errors'); } else { // Success - if ($action == 'confirm_passwordsend' && $confirm == 'yes') { // Test on permission already done + if ($action == 'confirm_passwordsend') { // Test on permission already done if ($object->send_password($user, $newpassword) > 0) { setEventMessages($langs->trans("PasswordChangedAndSentTo", $object->email), null, 'mesgs'); } else { diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 142e1078236..6c10b724fc7 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -97,7 +97,7 @@ class ProductAttribute extends CommonObject * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index a45dd0e2ec0..28636d1733b 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2022 Open-Dsi - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -66,7 +66,7 @@ class ProductAttributeValue extends CommonObjectLine * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 48a2854e17d..e22eadd2f0b 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -95,7 +95,7 @@ class Target extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/webportal/class/html.formlistwebportal.class.php b/htdocs/webportal/class/html.formlistwebportal.class.php index f85373f71e7..694f067c9e6 100644 --- a/htdocs/webportal/class/html.formlistwebportal.class.php +++ b/htdocs/webportal/class/html.formlistwebportal.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2023-2024 Laurent Destailleur * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2023-2024 Patrice Andreani - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -92,7 +92,7 @@ class FormListWebPortal public $contextpage = ''; /** - * @var string[] Search filters + * @var array Search filters */ public $search = array(); diff --git a/htdocs/webportal/class/webportalinvoice.class.php b/htdocs/webportal/class/webportalinvoice.class.php index 3d4de9ef1ec..8bc7e15db8e 100644 --- a/htdocs/webportal/class/webportalinvoice.class.php +++ b/htdocs/webportal/class/webportalinvoice.class.php @@ -93,7 +93,7 @@ class WebPortalInvoice extends Facture // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 1,), diff --git a/htdocs/webportal/class/webportalmember.class.php b/htdocs/webportal/class/webportalmember.class.php index 745743a05d6..23b5bd4c3f5 100644 --- a/htdocs/webportal/class/webportalmember.class.php +++ b/htdocs/webportal/class/webportalmember.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -109,7 +109,7 @@ class WebPortalMember extends Adherent // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10,), diff --git a/htdocs/webportal/class/webportalorder.class.php b/htdocs/webportal/class/webportalorder.class.php index 89daf25ab81..434f3ebe5a6 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -94,7 +94,7 @@ class WebPortalOrder extends Commande // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10,), diff --git a/htdocs/webportal/class/webportalpartnership.class.php b/htdocs/webportal/class/webportalpartnership.class.php index 451550b4fa4..613a1715bc8 100644 --- a/htdocs/webportal/class/webportalpartnership.class.php +++ b/htdocs/webportal/class/webportalpartnership.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -93,7 +93,7 @@ class WebPortalPartnership extends Partnership // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id",), diff --git a/htdocs/webportal/class/webportalpropal.class.php b/htdocs/webportal/class/webportalpropal.class.php index d4d4e744b0d..bba71fd4bd6 100644 --- a/htdocs/webportal/class/webportalpropal.class.php +++ b/htdocs/webportal/class/webportalpropal.class.php @@ -94,7 +94,7 @@ class WebPortalPropal extends Propal // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id",), diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 437f21029af..f17e91f5025 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -203,7 +203,7 @@ class WebsitePage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index 90e06c40e77..bd1ded780c6 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -90,7 +90,7 @@ class Workstation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 36d3638e971..31fe884b26f 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -30,14 +30,14 @@ */ class WorkstationResource extends CommonObject { - /** @var string $table_element Table name in SQL */ + /** @var string Table name in SQL */ public $table_element = 'workstation_workstation_resource'; - /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */ + /** @var string Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */ public $element = 'workstationresource'; /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer', 'label' => 'Workstation', 'enabled' => 1, 'position' => 10, 'visible' => 1), diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index 0f623d57564..cad45aef8fd 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -29,14 +29,14 @@ */ class WorkstationUserGroup extends CommonObject { - /** @var string $table_element Table name in SQL */ + /** @var string Table name in SQL */ public $table_element = 'workstation_workstation_usergroup'; - /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */ + /** @var string Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */ public $element = 'workstationusergroup'; /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer', 'label' => 'Workstation', 'enabled' => 1, 'position' => 10, 'visible' => 1), diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index f36dcd6e16a..2ae1d534362 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2019-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -72,7 +72,7 @@ class Hook extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>|string,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array(
'; - $searchpicto = $form->showFilterButtons(); + print ''; + $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print '