From 2fd6be2112cbc770733dab673f8dded3be757bd4 Mon Sep 17 00:00:00 2001 From: MathildeMar <52039073+MathildeMar@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:56:42 +0200 Subject: [PATCH 001/259] Bug fix: substitution variables in notification of a quote signed by customer Add fetch_thirdparty before getCommonSubstitutionArray to initialize substitution variables of type __THIRDPARTY_XXX__ in notification mails --- htdocs/core/class/notify.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 93519c6e0ec..1f9d52ba70b 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -938,6 +938,9 @@ class Notify $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse); } if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + if (empty($object->thirdparty)) { + $object->fetch_thirdparty(); + } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs); From 72cf841677e2402647811b8e115f227114a7fc4e Mon Sep 17 00:00:00 2001 From: MathildeMar <52039073+MathildeMar@users.noreply.github.com> Date: Fri, 20 Sep 2024 11:06:24 +0200 Subject: [PATCH 002/259] Check that the method fetch_thirdparty() exists --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 1f9d52ba70b..127e49fe12c 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -938,7 +938,7 @@ class Notify $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse); } if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - if (empty($object->thirdparty)) { + if (method_exists($object, 'fetch_thirdparty') && empty($object->thirdparty)) { $object->fetch_thirdparty(); } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); From c51011b8d185639afaf87d37459676d82db01867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 19 Nov 2024 15:40:37 +0100 Subject: [PATCH 003/259] fix CI phpstan (#32001) * Update project.class.php * Update assetmodel.class.php * Update assetmodel.class.php * test * Update assetmodel.class.php * Update assetmodel.class.php * Update assetmodel.class.php * Update assetmodel.class.php * Update project.class.php * Update project.class.php --- htdocs/asset/class/assetmodel.class.php | 2 +- htdocs/projet/class/project.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index d149a81f9d0..1f2442e2418 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -95,7 +95,7 @@ class AssetModel extends CommonObject 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'position' => 25, 'notnull' => 0, 'visible' => 0), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => 1,), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,), 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array(0 => 'AssetTypeIntangible', 1 => 'AssetTypeTangible', 2 => 'AssetTypeInProgress', 3 => 'AssetTypeFinancial'), 'validate' => 1,), 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 301, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 3d29e805129..d1cdb653234 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -95,7 +95,7 @@ class Project extends CommonObject public $dateo; /** - * @var ?int|string Date start + * @var null|int|string Field with Date start */ public $date_start; @@ -106,7 +106,7 @@ class Project extends CommonObject public $datee; /** - * @var ?int|string Date end + * @var null|int|string Field with Date end */ public $date_end; From 6bc13b88adf6e93773540aa1e4a3a235e99243f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Nov 2024 18:07:35 +0100 Subject: [PATCH 004/259] Debug v21 --- htdocs/core/js/lib_head.js.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 7e474a1904b..325955b617a 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1108,6 +1108,10 @@ function getParameterByName(name, valueifnotfound) function getOperatorsForFieldType(type) { // Define the list of operators for each general field category const operatorList = { + selectlink: { + Is: 'trans('Is')); ?>', + IsNot: 'trans('IsNot')); ?>', + }, text: { Contains: 'trans('Contains')); ?>', DoesNotContain: 'trans('DoesNotContain')); ?>', @@ -1143,7 +1147,9 @@ function getOperatorsForFieldType(type) { console.log('Get list of operators for type='+type); - if (/^(varchar|char|text|blob|nchar|mediumtext|longtext)\(\d+\)$/i.test(type) || /^(varchar)$/i.test(type)) { + if (/^select$/i.test(type) || /^link$/i.test(type)) { + generalType = "selectlink"; + } else if (/^(varchar|char|text|blob|nchar|mediumtext|longtext)\(\d+\)$/i.test(type) || /^varchar$/i.test(type)) { generalType = "text"; } else if (/^(int|integer|float|double|decimal|numeric)(\(\d+,\d+\))?$/i.test(type)) { generalType = "number"; @@ -1155,6 +1161,7 @@ function getOperatorsForFieldType(type) { generalType = "html"; } else { // Handle unknown or unsupported types + console.log("The type of field "+type+" is not supported"); return []; } From c254f1f11c801d35e9f0b954e06daf3a25292748 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Nov 2024 18:21:23 +0100 Subject: [PATCH 005/259] Restore v1 file for batch of apstats until we succeed in running v2 --- phpstan.v1.neon | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 phpstan.v1.neon diff --git a/phpstan.v1.neon b/phpstan.v1.neon new file mode 100644 index 00000000000..b4c987d2c41 --- /dev/null +++ b/phpstan.v1.neon @@ -0,0 +1,97 @@ +parameters: + tmpDir: ./.github/tmp + parallel: + # Commented some of the settings, reminding the defaults: + # should adapt better to target machines + # jobSize: 8 # default is 20 + processTimeout: 600.0 + # maximumNumberOfProcesses: 20 # default is 32 + # minimumNumberOfJobsPerProcess: 2 # default is 2 + # buffer: 134217728 # 128 MB # Not documented + customRulesetUsed: true + level: 9 + fileExtensions: + - php + paths: + - htdocs + - scripts + excludePaths: + analyseAndScan: + - htdocs/custom/* + - htdocs/documents/* + - htdocs/install/doctemplates/* + - htdocs/langs/* + - htdocs/modulebuilder/template/test/* + - htdocs/support/* + analyse: + - htdocs/includes/* + - htdocs/core/class/lessc.class.php + checkAlwaysTrueCheckTypeFunctionCall: false + checkAlwaysTrueInstanceof: false + checkAlwaysTrueStrictComparison: false + checkClassCaseSensitivity: true + checkFunctionArgumentTypes: true + checkFunctionNameCase: true + checkArgumentsPassedByReference: true + checkMaybeUndefinedVariables: true + checkNullables: false + checkThisOnly: true + checkUnionTypes: false + checkExplicitMixedMissingReturn: true + reportMaybes: false + reportMaybesInMethodSignatures: false + reportStaticMethodSignatures: false + polluteScopeWithLoopInitialAssignments: true + polluteScopeWithAlwaysIterableForeach: true + reportMagicMethods: false + reportMagicProperties: false + treatPhpDocTypesAsCertain: false + ignoreErrors: + - '#.*phan-var#' + internalErrorsCountLimit: 50 + cache: + nodesByFileCountMax: 512 + nodesByStringCountMax: 512 + reportUnmatchedIgnoredErrors: false + universalObjectCratesClasses: + - stdClass + - SimpleXMLElement + earlyTerminatingMethodCalls: [] + dynamicConstantNames: + - ICONV_IMPL + - PHP_VERSION + - PHP_MAJOR_VERSION + - PHP_MINOR_VERSION + - PHP_RELEASE_VERSION + - PHP_VERSION_ID + - PHP_EXTRA_VERSION + - PHP_ZTS + - PHP_DEBUG + - PHP_MAXPATHLEN + - PHP_OS + - PHP_OS_FAMILY + - PHP_SAPI + - PHP_EOL + - PHP_INT_MAX + - PHP_INT_MIN + - PHP_INT_SIZE + - PHP_FLOAT_DIG + - PHP_FLOAT_EPSILON + - PHP_FLOAT_MIN + - PHP_FLOAT_MAX + - DEFAULT_INCLUDE_PATH + - PEAR_INSTALL_DIR + - PEAR_EXTENSION_DIR + - PHP_EXTENSION_DIR + - PHP_PREFIX + - PHP_BINDIR + - PHP_BINARY + - PHP_MANDIR + - PHP_LIBDIR + - PHP_DATADIR + - PHP_SYSCONFDIR + - PHP_LOCALSTATEDIR + - PHP_CONFIG_FILE_PATH + - PHP_CONFIG_FILE_SCAN_DIR + - PHP_SHLIB_SUFFIX + - PHP_FD_SETSIZE From cf5e5d7dbd33bb515c396ba7e3b656dd047b0ed8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Nov 2024 18:41:33 +0100 Subject: [PATCH 006/259] Fix use of phpstan file --- dev/tools/apstats.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index 79549d03b3f..b6fd7ed4adb 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -149,7 +149,7 @@ $phpstanversion = $output_arrtd[0]; $output_arrtd = array(); if ($dirphpstan != 'disabled') { - $commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan --level='.$PHPSTANLEVEL.' -v analyze -a build/phpstan/bootstrap.php --memory-limit 8G --error-format=github'; + $commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan --level='.$PHPSTANLEVEL.' -v analyze -a build/phpstan/bootstrap.php --memory-limit 8G --error-format=github -c ~/preview.dolibarr.org/dolibarr/phpstan.v1.neon'; print 'Execute PHPStan to get the technical debt: '.$commandcheck."\n"; $resexectd = 0; exec($commandcheck, $output_arrtd, $resexectd); From 926b6301c7f863e39796587c18af65dac5604610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 19 Nov 2024 19:16:46 +0100 Subject: [PATCH 007/259] fix phpstan (#32004) * fix phpstan * fix phpstan --- build/phpstan/phpstan-baseline.neon | 374 +--------------------------- htdocs/loan/card.php | 1 + htdocs/loan/class/loan.class.php | 27 +- htdocs/loan/list.php | 5 +- 4 files changed, 20 insertions(+), 387 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 55b851c12de..e3610846bdd 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -2640,12 +2640,6 @@ parameters: count: 2 path: ../../htdocs/asset/class/assetmodel.class.php - - - message: '#^Property AssetModel\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-2, 5\>\|string, noteditable\?\: int\<0, 1\>, default\?\: string, \.\.\.\}\>\) does not accept default value of type array\{rowid\: array\{type\: ''integer'', label\: ''TechnicalID'', enabled\: 1, position\: 1, notnull\: 1, visible\: 0, noteditable\: 1, index\: 1, \.\.\.\}, ref\: array\{type\: ''varchar\(128\)'', label\: ''Ref'', enabled\: 1, position\: 20, notnull\: 1, visible\: 1, index\: 1, searchall\: 1, \.\.\.\}, label\: array\{type\: ''varchar\(255\)'', label\: ''Label'', enabled\: 1, position\: 30, notnull\: 1, visible\: 1, searchall\: 1, css\: ''minwidth300'', \.\.\.\}, asset_type\: array\{type\: ''smallint'', label\: ''AssetType'', enabled\: 1, position\: 40, notnull\: 1, visible\: 1, arrayofkeyval\: array\{''AssetTypeIntangible'', ''AssetTypeTangible'', ''AssetTypeInProgress'', ''AssetTypeFinancial''\}, validate\: 1\}, note_public\: array\{type\: ''html'', label\: ''NotePublic'', enabled\: 1, position\: 300, notnull\: 0, visible\: 0, validate\: 1\}, note_private\: array\{type\: ''html'', label\: ''NotePrivate'', enabled\: 1, position\: 301, notnull\: 0, visible\: 0, validate\: 1\}, date_creation\: array\{type\: ''datetime'', label\: ''DateCreation'', enabled\: 1, position\: 500, notnull\: 1, visible\: \-2\}, tms\: array\{type\: ''timestamp'', label\: ''DateModification'', enabled\: 1, position\: 501, notnull\: 0, visible\: \-2\}, \.\.\.\}\.$#' - identifier: property.defaultValue - count: 1 - path: ../../htdocs/asset/class/assetmodel.class.php - - message: '#^Property AssetModel\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -6732,42 +6726,6 @@ parameters: count: 2 path: ../../htdocs/compta/paiement.php - - - message: '#^Variable \$multicurrency_creditnotes might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$multicurrency_deposits might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$multicurrency_payment might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$multicurrency_remaintopay might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$sign might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$text might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/compta/paiement.php - - message: '#^Variable \$marginInfo might not be defined\.$#' identifier: variable.undefined @@ -6780,12 +6738,6 @@ parameters: count: 2 path: ../../htdocs/compta/paiement/card.php - - - message: '#^Variable \$site_account_payment might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/compta/paiement/card.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -6798,12 +6750,6 @@ parameters: count: 3 path: ../../htdocs/compta/paiement/cheque/card.php - - - message: '#^Variable \$paiement might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/compta/paiement/cheque/card.php - - message: '#^Call to function method_exists\(\) with \$this\(RemiseCheque\) and ''LibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -6984,12 +6930,6 @@ parameters: count: 1 path: ../../htdocs/compta/paiement_charge.php - - - message: '#^Variable \$sumpaid might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/compta/paiement_charge.php - - message: '#^Comparison operation "\>" between 1 and 1 is always false\.$#' identifier: greater.alwaysFalse @@ -7002,18 +6942,6 @@ parameters: count: 2 path: ../../htdocs/compta/paiement_vat.php - - - message: '#^Variable \$sumpaid might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/paiement_vat.php - - - - message: '#^Variable \$outputlangs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/payment_vat/card.php - - message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -7026,18 +6954,6 @@ parameters: count: 1 path: ../../htdocs/compta/prelevement/card.php - - - message: '#^Variable \$thirdparty might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/card.php - - - - message: '#^Variable \$userSalary might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/card.php - - message: '#^Call to function method_exists\(\) with \$this\(BonPrelevement\) and ''LibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7134,18 +7050,6 @@ parameters: count: 1 path: ../../htdocs/compta/prelevement/demandes.php - - - message: '#^Variable \$invoicetmpcustomer might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/factures.php - - - - message: '#^Variable \$invoicetmpsupplier might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/factures.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -7158,30 +7062,6 @@ parameters: count: 1 path: ../../htdocs/compta/prelevement/orders_list.php - - - message: '#^Variable \$nbignored might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/orders_list.php - - - - message: '#^Variable \$nbok might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/compta/prelevement/orders_list.php - - - - message: '#^Variable \$nbtotal might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/prelevement/stats.php - - - - message: '#^Variable \$total might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/prelevement/stats.php - - message: '#^Offset ''checked'' on array\{label\: ''Date'', checked\: 1\} in empty\(\) always exists and is not falsy\.$#' identifier: empty.offset @@ -7212,40 +7092,16 @@ parameters: count: 1 path: ../../htdocs/compta/resultat/clientfourn.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/index.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/resultat/index.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/index.php - - - - message: '#^Variable \$period might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/index.php - - - - message: '#^Variable \$periodlink might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/index.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined - count: 6 + count: 5 path: ../../htdocs/compta/resultat/index.php - @@ -7260,18 +7116,6 @@ parameters: count: 1 path: ../../htdocs/compta/resultat/result.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/result.php - - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/result.php - - message: '#^Variable \$code might not be defined\.$#' identifier: variable.undefined @@ -7284,18 +7128,6 @@ parameters: count: 1 path: ../../htdocs/compta/resultat/result.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/result.php - - - - message: '#^Variable \$period might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/result.php - - message: '#^Variable \$sommes in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -7506,30 +7338,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/cabyprodserv.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyprodserv.php - - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyprodserv.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/cabyprodserv.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyprodserv.php - - message: '#^Variable \$searchCategorySocieteList in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -7560,30 +7374,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/cabyuser.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyuser.php - - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyuser.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/cabyuser.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyuser.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined @@ -7596,30 +7392,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/casoc.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/casoc.php - - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/casoc.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/casoc.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/casoc.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined @@ -7638,18 +7416,6 @@ parameters: count: 1 path: ../../htdocs/compta/stats/index.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/index.php - - - - message: '#^Variable \$periodlink might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/index.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined @@ -7668,18 +7434,6 @@ parameters: count: 1 path: ../../htdocs/compta/stats/supplier_turnover.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover.php - - - - message: '#^Variable \$periodlink might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined @@ -7692,30 +7446,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - - - message: '#^Variable \$q might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - message: '#^Variable \$result might not be defined\.$#' identifier: variable.undefined @@ -7746,24 +7482,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - message: '#^Variable \$result might not be defined\.$#' identifier: variable.undefined @@ -7794,18 +7518,6 @@ parameters: count: 1 path: ../../htdocs/compta/tva/card.php - - - message: '#^Variable \$accountline might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/tva/card.php - - - - message: '#^Variable \$resteapayer might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/tva/card.php - - message: '#^Property PaymentVAT\:\:\$amount \(float\|int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -8280,12 +7992,6 @@ parameters: count: 1 path: ../../htdocs/contact/consumption.php - - - message: '#^Variable \$documentstaticline might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/contact/consumption.php - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable @@ -8952,12 +8658,6 @@ parameters: count: 2 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$pagecount might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$permissiontoadd might not be defined\.$#' identifier: variable.undefined @@ -9036,12 +8736,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_sendmails.inc.php - - - message: '#^Variable \$sendtosocid might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/actions_sendmails.inc.php - - message: '#^Variable \$thirdparty might not be defined\.$#' identifier: variable.undefined @@ -9126,12 +8820,6 @@ parameters: count: 1 path: ../../htdocs/core/ajax/ajaxdirpreview.php - - - message: '#^Property User\:\:\$lastname \(string\) does not accept int\.$#' - identifier: assign.propertyType - count: 1 - path: ../../htdocs/core/ajax/ajaxdirtree.php - - message: '#^Variable \$action might not be defined\.$#' identifier: variable.undefined @@ -9144,12 +8832,6 @@ parameters: count: 2 path: ../../htdocs/core/ajax/ajaxdirtree.php - - - message: '#^Variable \$fullpathpreopened might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/ajax/ajaxdirtree.php - - message: '#^Variable \$module might not be defined\.$#' identifier: variable.undefined @@ -9222,12 +8904,6 @@ parameters: count: 1 path: ../../htdocs/core/ajax/selectobject.php - - - message: '#^Variable \$objecttmp might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/core/ajax/selectobject.php - - message: '#^Constructor of class box_accountancy_last_manual_entries has an unused parameter \$param\.$#' identifier: constructor.unusedParameter @@ -24618,48 +24294,6 @@ parameters: count: 1 path: ../../htdocs/knowledgemanagement/knowledgerecord_list.php - - - message: '#^Variable \$staytopay might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/loan/card.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Loan\) and ''LibStatut'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Loan\) and ''getNomUrl'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Loan\) and ''capital'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Loan\) and ''dateend'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Loan\) and ''datestart'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Parameter \#2 \$alreadypaid of method Loan\:\:getLibStatut\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - message: '#^Property Loan\:\:\$account_capital \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -34038,12 +33672,6 @@ parameters: count: 3 path: ../../htdocs/takepos/pay.php - - - message: '#^Variable \$servicestatus might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/takepos/pay.php - - message: '#^Variable \$stripeacc might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 3b62584644b..413f32e1257 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -75,6 +75,7 @@ $object = new Loan($db); $permissiontoadd = $user->hasRight('loan', 'write'); $error = 0; +$staytopay = 0; /* diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 97c87aaf641..a764f141a90 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -526,7 +526,7 @@ class Loan extends CommonObject * Return label of loan status (unpaid, paid) * * @param int $mode 0=label, 1=short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label - * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise) + * @param float $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise) * @return string Label */ public function getLibStatut($mode = 0, $alreadypaid = -1) @@ -540,7 +540,7 @@ class Loan extends CommonObject * * @param int $status Id status * @param int $mode 0=Label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label, 5=Short label + Picto - * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise) + * @param float $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise) * @return string Label */ public function LibStatut($status, $mode = 0, $alreadypaid = -1) @@ -606,6 +606,12 @@ class Loan extends CommonObject if (!empty($this->label)) { $label .= '
'.$langs->trans('Label').': '.$this->label; } + if (isDolTms($this->datestart)) { + $label .= '
'.$langs->trans("DateStart").': '.dol_print_date($this->datestart, 'day'); + } + if (isDolTms($this->dateend)) { + $label .= '
'.$langs->trans("DateEnd").': '.dol_print_date($this->dateend, 'day'); + } $url = DOL_URL_ROOT.'/loan/card.php?id='.$this->id; @@ -775,26 +781,25 @@ class Loan extends CommonObject $return .= img_picto('', $this->picto); $return .= ''; $return .= '
'; - $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + $return .= ''.$this->getNomUrl(1).''; if ($selected >= 0) { $return .= ''; } - if (property_exists($this, 'capital')) { + if (!empty($this->capital)) { $return .= ' | '.$langs->trans("Amount").' : '.price($this->capital).''; } - if (property_exists($this, 'datestart')) { - $return .= '
'.$langs->trans("DateStart").' : '.dol_print_date($this->db->jdate($this->datestart), 'day').''; + if (isDolTms($this->datestart)) { + $return .= '
'.$langs->trans("DateStart").' : '.dol_print_date($this->datestart, 'day').''; } - if (property_exists($this, 'dateend')) { - $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->db->jdate($this->dateend), 'day').''; + if (isDolTms($this->dateend)) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->dateend, 'day').''; } - if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; - } + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; $return .= '
'; $return .= ''; $return .= ''; + return $return; } } diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index f2fa046923b..e0dd7cb4b98 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -417,7 +417,8 @@ while ($i < $imaxinloop) { $object->ref = $obj->rowid; $object->label = $obj->label; $object->paid = $obj->paid; - + $object->datestart= $db->jdate($obj->datestart); + $object->dateend = $db->jdate($obj->dateend); if ($mode == 'kanban') { if ($i == 0) { @@ -425,8 +426,6 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban - $object->datestart= $obj->datestart; - $object->dateend = $obj->dateend; $object->capital = $obj->capital; $object->totalpaid = $obj->paid; From daae68f9d3fba2175e605db59f0c6d684000d7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 19 Nov 2024 21:02:05 +0100 Subject: [PATCH 008/259] Fix phpstan (#32005) * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan --- build/phpstan/phpstan-baseline.neon | 126 ------------------ .../class/accountancysystem.class.php | 10 +- htdocs/adherents/index.php | 7 + htdocs/admin/remotestore/ajax/image.php | 6 +- htdocs/core/js/lib_foot.js.php | 42 +++--- htdocs/core/js/lib_gravatar.js.php | 7 +- htdocs/core/js/timepicker.js.php | 2 + htdocs/cron/list.php | 4 +- htdocs/hrm/skill_tab.php | 2 + htdocs/modulebuilder/admin/setup.php | 1 + htdocs/product/ajax/products.php | 1 + scripts/product/migrate_picture_path.php | 12 +- scripts/product/regenerate_thumbs.php | 12 +- scripts/user/migrate_picture_path.php | 8 +- scripts/user/sync_groups_dolibarr2ldap.php | 1 + scripts/user/sync_groups_ldap2dolibarr.php | 1 + scripts/user/sync_users_dolibarr2ldap.php | 1 + scripts/user/sync_users_ldap2dolibarr.php | 1 + 18 files changed, 79 insertions(+), 165 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index e3610846bdd..f08d62540be 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1158,36 +1158,6 @@ parameters: count: 2 path: ../../htdocs/adherents/class/subscription.class.php - - - message: '#^Variable \$badgeStatus0 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/index.php - - - - message: '#^Variable \$badgeStatus1 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/index.php - - - - message: '#^Variable \$badgeStatus4 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/index.php - - - - message: '#^Variable \$badgeStatus6 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/index.php - - - - message: '#^Variable \$badgeStatus8 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/adherents/index.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -18246,12 +18216,6 @@ parameters: count: 1 path: ../../htdocs/cron/list.php - - - message: '#^Variable \$head might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/cron/list.php - - message: '#^Variable \$texttoshow might not be defined\.$#' identifier: variable.undefined @@ -23220,12 +23184,6 @@ parameters: count: 1 path: ../../htdocs/hrm/skill_tab.php - - - message: '#^Variable \$head might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/hrm/skill_tab.php - - message: '#^Variable \$object might not be defined\.$#' identifier: variable.undefined @@ -24720,12 +24678,6 @@ parameters: count: 2 path: ../../htdocs/master.inc.php - - - message: '#^Variable \$head might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/modulebuilder/admin/setup.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -26460,12 +26412,6 @@ parameters: count: 1 path: ../../htdocs/product/admin/product_tools.php - - - message: '#^Variable \$arrayresult might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/ajax/products.php - - message: '#^Property ActionsCardProduct\:\:\$field_list has no type specified\.$#' identifier: missingType.property @@ -36312,54 +36258,18 @@ parameters: count: 1 path: ../../scripts/product/migrate_picture_path.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../scripts/product/migrate_picture_path.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/migrate_picture_path.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/migrate_picture_path.php - - message: '#^Result of \|\| is always false\.$#' identifier: booleanOr.alwaysFalse count: 1 path: ../../scripts/product/regenerate_thumbs.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/regenerate_thumbs.php - - message: '#^Variable \$dir in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable count: 1 path: ../../scripts/product/regenerate_thumbs.php - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/regenerate_thumbs.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/regenerate_thumbs.php - - message: '#^Variable \$subdir in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -36372,44 +36282,8 @@ parameters: count: 1 path: ../../scripts/user/migrate_picture_path.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../scripts/user/migrate_picture_path.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/user/migrate_picture_path.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/user/migrate_picture_path.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/user/sync_groups_dolibarr2ldap.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/user/sync_users_dolibarr2ldap.php - - message: '#^Unable to resolve the template type T in call to function array_values$#' identifier: argument.templateType count: 1 path: ../../scripts/user/sync_users_ldap2dolibarr.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/user/sync_users_ldap2dolibarr.php diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 980779ff254..8fdbd1a300c 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2023 Frédéric France - * Copyright (C) 2024 Alexandre Janniaux +/* Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 Alexandre Janniaux * * 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 diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index bc86a13d033..05f86c5989d 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -136,6 +136,13 @@ if ($conf->use_javascript_ajax) { $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), $sumMembers['total']['members_excluded']); $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), $sumMembers['total']['members_resiliated']); + /** + * @var string $badgeStatus0 + * @var string $badgeStatus1 + * @var string $badgeStatus4 + * @var string $badgeStatus6 + * @var string $badgeStatus8 + */ include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; diff --git a/htdocs/admin/remotestore/ajax/image.php b/htdocs/admin/remotestore/ajax/image.php index c32791685fa..b78bab01011 100644 --- a/htdocs/admin/remotestore/ajax/image.php +++ b/htdocs/admin/remotestore/ajax/image.php @@ -1,7 +1,7 @@ . - * Copyright (C) 2008-2011 Laurent Destailleur - * Copyright (C) 2020 Frédéric France +/* Copyright (C) 2017 Oscss-Shop . + * Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2020-2024 Frédéric France * * This program is free software; you can redistribute it and/or modifyion 2.0 (the "License"); * it under the terms of the GNU General Public License as published bypliance with the License. diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 224caed534c..7bf2a7eff0d 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -50,6 +50,8 @@ require_once '../../main.inc.php'; /** * @var Conf $conf * @var Translate $langs + * + * @var int $dolibarr_nocache */ @@ -75,7 +77,7 @@ jQuery(document).ready(function () {\n"; if (empty($conf->dol_no_mouse_hover)) { print ' - /* for standard tooltip */ + /* for standard tooltip */ jQuery(".classfortooltip").tooltip({ tooltipClass: "mytooltip", show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 }, @@ -101,30 +103,30 @@ if (empty($conf->dol_no_mouse_hover)) { target.off("mouseover mouseout"); target.on("mouseover", function(event) { console.log("we will create timer for ajax call"); - event.stopImmediatePropagation(); + event.stopImmediatePropagation(); clearTimeout(elemtostoretooltiptimer.data("openTimeoutId")); var params = JSON.parse($(this).attr("data-params")); params.token = currenttoken; var elemfortooltip = $(this); - elemtostoretooltiptimer.data("openTimeoutId", setTimeout(function() { + elemtostoretooltiptimer.data("openTimeoutId", setTimeout(function() { target.tooltip("close"); $.ajax({ - url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php", - type: "post", - async: true, - data: params, - success: function(response){ - // Setting content option - console.log("ajax success"); - if (elemfortooltip.is(":hover")) { - elemfortooltip.tooltip("option","content",response); - elemfortooltip.tooltip("open"); - } + url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php", + type: "post", + async: true, + data: params, + success: function(response){ + // Setting content option + console.log("ajax success"); + if (elemfortooltip.is(":hover")) { + elemfortooltip.tooltip("option","content",response); + elemfortooltip.tooltip("open"); } - }); - }, opendelay)); + } + }); + }, opendelay)); }); target.on("mouseout", function(event) { console.log("mouse out of a .classforajaxtooltip"); @@ -346,9 +348,9 @@ print ' var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content"); console.log("We click on a cssforclicktodial class with href="+this.href); $.ajax({ - url: this.href, - type: \'GET\', - data: { token: currenttoken } + url: this.href, + type: \'GET\', + data: { token: currenttoken } }).done(function(xhr, textStatus, errorThrown) { /* do nothing */ }).fail(function(xhr, textStatus, errorThrown) { diff --git a/htdocs/core/js/lib_gravatar.js.php b/htdocs/core/js/lib_gravatar.js.php index d7ca7bea933..34e350fbbc1 100644 --- a/htdocs/core/js/lib_gravatar.js.php +++ b/htdocs/core/js/lib_gravatar.js.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2017 Laurent Destailleur + * 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 @@ -50,7 +51,9 @@ if (!defined('NOREQUIREAJAX')) { session_cache_limiter('public'); require_once '../../main.inc.php'; - +/** + * @var int $dolibarr_nocache + */ // Define javascript type top_httphead('text/javascript; charset=UTF-8'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. diff --git a/htdocs/core/js/timepicker.js.php b/htdocs/core/js/timepicker.js.php index 5db75245711..0ac0b269b0d 100644 --- a/htdocs/core/js/timepicker.js.php +++ b/htdocs/core/js/timepicker.js.php @@ -50,6 +50,8 @@ require_once '../../main.inc.php'; /** * @var DoliDB $db * @var Translate $langs + * + * @var int $dolibarr_nocache */ /* * View diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 79cd9af8ae9..c65e63af98b 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -401,6 +401,7 @@ if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predel } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); +$head = []; if ($mode == 'modulesetup') { $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CronSetup"), $linkback, 'title_setup'); @@ -422,8 +423,7 @@ print ''; print ''; // Line with explanation and button new -$newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/cron/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?mode=modulesetup'), '', $user->hasRight('cron', 'create')); +$newcardbutton = dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/cron/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?mode=modulesetup'), '', $user->hasRight('cron', 'create')); if ($mode == 'modulesetup') { diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index c933765fdef..7843c63de5b 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -350,6 +350,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $object->getRights(); $head = user_prepare_head($object); $listLink = dol_buildpath('/user/list.php', 1); + } else { + $head = []; } print dol_get_fiche_head($head, 'skill_tab', $langs->trans("Workstation"), -1, $object->picto); diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index e0e5df8bc15..d4222b926b6 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -36,6 +36,7 @@ $langs->loadLangs(array("admin", "other", "modulebuilder")); $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$head = []; if (!$user->admin || !isModEnabled('modulebuilder')) { accessforbidden(); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 9eebdb978c4..a0337a75a49 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -323,6 +323,7 @@ if ($action == 'fetch' && !empty($id)) { $form = new Form($db); } + $arrayresult = []; if (empty($mode) || $mode == 1) { // mode=1: customer $arrayresult = $form->select_produits_list("", $htmlname, $type, getDolGlobalInt('PRODUIT_LIMIT_SIZE', 1000), $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus, $status_purchase, $warehouseId); } elseif ($mode == 2) { // mode=2: supplier diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 098024e4847..724f8bf21bf 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -1,8 +1,9 @@ #!/usr/bin/env php - * Copyright (C) 2015 Jean Heimburger + * Copyright (C) 2007-2016 Laurent Destailleur + * Copyright (C) 2015 Jean Heimburger + * 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 @@ -48,7 +49,12 @@ require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. - +/** + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ // $langs->setDefaultLang('en_US'); // To change default language of $langs $langs->load("main"); // To load language file for default language diff --git a/scripts/product/regenerate_thumbs.php b/scripts/product/regenerate_thumbs.php index 6504fb14069..07b202d7d9b 100755 --- a/scripts/product/regenerate_thumbs.php +++ b/scripts/product/regenerate_thumbs.php @@ -1,7 +1,8 @@ #!/usr/bin/env php - * Copyright (C) 2015 Jean Heimburger +/* Copyright (C) 2007-2016 Laurent Destailleur + * Copyright (C) 2015 Jean Heimburger + * 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 @@ -48,7 +49,12 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/images.lib.php"; // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. - +/** + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ // $langs->setDefaultLang('en_US'); // To change default language of $langs $langs->load("main"); // To load language file for default language diff --git a/scripts/user/migrate_picture_path.php b/scripts/user/migrate_picture_path.php index 9ef9d886aba..bf7b7d843ac 100755 --- a/scripts/user/migrate_picture_path.php +++ b/scripts/user/migrate_picture_path.php @@ -3,6 +3,7 @@ /* * Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2015 Jean Heimburger + * 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 @@ -48,7 +49,12 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. - +/** + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ // $langs->setDefaultLang('en_US'); // To change default language of $langs $langs->load("main"); // To load language file for default language diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php index 3f20ac90149..c9b23786405 100755 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -55,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"; * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs + * @var User $user */ // Global variables diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index f6aa7a85c07..ed3e7415010 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -52,6 +52,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"; * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs + * @var User $user */ $langs->loadLangs(array("main", "errors")); diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php index 97dd59f311f..5a21b9f5a61 100755 --- a/scripts/user/sync_users_dolibarr2ldap.php +++ b/scripts/user/sync_users_dolibarr2ldap.php @@ -55,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php"; * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs + * @var User $user */ // Global variables diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index b730ce45cf7..3e7625fdf11 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -50,6 +50,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php"; * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs + * @var User $user */ $langs->loadLangs(array("main", "errors")); From b71e3742e6d569ac92ada6b37104ce3e2f9a8872 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Nov 2024 21:12:49 +0100 Subject: [PATCH 009/259] Fix avoid to show button without permissions --- htdocs/expedition/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8ee36319c1b..2583dec22c2 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2184,7 +2184,7 @@ if ($action == 'create') { print $langs->trans('SendingMethod'); print ''; - if ($action != 'editshipping_method_id') { + if ($action != 'editshipping_method_id' && $permissiontoadd) { print 'id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).''; } print ''; @@ -2218,10 +2218,10 @@ if ($action == 'create') { // Incoterms if (isModEnabled('incoterm')) { print ''; - print ''; print ''; @@ -2580,7 +2581,10 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT print ''; if (!empty($extralabels)) { foreach ($extralabels as $key) { - print ''; + // Show field if not hidden + if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && $extrafields->attributes["product_customer_price"]['list'][$key] != 3) { + print ''; + } } } if ($user->hasRight('produit', 'supprimer') || $user->hasRight('service', 'supprimer')) { From e87c66ba4edecf46854b3021439e62229ddfc80b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 23:59:50 +0100 Subject: [PATCH 033/259] Debug v21 --- htdocs/theme/eldy/info-box.inc.php | 3 +++ htdocs/theme/md/info-box.inc.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index c0ae0fa7a93..1f5608090d7 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -447,6 +447,9 @@ a.vmenu span, span.vmenu, span.vmenu span { .infobox-order_supplier:not(.error) { color: #599caf; } +.infobox-order_supplier::before { + margin-left: 5px; +} .infobox-contrat, .infobox-ticket{ color: #3bbfa8; } diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 2107fc5bec3..71ac51a3d7f 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -136,6 +136,9 @@ div.login_block_other a { .infobox-order_supplier:not(.pictotitle):not(.error) { color: #599caf; } +.infobox-order_supplier::before { + margin-left: 3px; +} .infobox-contrat, .infobox-ticket{ color: #46a676; From 275627bd141a5396db846f5ff79ba7568db95ba6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 00:57:16 +0100 Subject: [PATCH 034/259] Clean code --- htdocs/public/ticket/ajax/ajax.php | 2 +- htdocs/ticket/class/ticket.class.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/public/ticket/ajax/ajax.php b/htdocs/public/ticket/ajax/ajax.php index e28b849eb2d..a2f57cade82 100644 --- a/htdocs/public/ticket/ajax/ajax.php +++ b/htdocs/public/ticket/ajax/ajax.php @@ -57,7 +57,7 @@ include_once '../../../main.inc.php'; // Load $user and permissions * @var DoliDB $db */ - $action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $id = GETPOSTINT('id'); $email = GETPOST('email', 'custom', 0, FILTER_VALIDATE_EMAIL); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index aafe16ca868..691385ef878 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2186,7 +2186,7 @@ class Ticket extends CommonObject { if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET fk_soc = ".($id > 0 ? $id : "null"); + $sql .= " SET fk_soc = ".($id > 0 ? (int) $id : "null"); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this).'::setCustomer sql='.$sql); $resql = $this->db->query($sql); @@ -2210,7 +2210,7 @@ class Ticket extends CommonObject { if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET progress = ".($percent > 0 ? $percent : "null"); + $sql .= " SET progress = ".($percent > 0 ? (float) $percent : "null"); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this).'::set_progression sql='.$sql); $resql = $this->db->query($sql); @@ -2234,7 +2234,7 @@ class Ticket extends CommonObject { if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET fk_contract = ".($contractid > 0 ? $contractid : "null"); + $sql .= " SET fk_contract = ".($contractid > 0 ? (int) $contractid : "null"); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this).'::setContract sql='.$sql); $resql = $this->db->query($sql); From 2d135b4c222238d85a99d76784d5f65d7a5acb95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 02:27:41 +0100 Subject: [PATCH 035/259] Add step to read DCO --- .github/CONTRIBUTING.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 1eae1b063b0..d898628013e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -36,12 +36,13 @@ Definition: As the Developer: -1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr). -2. Clone your fork. -3. Choose a branch(See the [Branches](#branches) section below). -4. Read our developer documentation on the [Dolibarr Wiki](https://wiki.dolibarr.org/index.php?title=Developer_documentation). -5. Commit and push your changes. -6. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). +1. Check you agree with the terms of the [DCO - Developer's Certificate of Origin](https://github.com/Dolibarr/dolibarr/DCO) +2. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr). +3. Clone your fork. +4. Choose a branch(See the [Branches](#branches) section below). +5. Read our developer documentation on the [Dolibarr Wiki](https://wiki.dolibarr.org/index.php?title=Developer_documentation). +6. Commit and push your changes. +7. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). As the PR Maintainer: From d04e0a7ac2dfe0c7818ec5d267cb7b14a587e825 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 04:45:11 +0100 Subject: [PATCH 036/259] Debug v21 --- htdocs/compta/bank/bankentries_list.php | 13 +++-- htdocs/compta/bank/releve.php | 3 +- htdocs/core/lib/bank.lib.php | 69 +++++++++++++++++++------ htdocs/langs/en_US/banks.lang | 2 +- htdocs/langs/en_US/stocks.lang | 1 + 5 files changed, 66 insertions(+), 22 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 6f4e4a946f3..3dd37bf0d1b 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -554,7 +554,11 @@ if ($id > 0 || !empty($ref)) { // Bank card $head = bank_prepare_head($object); - print dol_get_fiche_head($head, 'journal', $langs->trans("FinancialAccount"), 0, 'account'); + $activetab = 'journal'; + if ($action == 'reconcile') { + $activetab = 'reconcile'; + } + print dol_get_fiche_head($head, $activetab, $langs->trans("FinancialAccount"), 0, 'account'); $linkback = ''.$langs->trans("BackToList").''; @@ -566,7 +570,7 @@ if ($id > 0 || !empty($ref)) { /* * Buttons actions */ - + /* Moved into tab if ($action != 'reconcile') { if ($object->canBeConciliated() > 0) { $allowautomaticconciliation = false; // TODO @@ -598,6 +602,7 @@ if ($id > 0 || !empty($ref)) { } } } + */ } $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,"; @@ -1032,8 +1037,8 @@ if ($resql) { print ''; print ' '.$langs->trans("otherwise").' '; print ''; - print ' '.$langs->trans("or").' '; - print ''; + //print ' '.$langs->trans("or").' '; + //print ''; print ''; print '
'; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index f1d3523c336..1ebf78604fd 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -310,7 +310,7 @@ if (empty($numref)) { print dol_get_fiche_end(); - + /* Moved as a tab if ($object->canBeConciliated() > 0) { $allowautomaticconciliation = false; // TODO $titletoconciliatemanual = $langs->trans("Conciliate"); @@ -339,6 +339,7 @@ if (empty($numref)) { } } } + */ // List of mass actions available $arrayofmassactions = array( diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 787ae745949..7091f6aa0e5 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -38,7 +38,8 @@ */ function bank_prepare_head(Account $object) { - global $db, $langs, $conf; + global $db, $langs, $conf, $user; + $h = 0; $head = array(); @@ -52,23 +53,44 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'journal'; $h++; - // if ($conf->global->MAIN_FEATURES_LEVEL >= 1) - // { - $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id; - $head[$h][1] = $langs->trans("PlannedTransactions"); - $head[$h][2] = 'cash'; - $h++; - // } + if ($object->canBeConciliated() > 0) { + $allowautomaticconciliation = false; // TODO + $titletoconciliatemanual = $langs->trans("Conciliate"); + $titletoconciliateauto = $langs->trans("Conciliate"); + if ($allowautomaticconciliation) { + $titletoconciliatemanual .= ' ('.$langs->trans("Manual").')'; + $titletoconciliateauto .= ' ('.$langs->trans("Auto").')'; + } - $head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id; - $head[$h][1] = $langs->trans("IOMonthlyReporting"); - $head[$h][2] = 'annual'; - $h++; + $param = ''; - $head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id; - $head[$h][1] = $langs->trans("Graph"); - $head[$h][2] = 'graph'; - $h++; + // If not cash account and can be reconciliate + if ($user->hasRight('banque', 'consolidate')) { + $head[$h][0] = DOL_URL_ROOT."/compta/bank/bankentries_list.php?id=".$object->id.'&action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$object->id.$param; + $head[$h][1] = $titletoconciliatemanual; + $head[$h][2] = 'reconcile'; + $h++; + }/* else { + $buttonreconcile = ''.$titletoconciliatemanual.''; + }*/ + + if ($allowautomaticconciliation) { + // If not cash account and can be reconciliate + if ($user->hasRight('banque', 'consolidate')) { + $newparam = $param; + $newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam); + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/bankentries_list.php?id=".$object->id.'&action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$object->id.$newparam; + $head[$h][1] = $titletoconciliateauto; + $head[$h][2] = 'reconcileauto'; + $h++; + + //$buttonreconcile .= ' '.$titletoconciliateauto.''; + }/* else { + $buttonreconcile .= ' '.$titletoconciliateauto.''; + }*/ + } + } if ($object->type != Account::TYPE_CASH || getDolGlobalString('BANK_CAN_RECONCILIATE_CASHACCOUNT')) { $nbReceipts = 0; @@ -110,6 +132,21 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'document'; $h++; + $head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id; + $head[$h][1] = $langs->trans("IOMonthlyReporting"); + $head[$h][2] = 'annual'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id; + $head[$h][1] = $langs->trans("Graph"); + $head[$h][2] = 'graph'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id; + $head[$h][1] = $langs->trans("PlannedTransactions"); + $head[$h][2] = 'cash'; + $h++; + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 7084a3332d7..fc5a4283965 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -133,7 +133,7 @@ DeleteTransaction=Delete entry ConfirmDeleteTransaction=Are you sure you want to delete this entry? ThisWillAlsoDeleteBankRecord=This will also delete generated bank entry BankMovements=Movements -PlannedTransactions=Planned entries +PlannedTransactions=Upcoming entries Graph=Graphs ExportDataset_banque_1=Bank entries and account statement ExportDataset_banque_2=Deposit slip diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 400a39ec951..0648dde54b4 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -348,3 +348,4 @@ QtyViewed=Quantity viewed QtyStock=Quantity on stock QtyRegulated=Quantity on stock correction InventoryEntrepot=Warehouse identity +SelectedWarehouse=Select a warehouse From ac91727bb6bedc93784c6ea26b3ece1b8d86bb00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 04:49:57 +0100 Subject: [PATCH 037/259] Debug v21 --- htdocs/compta/bank/treso.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 69c859037b2..243ab3af6c1 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -216,7 +216,7 @@ if (GETPOST("account") || GETPOST("ref")) { $morehtml = ''; $limit = 0; - print_barre_liste($langs->trans("RemainderToPay"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("PlannedTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1); $solde = $object->solde(0); From cc0db78984843173339cd6cab4b338bea6e722d4 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech <52404047+nicolas-eoxia@users.noreply.github.com> Date: Thu, 21 Nov 2024 08:48:55 +0100 Subject: [PATCH 038/259] FIX #32007 missing parameter on function multiSelectArrayWithCheckbox (#32008) --- htdocs/projet/tasks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d770f23f4f5..6f4a3aa4832 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -857,7 +857,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- print ''; } elseif ($id > 0 || !empty($ref)) { - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields /* * Projet card in view mode From c907327e3c0e6bea8d1b81e389e0b0979404cba7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 09:08:54 +0100 Subject: [PATCH 039/259] Fix removed foreign key not on a unique key --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 3 ++- htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index b2397e2069c..ec3053a6a40 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -349,7 +349,8 @@ ALTER TABLE llx_societe_commerciaux ADD COLUMN fk_c_type_contact_code varchar(32 -- VPGSQL8.2 DROP INDEX uk_societe_commerciaux; ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code); ALTER TABLE llx_c_type_contact ADD INDEX idx_c_type_contact_code (code); -ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +--Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +ALTER TABLE llx_societe_commerciaux DROP FOREIGN KEY fk_societe_commerciaux_fk_c_type_contact_code; ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); diff --git a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql index 1672ff659c1..f4bc719c4ba 100644 --- a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql +++ b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql @@ -17,6 +17,6 @@ -- =================================================================== ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code); -ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +--Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); From bf3a08ffa51771a197248911e1ee406833c01a59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 09:41:59 +0100 Subject: [PATCH 040/259] Tooltip --- htdocs/langs/en_US/ticket.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index bb0cd645857..f0f7a31831d 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -75,7 +75,7 @@ TicketParamMail=Email setup TicketEmailNotificationFrom=Sender e-mail for notification on answers TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification email when an answer is provided inside the back office. For example noreply@example.com TicketEmailNotificationTo=Notify ticket creation to this e-mail address -TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation +TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to already assigned contacts) TicketNewEmailBodyLabel=Text message sent after creating a ticket TicketNewEmailBodyHelp=The text specified here will be inserted into the email confirming the creation of a new ticket from the public interface. Information on the consultation of the ticket are automatically added. TicketParamPublicInterface=Public interface setup From 4c95fa2ac6b8a96baa6091a955aa128db30aa788 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 10:10:32 +0100 Subject: [PATCH 041/259] Fix clean a bugged option duplicated at wrong place in setup --- htdocs/admin/ticket.php | 40 +++------------------------- htdocs/ticket/class/ticket.class.php | 8 +++--- 2 files changed, 7 insertions(+), 41 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 76fd7f98064..b05d7e71f23 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -89,17 +89,9 @@ if ($action == 'updateMask') { } elseif (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; $value = GETPOSTISSET($code) ? GETPOSTINT($code) : 1; - if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } else { - $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; } } elseif (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; @@ -211,15 +203,6 @@ if ($action == 'updateMask') { if (!($res > 0)) { $error++; } - - // For compatibility when javascript is not enabled - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) { - $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } } @@ -659,23 +642,6 @@ print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToH print ''; print '
'; -// Also send to TICKET_NOTIFICATION_EMAIL_TO for responses (not only creation) -if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - print ''; - print ''; - print ''; - print ''; -} - // Message header $mail_intro = getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO', ''); print ''; @@ -1054,7 +1055,7 @@ if ($action == 'create') { print $form->buttonsSaveCancel("CreateDraftIntervention"); // Show origin lines - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !getDolGlobalInt('FICHINTER_DISABLE_DETAILS')) { $title = $langs->trans('Services'); print load_fiche_titre($title); From b8c3bd8f41f5af62fb59d860fa95eaca0f361ea5 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 21 Nov 2024 17:19:52 +0100 Subject: [PATCH 048/259] 20 fix php warning (#32029) * fix: php warning intervention when FICHINTER_DISABLE_DETAILS is set * Update list.php --------- Co-authored-by: Laurent Destailleur --- htdocs/fichinter/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 30bfffaaf1b..08b4b55373a 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -1025,7 +1025,7 @@ while ($i < $imaxinloop) { print ''."\n"; - $total += $obj->duree; + $total += (isset($obj->duree) ? $obj->duree : 0); } $i++; } From 6c2effa2247e5ef25ef6794d7f82574523ac4ceb Mon Sep 17 00:00:00 2001 From: Eric - CAP-REL <1468823+rycks@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:31:40 +0100 Subject: [PATCH 049/259] dol_add_file_process : return nb of success in case of multiple added files (#32027) --- htdocs/core/lib/files.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 2a77d594349..737f8ac24fc 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1898,7 +1898,7 @@ function dol_init_file_process($pathtoscan = '', $trackid = '') * @param int<0,1> $generatethumbs 1=Generate also thumbs for uploaded image files * @param ?Object $object Object used to set 'src_object_*' fields * @param string $forceFullTestIndexation '1'=Force full text storage in database even if global option not set (consume a high level of data) - * @return int Return integer <=0 if KO, >0 if OK + * @return int Return integer <=0 if KO, nb of success if OK (>0) * @see dol_remove_file_process() */ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionordb = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null, $forceFullTestIndexation = '') @@ -2041,7 +2041,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionor } } if ($nbok > 0) { - $res = 1; + $res = $nbok; setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs'); } } else { From 991f53db9ebfb7cb3a98d34fa9c407c8df94835d Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 21 Nov 2024 17:46:54 +0100 Subject: [PATCH 050/259] FIX: use tax with code on supplier order line give tax code missing in supplier invoice (#32018) * FIX: use vat with code on supplier order result code missing in supplier invoice * FIX: use vat with code on supplier order result code missing in supplier invoice --- htdocs/fourn/commande/list.php | 8 +++++++- htdocs/fourn/facture/card.php | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 454af465920..60518e789fb 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -496,10 +496,16 @@ if (empty($reshook)) { if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } + + $tva_tx = $lines[$i]->tva_tx; + if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) { + $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; + } + $result = $objecttmp->addline( $desc, $lines[$i]->subprice, - $lines[$i]->tva_tx, + $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 23b9be4300c..6f90af4ba22 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1255,6 +1255,11 @@ if (empty($reshook)) { $date_end = $lines[$i]->date_end; } + $tva_tx = $lines[$i]->tva_tx; + if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) { + $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; + } + // FIXME Missing special_code into addline and updateline methods $object->special_code = $lines[$i]->special_code; @@ -1271,7 +1276,7 @@ if (empty($reshook)) { $result = $object->addline( $desc, $pu, - $lines[$i]->tva_tx, + $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, From d1ded1caa11391f5879072cd319ddb83079b358f Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Thu, 21 Nov 2024 18:05:35 +0100 Subject: [PATCH 051/259] Add option to hide only Volume (and keep weight) in shipping PDF - Issue #32030 (#32031) * Add option to hide only Volume (and keep weight) in shipping PDF * Fix use of option SHIPPING_PDF_HIDE_VOLUME in shipping lines --------- Co-authored-by: Laurent Destailleur --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 6 +++--- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 190a50e6ae1..f5873eaeeb3 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -689,7 +689,7 @@ class pdf_espadon extends ModelePdfExpedition $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_WEIGHT_ON_PDF', 5)).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units, 1); } $voltxt = ''; - if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume) { + if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $voltxt = round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_VOLUME_ON_PDF', 5)).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units ? $object->lines[$i]->volume_units : 0, 1); } @@ -883,13 +883,13 @@ class pdf_espadon extends ModelePdfExpedition if (!empty($totalWeight)) { $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1); } - if (!empty($totalVolume)) { + if (!empty($totalVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1); } if (!empty($object->trueWeight)) { $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, (int) $object->weight_units, "weight", $outputlangs); } - if (!empty($object->trueVolume)) { + if (!empty($object->trueVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { if ($object->volume_units < 50) { $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); } else { diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index dfaa64aafea..9d54b5b4e88 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -583,7 +583,7 @@ class pdf_rouget extends ModelePdfExpedition $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_WEIGHT_ON_PDF', 5)).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units, 1); } $voltxt = ''; - if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume) { + if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $voltxt = round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_VOLUME_ON_PDF', 5)).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units ? $object->lines[$i]->volume_units : 0, 1); } @@ -769,13 +769,13 @@ class pdf_rouget extends ModelePdfExpedition if (!empty($totalWeight)) { $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1); } - if (!empty($totalVolume)) { + if (!empty($totalVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1); } if (!empty($object->trueWeight)) { $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, (int) $object->weight_units, "weight", $outputlangs); } - if (!empty($object->trueVolume)) { + if (!empty($object->trueVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); } From 63073f7e712fcb94a379991762321f91557be270 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 18:15:34 +0100 Subject: [PATCH 052/259] FIX #32021 --- htdocs/recruitment/class/recruitmentcandidature.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 7fa4a473d5c..26672044baa 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -18,21 +18,22 @@ */ /** - * \file class/recruitmentcandidature.class.php + * \file recruitment/class/recruitmentcandidature.class.php * \ingroup recruitment * \brief This file is a CRUD class file for RecruitmentCandidature (Create/Read/Update/Delete) */ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonpeople.class.php'; /** * Class for RecruitmentCandidature */ class RecruitmentCandidature extends CommonObject { + use CommonPeople; + /** * @var string ID of module. */ From 2e90ba085001cfa9be578b7717eb1afcdbe0afd1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 18:21:34 +0100 Subject: [PATCH 053/259] Fix trans --- htdocs/recruitment/recruitmentcandidature_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 813f0b74677..0c1d222e5c1 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -277,7 +277,7 @@ llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { - print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("RecruitmentCandidature")), '', 'object_'.$object->picto); + print load_fiche_titre($title, '', 'object_'.$object->picto); print '
'; print ''; From 3d2adf511ed70cf6bc8f421b2a02abbc3255d3c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 18:39:48 +0100 Subject: [PATCH 054/259] Debug v21 --- htdocs/langs/en_US/hrm.lang | 3 ++- htdocs/recruitment/class/recruitmentcandidature.class.php | 2 +- htdocs/recruitment/recruitmentcandidature_card.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 7b78f488cd0..5c8287b4c0b 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -98,4 +98,5 @@ NeedBusinessTravels=Need business travels NoDescription=No description TheJobProfileHasNoSkillsDefinedFixBefore=The evaluated job profile of this employee has no skill defined on it. Please add skill(s), then delete and restart the evaluation. PDFStandardHrmEvaluation=Standard template to generate a PDF document for a competency assessment -SkillNotRequired=Skill not required \ No newline at end of file +SkillNotRequired=Skill not required +LinkToUserCreated=Link to an employee if the applicant has been hired and converted into a user. diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index d9ac151e59d..c70153127c3 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -120,7 +120,7 @@ class RecruitmentCandidature extends CommonObject 'description' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'position' => 300, 'notnull' => 0, 'visible' => 3, 'cssview' => 'wordbreak'), 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -4, 'csslist' => 'nowraponall'), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2, 'csslist' => 'nowraponall'), - 'fk_user' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'LinkedToDolibarrUser', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => -1, 'csslist' => 'tdoverflowmax100'), + 'fk_user' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Employee', 'picto' => 'user', 'help' => 'LinkToUserCreated', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => -1, 'css' => 'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist' => 'tdoverflowmax100'), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Received', '3' => 'ContractProposed', '5' => 'ContractSigned', '8' => 'Refused', '9' => 'Canceled')), diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index d1d7eb128a8..8c3030a07e3 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -117,7 +117,7 @@ if (empty($reshook)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + $backtopage = DOL_URL_ROOT.'/recruitment/recruitmentcandidature_card.php?id='.($id > 0 ? $id : '__ID__'); } } } @@ -597,7 +597,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->hasRight('user', 'user', 'creer')) { $useralreadyexists = $object->fk_user; if (empty($useralreadyexists)) { - print ''; + print ''; } else { print ''; } From 687e71dfa305fb6c8577e7e2875bbb6b0b1b98ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 19:05:06 +0100 Subject: [PATCH 055/259] Debug v21 --- htdocs/adherents/subscription.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index a4d7451af03..0f882fb1d53 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -608,7 +608,7 @@ if (getDolGlobalInt('MAIN_MULTILANGS')) { // Public $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : ''); -print '
'; +print ''; // Other attributes $cols = 2; @@ -617,7 +617,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Third party Dolibarr if (isModEnabled('societe')) { print '
'; + print '
'; print $langs->trans('IncotermLabel'); print ''; - if ($user->hasRight('expedition', 'creer')) { + if ($permissiontoadd) { print ''.img_edit().''; } else { print ' '; From 59ffaa538c9ed216455f0c971ed2b04a23b7900e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 01:29:01 +0100 Subject: [PATCH 010/259] Clean code --- htdocs/expedition/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 2583dec22c2..532b7ae411e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -138,6 +138,8 @@ $result = restrictedArea($user, 'expedition', $object->id, ''); $permissiondellink = $user->hasRight('expedition', 'delivery', 'creer'); // Used by the include of actions_dellink.inc.php $permissiontoadd = $user->hasRight('expedition', 'creer'); +$upload_dir = $conf->expedition->dir_output.'/sending'; + $editColspan = 0; $objectsrc = null; $typeobject = null; @@ -146,6 +148,7 @@ $typeobject = null; /* * Actions */ + $error = 0; $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -169,7 +172,6 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' // Actions to build doc - $upload_dir = $conf->expedition->dir_output.'/sending'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Back to draft From 322e8c921d52260b6664adae9a045ed581c39661 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 01:37:58 +0100 Subject: [PATCH 011/259] Update VDP --- SECURITY.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 809681c74d1..50a74ea0716 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -12,8 +12,9 @@ Security report are valid only on current stable version (see https://dolibarr.o To report a vulnerability, for a private report, you can: -- Send your report on Vulnerability Disclosure Program (VDP) [https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US](https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US) (recommended for everybody) +- Send your report on Vulnerability Disclosure Program (VDP): Link will be upadeted soon (recommended for everybody) - Or send an email to security@dolibarr.org with clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary. From 28f657ea1daa27d152e34e10a3398b70d160c3c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 13:22:37 +0100 Subject: [PATCH 012/259] Better error message --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 53a7fba96df..ebd5fd2e3ca 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -268,7 +268,7 @@ if (empty($dolibarr_strict_mode)) { define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs) if (!file_exists(DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php")) { - print "Error: Dolibarr config file content seems to be not correctly defined.
\n"; + print "Error: Dolibarr config file content seems to be not correctly defined (file ".DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php not found).
\n"; print "Please run dolibarr setup by calling page /install.
\n"; exit(1); } From ce0d9d82c2414d66040be91481e7f4b075fc1436 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 13:29:07 +0100 Subject: [PATCH 013/259] Fix test on install process --- htdocs/install/inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index b1a80578fa6..3fd55c11bc4 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -242,7 +242,7 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > $result = conf($dolibarr_main_document_root); } // Load database driver - if ($result) { + if ($result > 0) { if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type)) { $result = include_once $dolibarr_main_document_root."/core/db/".$dolibarr_main_db_type.'.class.php'; if (!$result) { @@ -432,7 +432,7 @@ function conf($dolibarr_main_document_root) global $dolibarr_main_instance_unique_id; global $dolibarr_main_cookie_cryptkey; - $return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; + $return = @include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; if (!$return) { return -1; } From 12ec583cb826275cbbd45b07a212d6f77a066d40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 15:40:51 +0100 Subject: [PATCH 014/259] Look and feel v21 --- htdocs/adherents/card.php | 2 +- htdocs/theme/eldy/global.inc.php | 3 +++ htdocs/theme/md/style.css.php | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 37c52af55e8..153644333b7 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1623,7 +1623,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (isModEnabled('mailman') && getDolGlobalString('ADHERENT_USE_SPIP')) { $formquestion[] = array('type' => 'other', 'label' => $langs->transnoentitiesnoconv("SynchroSpipEnabled"), 'value' => ''); } - print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 220); + print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 250); } // Confirm resiliate diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a37f76bcb3d..374537924e1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5409,6 +5409,9 @@ div.info { background: #eff8fc; color: #558; } +div.fiche div.info { + box-shadow: 4px 4px 12px #ddd; +} /* Warning message */ div.warning, div.warningborder { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index eeb8358107f..1327a739682 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5396,6 +5396,9 @@ div.info { border-: solid 5px #87cfd2; background: #eff8fc; } +div.fiche div.info { + box-shadow: 4px 4px 12px #ddd; +} /* Warning message */ div.warning, div.warningborder { From 88a1eadfc7893084232dce9277e065fdcad5492e Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 20 Nov 2024 19:50:07 +0100 Subject: [PATCH 015/259] fix: php warning (#32020) * fix: php warning * fix php warning * fix php warning --- htdocs/admin/mails.php | 2 +- htdocs/comm/action/card.php | 4 ++-- htdocs/comm/action/peruser.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index ab8695e871b..7808ff615d3 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -511,7 +511,7 @@ if ($action == 'edit') { // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE); + print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE')); } else { $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE')]; if (empty($text)) { diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index d37b799493c..30c71c6e01a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1963,8 +1963,8 @@ if ($id > 0) { 'type' => 'user', //'transparency'=>$object->userassigned[$user->id]['transparency'], 'transparency' => $object->transparency, // Force transparency on ownerfrom event - 'answer_status' => $object->userassigned[$object->userownerid]['answer_status'], - 'mandatory' => $object->userassigned[$object->userownerid]['mandatory'] + 'answer_status' => (isset($object->userassigned[$object->userownerid]['answer_status']) ? $object->userassigned[$object->userownerid]['answer_status']: null), + 'mandatory' => (isset($object->userassigned[$object->userownerid]['mandatory']) ? $object->userassigned[$object->userownerid]['mandatory']:null) ); } if (!empty($object->userassigned)) { // Now concat assigned users diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 6abe480da9c..56b758f64a6 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -1426,7 +1426,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $tmpcontact->fetch($event->contact_id); $cachecontacts[$event->contact_id] = $tmpcontact; } - $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); + $cases3[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } if ($event->date_start_in_calendar < $c && $dateendtouse > $b2) { From 9f56bfe5b76171ba4f8452740fd0b9be76a6dc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= <81741011+altairis-noe@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:06:43 +0100 Subject: [PATCH 016/259] FIX: shipping date was not editable in view mode (#32022) --- htdocs/expedition/card.php | 14 +++++++--- htdocs/expedition/class/expedition.class.php | 28 ++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 532b7ae411e..38e18e2302c 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -560,6 +560,14 @@ if (empty($reshook)) { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } + } elseif ($action == 'setdate_shipping' && $user->hasRight('expedition', 'creer')) { + $dateshipping = dol_mktime(GETPOSTINT('ship_hour'), GETPOSTINT('ship_min'), 0, GETPOSTINT('ship_month'), GETPOSTINT('ship_day'), GETPOSTINT('ship_year')); + + $object->fetch($id); + $result = $object->setShippingDate($user, $dateshipping); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif (in_array($action, array('settracking_number', 'settracking_url', 'settrueWeight', 'settrueWidth', 'settrueHeight', 'settrueDepth', 'setshipping_method_id')) && $user->hasRight('expedition', 'creer')) { // Action update $error = 0; @@ -2061,10 +2069,10 @@ if ($action == 'create') { print '
'; print '
'; if ($action == 'editdate_shipping') { - print '
'; + print ''; print ''; - print ''; - print $form->selectDate($object->date_shipping ? $object->date_shipping : -1, 'liv_', 1, 1, 0, "setdate_shipping", 1, 0); + print ''; + print $form->selectDate($object->date_shipping ? $object->date_shipping : -1, 'ship_', 1, 1, 0, "setdate_shipping", 1, 0); print ''; print '
'; } else { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8a49d6139a6..5193c3cde90 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2223,6 +2223,34 @@ class Expedition extends CommonObject } } + /** + * Set the shipping date + * + * @param User $user Object user that modify + * @param integer $shipping_date Date of shipping + * @return int Return integer <0 if KO, >0 if OK + */ + public function setShippingDate($user, $shipping_date) + { + if ($user->hasRight('expedition', 'creer')) { + $sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; + $sql .= " SET date_expedition = ".($shipping_date ? "'".$this->db->idate($shipping_date)."'" : 'null'); + $sql .= " WHERE rowid = ".((int) $this->id); + + dol_syslog(get_class($this)."::setShippingDate", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $this->date_shipping = $shipping_date; + return 1; + } else { + $this->error = $this->db->error(); + return -1; + } + } else { + return -2; + } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fetch deliveries method and return an array. Load array this->meths(rowid=>label). From a9b2e7bde133f0e29049e807e62608a3db18bfa4 Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:50:49 +0100 Subject: [PATCH 017/259] Update facture.class.php (#32013) Incoterms and location are missing when invoice is auto gen from an order (when WORKFLOW_ORDER_AUTOCREATE_INVOICE is active for instance) --- htdocs/compta/facture/class/facture.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dacff6569d8..06eb0d45c29 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1472,6 +1472,8 @@ class Facture extends CommonInvoice $this->fk_account = $object->fk_account; $this->cond_reglement_id = $object->cond_reglement_id; $this->mode_reglement_id = $object->mode_reglement_id; + $this->fk_incoterms = $object->fk_incoterms; + $this->location_incoterms = $object->location_incoterms; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; $this->delivery_date = $object->delivery_date; From b7816bf6480f77b10a8517210cad0a465e82c04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Nov 2024 20:56:16 +0100 Subject: [PATCH 018/259] fix phpstan (#32010) * fix phpstan * Update extrafields_view.tpl.php * Update extrafields.class.php --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 221925075e1..0aef926b693 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -51,7 +51,7 @@ class ExtraFields public $attributes = array(); /** - * @var array> Array with boolean of status of groups + * @var array>|null Array with boolean of status of groups */ public $expand_display; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index e0dccc9b8ab..700824e7ae3 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -29,6 +29,7 @@ * @var CommonObject $object * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var Form $form * @var Translate $langs * @var User $user @@ -81,7 +82,7 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att $enabled = 1; if ($enabled && isset($extrafields->attributes[$object->table_element]['enabled'][$tmpkeyextra])) { - $enabled = (int) dol_eval($extrafields->attributes[$object->table_element]['enabled'][$tmpkeyextra], 1, 1, '2'); + $enabled = (int) dol_eval((string) $extrafields->attributes[$object->table_element]['enabled'][$tmpkeyextra], 1, 1, '2'); } if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$tmpkeyextra])) { $enabled = (int) dol_eval($extrafields->attributes[$object->table_element]['list'][$tmpkeyextra], 1, 1, '2'); From 98b884e8ba26a466cd2806cefe31e52a0d624748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Nov 2024 20:57:47 +0100 Subject: [PATCH 019/259] Fix typo in SECURITY.md (#32011) --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 50a74ea0716..062578e03b9 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -12,7 +12,7 @@ Security report are valid only on current stable version (see https://dolibarr.o To report a vulnerability, for a private report, you can: -- Send your report on Vulnerability Disclosure Program (VDP): Link will be upadeted soon (recommended for everybody) +- Send your report on Vulnerability Disclosure Program (VDP): Link will be updated soon (recommended for everybody) '; - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this, $this->table_element); break; case "edit": $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICTO', 'email,phone,ip,password')); if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) { $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this->id, $this->table_element); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this, $this->table_element); break; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6138ad7c169..4a1ed96b238 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1076,18 +1076,18 @@ class ExtraFields * Return HTML string to put an input field into a page * Code very similar with showInputField of common object * - * @param string $key Key of attribute + * @param string $key Key of attribute * @param string|array{start:int,end:int} $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value); for dates in filter mode, a range array('start'=>, 'end'=>) should be provided - * @param string $moreparam To add more parameters on html input tag - * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) - * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) - * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) - * @param int $objectid Current object id - * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) - * @param int $mode 1=Used for search filters + * @param string $moreparam To add more parameters on html input tag + * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) + * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) + * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) + * @param int|CommonObject $object Current object or object ID. Preferably, pass the object itself. + * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) + * @param int $mode 1=Used for search filters * @return string */ - public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '', $mode = 0) + public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $object = 0, $extrafieldsobjectkey = '', $mode = 0) { global $conf, $langs, $form; @@ -1096,6 +1096,8 @@ class ExtraFields $form = new Form($this->db); } + $objectid = (is_numeric($object) ? $object : $object->id); + $out = ''; if (!preg_match('/options_$/', $keyprefix)) { // Because we work on extrafields, we add 'options_' to prefix if not already added @@ -1120,6 +1122,7 @@ class ExtraFields $list = (string) dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '2'); $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; + $alwayseditable = $this->attributes[$extrafieldsobjectkey]['alwayseditable'][$key]; $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) //var_dump('key='.$key.' '.$value.' '.$moreparam.' '.$keysuffix.' '.$keyprefix.' '.$objectid.' '.$extrafieldsobjectkey.' '.$mode); @@ -1935,6 +1938,12 @@ class ExtraFields if (!empty($hidden)) { $out = ''; } + + // If alwayseditable is false, and object is not in draft, then showOutputField + // @phan-suppress-next-line PhanUndeclaredConstantOfClass + if ($alwayseditable == 0 && !is_numeric($object) && isset($object->status) && $object->status != $object::STATUS_DRAFT) { + $out = $this->showOutputField($key, $value, $moreparam, $extrafieldsobjectkey, null, $object); + } /* Add comments if ($type == 'date') $out.=' (YYYY-MM-DD)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; From 914ed1b18cc1c388b1b9bd45982d43ec7c3dc432 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Wed, 20 Nov 2024 21:33:32 +0100 Subject: [PATCH 026/259] Fix #30766 Extra field Can Always Be Edited (#31876) * fix alwayseditable * Update extrafields.class.php * Update extrafields.class.php * Update extrafields.class.php * enhance fix alwayseditable * fix phan --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/class/extrafields.class.php | 28 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d6a0ef32ba4..37a0c324dfb 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9393,14 +9393,14 @@ abstract class CommonObject $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } //$out .= ''; - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this, $this->table_element); break; case "edit": $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICTO', 'email,phone,ip,password')); if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) { $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this->id, $this->table_element); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this, $this->table_element); break; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6138ad7c169..6aca908bffd 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1076,18 +1076,18 @@ class ExtraFields * Return HTML string to put an input field into a page * Code very similar with showInputField of common object * - * @param string $key Key of attribute + * @param string $key Key of attribute * @param string|array{start:int,end:int} $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value); for dates in filter mode, a range array('start'=>, 'end'=>) should be provided - * @param string $moreparam To add more parameters on html input tag - * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) - * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) - * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) - * @param int $objectid Current object id - * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) - * @param int $mode 1=Used for search filters + * @param string $moreparam To add more parameters on html input tag + * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) + * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) + * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) + * @param int|CommonObject $object Current object or object ID. Preferably, pass the object itself. + * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) + * @param int $mode 1=Used for search filters * @return string */ - public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '', $mode = 0) + public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $object = 0, $extrafieldsobjectkey = '', $mode = 0) { global $conf, $langs, $form; @@ -1096,6 +1096,8 @@ class ExtraFields $form = new Form($this->db); } + $objectid = (is_numeric($object) ? $object : $object->id); + $out = ''; if (!preg_match('/options_$/', $keyprefix)) { // Because we work on extrafields, we add 'options_' to prefix if not already added @@ -1120,6 +1122,7 @@ class ExtraFields $list = (string) dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '2'); $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; + $alwayseditable = $this->attributes[$extrafieldsobjectkey]['alwayseditable'][$key]; $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) //var_dump('key='.$key.' '.$value.' '.$moreparam.' '.$keysuffix.' '.$keyprefix.' '.$objectid.' '.$extrafieldsobjectkey.' '.$mode); @@ -1935,6 +1938,12 @@ class ExtraFields if (!empty($hidden)) { $out = ''; } + + // If alwayseditable is false, and object is not in draft, then showOutputField + // @phan-suppress-next-line PhanUndeclaredConstantOfClass + if ($alwayseditable == 0 && is_object($object) && isset($object->status) && defined(get_class($object)."::STATUS_DRAFT") && $object->status != $object::STATUS_DRAFT) { + $out = $this->showOutputField($key, $value, $moreparam, $extrafieldsobjectkey, null, $object); + } /* Add comments if ($type == 'date') $out.=' (YYYY-MM-DD)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; @@ -1987,6 +1996,7 @@ class ExtraFields // If alwayseditable is false, and object is not in draft, then we show value instead of input field $showValueInsteadOfInputField = 0; // Variable used to disable update of fields via ajax + // @phan-suppress-next-line PhanUndeclaredConstantOfClass if ($alwayseditable == 0 && is_object($object) && isset($object->status) && defined(get_class($object)."::STATUS_DRAFT") && $object->status != $object::STATUS_DRAFT) { $showValueInsteadOfInputField = 1; } From d22c3dbded6282f7a834981cbeb43da56cdac678 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 21:47:02 +0100 Subject: [PATCH 027/259] Trans --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 150984d4064..1f0a72aeb43 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -745,7 +745,7 @@ if ($usevirtualstock == 0) { $stocklabel = $langs->trans('PhysicalStock'); } if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) { - $stocklabelbis = $stocklabel.' (Selected warehouse)'; + $stocklabelbis = $stocklabel.' ('.$langs->trans('SelectedWarehouse').')'; $stocklabel .= ' ('.$langs->trans("AllWarehouses").')'; } $texte = $langs->trans('Replenishment'); From ec1ea71175025787170d4ce0b4dbb99a91b4609d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 22:49:59 +0100 Subject: [PATCH 028/259] Fix to make protection ok when no stock and STOCK_ALLOW_NEGATIVE_TRANSFER on --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 6f4232b1ca7..45668188f93 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -478,7 +478,7 @@ class MouvementStock extends CommonObject return -8; } } else { - if (isset($product->stock_warehouse[$entrepot_id]) && (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty))) { + if (empty($product->stock_warehouse[$entrepot_id]) || empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) { $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; $this->errors[] = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; From 9191c216f3c95a8349f2878507f5fe131228b4e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 22:49:59 +0100 Subject: [PATCH 029/259] Fix to make protection ok when no stock and STOCK_ALLOW_NEGATIVE_TRANSFER on --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index fd7ea010270..60cd678ba36 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -446,7 +446,7 @@ class MouvementStock extends CommonObject return -8; } } else { - if (isset($product->stock_warehouse[$entrepot_id]) && (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty))) { + if (empty($product->stock_warehouse[$entrepot_id]) || empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) { $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; $this->errors[] = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; From 0d07520e02c8156834093e2a9fdce45198b2f7ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 22:49:59 +0100 Subject: [PATCH 030/259] Fix to make protection ok when no stock and STOCK_ALLOW_NEGATIVE_TRANSFER on --- htdocs/comm/action/class/actioncomm.class.php | 135 +++++++++--------- .../stock/class/mouvementstock.class.php | 2 +- 2 files changed, 70 insertions(+), 67 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fb94299c405..249e342d5fc 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2715,83 +2715,86 @@ class ActionComm extends CommonObject // Load event $res = $this->fetch($actionCommReminder->fk_actioncomm); if ($res > 0) { - $res = $this->fetch_thirdparty(); - } - if ($res > 0) { - // PREPARE EMAIL - $errormesg = ''; + $res2 = $this->fetch_thirdparty(); + if ($res2 >= 0) { + // PREPARE EMAIL + $errormesg = ''; - // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); - complete_substitutions_array($substitutionarray, $langs, $this); + complete_substitutions_array($substitutionarray, $langs, $this); - // Content - $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); + // Content + $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); - //Topic - $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); + //Topic + $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); - // Recipient - $recipient = new User($this->db); - $res = $recipient->fetch($actionCommReminder->fk_user); - if ($res > 0) { - if (!empty($recipient->email)) { - $to = $recipient->email; + // Recipient + $recipient = new User($this->db); + $res = $recipient->fetch($actionCommReminder->fk_user); + if ($res > 0) { + if (!empty($recipient->email)) { + $to = $recipient->email; + } else { + $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $error++; + } } else { - $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; $error++; } + + // Sender + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + if (empty($from)) { + $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; + $error++; + } + + if (!$error) { + // Errors Recipient + $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); + + // Mail Creation + $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); + + // Sending Mail + if ($cMailFile->sendfile()) { + $nbMailSend++; + } else { + $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); + $error++; + } + } + + if (!$error) { + $actionCommReminder->status = $actionCommReminder::STATUS_DONE; + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } + } else { + $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; + $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } else { + $errorsMsg[] = $errormesg; + } + } } else { - $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; + $errorsMsg[] = 'Failed to fetch record thirdparty on actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; } - - // Sender - $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); - if (empty($from)) { - $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; - $error++; - } - - if (!$error) { - // Errors Recipient - $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); - - // Mail Creation - $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); - - // Sending Mail - if ($cMailFile->sendfile()) { - $nbMailSend++; - } else { - $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); - $error++; - } - } - - if (!$error) { - $actionCommReminder->status = $actionCommReminder::STATUS_DONE; - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } - } else { - $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; - $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } else { - $errorsMsg[] = $errormesg; - } - } } else { $errorsMsg[] = 'Failed to fetch record actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 6f4232b1ca7..45668188f93 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -478,7 +478,7 @@ class MouvementStock extends CommonObject return -8; } } else { - if (isset($product->stock_warehouse[$entrepot_id]) && (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty))) { + if (empty($product->stock_warehouse[$entrepot_id]) || empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) { $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; $this->errors[] = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; From 4a3edf9294aec3daca8301169291b24049357346 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 22:49:59 +0100 Subject: [PATCH 031/259] Fix to make protection ok when no stock and STOCK_ALLOW_NEGATIVE_TRANSFER on --- htdocs/comm/action/class/actioncomm.class.php | 133 +++++++++--------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 3ca29e1af4e..0b0e6d73db9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2702,82 +2702,87 @@ class ActionComm extends CommonObject // Load event $res = $this->fetch($actionCommReminder->fk_actioncomm); - if ($res > 0) $res = $this->fetch_thirdparty(); if ($res > 0) { - // PREPARE EMAIL - $errormesg = ''; + $res2 = $this->fetch_thirdparty(); + if ($res2 >= 0) { + // PREPARE EMAIL + $errormesg = ''; - // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($langs, 0, '', $this); + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); - complete_substitutions_array($substitutionarray, $langs, $this); + complete_substitutions_array($substitutionarray, $langs, $this); - // Content - $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); + // Content + $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); - //Topic - $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); + //Topic + $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); - // Recipient - $recipient = new User($this->db); - $res = $recipient->fetch($actionCommReminder->fk_user); - if ($res > 0) { - if (!empty($recipient->email)) { - $to = $recipient->email; + // Recipient + $recipient = new User($this->db); + $res = $recipient->fetch($actionCommReminder->fk_user); + if ($res > 0) { + if (!empty($recipient->email)) { + $to = $recipient->email; + } else { + $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $error++; + } } else { - $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; $error++; } + + // Sender + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + if (empty($from)) { + $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; + $error++; + } + + if (!$error) { + // Errors Recipient + $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); + + // Mail Creation + $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); + + // Sending Mail + if ($cMailFile->sendfile()) { + $nbMailSend++; + } else { + $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); + $error++; + } + } + + if (!$error) { + $actionCommReminder->status = $actionCommReminder::STATUS_DONE; + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } + } else { + $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; + $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } else { + $errorsMsg[] = $errormesg; + } + } } else { - $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; + $errorsMsg[] = 'Failed to fetch record thirdparty on actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; } - - // Sender - $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); - if (empty($from)) { - $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; - $error++; - } - - if (!$error) { - // Errors Recipient - $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); - - // Mail Creation - $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); - - // Sending Mail - if ($cMailFile->sendfile()) { - $nbMailSend++; - } else { - $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); - $error++; - } - } - - if (!$error) { - $actionCommReminder->status = $actionCommReminder::STATUS_DONE; - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } - } else { - $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; - $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } else { - $errorsMsg[] = $errormesg; - } - } } else { $errorsMsg[] = 'Failed to fetch record actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; From e9c1274356162469298f6367182ebeee59ad4c31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 23:47:39 +0100 Subject: [PATCH 032/259] Debug v21 --- htdocs/product/price.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index e10fe4caabd..2ca40d0bad0 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2539,6 +2539,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT $total_ttc = $resultarray[2]; if (!getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { + print ''."\n"; print '
' . $langs->trans('Default') . '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $formcategory->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS); - } - print ''; - print $formcategory->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help'); - print '
'.$langs->trans("TicketMessageMailIntro"); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 219feb82a0f..77671f61614 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2779,10 +2779,10 @@ class Ticket extends CommonObject } // Add global email address recipient - if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && - getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto) - ) { - $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); + if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto)) { + if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')) { + $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); + } } if (!empty($sendto)) { From 9a5aea09da2732df10a241260d4b44c280c39bfd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 12:33:23 +0100 Subject: [PATCH 042/259] FIX Debug option not working replaced by the one that works. --- htdocs/admin/ticket.php | 31 +++++++++- htdocs/admin/ticket_public.php | 56 ++++++------------- ...terface_50_modTicket_TicketEmail.class.php | 18 ++++-- htdocs/langs/en_US/ticket.lang | 12 ++-- htdocs/ticket/class/ticket.class.php | 2 +- 5 files changed, 64 insertions(+), 55 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index b05d7e71f23..192a8ad9c98 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -59,6 +59,15 @@ $reg = array(); include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +if (GETPOSTISSET('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')) { // only for no js case + $param_disable_email = GETPOST('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', $param_disable_email, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + } +} + if ($action == 'updateMask') { $maskconstticket = GETPOST('maskconstticket', 'aZ09'); $maskticket = GETPOST('maskticket', 'alpha'); @@ -595,13 +604,14 @@ print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition'); print ''; +print '
'; /* - * Notification + * Emails */ // Admin var of module -print load_fiche_titre($langs->trans("Notification"), '', ''); +print load_fiche_titre($langs->trans("Emails"), '', ''); print ''; @@ -636,12 +646,27 @@ print ''; // Email for notification of TICKET_CREATE print ''; print ''; +print ''; print ''; print ''; +// Disable email to customers +print ''; +print ''; +print ''; +print ''; + // Message header $mail_intro = getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO', ''); print ''; print ''; - // Also send to main email address - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - print ''; - print ''; - print ''; - print ''; - } - if (empty($conf->use_javascript_ajax)) { print ''; print ''; @@ -493,20 +467,6 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'; print '
'.$langs->trans("TicketEmailNotificationTo").''; -print ''; print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help'); print '
'; +print $form->textwithpicto($langs->trans("TicketsNotifyThirdPartyFromBackOfficeByDefault"), $langs->trans("TicketsNotifyThirdPartyFromBackOfficeByDefaultHelp"), 1, 'help'); +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION", $arrval, getDolGlobalInt('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')); +} +print '
'.$langs->trans("TicketMessageMailIntro"); diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index abda918f202..91ae4bf5491 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -72,15 +72,6 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') { } } - if (GETPOSTISSET('TICKET_DISABLE_CUSTOMER_MAILS')) { // only for no js case - $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - $errors[] = $db->lasterror(); - } - } - if (GETPOSTISSET('TICKET_SHOW_COMPANY_LOGO')) { // only for no js case $param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity); @@ -412,23 +403,6 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; - if (!empty($conf->use_javascript_ajax)) { - print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')); - } - print ''; - print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help'); - print '
'; - // Activate email creation to user - print ''; - print ''; - print ''; - // Text of email after creatio of a ticket $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody')); print ''; print ''; + // Also send to main email address + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + print ''; + print ''; + print ''; + } + print '
'; - print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help'); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS')); - } - print '
'; @@ -541,6 +501,22 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress"); + print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help'); + print ''; + if (!empty($conf->use_javascript_ajax)) { + print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')); + } + print '
'; print ''; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index faa556da235..ed97f3b7b40 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -183,15 +183,19 @@ class InterfaceTicketEmail extends DolibarrTriggers $see_ticket_customer = 'TicketNewEmailBodyInfosTrackUrlCustomer'; // Send email to notification email + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page + // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { - $sendto = !getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); if ($sendto) { $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); } } // Send email to customer - if (!getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS') && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page + // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface + if (empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { $sendto = ''; // if contact selected send to email's contact else send to email's thirdparty @@ -238,15 +242,17 @@ class InterfaceTicketEmail extends DolibarrTriggers $see_ticket_customer = 'TicketCloseEmailBodyInfosTrackUrlCustomer'; // Send email to notification email + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { - $sendto = !getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); if ($sendto) { $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); } } // Send email to customer. - if (!getDolGlobalString('TICKET_DISABLE_CUSTOMER_MAILS') && empty($object->context['disableticketemail'])) { + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing + if (empty($object->context['disableticketemail'])) { $linked_contacts = $object->listeContact(-1, 'thirdparty'); $linked_contacts = array_merge($linked_contacts, $object->listeContact(-1, 'internal')); if (empty($linked_contacts) && getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') && !empty($object->fk_soc)) { @@ -346,7 +352,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_admin .= '

'.$langs->trans('Message').' :

'.$message.'


'; $message_admin .= '

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; - $from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . '<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; + $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '') . '<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $trackid = 'tic'.$object->id; @@ -434,7 +440,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; - $from = (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? '' : getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ').'<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; + $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '').'<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $trackid = 'tic'.$object->id; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index f0f7a31831d..4e3788f0512 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -72,10 +72,10 @@ TicketPublicAccess=A public interface requiring no identification is available a TicketSetupDictionaries=The type of ticket, severity and analytic codes are configurable from dictionaries TicketParamModule=Module variable setup TicketParamMail=Email setup -TicketEmailNotificationFrom=Sender e-mail for notification on answers -TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification email when an answer is provided inside the back office. For example noreply@example.com +TicketEmailNotificationFrom=Sender e-mail for notification on tickets +TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification emails for tickets creation or messages. For example noreply@example.com TicketEmailNotificationTo=Notify ticket creation to this e-mail address -TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to already assigned contacts) +TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to any other default recipients) TicketNewEmailBodyLabel=Text message sent after creating a ticket TicketNewEmailBodyHelp=The text specified here will be inserted into the email confirming the creation of a new ticket from the public interface. Information on the consultation of the ticket are automatically added. TicketParamPublicInterface=Public interface setup @@ -96,7 +96,9 @@ TicketPublicInterfaceTextHelpMessageHelpAdmin=This text will appear above the me ExtraFieldsTicket=Extra attributes TicketCkEditorEmailNotActivated=HTML editor is not activated. Please put FCKEDITOR_ENABLE_MAIL content to 1 to get it. TicketsDisableEmail=Do not send emails for ticket creation or message recording -TicketsDisableEmailHelp=By default, emails are sent when new tickets or messages created. Enable this option to disable *all* email notifications +TicketsDisableEmailHelp=By default, notification emails to third parties are sent when new tickets or messages are created for both backoffice and public interface. Enable this option to disable email notifications to thirdparties when creation is done from backoffice. +TicketsNotifyThirdPartyFromBackOfficeByDefault=Notify third party by default on ticket creation from backoffice +TicketsNotifyThirdPartyFromBackOfficeByDefaultHelp=When creating a ticket from the backoffice, the option "Notify third party" will be checked by default TicketsLogEnableEmail=Enable log by email TicketsLogEnableEmailHelp=At each change, an email will be sent **to each contact** associated with the ticket. TicketParams=Params @@ -117,7 +119,7 @@ TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automaticall TicketNumberingModules=Tickets numbering module TicketsModelModule=Document templates for tickets TicketNotifyTiersAtCreation=Notify third party at creation -TicketsDisableCustomerEmail=Always disable emails when a ticket is created from public interface +TicketsDisableCustomerEmail=Always disable emails to third parties when a ticket is created from the backoffice TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is added to a ticket TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 77671f61614..24629554b32 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -223,7 +223,7 @@ class Ticket extends CommonObject public $cache_msgs_ticket; /** - * @var int Notify thirdparty at create + * @var int Save if a thirdparty was notified at creation at ticket or not */ public $notify_tiers_at_create; From d420d035defaf98cf2e5b549e9aa14f08e2ec5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Nov 2024 13:02:14 +0100 Subject: [PATCH 043/259] Update pr-18.yaml (#32024) * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml --------- Co-authored-by: Laurent Destailleur --- .github/workflows/pr-18.yaml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 376bf29454f..3464d60fd03 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -4,17 +4,32 @@ on: - opened branches: - "18.0" + push: + branches: + - "18.0" jobs: run: runs-on: ubuntu-22.04 permissions: - pull-requests: write + pull-requests: write steps: - name: Create PR review request + continue-on-error: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} + # GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # GH_TOKEN: ${{ secrets.AUTOMATION_TOKEN }} url: ${{ github.event.pull_request.html_url }} run: | - gh pr edit "$url" --add-assignee lvessiller-opendsi,rycks --add-reviewer lvessiller-opendsi,rycks - gh pr merge "$url" --merge --auto + # https://cli.github.com/manual/gh_api + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ + -f "reviewers[]=eldy" + #gh pr edit "$url" --add-assignee lvessiller-opendsi,rycks --add-reviewer lvessiller-opendsi,rycks + #gh pr merge "$url" --merge --auto From 877fd003533d144cbeacdbc5af81b1592ad0efdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 13:21:58 +0100 Subject: [PATCH 044/259] Update pr-18.yaml --- .github/workflows/pr-18.yaml | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 3464d60fd03..e78a72217b6 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -11,25 +11,25 @@ on: jobs: run: runs-on: ubuntu-22.04 - permissions: - pull-requests: write steps: - - name: Create PR review request - continue-on-error: true - env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ github.token }} - # GH_TOKEN: ${{ github.token }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # GH_TOKEN: ${{ secrets.AUTOMATION_TOKEN }} - url: ${{ github.event.pull_request.html_url }} - run: | - # https://cli.github.com/manual/gh_api - gh api \ - --method POST \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ - -f "reviewers[]=eldy" - #gh pr edit "$url" --add-assignee lvessiller-opendsi,rycks --add-reviewer lvessiller-opendsi,rycks - #gh pr merge "$url" --merge --auto + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install GitHub CLI + run: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 && \ + sudo apt-add-repository https://cli.github.com/packages && \ + sudo apt update && \ + sudo apt install gh -y + + - name: Authenticate GitHub CLI + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: gh auth login --with-token <<< "$GH_TOKEN" + + - name: Assign reviewer + env: + REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer + run: | + pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) + gh pr edit $pr_number --add-reviewer "$REVIEWER" From 1a752c16cfcab8703c3c80258e9e5ea9ec564184 Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:11:19 +0100 Subject: [PATCH 045/259] Fix setincoterms Location (#32037) * Fix setincoterms Location * Fix location_incoterms on invoice card * Fix location_incoterms on supplier order * Fix location_incoterms on supplier invoice --- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7caa20868fa..586eb8bcbaa 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -633,7 +633,7 @@ if (empty($reshook)) { } } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) { // Set incoterm - $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOSTFLOAT('location_incoterms')); + $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f1d2eaaeaf6..1fbe7c56502 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -583,7 +583,7 @@ if (empty($reshook)) { } } } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) { // Set incoterm - $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOSTINT('location_incoterms')); + $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); } elseif ($action == 'setbankaccount' && $usercancreate) { // bank account $result = $object->setBankAccount(GETPOSTINT('fk_account')); } elseif ($action == 'setremisepercent' && $usercancreate) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 66761d12cdd..8f3041a20ec 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -220,7 +220,7 @@ if (empty($reshook)) { // Set incoterm if ($action == 'set_incoterms' && $usercancreate) { - $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOSTINT('location_incoterms')); + $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index bc0d1140b2d..2f64ae47dc4 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -445,7 +445,7 @@ if (empty($reshook)) { } } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) { // Set incoterm - $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOSTINT('location_incoterms')); + $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); } elseif ($action == 'setmode' && $usercancreate) { // payment mode $result = $object->setPaymentMethods(GETPOSTINT('mode_reglement_id')); From 283265448a1692a548ccba666e9516c3a8fb2b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Nov 2024 17:12:16 +0100 Subject: [PATCH 046/259] fix CI phpstan (#32032) * fix CI phpstan * Update interface_50_modTicket_TicketEmail.class.php * Update interface_50_modTicket_TicketEmail.class.php --- htdocs/core/lib/bank.lib.php | 2 +- .../interface_50_modTicket_TicketEmail.class.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 7091f6aa0e5..5815d177767 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -54,7 +54,7 @@ function bank_prepare_head(Account $object) $h++; if ($object->canBeConciliated() > 0) { - $allowautomaticconciliation = false; // TODO + $allowautomaticconciliation = getDolGlobalBool('MAIN_ALLOW_AUTOMATIC_CONCILIATION'); // TODO $titletoconciliatemanual = $langs->trans("Conciliate"); $titletoconciliateauto = $langs->trans("Conciliate"); if ($allowautomaticconciliation) { diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 27b544205b1..9661cdb6416 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -164,9 +164,9 @@ class InterfaceTicketEmail extends DolibarrTriggers // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); - if ($sendto) { - $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); - } + // if ($sendto) { // already test, can't be empty + $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); + // } } // Send email to assignee if an assignee was set at creation @@ -251,9 +251,9 @@ class InterfaceTicketEmail extends DolibarrTriggers // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); - if ($sendto) { - $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); - } + // if ($sendto) { // already test, can't be empty + $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); + // } } // Send email to customer. From 0577fe44a4903520386c75843d0a289a9e5a3695 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 21 Nov 2024 17:13:22 +0100 Subject: [PATCH 047/259] FIX: when create intervention from propal (or other object), element link is mising after creation (#32035) * fix: when create intervention from propal, element link is mising * fix: when create intervention from propal, element link is mising * fix: when create intervention from propal, element link is mising --- htdocs/fichinter/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index eed887b616c..c29768f40c3 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -844,7 +844,7 @@ if ($action == 'create') { $res = $soc->fetch($socid); } - if (GETPOSTINT('origin') && GETPOSTINT('originid')) { + if (GETPOST('origin', 'alphanohtml') && GETPOSTINT('originid')) { // Parse element/subelement (ex: project_task) $regs = array(); $element = $subelement = GETPOST('origin', 'alphanohtml'); @@ -1011,6 +1011,7 @@ if ($action == 'create') { if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { $newclassname = $classname; if ($newclassname == 'Propal') { + $langs->load('propal'); $newclassname = 'CommercialProposal'; } print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
'.$form->textwithpicto($langs->trans("PublicFile"), $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist), 1, 'help', '', 0, 3, 'publicfile').''.yn($object->public).'
'.$form->textwithpicto($langs->trans("MembershipPublic"), $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist), 1, 'help', '', 0, 3, 'publicfile').''.yn($object->public).'
'; - print '
'; + print ''; if ($action != 'editthirdparty' && $user->hasRight('adherent', 'creer')) { @@ -638,9 +638,9 @@ if (isModEnabled('societe')) { print ''; print '
'; print $langs->trans("LinkedToDolibarrThirdParty"); print '
'; } else { - if ($object->fk_soc) { + if ($object->socid > O) { $company = new Societe($db); - $result = $company->fetch($object->fk_soc); + $result = $company->fetch($object->socid); print $company->getNomUrl(1); // Show link to invoices @@ -659,7 +659,7 @@ if (isModEnabled('societe')) { // Login Dolibarr - Link to user print '
'; -print '
'; +print ''; if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) { From c12a7e144a5babe9feebc003d05682c2e92f16e5 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Thu, 21 Nov 2024 19:07:58 +0100 Subject: [PATCH 056/259] FIX TakePos barcode rule (#31857) * FIX TakePos barcode rule * Keep last test confition on barcode rule --- htdocs/takepos/ajax/ajax.php | 4 ++-- htdocs/takepos/index.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 249cdc04ed9..b196ed4a9f3 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -212,7 +212,7 @@ if ($action == 'getProducts') { if (isset($barcode_value_list['qd'])) { $qty_str .= '.' . $barcode_value_list['qd']; } - $qty = floatval($qty_str); + $qty = (float) $qty_str; } $objProd = new Product($db); @@ -241,7 +241,7 @@ if ($action == 'getProducts') { 'label' => $obj->label, 'tosell' => $obj->tosell, 'tobuy' => $obj->tobuy, - 'barcode' => $obj->barcode, + 'barcode' => $term, // there is only one product matches the barcode rule and so the term is considered as the barcode of this product, 'price' => empty($objProd->multiprices[$pricelevel]) ? $obj->price : $objProd->multiprices[$pricelevel], 'price_ttc' => empty($objProd->multiprices_ttc[$pricelevel]) ? $obj->price_ttc : $objProd->multiprices_ttc[$pricelevel], 'object' => 'product', diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 5ddd0e59b94..c18da67daca 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -731,7 +731,7 @@ function Search2(keyCodeForEnter, moreorless) { console.log("There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0]['rowid']); ChangeThirdparty(data[0]['rowid']); } - else if ($('#search').val() == data[0]['barcode'] && 'product' == data[0]['object']) { + else if ('product' == data[0]['object'] && $('#search').val() == data[0]['barcode']) { console.log("There is only 1 answer and we found search on a barcode, so we add the product in basket, qty="+data[0]['qty']); ClickProduct(0, data[0]['qty']); } From 57d121664fc53ba2204ab9e094b8d91eed210a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Nov 2024 19:11:32 +0100 Subject: [PATCH 057/259] set object entity at create (#32019) * set object entity at create * set object entity at create * set object entity at create * set object entity at create * set object entity at create * set object entity at create * do not break multicompany thing * do not break multicompany thing * missing translation * fix phpstan * doc * fix entity * fix set entity --- htdocs/adherents/class/adherent.class.php | 5 ++++- htdocs/comm/propal/class/propal.class.php | 4 +++- htdocs/commande/class/commande.class.php | 3 ++- htdocs/compta/facture/class/facture.class.php | 3 ++- htdocs/contact/class/contact.class.php | 3 ++- htdocs/contrat/class/contrat.class.php | 3 ++- htdocs/expedition/class/expedition.class.php | 3 ++- htdocs/fichinter/class/fichinter.class.php | 3 ++- htdocs/fourn/class/fournisseur.commande.class.php | 11 ++++++++--- htdocs/fourn/class/fournisseur.facture.class.php | 3 ++- htdocs/societe/class/societe.class.php | 2 +- 11 files changed, 30 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fb48539e467..452bd835d11 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -646,6 +646,9 @@ class Adherent extends CommonObject } } + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); + $this->db->begin(); // Insert member @@ -658,7 +661,7 @@ class Adherent extends CommonObject $sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script $sql .= ", null, null, '".$this->db->escape($this->morphy)."'"; $sql .= ", ".((int) $this->typeid); - $sql .= ", ".$conf->entity; + $sql .= ", ".((int) $this->entity); $sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= ", ".(!empty($this->ip) ? "'".$this->db->escape($this->ip)."'" : "null"); $sql .= ")"; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c42b5b22c93..daa19da672d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1135,6 +1135,8 @@ class Propal extends CommonObject $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); // Set tmp vars $delivery_date = $this->delivery_date; @@ -1229,7 +1231,7 @@ class Propal extends CommonObject $sql .= ", ".($this->fk_project ? $this->fk_project : "null"); $sql .= ", ".(int) $this->fk_incoterms; $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".(int) $this->entity; $sql .= ", ".(int) $this->fk_multicurrency; $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql .= ", ".(float) $this->multicurrency_tx; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3e97bd80372..976b37d28de 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -947,6 +947,7 @@ class Commande extends CommonOrder $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); dol_syslog(get_class($this)."::create user=".$user->id); @@ -1010,7 +1011,7 @@ class Commande extends CommonOrder $sql .= ", ".(!empty($this->warehouse_id) && $this->warehouse_id > 0 ? ((int) $this->warehouse_id) : 'NULL'); $sql .= ", ".(int) $this->fk_incoterms; $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".(int) $this->entity; $sql .= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); $sql .= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); $sql .= ", ".(int) $this->fk_multicurrency; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 06eb0d45c29..ed4d1e522a1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -523,6 +523,7 @@ class Facture extends CommonInvoice $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); dol_syslog(get_class($this)."::create user=".$user->id." date=".$this->date); @@ -718,7 +719,7 @@ class Facture extends CommonInvoice $sql .= ")"; $sql .= " VALUES ("; $sql .= "'(PROV)'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".(int) $this->entity; $sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null"); $sql .= ", '".$this->db->escape($this->type)."'"; $sql .= ", ".($this->subtype ? "'".$this->db->escape($this->subtype)."'" : "null"); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 08041134de3..9af01fe74ce 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -508,7 +508,8 @@ class Contact extends CommonObject $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request } - $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople ("; $sql .= " datec"; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 81371d0556e..2fefa846bce 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1024,6 +1024,7 @@ class Contrat extends CommonObject $this->error .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeFollowUp")); $paramsok = 0; } + $this->entity = setEntity($this); if (!$paramsok) { return -1; } @@ -1043,7 +1044,7 @@ class Contrat extends CommonObject $sql .= ",".($this->commercial_suivi_id > 0 ? ((int) $this->commercial_suivi_id) : "NULL"); $sql .= ",".($this->fk_project > 0 ? ((int) $this->fk_project) : "NULL"); $sql .= ", ".(dol_strlen($this->ref) <= 0 ? "null" : "'".$this->db->escape($this->ref)."'"); - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", ".((int) $this->signed_status); $sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL"); $sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 5193c3cde90..54df830cd06 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -430,6 +430,7 @@ class Expedition extends CommonObject if (empty($this->date_shipping) && !empty($this->date_expedition)) { $this->date_shipping = $this->date_expedition; } + $this->entity = setEntity($this); $this->user = $user; @@ -462,7 +463,7 @@ class Expedition extends CommonObject $sql .= ", signed_status"; $sql .= ") VALUES ("; $sql .= "'(PROV)'"; - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", ".($this->ref_customer ? "'".$this->db->escape($this->ref_customer)."'" : "null"); $sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null"); $sql .= ", '".$this->db->idate($now)."'"; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 33d4eda3805..1a9340923e6 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -295,6 +295,7 @@ class Fichinter extends CommonObject dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } + $this->entity = setEntity($this); $soc = new Societe($this->db); $result = $soc->fetch($this->socid); @@ -325,7 +326,7 @@ class Fichinter extends CommonObject $sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->escape($this->ref)."'"; $sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null"); - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", ".((int) $user->id); $sql .= ", ".((int) $user->id); $sql .= ", ".($this->description ? "'".$this->db->escape($this->description)."'" : "null"); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3fef90726d4..9064fe9bbc4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -116,6 +116,8 @@ class CommandeFournisseur extends CommonOrder /** * @var ?int<0,9> + * @deprecated see $status + * @see $status */ public $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Ordered/Process running -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially // -> 7=Canceled/Never received -> (reopen) 3=Process running @@ -892,7 +894,7 @@ class CommandeFournisseur extends CommonOrder */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->statut, $mode, $this->billed); + return $this->LibStatut($this->status, $mode, $this->billed); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -992,7 +994,7 @@ class CommandeFournisseur extends CommonOrder if ($user->hasRight("fournisseur", "commande", "read")) { $datas['picto'] = ''.$langs->trans("SupplierOrder").''; - if ($this->statut) { + if ($this->status) { $datas['picto'] .= ' '.$this->getLibStatut(5); } if (!empty($this->ref)) { @@ -1156,6 +1158,7 @@ class CommandeFournisseur extends CommonOrder $obj = new $classname(); '@phan-var-force ModeleNumRefSuppliersOrders $obj'; + /** @var ModeleNumRefSuppliersOrders $obj */ $numref = $obj->getNextValue($soc, $this); if ($numref != "") { @@ -1169,6 +1172,7 @@ class CommandeFournisseur extends CommonOrder return -2; } } + /** * Class invoiced the supplier order * @@ -1598,6 +1602,7 @@ class CommandeFournisseur extends CommonOrder $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); // We set order into draft status $this->statut = self::STATUS_DRAFT; // deprecated @@ -1630,7 +1635,7 @@ class CommandeFournisseur extends CommonOrder $sql .= ", ".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "NULL"); $sql .= ", '".$this->db->escape($this->note_private)."'"; $sql .= ", '".$this->db->escape($this->note_public)."'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".((int) $this->entity); $sql .= ", ".((int) $this->socid); $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); $sql .= ", '".$this->db->idate($date)."'"; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c0514cead7e..be62ce3770b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -423,6 +423,7 @@ class FactureFournisseur extends CommonInvoice $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); $this->db->begin(); @@ -577,7 +578,7 @@ class FactureFournisseur extends CommonInvoice $sql .= "'(PROV)'"; $sql .= ", '".$this->db->escape($this->ref_supplier)."'"; $sql .= ", '".$this->db->escape($this->ref_ext)."'"; - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", '".$this->db->escape($this->type)."'"; $sql .= ", ".((int) $this->subtype); $sql .= ", '".$this->db->escape(isset($this->label) ? $this->label : (isset($this->libelle) ? $this->libelle : ''))."'"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7f35e25cef7..35b5d930548 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1038,7 +1038,7 @@ class Societe extends CommonObject $result = $this->verify(); if ($result >= 0) { - $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); + $this->entity = setEntity($this); $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe ("; $sql .= "nom"; From 869ee70c440ecd2c9fa0a239bfcb597a156135d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20de=20Grandpr=C3=A9?= Date: Thu, 21 Nov 2024 13:11:58 -0500 Subject: [PATCH 058/259] FIX#29901 blocking tasktimesel for nonbillabletime with dblclick enabling option (#32023) * FIX#29901 - Disable task checkbox in list with enable option on dbl-click when aligned in left column ans task not billable * typo * Managing $invoiced variable for phpstan * pre-commit hook correct. * phpcs * Update time.php * Update time.php --------- Co-authored-by: Laurent Destailleur --- htdocs/projet/tasks/time.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 523f93e97e4..aad0471027b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -2119,6 +2119,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser break; } + // Line is invoiced if it has an invoice_id + $invoiced = $task_time->invoice_id ? true : false; + $date1 = $db->jdate($task_time->element_date); $date2 = $db->jdate($task_time->element_datehour); @@ -2156,7 +2159,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $selected = 1; } print ' '; - print ''; + + // Disable select if task not billable or already invoiced + $disabled = (intval($task_time->billable) != 1 || $invoiced); + $ctrl = ''; + if ($disabled) { + // If disabled, a dbl-click very close outside the control + // will re-enable it, so that user is not blocked if needed. + print ''.$ctrl.''; + print ''; + } else { + print $ctrl; + } } } } @@ -2426,7 +2440,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } // Invoiced - $invoiced = false; if (!empty($arrayfields['valuebilled']['checked'])) { print '
'; print $langs->trans("LinkedToDolibarrUser"); print ''; // invoice_id and invoice_line_id if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { @@ -2506,6 +2519,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $selected = 1; } print ' '; + // Disable select if task not billable or already invoiced $disabled = (intval($task_time->billable) != 1 || $invoiced); $ctrl = ''; From 71d988b015677851cc3848736cce7300bc5da332 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 19:34:36 +0100 Subject: [PATCH 059/259] Add code to make easier to test PDF generation with n lines of product --- htdocs/commande/class/commande.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3e97bd80372..d29baca6cd5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4049,8 +4049,9 @@ class Commande extends CommonOrder $this->status = $this::STATUS_DRAFT; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; + while ($xnbp < $nbp) { $line = new OrderLine($this->db); From 6e9bbe42bb59b0db9c8f4db60e1f5f0843de8e82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 19:40:52 +0100 Subject: [PATCH 060/259] Add code to make easier to test PDF generation with n lines of product --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/compta/facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expensereport/class/expensereport.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 3 ++- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/reception/class/reception.class.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 11 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index daa19da672d..ac6d62da82c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3568,7 +3568,7 @@ class Propal extends CommonObject $this->multicurrency_code = $conf->currency; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new PropaleLigne($this->db); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index c8242aa1753..3a5fe7166ab 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1830,7 +1830,7 @@ class FactureRec extends CommonInvoice if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new FactureLigne($this->db); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ed4d1e522a1..e63c86551cc 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5159,7 +5159,7 @@ class Facture extends CommonInvoice if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new FactureLigne($this->db); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 2fefa846bce..7a5311695ff 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2487,7 +2487,7 @@ class Contrat extends CommonObject $this->note_public = 'This is a comment (public)'; $this->fk_project = 0; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new ContratLigne($this->db); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 54df830cd06..47fae30ca4b 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2157,7 +2157,7 @@ class Expedition extends CommonObject $this->note_private = 'Private note'; $this->note_public = 'Public note'; - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new ExpeditionLigne($this->db); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index f73497dd375..a4e5b557b08 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -968,7 +968,7 @@ class ExpenseReport extends CommonObject $this->note_private = 'Private note'; $this->note_public = 'SPECIMEN'; - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new ExpenseReportLine($this->db); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9064fe9bbc4..7f6dc7b957e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3193,9 +3193,10 @@ class CommandeFournisseur extends CommonOrder $this->multicurrency_code = $conf->currency; $this->statut = 0; + $this->status = 0; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new CommandeFournisseurLigne($this->db); diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index db1b79ad4c6..f57cfab72fb 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1783,7 +1783,7 @@ class FactureFournisseurRec extends CommonInvoice if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new FactureLigne($this->db); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index be62ce3770b..b0b14cf5092 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3072,7 +3072,7 @@ class FactureFournisseur extends CommonInvoice $xnbp = 0; if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) while ($xnbp < $nbp) { $line = new SupplierInvoiceLine($this->db); $line->desc = $langs->trans("Description")." ".$xnbp; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 25a6cc5c78c..71d4a47caff 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1528,7 +1528,7 @@ class Reception extends CommonObject $this->fk_incoterms = 1; - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new CommandeFournisseurDispatch($this->db); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 0aba526fa84..fd29fe5bbbf 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2373,7 +2373,7 @@ class SupplierProposal extends CommonObject $this->note_public = 'This is a comment (public)'; $this->note_private = 'This is a comment (private)'; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new SupplierProposalLine($this->db); From 235b61e07a516473eed84aba9878e7c4f308c6ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 22:13:45 +0100 Subject: [PATCH 061/259] FIX Debug v21 --- htdocs/compta/resultat/clientfourn.php | 4 ++-- htdocs/compta/tva/quadri_detail.php | 8 ++++---- htdocs/core/lib/tax.lib.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 34610f8d98a..f7da72fa53d 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -274,9 +274,9 @@ print ''; print ''; if ($modecompta == 'BOOKKEEPING') { - print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, 'width200 '); + print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, ''); } else { - print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'width200 '); + print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, ''); } print_liste_field_titre(''); if ($modecompta == 'BOOKKEEPING') { diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 54fee8c2882..2d24466a2a4 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -60,6 +60,7 @@ $refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTIS $invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : ''; $vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1; +// Set $date_start_xxx and $date_end_xxx... include DOL_DOCUMENT_ROOT . '/compta/tva/initdatesforvat.inc.php'; // Variables provided by include: ' @@ -323,7 +324,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { foreach ($x_paye[$my_paye_rate]['facid'] as $id => $dummy) { // ExpenseReport - if ($x_paye[$my_paye_rate]['ptype'][$id] == 'ExpenseReportPayment') { + if ($x_paye[$my_paye_rate]['ptype'][$id] === 'ExpenseReportPayment') { $expensereport->id = $x_paye[$my_paye_rate]['facid'][$id]; $expensereport->ref = $x_paye[$my_paye_rate]['facnum'][$id]; $expensereport->type = $x_paye[$my_paye_rate]['type'][$id]; @@ -441,7 +442,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print ""; print '\n"; // Allow external download print ''; print ''; -print ''; print ''; From 538c10fa6eab28346e3852e362d816479324d12e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 22:59:24 +0100 Subject: [PATCH 066/259] Fix phpstan --- htdocs/compta/tva/quadri_detail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 2d24466a2a4..e0ea47ccbd8 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -678,7 +678,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $subtot_paye_total_ht = 0; $subtot_paye_vat = 0; - if (is_array($x_both[$rate]['paye']['detail'])) { + if (is_array($x_both[$rate]['paye']['detail'])) { // @phpstan-ignore-line print ""; print '
'; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; - print ' - "; print ''; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; - print ' - '; // Ref diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 205031bed98..ed5586ff29d 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -1160,8 +1160,8 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql = "SELECT d.rowid, d.product_type as dtype, e.rowid as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,"; $sql .= " d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, "; $sql .= " e.date_debut as date_start, e.date_fin as date_end, e.fk_user_author,"; - $sql .= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,"; - $sql .= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid, e.ref as pref"; + $sql .= " e.ref as facnum, e.ref as pref, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,"; + $sql .= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expensereport_det as d ON d.fk_expensereport = e.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_expensereport as p ON p.fk_expensereport = e.rowid"; @@ -1184,7 +1184,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql .= " AND (d.product_type = -1"; $sql .= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service if (getDolGlobalString('MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS')) { - $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; + $sql .= " AND (d.".$db->sanitize($f_rate)." <> 0 OR d.total_tva <> 0)"; } $sql .= " ORDER BY e.rowid"; From 3085b48dc91601cb3cebcb138bd5574ed4be85d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 22:13:45 +0100 Subject: [PATCH 062/259] FIX Debug v21 --- htdocs/compta/resultat/clientfourn.php | 4 ++-- htdocs/compta/tva/quadri_detail.php | 8 ++++---- htdocs/core/lib/tax.lib.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index c300817bfa4..efbde5c60dd 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -258,9 +258,9 @@ print ''; print ''; if ($modecompta == 'BOOKKEEPING') { - print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, 'width200 '); + print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, ''); } else { - print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'width200 '); + print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, ''); } print_liste_field_titre(''); if ($modecompta == 'BOOKKEEPING') { diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 441c6bee6cd..ffc0adcd265 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -51,6 +51,7 @@ $refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTIS $invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : ''; $vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1; +// Set $date_start_xxx and $date_end_xxx... include DOL_DOCUMENT_ROOT . '/compta/tva/initdatesforvat.inc.php'; $min = price2num(GETPOST("min", "alpha")); @@ -299,7 +300,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { foreach ($x_paye[$my_paye_rate]['facid'] as $id => $dummy) { // ExpenseReport - if ($x_paye[$my_paye_rate]['ptype'][$id] == 'ExpenseReportPayment') { + if ($x_paye[$my_paye_rate]['ptype'][$id] === 'ExpenseReportPayment') { $expensereport->id = $x_paye[$my_paye_rate]['facid'][$id]; $expensereport->ref = $x_paye[$my_paye_rate]['facnum'][$id]; $expensereport->type = $x_paye[$my_paye_rate]['type'][$id]; @@ -417,7 +418,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print ""; print ''; print '
'; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; - print ' - "; print ''; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; - print ' - '; // Ref diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 9632a893acd..62c375ed81b 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -1154,8 +1154,8 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql = "SELECT d.rowid, d.product_type as dtype, e.rowid as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,"; $sql .= " d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, "; $sql .= " e.date_debut as date_start, e.date_fin as date_end, e.fk_user_author,"; - $sql .= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,"; - $sql .= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid, e.ref as pref"; + $sql .= " e.ref as facnum, e.ref as pref, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,"; + $sql .= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expensereport_det as d ON d.fk_expensereport = e.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_expensereport as p ON p.fk_expensereport = e.rowid"; @@ -1178,7 +1178,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql .= " AND (d.product_type = -1"; $sql .= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service if (getDolGlobalString('MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS')) { - $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; + $sql .= " AND (d.".$db->sanitize($f_rate)." <> 0 OR d.total_tva <> 0)"; } $sql .= " ORDER BY e.rowid"; From 75400611e1d3d7415e26a3d2163c55e9f5e91d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Nov 2024 22:36:00 +0100 Subject: [PATCH 063/259] fix phpstan (#32040) * fix phpstan * fix * fix * fix * fix * fix * fix --- build/phpstan/phpstan-baseline.neon | 300 +--------------------- htdocs/adherents/class/adherent.class.php | 4 +- htdocs/adherents/subscription.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/commonpeople.class.php | 32 ++- htdocs/core/lib/project.lib.php | 10 +- htdocs/societe/class/societe.class.php | 15 +- 7 files changed, 36 insertions(+), 329 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index f08d62540be..9b055ffc31c 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -972,12 +972,6 @@ parameters: count: 2 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Adherent\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -1014,36 +1008,12 @@ parameters: count: 5 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Adherent\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Adherent\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Adherent\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' identifier: argument.type count: 1 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^Property Adherent\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Property Adherent\:\:\$first_subscription_amount \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -1056,16 +1026,10 @@ parameters: count: 1 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^Property Adherent\:\:\$societe \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse - count: 2 + count: 1 path: ../../htdocs/adherents/class/adherent.class.php - @@ -5280,12 +5244,6 @@ parameters: count: 2 path: ../../htdocs/compta/bank/bankentries_list.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 2 - path: ../../htdocs/compta/bank/bankentries_list.php - - message: '#^Left side of && is always true\.$#' identifier: booleanAnd.leftAlwaysTrue @@ -5568,12 +5526,6 @@ parameters: count: 3 path: ../../htdocs/compta/bank/list.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 2 - path: ../../htdocs/compta/bank/releve.php - - message: '#^Variable \$buttonreconcile might not be defined\.$#' identifier: variable.undefined @@ -7860,12 +7812,6 @@ parameters: count: 1 path: ../../htdocs/contact/card.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Contact\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7902,33 +7848,9 @@ parameters: count: 3 path: ../../htdocs/contact/class/contact.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Contact\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Contact\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Contact\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 2 - path: ../../htdocs/contact/class/contact.class.php - - - - message: '#^Property Contact\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property count: 1 path: ../../htdocs/contact/class/contact.class.php @@ -7944,12 +7866,6 @@ parameters: count: 1 path: ../../htdocs/contact/class/contact.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - message: '#^Variable \$url in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -12324,24 +12240,6 @@ parameters: count: 1 path: ../../htdocs/core/lib/project.lib.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerDay expects string, \(float\|int\) given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/lib/project.lib.php - - - - message: '#^Parameter \#1 \$inc of function projectLinesPerMonth expects string, \(float\|int\) given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/lib/project.lib.php - - - - message: '#^Parameter \#1 \$inc of function projectLinesPerWeek expects string, \(float\|int\) given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/lib/project.lib.php - - message: '#^Property Task\:\:\$progress \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -17970,12 +17868,6 @@ parameters: count: 2 path: ../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php - - - message: '#^Negated boolean expression is always false\.$#' - identifier: booleanNot.alwaysFalse - count: 2 - path: ../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php - - message: '#^Variable \$old_MAIN_MAIL_AUTOCOPY_TO might not be defined\.$#' identifier: variable.undefined @@ -18432,12 +18324,6 @@ parameters: count: 1 path: ../../htdocs/don/class/api_donations.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Don\) and ''LibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -18474,42 +18360,12 @@ parameters: count: 1 path: ../../htdocs/don/class/don.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Don\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Don\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Don\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^Property Don\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Property Don\:\:\$societe \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property count: 1 path: ../../htdocs/don/class/don.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -19104,12 +18960,6 @@ parameters: count: 1 path: ../../htdocs/eventorganization/class/conferenceorboothattendee.class.php - - - message: '#^Property CommonObject\:\:\$name \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/eventorganization/class/conferenceorboothattendee.class.php - - message: '#^Property ConferenceOrBoothAttendee\:\:\$lastname \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -28368,12 +28218,6 @@ parameters: count: 1 path: ../../htdocs/projet/activity/perday.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerDay expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/activity/perday.php - - message: '#^Parameter \#11 \$isavailable of function projectLinesPerDay expects array\, afternoon\: int\<0, 1\>\}\>, non\-empty\-array\ given\.$#' identifier: argument.type @@ -28452,12 +28296,6 @@ parameters: count: 1 path: ../../htdocs/projet/activity/permonth.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerMonth expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/activity/permonth.php - - message: '#^Parameter \#14 \$arrayfields of function projectLinesPerMonth expects array\, array\\> given\.$#' identifier: argument.type @@ -28512,12 +28350,6 @@ parameters: count: 1 path: ../../htdocs/projet/activity/perweek.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerWeek expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/activity/perweek.php - - message: '#^Parameter \#11 \$isavailable of function projectLinesPerWeek expects array\, afternoon\: int\<0, 1\>\}\>, non\-empty\-array\ given\.$#' identifier: argument.type @@ -29184,12 +29016,6 @@ parameters: count: 1 path: ../../htdocs/projet/tasks.php - - - message: '#^Parameter \#1 \$inc of function projectLinesa expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/tasks.php - - message: '#^Parameter \#13 \$arrayfields of function projectLinesa expects array\, array\\> given\.$#' identifier: argument.type @@ -31410,12 +31236,6 @@ parameters: count: 1 path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - - message: '#^Call to function property_exists\(\) with \$this\(RecruitmentCandidature\) and ''phone'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - message: '#^Call to function property_exists\(\) with RecruitmentCandidature and ''date_creation'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -31458,24 +31278,12 @@ parameters: count: 1 path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - - message: '#^Property CommonObject\:\:\$name \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - message: '#^Property RecruitmentCandidature\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-2, 5\>\|string, noteditable\?\: int\<0, 1\>, default\?\: string, \.\.\.\}\>\) does not accept default value of type array\{rowid\: array\{type\: ''integer'', label\: ''TechnicalID'', enabled\: 1, position\: 1, notnull\: 1, visible\: 0, noteditable\: 1, index\: 1, \.\.\.\}, entity\: array\{type\: ''integer'', label\: ''Entity'', enabled\: 1, visible\: 0, position\: 5, notnull\: 1, default\: ''1'', index\: 1\}, ref\: array\{type\: ''varchar\(128\)'', label\: ''Ref'', enabled\: 1, position\: 10, notnull\: 1, visible\: 4, noteditable\: 1, default\: ''\(PROV\)'', \.\.\.\}, fk_recruitmentjobposition\: array\{type\: ''integer…'', label\: ''Job'', enabled\: 1, position\: 15, notnull\: 0, visible\: 1, index\: 1, picto\: ''recruitmentjobposit…'', \.\.\.\}, note_public\: array\{type\: ''html'', label\: ''NotePublic'', enabled\: 1, position\: 61, notnull\: 0, visible\: 0\}, note_private\: array\{type\: ''html'', label\: ''NotePrivate'', enabled\: 1, position\: 62, notnull\: 0, visible\: 0\}, fk_user_creat\: array\{type\: ''integer\:User\:user…'', label\: ''UserAuthor'', enabled\: 1, position\: 510, notnull\: \-1, visible\: \-2, foreignkey\: ''user\.rowid'', csslist\: ''tdoverflowmax100''\}, fk_user_modif\: array\{type\: ''integer\:User\:user…'', label\: ''UserModif'', enabled\: 1, position\: 511, notnull\: \-1, visible\: \-2, csslist\: ''tdoverflowmax100''\}, \.\.\.\}\.$#' identifier: property.defaultValue count: 1 path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - - message: '#^Property RecruitmentCandidature\:\:\$lastname \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - message: '#^Property RecruitmentCandidature\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -31830,30 +31638,6 @@ parameters: count: 1 path: ../../htdocs/resource/card.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Dolresource\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Dolresource\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Dolresource\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -31893,7 +31677,7 @@ parameters: - message: '#^Property Dolresource\:\:\$email \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 3 + count: 2 path: ../../htdocs/resource/class/dolresource.class.php - @@ -31938,12 +31722,6 @@ parameters: count: 2 path: ../../htdocs/resource/class/dolresource.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - message: '#^Call to function is_numeric\(\) with float\|int\\|int\<1, max\>\|\(non\-falsy\-string&numeric\-string\) will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -32718,12 +32496,6 @@ parameters: count: 2 path: ../../htdocs/societe/class/companybankaccount.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Societe\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -32760,24 +32532,6 @@ parameters: count: 6 path: ../../htdocs/societe/class/societe.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Societe\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Societe\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Societe\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Property Contact\:\:\$roles \(array\\) does not accept non\-empty\-list\\.$#' identifier: assign.propertyType @@ -32796,16 +32550,10 @@ parameters: count: 1 path: ../../htdocs/societe/class/societe.class.php - - - message: '#^Property Societe\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Property Societe\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 3 + count: 2 path: ../../htdocs/societe/class/societe.class.php - @@ -32844,12 +32592,6 @@ parameters: count: 1 path: ../../htdocs/societe/class/societe.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Property SocieteAccount\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-2, 5\>\|string, noteditable\?\: int\<0, 1\>, default\?\: string, \.\.\.\}\>\) does not accept default value of type array\{rowid\: array\{type\: ''integer'', label\: ''TechnicalID'', visible\: \-2, enabled\: 1, position\: 1, notnull\: 1, index\: 1, comment\: ''Id''\}, entity\: array\{type\: ''integer'', label\: ''Entity'', visible\: 0, enabled\: 1, position\: 5, default\: 1\}, login\: array\{type\: ''varchar\(64\)'', label\: ''Login'', visible\: 1, enabled\: 1, notnull\: 1, position\: 10, showoncombobox\: 1, autofocusoncreate\: 1\}, pass_encoding\: array\{type\: ''varchar\(24\)'', label\: ''PassEncoding'', visible\: 0, enabled\: 1, position\: 30\}, pass_crypted\: array\{type\: ''password'', label\: ''Password'', visible\: \-1, enabled\: 1, position\: 31, notnull\: 1\}, pass_temp\: array\{type\: ''varchar\(128\)'', label\: ''Temp'', visible\: 0, enabled\: 0, position\: 32, notnull\: \-1\}, fk_soc\: array\{type\: ''integer\:Societe…'', label\: ''ThirdParty'', visible\: 1, enabled\: 1, position\: 40, notnull\: \-1, index\: 1, picto\: ''company'', \.\.\.\}, site\: array\{type\: ''varchar\(128\)'', label\: ''WebsiteTypeLabel'', visible\: 0, enabled\: 0, position\: 41, notnull\: 1, default\: '''', help\: ''Name of the website…'', \.\.\.\}, \.\.\.\}\.$#' identifier: property.defaultValue @@ -34512,12 +34254,6 @@ parameters: count: 1 path: ../../htdocs/user/class/api_users.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Call to function method_exists\(\) with \$this\(User\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -34542,36 +34278,12 @@ parameters: count: 3 path: ../../htdocs/user/class/user.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(User\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/user/class/user.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(User\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/user/class/user.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(User\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Parameter \#1 \$array of function dol_sort_array contains unresolvable type\.$#' identifier: argument.unresolvableType count: 1 path: ../../htdocs/user/class/user.class.php - - - message: '#^Property User\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Property User\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -34638,12 +34350,6 @@ parameters: count: 1 path: ../../htdocs/user/class/user.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Variable \$whereforadd in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 452bd835d11..e2353b82af6 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -112,14 +112,14 @@ class Adherent extends CommonObject public $civility; /** - * @var string company name + * @var ?string company name * @deprecated Use $company * @see $company */ public $societe; /** - * @var string company name + * @var ?string company name */ public $company; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 0f882fb1d53..3b7b80d6935 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -638,7 +638,7 @@ if (isModEnabled('societe')) { print '
'; } else { - if ($object->socid > O) { + if ($object->socid > 0) { $company = new Societe($db); $result = $company->fetch($object->socid); print $company->getNomUrl(1); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 37a0c324dfb..71cc203b2d8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -637,7 +637,7 @@ abstract class CommonObject public $comments = array(); /** - * @var string The name + * @var ?string The name */ public $name; diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index 8bd31082ba7..dae9ff582bc 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -152,9 +152,9 @@ trait CommonPeople /** * Return full address for banner * - * @param string $htmlkey HTML id to make banner content unique - * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) - * @return string Full address string + * @param string $htmlkey HTML id to make banner content unique + * @param CommonObject $object Object (thirdparty, thirdparty of contact for contact, null for a member) + * @return string Full address string */ public function getBannerAddress($htmlkey, $object) { @@ -165,20 +165,24 @@ trait CommonPeople $contactid = 0; $thirdpartyid = 0; $elementforaltlanguage = $this->element; - if ($this->element == 'societe') { - /** @var Societe $this */ + if ($this->element == 'societe' && $this instanceof Societe) { $thirdpartyid = $this->id; } - if ($this->element == 'contact') { - /** @var Contact $this */ + if ($this->element == 'contact' && $this instanceof Contact) { $contactid = $this->id; $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc; } - if ($this->element == 'user') { - /** @var User $this */ + if ($this->element == 'member' && $this instanceof Adherent) { + $contactid = $this->id; + $thirdpartyid = empty($this->socid) ? 0 : $this->socid; + } + if ($this->element == 'user' && $this instanceof User) { $contactid = $this->contact_id; $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; } + if ($this->element == 'recruitmentcandidature' && $this instanceof RecruitmentCandidature) { + $thirdpartyid = 0; + } $out = ''; @@ -210,7 +214,7 @@ trait CommonPeople $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'); } - if (is_array($arrayoflangcode) && count($arrayoflangcode)) { + if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) { if (!is_object($extralanguages)) { include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; $extralanguages = new ExtraLanguages($this->db); @@ -258,7 +262,7 @@ trait CommonPeople // Phones $outphonedone = 0; if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone - $out .= ($outphonedone ? ' ' : ''); + // $out .= ($outphonedone ? ' ' : ''); $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++; $outphonedone++; @@ -387,7 +391,7 @@ trait CommonPeople $this->address = dol_strtoupper($this->address); $this->town = dol_strtoupper($this->town); } - if (isset($this->email)) { + if (!empty($this->email)) { $this->email = dol_strtolower($this->email); } if (isset($this->personal_email)) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 95566b86a53..2383a86619f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -581,7 +581,7 @@ function project_admin_prepare_head() /** * Show task lines with a particular parent * - * @param string $inc Line number (start to 0, then increased by recursive call) + * @param int $inc Line number (start to 0, then increased by recursive call) * @param int $parent Id of parent task to show (0 to show all) * @param Task[] $lines Array of lines * @param int $level Level (start to 0, then increased/decrease by recursive call), or -1 to show all level in order of $lines without the recursive groupment feature. @@ -1168,7 +1168,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t /** * Output a task line into a pertime input mode * - * @param string $inc Line number (start to 0, then increased by recursive call) + * @param int $inc Line number (start to 0, then increased by recursive call) * @param int $parent Id of parent task to show (0 to show all) * @param ?User $fuser Restrict list to user if defined * @param Task[] $lines Array of lines @@ -1398,7 +1398,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec /** * Output a task line into a pertime input mode * - * @param string $inc Line number (start to 0, then increased by recursive call) + * @param int $inc Line number (start to 0, then increased by recursive call) * @param int $parent Id of parent task to show (0 to show all) * @param ?User $fuser Restrict list to user if defined * @param Task[] $lines Array of lines @@ -1801,7 +1801,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr /** * Output a task line into a perday input mode * - * @param string $inc Line output identificator (start to 0, then increased by recursive call) + * @param int $inc Line output identificator (start to 0, then increased by recursive call) * @param int $firstdaytoshow First day to show * @param ?User $fuser Restrict list to user if defined * @param int $parent Id of parent task to show (0 to show all) @@ -2207,7 +2207,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ /** * Output a task line into a perday input mode * - * @param string $inc Line output identificator (start to 0, then increased by recursive call) + * @param int $inc Line output identificator (start to 0, then increased by recursive call) * @param int $firstdaytoshow First day to show * @param User|null $fuser Restrict list to user if defined * @param int $parent Id of parent task to show (0 to show all) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 35b5d930548..b3922c07312 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -273,14 +273,14 @@ class Societe extends CommonObject /** * Thirdparty name - * @var string + * @var ?string * @deprecated Use $name instead * @see $name */ public $nom; /** - * @var string Thirdparty name + * @var ?string Thirdparty name */ public $name; @@ -1212,14 +1212,13 @@ class Societe extends CommonObject $this->setUpperOrLowerCase(); $contact->phone_pro = $this->phone; if (getDolGlobalString('CONTACTS_DEFAULT_ROLES')) { - $contact->roles = explode(',', getDolGlobalString('CONTACTS_DEFAULT_ROLES')); + $contact->roles = explode(',', getDolGlobalString('CONTACTS_DEFAULT_ROLES')); } $contactId = $contact->create($user, $notrigger); if ($contactId < 0) { $error++; - $this->error = $contact->error; - $this->errors = $contact->errors; + $this->setErrorsFromObject($contact); dol_syslog(get_class($this)."::create_individual ERROR:".$this->error, LOG_ERR); } @@ -1227,8 +1226,7 @@ class Societe extends CommonObject $result = $contact->setCategories($tags); if ($result < 0) { $error++; - $this->error = $contact->error; - $this->errors = array_merge($this->errors, $contact->errors); + $this->setErrorsFromObject($contact); dol_syslog(get_class($this)."::create_individual Affect Tag ERROR:".$this->error, LOG_ERR); $contactId = $result; } @@ -1237,8 +1235,7 @@ class Societe extends CommonObject if (empty($error) && isModEnabled('mailing') && !empty($contact->email) && isset($no_email)) { $result = $contact->setNoEmail($no_email); if ($result < 0) { - $this->error = $contact->error; - $this->errors = array_merge($this->errors, $contact->errors); + $this->setErrorsFromObject($contact); dol_syslog(get_class($this)."::create_individual set mailing status ERROR:".$this->error, LOG_ERR); $contactId = $result; } From e4847961a48e9be8c215f96c3b1ae4abd1f3ccf3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 22:40:59 +0100 Subject: [PATCH 064/259] Fix phpstan --- htdocs/core/class/commonpeople.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index 8bd31082ba7..b71925e0b9a 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -165,16 +165,16 @@ trait CommonPeople $contactid = 0; $thirdpartyid = 0; $elementforaltlanguage = $this->element; - if ($this->element == 'societe') { + if ($this instanceOf Societe && $this->element === 'societe') { /** @var Societe $this */ $thirdpartyid = $this->id; } - if ($this->element == 'contact') { + if ($this instanceOf Contact && $this->element === 'contact') { /** @var Contact $this */ $contactid = $this->id; $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc; } - if ($this->element == 'user') { + if ($this instanceOf User && $this->element === 'user') { /** @var User $this */ $contactid = $this->contact_id; $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; From 1d1f8226034d5fc105ba06a61f3103986898f5e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 22:52:50 +0100 Subject: [PATCH 065/259] debug v21 --- htdocs/admin/order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/order.php b/htdocs/admin/order.php index e2f2cac0bfe..ebad20367b1 100644 --- a/htdocs/admin/order.php +++ b/htdocs/admin/order.php @@ -695,7 +695,7 @@ print "
'.$langs->trans("AllowExternalDownload").''; +print ''; print ajax_constantonoff('ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); print '
'; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; From 240c5bb3115e7428ec1a1fd7e92c41f4234b5c08 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 21 Nov 2024 23:00:41 +0100 Subject: [PATCH 067/259] fix: buyer and sellers in supplier invoice and supplier order list are not corectly defined (#32028) * fix: buyer and sellers in supplier invoice and supplier order list are not corectly defined * chore: revert bad changes --- htdocs/fourn/commande/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 60518e789fb..33c59ea0330 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -391,6 +391,7 @@ if (empty($reshook)) { $societe = new Societe($db); $societe->fetch($cmd->socid); $objecttmp->vat_reverse_charge = $societe->vat_reverse_charge; + $objecttmp->thirdparty = $societe; } $objecttmp->socid = $cmd->socid; $objecttmp->type = $objecttmp::TYPE_STANDARD; From ec93f508631ab4c2a0d21df645af1c97f679aae3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 00:15:14 +0100 Subject: [PATCH 068/259] Test --- .github/workflows/pr-18.yaml | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 376bf29454f..11188dc974d 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -1,20 +1,29 @@ on: pull_request: - types: - - opened + types: [opened, reopened] branches: - "18.0" jobs: run: - runs-on: ubuntu-22.04 - permissions: - pull-requests: write + runs-on: ubuntu-latest steps: - - name: Create PR review request - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - url: ${{ github.event.pull_request.html_url }} - run: | - gh pr edit "$url" --add-assignee lvessiller-opendsi,rycks --add-reviewer lvessiller-opendsi,rycks - gh pr merge "$url" --merge --auto + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install GitHub CLI + run: | + sudo apt update + sudo apt install gh -y + + - name: Authenticate GitHub CLI + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: gh auth login --with-token <<< "$GH_TOKEN" + + - name: Assign reviewer + env: + REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer + run: | + pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) + gh pr edit $pr_number --add-reviewer "$REVIEWER" From c2a037842d502b79ebada741434b284a1b3b859b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 00:22:26 +0100 Subject: [PATCH 069/259] Add test --- .github/workflows/test.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000000..f49494c5522 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,18 @@ +on: + workflow_dispatch: +jobs: + demo_app_authentication: + runs-on: ubuntu-latest + steps: + - name: Generate a token + id: generate-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.CIAPPID }} + private-key: ${{ secrets.CIAPPPRIKEY }} + + - name: Use the token + env: + GH_TOKEN: ${{ steps.generate-token.outputs.token }} + run: | + gh api dolibarr From 53ffe42f9235cce3d3287b87fbbd911a82adcd61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 00:27:58 +0100 Subject: [PATCH 070/259] Test CI --- .github/workflows/test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f49494c5522..1fb89b8cb96 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,6 +4,9 @@ jobs: demo_app_authentication: runs-on: ubuntu-latest steps: + - name: Log + run: echo "CIAPPID ${{ vars.CIAPPID }}" + - name: Generate a token id: generate-token uses: actions/create-github-app-token@v1 From 9aca86d16a3c9f7348c2f76ce8be391777b354ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 22 Nov 2024 00:39:22 +0100 Subject: [PATCH 071/259] fix phpstan (#32049) * fix phpstan * refix --- htdocs/adherents/stats/geo.php | 2 ++ htdocs/core/class/commonpeople.class.php | 30 ++++++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 3f0ebd040f2..8e5362fdeec 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -95,6 +95,7 @@ print load_fiche_titre($title, '', $memberstatic->picto); //dol_mkdir($dir); $data = array(); $tab = null; +$label = ''; if ($mode) { // Define sql @@ -263,6 +264,7 @@ if ($mode && !count($data)) { // Show graphics if (count($arrayjs) && $mode == 'memberbycountry') { + global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; if (is_readable($color_file)) { include $color_file; diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index b71925e0b9a..9d80dbdd518 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -152,9 +152,9 @@ trait CommonPeople /** * Return full address for banner * - * @param string $htmlkey HTML id to make banner content unique - * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) - * @return string Full address string + * @param string $htmlkey HTML id to make banner content unique + * @param CommonObject $object Object (thirdparty, thirdparty of contact for contact, null for a member) + * @return string Full address string */ public function getBannerAddress($htmlkey, $object) { @@ -165,20 +165,24 @@ trait CommonPeople $contactid = 0; $thirdpartyid = 0; $elementforaltlanguage = $this->element; - if ($this instanceOf Societe && $this->element === 'societe') { - /** @var Societe $this */ + if ($this->element === 'societe' && $this instanceof Societe) { $thirdpartyid = $this->id; } - if ($this instanceOf Contact && $this->element === 'contact') { - /** @var Contact $this */ + if ($this->element === 'contact' && $this instanceof Contact) { $contactid = $this->id; $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc; } - if ($this instanceOf User && $this->element === 'user') { - /** @var User $this */ + if ($this->element == 'member' && $this instanceof Adherent) { + $contactid = $this->id; + $thirdpartyid = empty($this->socid) ? 0 : $this->socid; + } + if ($this->element === 'user' && $this instanceof User) { $contactid = $this->contact_id; $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; } + if ($this->element == 'recruitmentcandidature' && $this instanceof RecruitmentCandidature) { + $thirdpartyid = 0; + } $out = ''; @@ -210,7 +214,7 @@ trait CommonPeople $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'); } - if (is_array($arrayoflangcode) && count($arrayoflangcode)) { + if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) { if (!is_object($extralanguages)) { include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; $extralanguages = new ExtraLanguages($this->db); @@ -258,7 +262,7 @@ trait CommonPeople // Phones $outphonedone = 0; if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone - $out .= ($outphonedone ? ' ' : ''); + // $out .= ($outphonedone ? ' ' : ''); $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++; $outphonedone++; @@ -387,7 +391,7 @@ trait CommonPeople $this->address = dol_strtoupper($this->address); $this->town = dol_strtoupper($this->town); } - if (isset($this->email)) { + if (!empty($this->email)) { $this->email = dol_strtolower($this->email); } if (isset($this->personal_email)) { From e12fdfb55039440502ed3128402a97c722760c86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 02:56:17 +0100 Subject: [PATCH 072/259] Add language file for tunisia --- htdocs/langs/en_US/sendings.lang | 2 +- htdocs/langs/fr_TN/main.lang | 31 +++++++++++++++++++++++++++++++ htdocs/langs/fr_TN/sendings.lang | 2 ++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 htdocs/langs/fr_TN/main.lang create mode 100644 htdocs/langs/fr_TN/sendings.lang diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index eb9c16239cc..a9bb15faf5f 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -14,7 +14,7 @@ LastSendings=Latest %s shipments StatisticsOfSendings=Statistics for shipments NbOfSendings=Number of shipments NumberOfShipmentsByMonth=Number of shipments by month -SendingCard=Shipment card +SendingCard=Shipment NewSending=New shipment CreateShipment=Create shipment QtyShipped=Qty shipped diff --git a/htdocs/langs/fr_TN/main.lang b/htdocs/langs/fr_TN/main.lang new file mode 100644 index 00000000000..ae3db1eeb17 --- /dev/null +++ b/htdocs/langs/fr_TN/main.lang @@ -0,0 +1,31 @@ +# Dolibarr language file - Source file is en_US - main +DIRECTION=ltr +# Default for FONTFORPDF=helvetica +# Note for Chinese: +# msungstdlight or cid0ct are for traditional Chinese zh_TW (traditional does not render with Ubuntu pdf reader) +# stsongstdlight or cid0cs are for simplified Chinese zh_CN +# To read Chinese pdf with Linux: sudo apt-get install poppler-data +# cid0jp is for Japanish +# cid0kr is for Korean +# DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages +# freemono is for ru_RU or uk_UA, uz_UZ +# freeserif is for Tamil or Ethiopian +FONTFORPDF=helvetica +FONTSIZEFORPDF=10 +SeparatorDecimal=, +SeparatorThousand=Space +FormatDateShort=%d/%m/%Y +FormatDateShortInput=%d/%m/%Y +FormatDateShortJava=dd/MM/yyyy +FormatDateShortJavaInput=dd/MM/yyyy +FormatDateShortJQuery=dd/mm/yy +FormatDateShortJQueryInput=dd/mm/yy +FormatHourShortJQuery=HH:MI +FormatHourShort=%H:%M +FormatHourShortDuration=%H:%M +FormatDateTextShort=%d %b %Y +FormatDateText=%d %B %Y +FormatDateHourShort=%d/%m/%Y %H:%M +FormatDateHourSecShort=%d/%m/%Y %H:%M:%S +FormatDateHourTextShort=%d %b %Y %H:%M +FormatDateHourText=%d %B %Y %H:%M diff --git a/htdocs/langs/fr_TN/sendings.lang b/htdocs/langs/fr_TN/sendings.lang new file mode 100644 index 00000000000..776063f7602 --- /dev/null +++ b/htdocs/langs/fr_TN/sendings.lang @@ -0,0 +1,2 @@ +# Dolibarr language file - Source file is en_US - sendings +SendingCard=Bon livraison From 6d6335ccf35984853c60900641b6b6b5405d9095 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 02:57:40 +0100 Subject: [PATCH 073/259] Add french tunisia language --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 6afa486d033..4ea49a160fa 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -72,6 +72,7 @@ Language_fr_FR=French Language_fr_GA=French (Gabon) Language_fr_NC=French (New Caledonia) Language_fr_SN=French (Senegal) +Language_fr_TN=French (Tunisia) Language_fy_NL=Frisian Language_gl_ES=Galician Language_he_IL=Hebrew From c4b34dd8f74973b0ecc2d1fc6ddb820c2130626d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 09:00:28 +0100 Subject: [PATCH 074/259] Clean code --- htdocs/expedition/list.php | 8 +++----- htdocs/langs/en_US/receptions.lang | 1 - htdocs/langs/en_US/sendings.lang | 1 - htdocs/reception/list.php | 8 ++++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index e2cbfed00c5..b45450396bc 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -669,7 +669,7 @@ $companystatic = new Societe($db); $formcompany = new FormCompany($db); $shipment = new Expedition($db); -$title = $langs->trans('ListOfSendings'); +$title = $langs->trans('Shipments'); $help_url = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-expedition page-list'); @@ -934,8 +934,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ exit; } -$expedition = new Expedition($db); - if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); @@ -1074,7 +1072,7 @@ print ''; print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder -print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dolly', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans('Shipments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dolly', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendShippingRef"; $modelmail = "shipping_send"; @@ -1085,7 +1083,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'createbills') { print ''; - print ''; + print '
'; print ''; print ''."\n"; + print ''."\n"; print ''."\n"; } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index ad5339deb41..37051fda92d 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -720,7 +720,7 @@ if ($ligneamodifier < 0 && (!isset($_SESSION['nom']))) { } // Show button to add a new line into database - print ''."\n"; + print ''."\n"; print ''."\n"; } From 8f486591b210ee73ca44691842ad233b3f9e1f0b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 1 Dec 2024 22:06:38 +0100 Subject: [PATCH 210/259] Complete log --- htdocs/contrat/class/contrat.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 7a5311695ff..348fb069591 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -486,10 +486,12 @@ class Contrat extends CommonObject $contratline->date_cloture = $now; // For backward compatibility $contratline->user_closing_id = $user->id; $contratline->statut = ContratLigne::STATUS_CLOSED; + $result = $contratline->close_line($user, $now, $comment, $notrigger); + if ($result < 0) { $error++; - $this->error = $contratline->error; + $this->error = $contratline->error.($contratline->error ? ' ('.$this->ref.')' : ''); $this->errors = $contratline->errors; break; } From 51c2e8973b5ca7df60ad997d650755ef354b2756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 1 Dec 2024 23:02:36 +0100 Subject: [PATCH 211/259] fix phpstan (#32185) * fix phpstan * remove multiple fetch not needed --- build/phpstan/phpstan-baseline.neon | 36 ----------------------------- htdocs/don/card.php | 33 ++++++-------------------- 2 files changed, 7 insertions(+), 62 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b969325e0aa..ac56139964c 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17940,42 +17940,6 @@ parameters: count: 1 path: ../../htdocs/document.php - - - message: '#^Variable \$hidedesc might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/don/card.php - - - - message: '#^Variable \$hidedetails might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/don/card.php - - - - message: '#^Variable \$hideref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/don/card.php - - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/don/card.php - - - - message: '#^Variable \$soc might not be defined\.$#' - identifier: variable.undefined - count: 8 - path: ../../htdocs/don/card.php - - - - message: '#^Variable \$totalpaid might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/don/card.php - - message: '#^Method Donations\:\:_validate\(\) has parameter \$data with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 1038cdb68d2..3f6e19412e7 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -140,8 +140,6 @@ if (empty($reshook)) { // Action reopen object if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) { - $object->fetch($id); - $result = $object->reopen($user); if ($result >= 0) { // Define output language @@ -149,7 +147,7 @@ if (empty($reshook)) { if (method_exists($object, 'generateDocument')) { $outputlangs = $langs; $newlang = ''; - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (getDolGlobalInt('MAIN_MULTILANGS') && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { @@ -161,7 +159,9 @@ if (empty($reshook)) { } $model = $object->model_pdf; $ret = $object->fetch($id); // Reload to get new records - + $hidedetails = 0; + $hidedesc = 0; + $hideref = 0; $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } } @@ -289,7 +289,6 @@ if (empty($reshook)) { // Action delete object if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $permissiontodelete) { - $object->fetch($id); $result = $object->delete($user); if ($result > 0) { header("Location: index.php"); @@ -302,7 +301,6 @@ if (empty($reshook)) { // Action validation if ($action == 'valid_promesse' && $permissiontoadd) { - $object->fetch($id); // @phan-suppress-next-line PhanPluginSuspiciousParamPosition if ($object->valid_promesse($id, $user->id) >= 0) { setEventMessages($langs->trans("DonationValidated", $object->ref), null); @@ -314,7 +312,6 @@ if (empty($reshook)) { // Action cancel if ($action == 'set_cancel' && $permissiontoadd) { - $object->fetch($id); if ($object->set_cancel($id) >= 0) { $action = ''; } else { @@ -325,21 +322,16 @@ if (empty($reshook)) { // Action set paid if ($action == 'set_paid' && $permissiontoadd) { $modepayment = GETPOSTINT('modepayment'); - - $object->fetch($id); if ($object->setPaid($id, $modepayment) >= 0) { $action = ''; } else { setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'classin' && $user->hasRight('don', 'creer')) { - $object->fetch($id); $object->setProject($projectid); } if ($action == 'update_extras' && $permissiontoadd) { - $object->fetch($id); - $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form @@ -405,7 +397,7 @@ if ($action == 'create') { // Company if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) { // Thirdparty - if ($soc->id > 0) { + if (!empty($soc) && $soc->id > 0) { print ''; print ''; print '
'; print $langs->trans('DateInvoice'); diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang index 80e9724b3b4..34b2276fca7 100644 --- a/htdocs/langs/en_US/receptions.lang +++ b/htdocs/langs/en_US/receptions.lang @@ -7,7 +7,6 @@ Receptions=Receptions AllReceptions=All Receptions ShowReception=Show Receptions ReceptionsArea=Receptions area -ListOfReceptions=List of receptions ReceptionMethod=Reception method LastReceptions=Latest %s receptions StatisticsOfReceptions=Statistics for receptions diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index a9bb15faf5f..95406dcc87e 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -8,7 +8,6 @@ Shipments=Shipments ShowSending=Show Shipments Receivings=Delivery Receipts SendingsArea=Shipments area -ListOfSendings=List of shipments SendingMethod=Shipping method LastSendings=Latest %s shipments StatisticsOfSendings=Statistics for shipments diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index b8801e6a26d..e50ffb1e687 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -608,9 +608,9 @@ $reception = new Reception($db); $formcompany = new FormCompany($db); $formfile = new FormFile($db); - +$title = $langs->trans('Receptions'); $helpurl = 'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones'; -llxHeader('', $langs->trans('ListOfReceptions'), $helpurl, '', 0, 0, '', '', '', 'bodyforlist mod-reception page-list'); +llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'bodyforlist mod-reception page-list'); $sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut as status, e.billed,"; $sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,"; @@ -906,13 +906,13 @@ print ''; print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder -print_barre_liste($langs->trans('ListOfReceptions'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dollyrevert', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dollyrevert', 0, $newcardbutton, '', $limit, 0, 0, 1); if ($massaction == 'createbills') { //var_dump($_REQUEST); print ''; - print ''; + print '
'; print ''; print ' Date: Fri, 22 Nov 2024 10:53:08 +0100 Subject: [PATCH 076/259] Debug v21 --- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/langs/en_US/products.lang | 1 - htdocs/langs/en_US/stocks.lang | 3 --- htdocs/product/admin/product.php | 3 +++ htdocs/product/stats/card.php | 2 +- htdocs/product/stock/movement_card.php | 2 +- htdocs/product/stock/movement_list.php | 8 ++++---- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e61568e6209..d27e941d1e6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2767,9 +2767,9 @@ class Form } if (empty($hidelabel)) { - $out .= $langs->trans("RefOrLabel") . ' : '; + $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; } elseif ($hidelabel > 1) { - $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; + $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; if ($hidelabel == 2) { $out .= img_picto($langs->trans("Search"), 'search'); } diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index c3b29b9751b..2d8d05e9761 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -97,7 +97,6 @@ ShowService=Show service ProductsAndServicesArea=Product and Services area ProductsArea=Product area ServicesArea=Services area -ListOfStockMovements=List of stock movements BuyingPrice=Buying price PriceForEachProduct=Products with specific prices SupplierCard=Vendor card diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 0648dde54b4..9b651192a6b 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -27,9 +27,6 @@ LotSerialList=List of lot/serials SubjectToLotSerialOnly=Products subject to lot/serial only Movements=Movements ErrorWarehouseRefRequired=Warehouse reference name is required -ListOfWarehouses=List of warehouses -ListOfStockMovements=List of stock movements -ListOfInventories=List of inventories MovementId=Movement ID StockMovementForId=Movement ID %d ListMouvementStockProject=List of stock movements associated to project diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index ea093c7885a..3d7e56c8de8 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -650,6 +650,9 @@ print ''; +print '
'; + + print load_fiche_titre($langs->trans("UserInterface"), '', ''); diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index a0d2cf1a04a..f2708e0df27 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -217,7 +217,7 @@ if ($result || !($id > 0)) { // Product print ''; // Tag diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index f76a30f674a..9c81e707e3d 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -560,7 +560,7 @@ if ($resql) { if ($msid) { $texte = $langs->trans('StockMovementForId', $msid); } else { - $texte = $langs->trans("ListOfStockMovements"); + $texte = $langs->trans("StockMovements"); if ($id) { $texte .= ' ('.$langs->trans("ForThisWarehouse").')'; } diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index a8ecbeacf72..86986da7ed4 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -832,7 +832,7 @@ $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; if ($msid) { $title = $langs->trans('StockMovementForId', $msid); } else { - $title = $langs->trans("ListOfStockMovements"); + $title = $langs->trans("StockMovements"); if ($id) { if (!empty($warehouse->ref)) { $title .= ' ('.$warehouse->ref.')'; @@ -1236,7 +1236,7 @@ if (!empty($arrayfields['pl.sellby']['checked'])) { if (!empty($arrayfields['e.ref']['checked'])) { print ''; } if (!empty($arrayfields['m.fk_user_author']['checked'])) { @@ -1564,7 +1564,7 @@ while ($i < $imaxinloop) { } // Warehouse if (!empty($arrayfields['e.ref']['checked'])) { - print '\n"; } @@ -1591,7 +1591,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['origin']['checked'])) { print ''; } - // fk_project + // Project if (!empty($arrayfields['m.fk_projet']['checked'])) { print ''; - print '\n"; } diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index f17607e7e74..a1e33ab79a0 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -278,7 +278,7 @@ print "\n"; print '\n"; // Services diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 43a1cab18a6..540244d87d6 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -59,7 +59,7 @@ $action = GETPOST('action', 'aZ09'); $left = GETPOST('left', 'alpha'); $top = GETPOST('top', 'alpha'); -$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant $newname = GETPOST('newname', 'alpha'); $mode = GETPOST('mode', 'alpha'); @@ -74,15 +74,22 @@ if (!$user->hasRight('takepos', 'run')) { */ if ($action == "getTables" && $user->hasRight('takepos', 'run')) { - $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables WHERE floor = ".((int) $floor)." AND entity IN (".getEntity('takepos').")"; - $resql = $db->query($sql); $rows = array(); + + $sql = "SELECT rowid, entity, label, leftpos, toppos, floor"; + $sql .= " FROM ".MAIN_DB_PREFIX."takepos_floor_tables"; + $sql .= " WHERE floor = ".((int) $floor)." AND entity IN (".getEntity('takepos').")"; + + $resql = $db->query($sql); while ($row = $db->fetch_array($resql)) { + $tmpplace = (int) $row['rowid']; + $invoice = new Facture($db); - $result = $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$row['rowid'].')'); + $result = $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$tmpplace.')'); if ($result > 0) { $row['occupied'] = "red"; } + $rows[] = $row; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 8f3259b46c0..4a7f4eebfe4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -624,7 +624,9 @@ if (empty($reshook)) { if ($placeid < 0) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid = ".((int) $placeid); + $sql = "UPDATE ".MAIN_DB_PREFIX."facture"; + $sql .= " SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql .= " WHERE rowid = ".((int) $placeid); $resql = $db->query($sql); if (!$resql) { $error++; @@ -898,7 +900,7 @@ if (empty($reshook)) { if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { $permissiontoupdateline = true; // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object - // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID } }*/ @@ -928,11 +930,12 @@ if (empty($reshook)) { // Action to delete or discard an invoice if ($action == "delete" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { - // $placeid is the invoice id (it differs from place) and is defined if the place is set and the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at beginning of page works. + // $placeid is the invoice id (it differs from place) and is defined if the place is set and + // the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at beginning of page works. if ($placeid > 0) { $result = $invoice->fetch($placeid); - if ($result > 0 && $invoice->statut == Facture::STATUS_DRAFT) { + if ($result > 0 && $invoice->status == Facture::STATUS_DRAFT) { $db->begin(); // We delete the lines @@ -973,7 +976,7 @@ if (empty($reshook)) { if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { $permissiontoupdateline = true; // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object - // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID } } if (!$permissiontoupdateline) { @@ -1023,7 +1026,7 @@ if (empty($reshook)) { if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { $permissiontoupdateline = true; // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object - // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID } } @@ -1074,7 +1077,7 @@ if (empty($reshook)) { if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { $permissiontoupdateline = true; // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object - // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID } } if (!$permissiontoupdateline) { diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index be9db4bb922..f60e08dd546 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -187,7 +187,7 @@ if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) { if (!getDolGlobalString($keyforstripeterminalbank)) { ?> const config = { simulated: true false - , location: 'global->STRIPE_LOCATION; ?>' + , location: '' } terminal.discoverReaders(config).then(function(discoverResult) { if (discoverResult.error) { @@ -233,8 +233,8 @@ if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) { total_ttc; ?>); - if (alreadypaydplusreceived > total_ttc; ?>) + //console.log("total_ttc = "+total_ttc; ?>); + if (alreadypaydplusreceived > total_ttc; ?>) { - var change=parseFloat(alreadypayed + parseFloat(received) - total_ttc; ?>); + var change=parseFloat(alreadypayed + parseFloat(received) - total_ttc; ?>); $('.change2').html(pricejs(change, 'MT')); $('.change2').val(change); $('.change1').removeClass('colorred'); @@ -439,7 +439,7 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) { fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(function(client_secret) { - terminal.setSimulatorConfiguration({testCardNumber: 'global->STRIPE_TERMINAL_SIMULATED; ?>'}); + terminal.setSimulatorConfiguration({testCardNumber: ''}); document.getElementById("card-present-alert").innerHTML = '
trans('PaymentSendToStripeTerminal'); ?>
'; terminal.collectPaymentMethod(client_secret).then(function(result) { diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 881c8bd16e5..8427e5b7b6c 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -78,8 +78,11 @@ if (!$user->hasRight('takepos', 'run')) { top_htmlhead('', '', 1); -if ($place > 0) { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; +if ((string) $place != '') { + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE ref = '(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; + $sql .= " AND entity IN (".getEntity('invoice').")"; + $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index 047fb89610c..b6eab6d8343 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -69,7 +69,10 @@ $invoice = new Facture($db); if ($invoiceid > 0) { $invoice->fetch($invoiceid); } else { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE ref = '(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql .= " AND entity IN (".getEntity('invoice').")"; + $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { diff --git a/htdocs/takepos/split.php b/htdocs/takepos/split.php index 7f6796db0b0..8fadea69c95 100644 --- a/htdocs/takepos/split.php +++ b/htdocs/takepos/split.php @@ -62,7 +62,7 @@ if (!$user->hasRight('takepos', 'run')) { * Actions */ -if ($action=="split" && $user->hasRight('takepos', 'run')) { +if ($action == "split" && $user->hasRight('takepos', 'run')) { $line = GETPOSTINT('line'); $split = GETPOSTINT('split'); if ($split==1) { // Split line @@ -85,16 +85,17 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { if ($placeid < 0) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-SPLIT)' where rowid=".$placeid; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-SPLIT)'"; + $sql .= " WHERE rowid = ".((int) $placeid); $db->query($sql); } } - $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set fk_facture=".$placeid." where rowid=".$line; + $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET fk_facture = ".((int) $placeid)." WHERE rowid = ".((int) $line); $db->query($sql); } elseif ($split==0) { // Unsplit line $invoice = new Facture($db); - if ($place=="SPLIT") { - $place="0"; + if ($place == "SPLIT") { + $place = "0"; } // Avoid move line to the same place (from SPLIT to SPLIT place) $ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')'); if ($ret > 0) { @@ -114,7 +115,9 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { if ($placeid < 0) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; + + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql .= " WHERE rowid = ".((int) $placeid); $db->query($sql); } } @@ -123,6 +126,7 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { } $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-SPLIT)'); $invoice->update_price(); + $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')'); $invoice->update_price(); } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 374537924e1..774f134dc0a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5363,7 +5363,7 @@ img.boxhandle, img.boxclose { .add-filter-btn { margin: 0 !important; } -.search-component-assistance .operand, .operator, .value { +.search-component-assistance .operand, .search-component-assistance .operator, .search-component-assistance .value { display: contents; } .search-component-assistance .btn-div{ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 1327a739682..4a2ee8d9890 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5352,7 +5352,7 @@ img.boxhandle, img.boxclose { .add-filter-btn { margin: 0 !important; } -.search-component-assistance .operand, .operator, .value { +.search-component-assistance .operand, .search-component-assistance .operator, .search-component-assistance .value { display: contents; } .search-component-assistance .btn-div{ From ef714b23c0247b26cf0b164d776b880978d4dac2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 12:29:00 +0100 Subject: [PATCH 078/259] Debug v21 --- htdocs/takepos/invoice.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 4a7f4eebfe4..e05f6f1d4d3 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -265,7 +265,7 @@ if (empty($reshook)) { $conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock during invoice validation - $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); dol_syslog("Validate invoice with stock change. Warehouse defined into constant ".$constantforkey." = ".getDolGlobalString($constantforkey)); // Validate invoice with stock change into warehouse getDolGlobalInt($constantforkey) @@ -799,7 +799,7 @@ if (empty($reshook)) { $line = array('description' => $prod->description, 'price' => $price, 'tva_tx' => $tva_tx, 'localtax1_tx' => $localtax1_tx, 'localtax2_tx' => $localtax2_tx, 'remise_percent' => $customer->remise_percent, 'price_ttc' => $price_ttc, 'array_options' => $array_options); /* setup of margin calculation */ - if (isset($conf->global->MARGIN_TYPE)) { + if (getDolGlobalString('MARGIN_TYPE')) { if (getDolGlobalString('MARGIN_TYPE') == 'pmp' && !empty($prod->pmp)) { $line['fk_fournprice'] = null; $line['pa_ht'] = $prod->pmp; @@ -1259,7 +1259,7 @@ if (empty($reshook)) { if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { $sectionwithinvoicelink .= ' Invoice'; } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { - if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { + if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { $sectionwithinvoicelink .= ' '; } else { $sectionwithinvoicelink .= ' '; @@ -1357,11 +1357,11 @@ $(document).ready(function() { global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { + if (filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { ?> $.ajax({ type: "POST", - url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php', + url: '/printer/index.php', data: 'invoice='+orderprinter1esc }); $.ajax({ type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', + url: 'http://:8111/print', data: '' }); @@ -1378,11 +1378,11 @@ if ($action == "order" && !empty($order_receipt_printer1)) { } if ($action == "order" && !empty($order_receipt_printer2)) { - if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { + if (filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { ?> $.ajax({ type: "POST", - url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=2', + url: '/printer/index.php?printer=2', data: 'invoice='+orderprinter2esc }); $.ajax({ type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print2', + url: 'http://:8111/print2', data: '' }); @@ -1399,11 +1399,11 @@ if ($action == "order" && !empty($order_receipt_printer2)) { } if ($action == "order" && !empty($order_receipt_printer3)) { - if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { + if (filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { ?> $.ajax({ type: "POST", - url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=3', + url: '/printer/index.php?printer=3', data: 'invoice='+orderprinter3esc }); $.ajax({ type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', + url: 'http://:8111/print', data: '' }); @@ -1984,7 +1984,7 @@ if ($placeid > 0) { if ($line->product_label && $line->desc) { $htmlforlines .= '
'; } - $firstline = dolGetFirstLineOfText($line->desc, $conf->global->TAKEPOS_SHOW_N_FIRST_LINES); + $firstline = dolGetFirstLineOfText($line->desc, getDolGlobalString('TAKEPOS_SHOW_N_FIRST_LINES')); if ($firstline != $line->desc) { $htmlforlines .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); } else { From 65aadd446a62d2908addf582d3d3a24c11eb4911 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 12:33:53 +0100 Subject: [PATCH 079/259] Debug v21 --- htdocs/takepos/admin/bar.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index beb3089cebd..9459557f18c 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -137,10 +137,13 @@ if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { print "\n"; print '
'; print ''; if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) { From ef41ebb864d36e56d39d9f45d5ad7bedbc660e12 Mon Sep 17 00:00:00 2001 From: daGrumpf <64209003+daGrumpf-bxp@users.noreply.github.com> Date: Fri, 22 Nov 2024 13:07:23 +0100 Subject: [PATCH 080/259] PR#28448 broke qty float on xpedition same correction as #31794 (#32055) --- htdocs/expedition/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index d16c964d4cb..6f5c3ed4777 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -357,7 +357,7 @@ if (empty($reshook)) { } } else { //shipment line for product with no batch management and no multiple stock location - if (GETPOSTINT($qty) > 0) { + if (GETPOSTFLOAT($qty) > 0) { $totalqty += price2num(GETPOST($qty, 'alpha'), 'MS'); $subtotalqty = price2num(GETPOST($qty, 'alpha'), 'MS'); } @@ -401,7 +401,7 @@ if (empty($reshook)) { } } } else { - if (GETPOSTINT($qty) > 0 || getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) { + if (GETPOSTFLOAT($qty) > 0 || getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) { $ent = "entl".$i; $idl = "idl".$i; $entrepot_id = is_numeric(GETPOSTINT($ent)) ? GETPOSTINT($ent) : GETPOSTINT('entrepot_id'); @@ -412,7 +412,7 @@ if (empty($reshook)) { $entrepot_id = 0; } - $ret = $object->addline($entrepot_id, GETPOSTINT($idl), price2num(GETPOSTINT($qty), 'MS'), $array_options[$i]); + $ret = $object->addline($entrepot_id, GETPOSTINT($idl), price2num(GETPOSTFLOAT($qty), 'MS'), $array_options[$i]); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -671,7 +671,7 @@ if (empty($reshook)) { $batch = "batchl".$detail_batch->fk_expeditiondet."_".$detail_batch->fk_origin_stock; $qty = "qtyl".$detail_batch->fk_expeditiondet.'_'.$detail_batch->id; $batch_id = GETPOSTINT($batch); - $batch_qty = GETPOSTINT($qty); + $batch_qty = GETPOSTFLOAT($qty); if (!empty($batch_id)) { if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) { // $line is ExpeditionLine if ($lines[$i]->entrepot_id != 0) { @@ -708,7 +708,7 @@ if (empty($reshook)) { $batch = "batchl".$line_id."_0"; $qty = "qtyl".$line_id."_0"; $batch_id = GETPOSTINT($batch); - $batch_qty = GETPOSTINT($qty); + $batch_qty = GETPOSTFLOAT($qty); $lineIdToAddLot = 0; if ($batch_qty > 0 && !empty($batch_id)) { if ($lotStock->fetch($batch_id) > 0) { From 682544ad45506539fe702e10e85e7bd96d49152c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 13:08:56 +0100 Subject: [PATCH 081/259] Update test.yaml (#32054) * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update pr-18.yaml * Update test.yaml --- .github/workflows/pr-18.yaml | 18 ++++++++++++------ .github/workflows/test.yaml | 26 ++++++++++++-------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index a0c2579dc0d..d60a225a455 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -1,15 +1,18 @@ on: pull_request: - types: [opened, reopened] + types: [opened, synchronize, reopened] branches: - "18.0" push: branches: - "18.0" +permissions: write-all + jobs: run: runs-on: ubuntu-latest + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -19,15 +22,18 @@ jobs: sudo apt update sudo apt install gh -y - - name: Authenticate GitHub CLI - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - run: gh auth login --with-token <<< "$GH_TOKEN" + #- name: Authenticate GitHub CLI + # env: + # GH_TOKEN: ${{ secrets.GH_TOKEN }} + # run: gh auth login --with-token <<< "$GH_TOKEN" - name: Assign reviewer env: + GH_TOKEN: ${{ github.token }} + #GH_TOKEN: ${{ secrets.GH_TOKEN }} #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | + echo "GH_TOKEN=$GH_TOKEN" pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) - gh pr edit $pr_number --add-reviewer "$REVIEWER" + #gh pr edit $pr_number --add-reviewer "$REVIEWER" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1fb89b8cb96..cf263dd0b57 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,21 +1,19 @@ on: workflow_dispatch: + pull_request: + types: [opened, reopened, synchronize] + branches: + - "18.0" + +permissions: write-all + jobs: - demo_app_authentication: + testjob: runs-on: ubuntu-latest steps: - name: Log - run: echo "CIAPPID ${{ vars.CIAPPID }}" - - - name: Generate a token - id: generate-token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ vars.CIAPPID }} - private-key: ${{ secrets.CIAPPPRIKEY }} - - - name: Use the token - env: - GH_TOKEN: ${{ steps.generate-token.outputs.token }} run: | - gh api dolibarr + echo "variable org: ${{vars.AAA}}" + echo "env prg: ${{env.AAA}}" + echo "secret org: ${{secrets.BBB}}" + echo "variable repository of orga: ${{vars.CCC}}" From 1f386fb8086607a670221ed0781d48ed1aba5820 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Fri, 22 Nov 2024 13:21:18 +0100 Subject: [PATCH 082/259] fix #32060 (#32061) * fix #32060 * fix #32060 --- htdocs/compta/facture/class/facture-rec.class.php | 2 +- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 3a5fe7166ab..f9cd158244f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1311,7 +1311,7 @@ class FactureRec extends CommonInvoice if (empty($this->date_when)) { return false; } - return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency); + return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency, 1); } /** diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index f57cfab72fb..7d2ea231dfc 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1307,7 +1307,7 @@ class FactureFournisseurRec extends CommonInvoice if (empty($this->date_when)) { return false; } - return dol_time_plus_duree((int) $this->date_when, $this->frequency, $this->unit_frequency); + return dol_time_plus_duree((int) $this->date_when, $this->frequency, $this->unit_frequency, 1); } /** From e35b534ee282bfa0657557d9b5ba146e3ae5bca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 22 Nov 2024 13:22:05 +0100 Subject: [PATCH 083/259] fix ajax tooltip lib_foot.js.php (#32044) Co-authored-by: Laurent Destailleur --- htdocs/core/js/lib_foot.js.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 5ed7dfb2eb1..4f2ca935115 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -110,8 +110,10 @@ if (empty($conf->dol_no_mouse_hover)) { success: function(response){ // Setting content option console.log("ajax success"); - elemfortooltip.tooltip("option","content",response); - elemfortooltip.tooltip("open"); + if (elemfortooltip.is(":hover")) { + elemfortooltip.tooltip("option","content",response); + elemfortooltip.tooltip("open"); + } } }); }, opendelay)); From 9cd7d381a64968126581e298e4f757235ed474e5 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Fri, 22 Nov 2024 13:25:25 +0100 Subject: [PATCH 084/259] flip supplier proposal and orders to show up as negative in the project Profit overview (#32048) Co-authored-by: Jon Bendtsen --- htdocs/projet/element.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 614d9d3c39f..ed14a6791bf 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -909,7 +909,7 @@ foreach ($listofreferent as $key => $value) { $total_ttc_by_line = $element->total_ttc; } - // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases + // Change sign of $total_ht_by_line and $total_ttc_by_line for various payments if ($tablename == 'payment_various') { if ($element->sens == 1) { $total_ht_by_line = -$total_ht_by_line; @@ -917,6 +917,12 @@ foreach ($listofreferent as $key => $value) { } } + // Change sign of $total_ht_by_line and $total_ttc_by_line for supplier proposal and supplier order + if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_proposal') { + $total_ht_by_line = -$total_ht_by_line; + $total_ttc_by_line = -$total_ttc_by_line; + } + // Add total if we have to if ($qualifiedfortotal) { $total_ht = $total_ht + $total_ht_by_line; From 32b18d6bfd497d54a8c89108deb1033660019d10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 15:22:22 +0100 Subject: [PATCH 085/259] Execute --- .github/workflows/pr-18.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index d60a225a455..2682e99df38 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -13,6 +13,10 @@ jobs: run: runs-on: ubuntu-latest + env: + # GH_TOKEN: ${{ secrets.GH_TOKEN }} + GH_TOKEN: ${{ github.token }} + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -23,17 +27,16 @@ jobs: sudo apt install gh -y #- name: Authenticate GitHub CLI - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # run: gh auth login --with-token <<< "$GH_TOKEN" + # run: | + # echo "GH_TOKEN=$GH_TOKEN" + # gh auth login --with-token <<< "$GH_TOKEN" - name: Assign reviewer env: - GH_TOKEN: ${{ github.token }} - #GH_TOKEN: ${{ secrets.GH_TOKEN }} #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | echo "GH_TOKEN=$GH_TOKEN" pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) - #gh pr edit $pr_number --add-reviewer "$REVIEWER" + gh pr edit $pr_number --add-reviewer "$REVIEWER" + continue-on-error: true From 2b264ae5d07bb27ea407ec3390ddba7096693c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 22 Nov 2024 15:24:11 +0100 Subject: [PATCH 086/259] fix phpstan (#32063) --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index e05f6f1d4d3..e557d95de02 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1984,7 +1984,7 @@ if ($placeid > 0) { if ($line->product_label && $line->desc) { $htmlforlines .= '
'; } - $firstline = dolGetFirstLineOfText($line->desc, getDolGlobalString('TAKEPOS_SHOW_N_FIRST_LINES')); + $firstline = dolGetFirstLineOfText($line->desc, getDolGlobalInt('TAKEPOS_SHOW_N_FIRST_LINES')); if ($firstline != $line->desc) { $htmlforlines .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); } else { From acdab170a7b0445102ceefab05e95e44fc5ae48a Mon Sep 17 00:00:00 2001 From: "Thomas C." <56068416+Thomas905@users.noreply.github.com> Date: Fri, 22 Nov 2024 17:58:21 +0100 Subject: [PATCH 087/259] fix (#32012) --- htdocs/fourn/facture/card.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6f90af4ba22..d2699019a63 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3030,14 +3030,12 @@ if ($action == 'create') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); } - if (!$formconfirm) { - $parameters = array('formConfirm' => $formconfirm, 'lineid'=>$lineid); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $formconfirm .= $hookmanager->resPrint; - } elseif ($reshook > 0) { - $formconfirm = $hookmanager->resPrint; - } + $parameters = array('formConfirm' => $formconfirm, 'lineid'=>$lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; } // Print form confirm From ef88eeeffda05f2c4ebf896997a77600be795b5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Nov 2024 15:30:19 +0100 Subject: [PATCH 088/259] Debug v21 --- htdocs/theme/eldy/global.inc.php | 6 +++++- htdocs/user/virtualcard.php | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 374537924e1..97b87c5faf0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -8700,7 +8700,11 @@ table.jPicker { .side-nav { z-index: 200; background: var(--colorbackvmenu1); - padding-top: 70px; + /* padding-top: 70px; */ + position: relative; + top: 70px; + width: 245px; /* must be same than div.login_block */ + box-shadow: none; } #id-left { z-index: 201; diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 95644a080fc..a83bc200025 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -131,7 +131,7 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; - $enabledisablehtml .= '

'.$langs->trans("UserPublicPageDesc").'

'; + $enabledisablehtml .= '

'.$langs->trans("UserPublicPageDesc").'
'; } else { // Button on, click to disable $enabledisablehtml .= ''; @@ -139,13 +139,14 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { $enabledisablehtml .= ''; } print $enabledisablehtml; -print ''; +print ''; -print '

'; print '
'; if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { + print '

'; + print ''; print ''; print ''; From d9d50202070ba638249d4d004fca1e66cdc1be76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 23 Nov 2024 23:35:18 +0100 Subject: [PATCH 089/259] fix updatelines of propal not updating object properties --- htdocs/comm/propal/card.php | 44 ++++++++++++--------- htdocs/core/class/html.formmargin.class.php | 1 + 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 10b01316bf0..5344cc94f36 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -971,9 +971,10 @@ if (empty($reshook)) { // Define date start and date end for all line $alldate_start = dol_mktime(GETPOSTINT('alldate_starthour'), GETPOSTINT('alldate_startmin'), 0, GETPOSTINT('alldate_startmonth'), GETPOSTINT('alldate_startday'), GETPOSTINT('alldate_startyear')); $alldate_end = dol_mktime(GETPOSTINT('alldate_endhour'), GETPOSTINT('alldate_endmin'), 0, GETPOSTINT('alldate_endmonth'), GETPOSTINT('alldate_endday'), GETPOSTINT('alldate_endyear')); - foreach ($object->lines as $line) { + foreach ($object->lines as $key => $line) { if ($line->product_type == 1) { // only service line $result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $alldate_start, $alldate_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); + $object->lines[$key] = $object->line; } } } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '' && $usercancreate) { @@ -982,24 +983,26 @@ if (empty($reshook)) { $vat_rate = str_replace('*', '', $vat_rate); $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); - foreach ($object->lines as $line) { + foreach ($object->lines as $key => $line) { $result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); + $object->lines[$key] = $object->line; } } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) { // Define a discount for all lines $remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0); $remise_percent = str_replace('*', '', $remise_percent); - foreach ($object->lines as $line) { + foreach ($object->lines as $key => $line) { $tvatx = $line->tva_tx; if (!empty($line->vat_src_code)) { $tvatx .= ' ('.$line->vat_src_code.')'; } $result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $tvatx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); + $object->lines[$key] = $object->line; } } elseif ($action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines') !== '' && $usercancreate) { // Define margin $margin_rate = (GETPOST('marginforalllines') ? GETPOST('marginforalllines') : 0); - foreach ($object->lines as &$line) { + foreach ($object->lines as $key => &$line) { $subprice = price2num($line->pa_ht * (1 + $margin_rate / 100), 'MU'); $prod = new Product($db); $prod->fetch($line->fk_product); @@ -1009,23 +1012,28 @@ if (empty($reshook)) { setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings'); } // Manage $line->subprice and $line->multicurrency_subprice - $multicurrency_subprice = (float) $subprice * $line->multicurrency_subprice / $line->subprice; + if ($line->subprice <> 0) { + $multicurrency_subprice = (float) $subprice * $line->multicurrency_subprice / $line->subprice; + } else { + $multicurrency_subprice = 0; + } // Update DB $result = $object->updateline($line->id, $subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $multicurrency_subprice); + $object->lines[$key] = $object->line; // Update $object with new margin info - $line->price = $subprice; - $line->marge_tx = $margin_rate; - $line->marque_tx = $margin_rate * $line->pa_ht / (float) $subprice; - $line->total_ht = $line->qty * (float) $subprice; - $line->total_tva = $line->tva_tx * $line->qty * (float) $subprice; - $line->total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice; - // Manage $line->subprice and $line->multicurrency_subprice - $line->multicurrency_total_ht = $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice; - $line->multicurrency_total_tva = $line->tva_tx * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice; - $line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice; - // Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values - $line->subprice = (float) $subprice; - $line->multicurrency_subprice = $multicurrency_subprice; + // $line->price = $subprice; + // $line->marge_tx = $margin_rate; + // $line->marque_tx = $margin_rate * $line->pa_ht / (float) $subprice; + // $line->total_ht = $line->qty * (float) $subprice; + // $line->total_tva = $line->tva_tx * $line->qty * (float) $subprice; + // $line->total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice; + // // Manage $line->subprice and $line->multicurrency_subprice + // $line->multicurrency_total_ht = $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice; + // $line->multicurrency_total_tva = $line->tva_tx * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice; + // $line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice; + // // Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values + // $line->subprice = (float) $subprice; + // $line->multicurrency_subprice = $multicurrency_subprice; } } elseif ($action == 'addline' && !GETPOST('submitforalllines', 'alpha') && !GETPOST('submitforallmargins', 'alpha') && $usercancreate) { // Add line // Set if we used free entry or predefined product diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 36dc92fcce1..5537893d372 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -109,6 +109,7 @@ class FormMargin if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { // Special case for old situation mode '@phan-var-force Facture $object'; + /** @var Facture $object */ if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) { // We need a compensation relative to $line->situation_percent From fb3c464555c3ea0fded626b5c3b9e71ba908c813 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Nov 2024 13:00:08 +0100 Subject: [PATCH 090/259] Debug v21 --- htdocs/core/lib/ajax.lib.php | 18 +++++++++++----- htdocs/core/lib/functions.lib.php | 2 +- htdocs/public/users/view.php | 36 ++++++++++++++++++++++++------- htdocs/user/virtualcard.php | 29 ++++++++++++------------- 4 files changed, 56 insertions(+), 29 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 20ebd6464df..8fa4576ad8c 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -639,14 +639,14 @@ function ajax_event($htmlname, $events) * @param string $suffix Suffix to use on the name of the switch picto when option is on. Example: '', '_red' * @param string $mode Add parameter &mode= to the href link (Used for href link) * @param string $morecss More CSS - * @param int $userconst 1=OnOff for user constant of user $userconst + * @param User|int $userconst If set, use the ajax On/Off for user or user ID $userconst * @param string $showwarning String to show a warning when enabled the option * @return string * @see ajax_object_onoff() to update the status of an object */ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block', $userconst = 0, $showwarning = '') { - global $conf, $langs, $user; + global $conf, $langs, $user, $db; $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); if (!isset($input)) { @@ -660,6 +660,14 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof $out = ''.img_picto($langs->trans("Enabled"), 'on').''; } } else { + if (is_object($userconst)) { + $userconstid = $userconst->id; + } elseif (is_numeric($userconstid) && $userconstid > 0) { + $userconstid = $userconst; + $userconst = new User($db); + $userconst->fetch($userconstid); + } + $out = "\n".' '."\n"; - if ($userconst) { - $value = getDolUserString($code); + if (!empty($userconst) && $userconst instanceof User) { + $value = getDolUserString($code, '', $userconst); } else { $value = getDolGlobalString($code); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d2609495d49..1c91d3d0b2d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4039,7 +4039,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor $link = str_replace('{socialid}', $value, getDolGlobalString($networkconstname)); if (preg_match('/^https?:\/\//i', $link)) { $htmllink .= ''.dol_escape_htmltag($value).''; - } else { + } elseif ($link) { $htmllink .= ''.dol_escape_htmltag($value).''; } } elseif (!empty($dictsocialnetworks[$type]['url'])) { diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index f0b759fa668..deec8d448ed 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -99,7 +99,6 @@ if ($cancel) { * View */ -$form = new Form($db); $v = new vCard(); $company = $mysoc; @@ -157,9 +156,20 @@ if (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) { } if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) { $object->socialnetworks = []; +} else { + // Show list of social networks for company + $listofnetworks = $object->socialnetworks; + + if (!empty($listofnetworks)) { + foreach ($listofnetworks as $key => $networkVal) { + if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) { + unset($object->socialnetworks[$key]); + } + } + } } -// By default, personal address not visible +// By default, personal birthdate and address is not visible if (!getDolUserInt('USER_PUBLIC_SHOW_BIRTH', 0, $object)) { $object->birth = null; } @@ -176,8 +186,18 @@ if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { } if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0, $object) && is_object($company)) { $company->socialnetworks = []; -} +} else { + // Show list of social networks for company + $listofnetworks = $mysoc->socialnetworks; + if (!empty($listofnetworks)) { + foreach ($listofnetworks as $key => $networkVal) { + if (getDolUserInt('SOCIETE_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) { + unset($mysoc->socialnetworks[$key]); + } + } + } +} // Output vcard if ($mode == 'vcard') { @@ -220,7 +240,7 @@ $arrayofjs = array(); $arrayofcss = array(); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); +llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'onlinepaymentbody'.(GETPOST('mode') == 'preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); print ' '; + .StripeElement--webkit-autofill { + background-color: #fefde5 !important; + } + '; //print '
'; @@ -2380,8 +2380,8 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme // $conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2 = use payment object (suggest both card payment mode but also sepa, ...) print ' -
'; print $langs->trans('DateInvoice'); From dbba584dfbdcccd35870fbd378ef7c076ac5e61e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 09:19:12 +0100 Subject: [PATCH 075/259] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contact/list.php | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index e2353b82af6..7ad5ee54ee7 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3300,7 +3300,7 @@ class Adherent extends CommonObject $return .= '
'; $return .= ''; if (property_exists($this, 'photo') || !empty($this->photo)) { - $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photowithmargin photologintooltip', 'small', 0, 1); } else { $return .= img_picto('', 'user'); } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9af01fe74ce..5fc553e9994 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1531,7 +1531,7 @@ class Contact extends CommonObject * @param string $morecss Add more css on link * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '') + public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = 'valignmiddle') { global $conf, $langs, $hookmanager; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 0d971f01723..ae6fd816681 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -166,26 +166,22 @@ if ($type == "p") { $contextpage = 'contactprospectlist'; } $title .= ' ('.$langs->trans("ThirdPartyProspects").')'; - $urlfiche = "card.php"; } if ($type == "c") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactcustomerlist'; } $title .= ' ('.$langs->trans("ThirdPartyCustomers").')'; - $urlfiche = "card.php"; } elseif ($type == "f") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactsupplierlist'; } $title .= ' ('.$langs->trans("ThirdPartySuppliers").')'; - $urlfiche = "card.php"; } elseif ($type == "o") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactotherlist'; } $title .= ' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; - $urlfiche = ""; } // Initialize a technical object @@ -1453,7 +1449,6 @@ while ($i < $imaxinloop) { } } else { // Show here line of result - $j = 0; print '
'.$langs->trans("ProductOrService").''; print img_picto('', 'product', 'class="pictofixedwidth"'); - print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', ($conf->dol_optimize_smallscreen ? 1 : 0), array(), 0, '1', 0, 'widthcentpercentminusx maxwidth400'); + print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', 0, array(), 0, $langs->trans("RefOrLabel"), 0, 'widthcentpercentminusx maxwidth400'); print '
'; //print ''; - print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'maxwidth200'); + print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'maxwidth150'); print ''; + print ''; print $warehousestatic->getNomUrl(1); print "'.$origin.''; if ($obj->fk_project != 0) { From 999754c1842b3c786ae046d11fc40c21c7c6864e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 12:07:48 +0100 Subject: [PATCH 077/259] Debug v21 --- htdocs/langs/en_US/cashdesk.lang | 2 +- htdocs/langs/fr_FR/cashdesk.lang | 2 +- htdocs/takepos/admin/bar.php | 4 ++-- htdocs/takepos/admin/setup.php | 2 +- htdocs/takepos/floors.php | 15 +++++++++++---- htdocs/takepos/invoice.php | 17 ++++++++++------- htdocs/takepos/pay.php | 14 +++++++------- htdocs/takepos/receipt.php | 7 +++++-- htdocs/takepos/reduction.php | 5 ++++- htdocs/takepos/split.php | 16 ++++++++++------ htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 12 files changed, 54 insertions(+), 34 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index afe22259f17..5155d532f7c 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -60,7 +60,7 @@ Numberspad=Numbers Pad BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr TakeposNeedsCategories=TakePOS needs at least one product category to work -TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category %s to work +TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 sub-category under the product category %s to work OrderNotes=Can add some notes to each ordered items CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 2f7a1a59aa8..ecbb052ad0b 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -60,7 +60,7 @@ Numberspad=Pavé numérique BillsCoinsPad=Pavé avec montant des Pièces et Billets DolistorePosCategory=Modules TakePOS et autres solutions de PDV pour Dolibarr TakeposNeedsCategories=TakePOS a besoin d'au moins une catégorie de produits pour fonctionner -TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS a besoin d'au moins 1 catégorie de produits dans la catégorie %s pour fonctionner +TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS a besoin d'au moins 1 sous-catégorie dans la catégorie de produit %s pour fonctionner OrderNotes=Il est possible d'ajouter des notes sur chacun des produits commandés CashDeskBankAccountFor=Compte par défaut à utiliser pour les paiements en NoPaimementModesDefined=Aucun mode de paiement défini dans la configuration de TakePOS diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 362942bc16d..beb3089cebd 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -179,9 +179,9 @@ if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { print '
'; print $langs->trans("SupplementCategory"); print ''; + print ''; print img_picto('', 'category', 'class="pictofixedwidth"'); - print $form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalString('TAKEPOS_SUPPLEMENTS_CATEGORY'), 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); + print $form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalString('TAKEPOS_SUPPLEMENTS_CATEGORY'), 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0, 0, 'minwidth 200 maxwidth500 widthcentpercentminusx'); print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); print "
'; print $langs->trans("NumberOfTerminals"); print ''; -print ''; +print ''; print "
'; - print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; + print $langs->trans("OrderPrinters"); print ''; print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); + if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) { + print'   '.$langs->trans("Setup").''; + } print '
- '; - print ''; // Default from type $liste = array(); $liste['user'] = $langs->trans('UserEmail'); - $liste['company'] = $langs->trans('CompanyEmail').' ('.(!getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')'; + $liste['company'] = $langs->trans('CompanyEmail').' ('.(!getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $langs->trans("NotDefined") : getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')).')'; print ''; } else { - print ''; + print ''; } @@ -724,7 +724,7 @@ if ($action == 'edit') { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { //print ''; } else { - print ''; + print ''; } // AUTH method @@ -909,7 +909,7 @@ if ($action == 'edit') { print ''; @@ -957,7 +957,7 @@ if ($action == 'edit') { // Errors To print ''; print ''; diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 78d1e381804..e91f1058b3d 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -363,7 +363,7 @@ if ($action == 'edit') { // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_EMAILING); + print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')); } else { $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')]; if (empty($text)) { @@ -386,7 +386,7 @@ if ($action == 'edit') { print ''; } else { print ''; // AUTH method - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { print ''; } // PW - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { $mainsmtppw = getDolGlobalString('MAIN_MAIL_SMTPS_PW_EMAILING'); print ''; } else { - print ''; + print ''; } // Port if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'mail')) { //print ''; } else { - print ''; + print ''; } // AUTH method @@ -618,12 +618,12 @@ if ($action == 'edit') { } // SMTPS ID - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { print ''; } // SMTPS PW - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') != "XOAUTH2") { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') != "XOAUTH2") { print ''; } @@ -641,7 +641,7 @@ if ($action == 'edit') { // Nothing } else { print ''; From f5ef2eee4908bf65ca5990a1465a772aa25ee815 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 1 Dec 2024 15:47:01 +0100 Subject: [PATCH 207/259] Debug v21 --- htdocs/core/modules/modTakePos.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 208439f0cfa..b9d43c6099d 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -269,6 +269,7 @@ class modTakePos extends DolibarrModules public function init($options = '') { global $conf, $langs, $user, $mysoc; + $langs->load("cashdesk"); dolibarr_set_const($this->db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); @@ -301,7 +302,7 @@ class modTakePos extends DolibarrModules $categories = new Categorie($this->db); $cate_arbo = $categories->get_full_arbo('product', 0, 1); if (is_array($cate_arbo)) { - if (!count($cate_arbo) || !getDolGlobalString('TAKEPOS_ROOT_CATEGORY_ID')) { + if (!count($cate_arbo) || (!getDolGlobalString('TAKEPOS_ROOT_CATEGORY_ID') || getDolGlobalString('TAKEPOS_ROOT_CATEGORY_ID') == '-1')) { $category = new Categorie($this->db); $category->label = $langs->trans("DefaultPOSCatLabel"); From 98b7e88c64fce3926a12736ff5c1e95cfc6f6600 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 1 Dec 2024 17:46:22 +0100 Subject: [PATCH 208/259] Debug v21 --- htdocs/install/mysql/tables/llx_c_chargesociales.sql | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_c_chargesociales.sql b/htdocs/install/mysql/tables/llx_c_chargesociales.sql index 78b87f95152..25b495c56a7 100644 --- a/htdocs/install/mysql/tables/llx_c_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_c_chargesociales.sql @@ -24,11 +24,8 @@ create table llx_c_chargesociales libelle varchar(128), deductible smallint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL, - code varchar(12) NOT NULL, + code varchar(24) NOT NULL, accountancy_code varchar(32) DEFAULT NULL, fk_pays integer DEFAULT 1 NOT NULL, module varchar(32) NULL )ENGINE=innodb; - - - From 58ddb40d67cc02444184bede2362c0bee48b63c3 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 1 Dec 2024 21:28:07 +0100 Subject: [PATCH 209/259] Trans --- htdocs/langs/en_US/opensurvey.lang | 1 + htdocs/opensurvey/card.php | 20 ++++++++++---------- htdocs/opensurvey/results.php | 2 +- htdocs/public/opensurvey/studs.php | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/langs/en_US/opensurvey.lang b/htdocs/langs/en_US/opensurvey.lang index 6f8bd25a966..93bc67ea34a 100644 --- a/htdocs/langs/en_US/opensurvey.lang +++ b/htdocs/langs/en_US/opensurvey.lang @@ -62,3 +62,4 @@ EmailSomeoneVoted=%s has filled a line.\nYou can find your poll at the link: \n% ShowSurvey=Show survey UserMustBeSameThanUserUsedToVote=You must have voted and use the same user name that the one used to vote, to post a comment ListOfOpenSurveys=List of open surveys +AddTheVote=Click to add the vote diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index a792c21b204..e4d3dd86271 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -261,16 +261,6 @@ if ($action == 'edit') { } print ''; -// Description -print ''; - // Receive an email with each vote print ''; +// Description +print ''; + print '
'; + + '; print ''; - $date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth'), GETPOST('date_rumday'), GETPOST('date_rumyear')); + $date_rum = GETPOSTDATE('date_rum', '00:00:00'); print ''; print ''; @@ -2257,7 +2257,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print ''; print ''; - $date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth'), GETPOST('date_rumday'), GETPOST('date_rumyear')); + $date_rum = GETPOSTDATE('date_rum', '00:00:00'); print ''; print ''; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 5ae56bdd3d5..24a7f838ad8 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs diff --git a/htdocs/variants/tpl/productattributevalueline_create.tpl.php b/htdocs/variants/tpl/productattributevalueline_create.tpl.php index 0d5ee24fc84..17d08243318 100644 --- a/htdocs/variants/tpl/productattributevalueline_create.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_create.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2022 Open-Dsi + * 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 @@ -24,13 +25,22 @@ * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) */ +/** + * @var CommonObject $this + * @var CommonObject $object + * @var HookManager $hookmanager + * @var Translate $langs + * + * @var string $action + */ + // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error: this template page cannot be called directly as an URL"; exit; } -'@phan-var-force CommonObject $this +'@phan-var-force CommonObject $object @phan-var-force CommonObject $this'; global $forcetoshowtitlelines; diff --git a/htdocs/variants/tpl/productattributevalueline_title.tpl.php b/htdocs/variants/tpl/productattributevalueline_title.tpl.php index 79d4034422b..b970a1513a3 100644 --- a/htdocs/variants/tpl/productattributevalueline_title.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_title.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2022 Open-Dsi + * 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 @@ -31,6 +32,11 @@ if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; exit(1); } +/** + * @var Translate $langs + * + * @var string $action + */ print "\n"; From d343807a049738131711f20ee5bd24d99f310ec5 Mon Sep 17 00:00:00 2001 From: Zephyriony <142790847+zephyriony@users.noreply.github.com> Date: Thu, 28 Nov 2024 11:16:34 +0100 Subject: [PATCH 155/259] FIX Linked elements not up to date (#32118) * FIX Linked elements not up to date If you add a linked element, it won't appear without this correction, and if you delete an element, it won't disappear. You're forced to refresh the page to have the links updated, which is rather unpleasant. * Update actions_dellink.inc.php * Update actions_dellink.inc.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/actions_dellink.inc.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index cf8b3614617..36959569502 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -50,6 +50,7 @@ if ($action == 'addlink' && !empty($permissiondellink) && !$cancellink && $id > foreach ($addlinkids as $addlinkid) { $result = $object->add_object_linked($addlink, $addlinkid); } + $object->clearObjectLinkedCache(); } // Link by reference @@ -69,6 +70,7 @@ if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $ if (isset($_POST['reftolinkto'])) { unset($_POST['reftolinkto']); } + $object->clearObjectLinkedCache(); } elseif ($ret < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); } else { @@ -81,6 +83,7 @@ if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $ // Delete link in table llx_element_element if ($action == 'dellink' && !empty($permissiondellink) && !$cancellink && $dellinkid > 0) { $result = $object->deleteObjectLinked(0, '', 0, '', $dellinkid); + $object->clearObjectLinkedCache(); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } From d823f3281d544104eb51e1d9576223f0f4247cff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Nov 2024 11:36:13 +0100 Subject: [PATCH 156/259] Update README.md --- dev/setup/pre-commit/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/setup/pre-commit/README.md b/dev/setup/pre-commit/README.md index d4bbb8013f5..f256cbf26e8 100644 --- a/dev/setup/pre-commit/README.md +++ b/dev/setup/pre-commit/README.md @@ -96,6 +96,6 @@ CI also runs pre-commit to help maintain code quality. Note: Code for precommits are saved into: -.cache/pre-commit/repo*/pre_commit_hooks/php-*.sh +.cache/pre-commit/repo.../pre_commit_hooks/php-....sh and -.cache/pre-commit/repo*/py_env-python3/lib/python*/site-packages/pre_commit_hooks/no_commit_to_branch.py +.cache/pre-commit/repo.../py_env-python3/lib/python.../site-packages/pre_commit_hooks/no_commit_to_branch.py From 16cbc512a278168eb4f877ca300829b80b0b2b91 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 11:38:07 +0100 Subject: [PATCH 157/259] Doc --- htdocs/core/lib/functions.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 01e906dbc54..06ce0567f53 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1145,8 +1145,9 @@ function GETPOSTFLOAT($paramname, $rounding = '') * optionally hour, minute, second) fields to return a timestamp. * * @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate) - * @param string $hourTime 'getpost' to include hour, minute, second values from the HTTP request, 'XX:YY:ZZ' to set - * hour, minute, second respectively (for instance '23:59:59') + * @param string $hourTime 'getpost' to include hour, minute, second values from the HTTP request, + * or 'XX:YY:ZZ' to set hour, minute, second respectively (for instance '23:59:59') + * or '' means '00:00:00' (default) * @param string $gm Passed to dol_mktime * @return int|string Date as a timestamp, '' or false if error */ From c06a4746512abc3554347c29ec70dcc8bc82cb3a Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 11:54:55 +0100 Subject: [PATCH 158/259] Rename and move conf file --- dev/tools/apstats.php | 2 +- phpstan.v1.neon => dev/tools/phpstan/phpstan_v1_apstats.neon | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) rename phpstan.v1.neon => dev/tools/phpstan/phpstan_v1_apstats.neon (99%) diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index b6fd7ed4adb..fa27133329a 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -149,7 +149,7 @@ $phpstanversion = $output_arrtd[0]; $output_arrtd = array(); if ($dirphpstan != 'disabled') { - $commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan --level='.$PHPSTANLEVEL.' -v analyze -a build/phpstan/bootstrap.php --memory-limit 8G --error-format=github -c ~/preview.dolibarr.org/dolibarr/phpstan.v1.neon'; + $commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan --level='.$PHPSTANLEVEL.' -v analyze -a build/phpstan/bootstrap.php --memory-limit 8G --error-format=github -c ~/preview.dolibarr.org/dolibarr/dev/tools/phpstan/phpstan_v1_apstats.neon'; print 'Execute PHPStan to get the technical debt: '.$commandcheck."\n"; $resexectd = 0; exec($commandcheck, $output_arrtd, $resexectd); diff --git a/phpstan.v1.neon b/dev/tools/phpstan/phpstan_v1_apstats.neon similarity index 99% rename from phpstan.v1.neon rename to dev/tools/phpstan/phpstan_v1_apstats.neon index b4c987d2c41..6b599560309 100644 --- a/phpstan.v1.neon +++ b/dev/tools/phpstan/phpstan_v1_apstats.neon @@ -48,6 +48,7 @@ parameters: treatPhpDocTypesAsCertain: false ignoreErrors: - '#.*phan-var#' + - '#is always#' internalErrorsCountLimit: 50 cache: nodesByFileCountMax: 512 From 76d4a8766659a22c3b9458b0f2dec0ba1abc30b1 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Thu, 28 Nov 2024 12:00:36 +0100 Subject: [PATCH 159/259] Fix hook doAddButton (#32116) Co-authored-by: Laurent Destailleur --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 275b4f6bb27..d901413cf17 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2166,7 +2166,7 @@ if ($action != 'dopayment') { $reshook = $hookmanager->executeHooks('doAddButton', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } elseif ($reshook > 0) { + } elseif ($reshook >= 0) { print $hookmanager->resPrint; } From 286c3d1093e31c88a041c3af2fa4250792720f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 28 Nov 2024 12:11:50 +0100 Subject: [PATCH 160/259] fix sql ticket list (#32080) * fix sql ticket list * fix sql ticket list * fix phpstan * fix * fix --- build/phpstan/phpstan-baseline.neon | 102 --------------- htdocs/accountancy/bookkeeping/list.php | 2 + .../accountancy/bookkeeping/listbyaccount.php | 2 + htdocs/commande/class/commande.class.php | 1 + htdocs/core/actions_massactions.inc.php | 1 + htdocs/core/class/commonobject.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 5 - htdocs/projet/list.php | 2 + htdocs/reception/class/reception.class.php | 4 - htdocs/salaries/payments.php | 2 + .../class/companybankaccount.class.php | 6 - htdocs/societe/list.php | 4 +- htdocs/ticket/class/ticket.class.php | 3 +- htdocs/ticket/list.php | 123 +++++++++--------- htdocs/user/list.php | 78 +++++------ 15 files changed, 116 insertions(+), 221 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index ddc424d9d08..192a9985d69 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -228,12 +228,6 @@ parameters: count: 4 path: ../../htdocs/accountancy/bookkeeping/export.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../htdocs/accountancy/bookkeeping/list.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -252,12 +246,6 @@ parameters: count: 3 path: ../../htdocs/accountancy/bookkeeping/list.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../htdocs/accountancy/bookkeeping/listbyaccount.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -4572,12 +4560,6 @@ parameters: count: 1 path: ../../htdocs/comm/propal/class/propal.class.php - - - message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../htdocs/comm/propal/class/propal.class.php - - message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -4974,12 +4956,6 @@ parameters: count: 1 path: ../../htdocs/commande/class/commande.class.php - - - message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../htdocs/commande/class/commande.class.php - - message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -6174,12 +6150,6 @@ parameters: count: 1 path: ../../htdocs/compta/facture/class/facture.class.php - - - message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../htdocs/compta/facture/class/facture.class.php - - message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -19368,12 +19338,6 @@ parameters: count: 2 path: ../../htdocs/expedition/class/expedition.class.php - - - message: '#^Property Expedition\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../htdocs/expedition/class/expedition.class.php - - message: '#^Property Expedition\:\:\$ref_customer \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -20742,12 +20706,6 @@ parameters: count: 1 path: ../../htdocs/fourn/class/fournisseur.commande.class.php - - - message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../htdocs/fourn/class/fournisseur.commande.class.php - - message: '#^Property CommonObject\:\:\$ref_ext \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -20982,12 +20940,6 @@ parameters: count: 1 path: ../../htdocs/fourn/class/fournisseur.facture.class.php - - - message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../htdocs/fourn/class/fournisseur.facture.class.php - - message: '#^Property CommonObject\:\:\$ref_ext \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -28758,12 +28710,6 @@ parameters: count: 1 path: ../../htdocs/projet/list.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../htdocs/projet/list.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -30654,12 +30600,6 @@ parameters: count: 2 path: ../../htdocs/reception/class/reception.class.php - - - message: '#^Property Reception\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../htdocs/reception/class/reception.class.php - - message: '#^Property Reception\:\:\$ref_supplier \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -31914,12 +31854,6 @@ parameters: count: 2 path: ../../htdocs/salaries/payments.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../htdocs/salaries/payments.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -32334,12 +32268,6 @@ parameters: count: 1 path: ../../htdocs/societe/class/companybankaccount.class.php - - - message: '#^Property CompanyBankAccount\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../htdocs/societe/class/companybankaccount.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Societe\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -33738,18 +33666,6 @@ parameters: count: 1 path: ../../htdocs/ticket/class/ticket.class.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/ticket/class/ticket.class.php - - - - message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../htdocs/ticket/class/ticket.class.php - - message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -33960,18 +33876,6 @@ parameters: count: 1 path: ../../htdocs/ticket/index.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 3 - path: ../../htdocs/ticket/list.php - - - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/ticket/list.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -34320,12 +34224,6 @@ parameters: count: 2 path: ../../htdocs/user/home.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 2 - path: ../../htdocs/user/list.php - - message: '#^Offset ''u\.salary'' on array\{u\.salary\: \(float\|int\)\} in isset\(\) always exists and is not nullable\.$#' identifier: isset.offset diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ebf0dec3396..60409e47f0f 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -495,6 +495,8 @@ if (empty($reshook)) { $permissiontodelete = $user->hasRight('societe', 'supprimer'); $permissiontoadd = $user->hasRight('societe', 'creer'); $uploaddir = $conf->societe->dir_output; + + global $error; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) { diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 62c058fbf95..7834b2a6d0f 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -459,6 +459,8 @@ if (empty($reshook)) { $permissiontodelete = $user->hasRight('societe', 'supprimer'); $permissiontoadd = $user->hasRight('societe', 'creer'); $uploaddir = $conf->societe->dir_output; + + global $error; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4a6d220c49c..24532b36ba0 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -947,6 +947,7 @@ class Commande extends CommonOrder $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active $this->entity = setEntity($this); dol_syslog(get_class($this)."::create user=".$user->id); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 872aa9ae73a..94964dfae8e 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -59,6 +59,7 @@ * @var string $objectclass * @var string $uploaddir * @var string $confirm + * @var int $error */ ' @phan-var-force ?string $permissiontoread diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8fe7db58b72..7ad7702b9df 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -546,7 +546,7 @@ abstract class CommonObject public $multicurrency_total_localtax2; // not in database /** - * @var string + * @var ?string * @see SetDocModel() */ public $model_pdf; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index f7b5c2aeb3b..f80e6e5d8c7 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -136,11 +136,6 @@ class Expedition extends CommonObject */ public $billed; - /** - * @var string name of pdf model - */ - public $model_pdf; - /** * @var int|string */ diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index da8c2b669b0..9170ba31ed3 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -445,6 +445,8 @@ if (empty($reshook)) { $permissiontodelete = $user->hasRight('projet', 'supprimer'); $permissiontoadd = $user->hasRight('projet', 'creer'); $uploaddir = $conf->project->dir_output; + + global $error; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; // Close records diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 71d4a47caff..86e8d046ff9 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -99,10 +99,6 @@ class Reception extends CommonObject * @var int<0,1> */ public $billed; - /** - * @var string - */ - public $model_pdf; /** * @var int|float diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index cc51621c14a..f91b5b3e566 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -214,6 +214,8 @@ if (empty($reshook)) { $objectclass = 'PaymentSalary'; $objectlabel = 'SalariesPayments'; $uploaddir = $conf->salaries->dir_output; + + global $error; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; // Validate records diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index a27f7c3504a..a50c111dbfb 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -329,12 +329,6 @@ class CompanyBankAccount extends Account */ public $datem; - /** - * @var string - * @see SetDocModel() - */ - public $model_pdf; - /** * @var string TRIGGER_PREFIX Dolibarr 16.0 and above use the prefix to prevent the creation of inconsistently * named triggers diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index e5508c334e7..a8167de49da 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -480,9 +480,11 @@ if (empty($reshook)) { $permissiontodelete = $user->hasRight('societe', 'supprimer'); $permissiontoadd = $user->hasRight("societe", "creer"); $uploaddir = $conf->societe->dir_output; + + global $error; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - if ($action == 'setstcomm' && $permissiontoadd) { + if (!$error && $action == 'setstcomm' && $permissiontoadd) { $object = new Client($db); $result = $object->fetch(GETPOST('stcommsocid')); $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm'); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 56cfb53ef9a..b2eb7d56f7b 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -510,7 +510,8 @@ class Ticket extends CommonObject $result = $this->verify(); if ($result >= 0) { - $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."ticket("; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index ec492d67936..d9c82030344 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -250,19 +250,54 @@ if (empty($reshook)) { $objectclass = 'Ticket'; $objectlabel = 'Ticket'; $uploaddir = $conf->ticket->dir_output; + + global $error; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; // Close records if (!$error && $massaction == 'close' && $permissiontoadd) { - $objecttmp = new $objectclass($db); - if (!$error) { - $db->begin(); + $objecttmp = new Ticket($db); + $db->begin(); - $nbok = 0; - foreach ($toselect as $toselectid) { - $result = $objecttmp->fetch($toselectid); - if ($result > 0) { - $result = $objecttmp->close($user); + $nbok = 0; + foreach ($toselect as $toselectid) { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + $result = $objecttmp->close($user); + if ($result < 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } else { + $nbok++; + } + } else { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (!$error) { + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } else { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; + } + + // Reopen records + if (!$error && $massaction == 'reopen' && $permissiontoadd) { + $objecttmp = new Ticket($db); + $db->begin(); + + $nbok = 0; + foreach ($toselect as $toselectid) { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) { + $result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED); if ($result < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; @@ -271,62 +306,25 @@ if (empty($reshook)) { $nbok++; } } else { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $langs->load("errors"); + setEventMessages($langs->trans("ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref), null, 'errors'); $error++; break; } - } - - if (!$error) { - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - $db->commit(); } else { - $db->rollback(); + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; } - //var_dump($listofobjectthirdparties);exit; } - } - // Reopen records - if (!$error && $massaction == 'reopen' && $permissiontoadd) { - $objecttmp = new $objectclass($db); if (!$error) { - $db->begin(); - - $nbok = 0; - foreach ($toselect as $toselectid) { - $result = $objecttmp->fetch($toselectid); - if ($result > 0) { - if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) { - $result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED); - if ($result < 0) { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } else { - $nbok++; - } - } else { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref), null, 'errors'); - $error++; - break; - } - } else { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - } - - if (!$error) { - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - $db->commit(); - } else { - $db->rollback(); - } - //var_dump($listofobjectthirdparties);exit; + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } else { + $db->rollback(); } + //var_dump($listofobjectthirdparties);exit; } } @@ -393,6 +391,7 @@ if ($socid > 0) { } foreach ($search as $key => $val) { + $tmpkey = 't.' . $key; if ($key == 'fk_statut' && !empty($search['fk_statut'])) { $newarrayofstatus = array(); foreach ($search['fk_statut'] as $key2 => $val2) { @@ -414,18 +413,18 @@ foreach ($search as $key => $val) { $newarrayofstatus[] = Ticket::STATUS_CANCELED; } if (count($newarrayofstatus)) { - $sql .= natural_search($key, implode(',', $newarrayofstatus), 2); + $sql .= natural_search($tmpkey, implode(',', $newarrayofstatus), 2); } continue; } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project' || $key == 'fk_contract') { if ($search[$key] > 0) { - $sql .= natural_search($key, $search[$key], 2); + $sql .= natural_search($tmpkey, $search[$key], 2); } continue; } elseif ($key == 'type_code') { $newarrayoftypecodes = is_array($search[$key]) ? $search[$key] : (!empty($search[$key]) ? explode(',', $search[$key]) : array()); if (count($newarrayoftypecodes)) { - $sql .= natural_search($key, implode(',', $newarrayoftypecodes), 3); + $sql .= natural_search($tmpkey, implode(',', $newarrayoftypecodes), 3); } continue; } @@ -433,7 +432,7 @@ foreach ($search as $key => $val) { $mode_search = ((!empty($object->fields[$key]) && ($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))) ? 1 : 0); // $search[$key] can be an array of values, or a string. We add filter if array not empty or if it is a string. if ((is_array($search[$key]) && !empty($search[$key])) || (!is_array($search[$key]) && $search[$key] != '')) { - $sql .= natural_search($key, $search[$key], $mode_search); + $sql .= natural_search($tmpkey, $search[$key], $mode_search); } } if ($search_all) { @@ -443,10 +442,10 @@ if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } if ($search_fk_project > 0) { - $sql .= natural_search('fk_project', (string) $search_fk_project, 2); + $sql .= natural_search('t.fk_project', (string) $search_fk_project, 2); } if ($search_fk_contract > 0) { - $sql .= natural_search('fk_contract', (string) $search_fk_contract, 2); + $sql .= natural_search('t.fk_contract', (string) $search_fk_contract, 2); } if ($search_date_start) { $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'"; @@ -661,7 +660,7 @@ $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { +if (/* !empty($contextpage) && */ $contextpage != $_SERVER["PHP_SELF"]) { // $contextpage can't be empty $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 36d0a7df8d9..fb0712c7482 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -304,63 +304,63 @@ if (empty($reshook)) { $objectclass = 'User'; $objectlabel = 'User'; $uploaddir = $conf->user->dir_output; + + global $error; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; // Disable or Enable records if (!$error && ($massaction == 'disable' || $massaction == 'reactivate') && $permissiontoadd) { $objecttmp = new User($db); - if (!$error) { - $db->begin(); + $db->begin(); - $nbok = 0; - foreach ($toselect as $toselectid) { - if ($toselectid == $user->id) { - setEventMessages($langs->trans($massaction == 0 ? 'CantDisableYourself' : 'CanEnableYourself'), null, 'errors'); + $nbok = 0; + foreach ($toselect as $toselectid) { + if ($toselectid == $user->id) { + setEventMessages($langs->trans($massaction == 0 ? 'CantDisableYourself' : 'CanEnableYourself'), null, 'errors'); + $error++; + break; + } + + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + if ($objecttmp->admin) { + setEventMessages($langs->trans($massaction == 0 ? 'CantDisableAnAdminUserWithMassActions' : 'CantEnableAnAdminUserWithMassActions', $objecttmp->login), null, 'errors'); $error++; break; } - $result = $objecttmp->fetch($toselectid); - if ($result > 0) { - if ($objecttmp->admin) { - setEventMessages($langs->trans($massaction == 0 ? 'CantDisableAnAdminUserWithMassActions' : 'CantEnableAnAdminUserWithMassActions', $objecttmp->login), null, 'errors'); - $error++; - break; - } - - $result = $objecttmp->setstatus($massaction == 'disable' ? 0 : 1); - if ($result == 0) { - // Nothing is done - } elseif ($result < 0) { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } else { - $nbok++; - } - } else { + $result = $objecttmp->setstatus($massaction == 'disable' ? 0 : 1); + if ($result == 0) { + // Nothing is done + } elseif ($result < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; + } else { + $nbok++; } - } - - if (!$error && !empty($conf->file->main_limit_users)) { - $nb = $object->getNbOfUsers("active"); - if ($nb >= $conf->file->main_limit_users) { - $error++; - setEventMessages($langs->trans("YourQuotaOfUsersIsReached"), null, 'errors'); - } - } - - if (!$error) { - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - $db->commit(); } else { - $db->rollback(); + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; } } + + if (!$error && !empty($conf->file->main_limit_users)) { + $nb = $object->getNbOfUsers("active"); + if ($nb >= $conf->file->main_limit_users) { + $error++; + setEventMessages($langs->trans("YourQuotaOfUsersIsReached"), null, 'errors'); + } + } + + if (!$error) { + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } else { + $db->rollback(); + } } } From 8f7810a06b88d68679c60b66775c33bb3f80e72f Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 13:40:38 +0100 Subject: [PATCH 161/259] Debug v21 --- htdocs/admin/tools/dolibarr_import.php | 33 +++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index adc8de22900..5fc190a7d55 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -46,7 +46,7 @@ if (!$user->admin) { } $radio_dump = GETPOST('radio_dump'); -$showpass = GETPOST('showpass'); +$action = GETPOST('action', 'aZ09'); /* @@ -148,11 +148,12 @@ print '';
'; - print ''.$langs->trans('RestoreMySQL').''; - print '
'; - // Parameters execution - $command = $db->getPathOfRestore(); + print '
'; + print ''.$langs->trans('RestoreMySQL').''; + print '
'; + + // Parameters execution + $command = $db->getPathOfRestore(); if (preg_match("/\s/", $command)) { $command = $command = escapeshellarg($command); // Use quotes on command } @@ -170,17 +171,17 @@ if (in_array($type, array('mysql', 'mysqli'))) { $paramclear .= " -p".$dolibarr_main_db_pass; } - echo $langs->trans("ImportMySqlDesc"); - print '
'; - print '
'; - print ajax_autoselect('restorecommand'); + print $langs->trans("ImportMySqlDesc"); + print '
'; + print '
'; + print ajax_autoselect('restorecommand'); - if (!GETPOST("showpass") && $dolibarr_main_db_pass) { - print '
'.$langs->trans("UnHidePassword").''; + if (GETPOST("action") != 'showpass' && $dolibarr_main_db_pass) { + print '
'.$langs->trans("UnHidePassword").''; } - //else print '
'.$langs->trans("HidePassword").''; - print '
'; - print '
'; + //else print '
'.$langs->trans("HidePassword").''; + print '
'; + print ''; } elseif (in_array($type, array('pgsql'))) { print '
'; print 'Restore PostgreSQL'; @@ -212,7 +213,7 @@ if (in_array($type, array('mysql', 'mysqli'))) { echo $langs->trans("ImportPostgreSqlDesc"); print '
'; - print '
'; + print '
'; print ajax_autoselect('restorecommand'); print '
'; From ff18a34c7179c01a50e827917540c841ee087b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 28 Nov 2024 15:43:47 +0100 Subject: [PATCH 162/259] FIX: Ensure extraparams cannot be selected by the user (#32132) * FIX: Ensure extraparams cannot be selected by the user * Update newpayment.php --- htdocs/public/payment/newpayment.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 21e67dde87e..2a07fa72ebc 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1675,7 +1675,7 @@ if ($source == 'member' || $source == 'membersubscription') { } // - If a new amount was posted from the form if ($caneditamount && GETPOSTISSET('newamount') && GETPOSTFLOAT('newamount', 'MT') > 0) { - $amount = GETPOSTFLOAT('newamount', 'MT'); + $amount = GETPOSTFLOAT('newamount', 'MT'); } // - If a min is set or an amount from the posted form, we take them into account $amount = max(0, (float) $amount, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 24629554b32..4791136e400 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -328,7 +328,7 @@ class Ticket extends CommonObject 'progress' => array('type' => 'integer', 'label' => 'Progression', 'visible' => -1, 'enabled' => 1, 'position' => 540, 'notnull' => -1, 'css' => 'right', 'help' => "", 'isameasure' => 2, 'csslist' => 'width50'), 'resolution' => array('type' => 'integer', 'label' => 'Resolution', 'visible' => -1, 'enabled' => 'getDolGlobalString("TICKET_ENABLE_RESOLUTION")', 'position' => 550, 'notnull' => 1), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'PDFTemplate', 'enabled' => 1, 'visible' => 0, 'position' => 560), - 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 570), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => 0, 'position' => 570), 'fk_statut' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 600, 'notnull' => 1, 'index' => 1, 'arrayofkeyval' => array(0 => 'Unread', 1 => 'Read', 2 => 'Assigned', 3 => 'InProgress', 5 => 'NeedMoreInformation', 7 => 'OnHold', 8 => 'SolvedClosed', 9 => 'Deleted')), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 900), ); From 3fc50f21a4b862800d4d792b88266789d6830793 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 28 Nov 2024 15:45:37 +0100 Subject: [PATCH 163/259] FIX set birthday alert (#32133) * FIX set birthday alert on contact personal data card * also on create card * fix travis --- htdocs/contact/card.php | 2 +- htdocs/contact/perso.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f7a52afa489..59b5863a9ff 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -241,7 +241,7 @@ if (empty($reshook)) { // Note: Correct date should be completed with location to have exact GM time of birth. $object->birthday = dol_mktime(0, 0, 0, GETPOSTINT("birthdaymonth"), GETPOSTINT("birthdayday"), GETPOSTINT("birthdayyear")); - $object->birthday_alert = GETPOSTINT("birthday_alert"); + $object->birthday_alert = (GETPOST('birthday_alert', 'alpha') == "on" ? 1 : 0); //Default language $object->default_lang = GETPOST('default_lang'); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 0661a80b685..209e04d199d 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -56,7 +56,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('societe', 'con // Note: Correct date should be completed with location to have exact GM time of birth. $object->birthday = dol_mktime(0, 0, 0, GETPOST("birthdaymonth"), GETPOST("birthdayday"), GETPOST("birthdayyear")); - $object->birthday_alert = GETPOSTINT("birthday_alert"); + $object->birthday_alert = (GETPOST('birthday_alert', 'alpha') == "on" ? 1 : 0); if (GETPOST('deletephoto')) { $object->photo = ''; From cd946f9829561391e6b2f47925e4e5bb395c400c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 16:44:19 +0100 Subject: [PATCH 164/259] Doc --- htdocs/core/modules/modAgenda.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 47c766d525b..bc0d440bad8 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -211,6 +211,8 @@ class modAgenda extends DolibarrModules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; + + // TODO Move the top menu entry into the code part (eldy_menu.php and auguria.sql) so we can have a top menu shown for resource module only. $this->menu[$r] = array( 'fk_menu' => 0, 'type' => 'top', From 11b4492c0e0f6dc16346e976f92fcb9040714819 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 19:56:10 +0100 Subject: [PATCH 165/259] Fix warning. --- htdocs/admin/mails.php | 34 +++++++++---------- htdocs/admin/mails_emailing.php | 50 ++++++++++++++-------------- htdocs/admin/mails_ingoing.php | 2 +- htdocs/admin/mails_passwordreset.php | 46 ++++++++++++------------- htdocs/admin/mails_ticket.php | 48 +++++++++++++------------- htdocs/core/lib/admin.lib.php | 2 +- 6 files changed, 91 insertions(+), 91 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index c54ca5dc0f4..b4e9267eec0 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -412,7 +412,7 @@ if ($action == 'edit') { print ''; } else { print '
'; @@ -549,7 +549,7 @@ if ($action == 'edit') { print ''; - print ''; // DKIM Selector print ''; - print ''; // DKIM PRIVATE KEY print ''; - print ''; print '
'; if (getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')) { print '
'; @@ -2395,8 +2395,8 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme if (getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION') == 1) { print '
- -
'; + + '; } if (getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION') == 2) { print '
@@ -2405,8 +2405,8 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme } print ' - -
'; + + '; print '
'; print ''; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 595943b5845..cacc2c3e002 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1,15 +1,15 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2022 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2013 Peter Fontaine - * Copyright (C) 2015-2016 Marcos García - * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2023 Thibault FOUCART - * Copyright (C) 2021 Alexandre Spangaro - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2002-2004 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2022 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2013 Peter Fontaine + * Copyright (C) 2015-2016 Marcos García + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018-2023 Thibault FOUCART + * Copyright (C) 2021 Alexandre Spangaro + * Copyright (C) 2024 MDW + * 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 @@ -199,7 +199,7 @@ if (empty($reshook)) { $companybankaccount->owner_address = GETPOST('owner_address', 'alpha'); $companybankaccount->frstrecur = GETPOST('frstrecur', 'alpha'); $companybankaccount->rum = GETPOST('rum', 'alpha'); - $companybankaccount->date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth'), GETPOST('date_rumday'), GETPOST('date_rumyear')); + $companybankaccount->date_rum = GETPOSTDATE('date_rum', '00:00:00'); if (empty($companybankaccount->rum)) { $companybankaccount->rum = $prelevement->buildRumNumber($object->code_client, $companybankaccount->datec, $companybankaccount->id); } @@ -331,7 +331,7 @@ if (empty($reshook)) { $companybankaccount->owner_address = GETPOST('owner_address', 'alpha'); $companybankaccount->frstrecur = GETPOST('frstrecur', 'alpha'); $companybankaccount->rum = GETPOST('rum', 'alpha'); - $companybankaccount->date_rum = dol_mktime(0, 0, 0, GETPOSTINT('date_rummonth'), GETPOSTINT('date_rumday'), GETPOSTINT('date_rumyear')); + $companybankaccount->date_rum = GETPOSTDATE('date_rum', '00:00:00'); $companybankaccount->datec = dol_now(); //$companybankaccount->clos = GETPOSTINT('clos'); @@ -2088,7 +2088,7 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) { print '
'.$langs->trans("RUM").'
'.$langs->trans("DateRUM").''.$form->selectDate($date_rum ? $date_rum : $companybankaccount->date_rum, 'date_rum', 0, 0, 1, 'date_rum', 1, 1).'
'.$form->textwithpicto($langs->trans("RUM"), $langs->trans("RUMLong").'
'.$langs->trans("RUMWillBeGenerated")).'
'.$langs->trans("DateRUM").''.$form->selectDate($date_rum, 'date_rum', 0, 0, 1, 'date_rum', 1, 1).'
'; - $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER') ? $conf->global->MAIN_MAIL_SMTP_SERVER : ''); + $mainserver = getDolGlobalString('MAIN_MAIL_SMTP_SERVER'); $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -443,7 +443,7 @@ if ($action == 'edit') { print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { - $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT') ? $conf->global->MAIN_MAIL_SMTP_PORT : ''); + $mainport = getDolGlobalString('MAIN_MAIL_SMTP_PORT'); $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -495,14 +495,14 @@ if ($action == 'edit') { // ID if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { - $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID') ? $conf->global->MAIN_MAIL_SMTPS_ID : ''); + $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID'); print '
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); - print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID, $htmltext, 1, 'superadmin'); + print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_ID'), $htmltext, 1, 'superadmin'); print ''; } print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS') ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS') ? getDolGlobalString('MAIN_MAIL_EMAIL_TLS') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -562,7 +562,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS') ? getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -575,7 +575,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED') ? getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -588,7 +588,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('swiftmailer')))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_ENABLED') ? $conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_ENABLED') ? getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_ENABLED') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -599,17 +599,17 @@ if ($action == 'edit') { // DKIM Domain print '
'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'
'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'
'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").''; + print ''; print '
'; @@ -632,13 +632,13 @@ if ($action == 'edit') { print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); print ' '.$help; print '
'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE'), 0); @@ -716,7 +716,7 @@ if ($action == 'edit') { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { //print '
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER') ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT') ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_PORT').'
' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) { print img_warning($langs->trans("Mandatory")); - } elseif (!isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) { + } elseif (!isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))) { print img_warning($langs->trans("ErrorBadEMail")); } print '
'.$langs->trans("MAIN_MAIL_ERRORS_TO").''.(getDolGlobalString('MAIN_MAIL_ERRORS_TO')); - if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) { + if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail(getDolGlobalString('MAIN_MAIL_ERRORS_TO'))) { print img_warning($langs->trans("ErrorBadEMail")); } print '
'; - $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : ''); + $mainserver = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING'); $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -418,7 +418,7 @@ if ($action == 'edit') { print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { - $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : ''); + $mainport = getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING'); $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -441,7 +441,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; $vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING'; if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { @@ -469,22 +469,22 @@ if ($action == 'edit') { } // ID - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { - $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING') ? $conf->global->MAIN_MAIL_SMTPS_ID_EMAILING : ''); + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { + $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING'); print '
' . $langs->trans("MAIN_MAIL_SMTPS_ID") . ''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); - print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING, $htmltext, 1, 'superadmin'); + print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING'), $htmltext, 1, 'superadmin'); print ''; } print '
' . $langs->trans("MAIN_MAIL_SMTPS_PW") . ''; // SuperAdministrator access only @@ -499,13 +499,13 @@ if ($action == 'edit') { } // OAUTH service provider - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { print '
'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING); + print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING')); } else { $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING')]; if (empty($text)) { @@ -521,9 +521,9 @@ if ($action == 'edit') { // TLS print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING') ? $conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING') ? getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -534,9 +534,9 @@ if ($action == 'edit') { // STARTTLS print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING') ? getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -547,9 +547,9 @@ if ($action == 'edit') { // SMTP_ALLOW_SELF_SIGNED_EMAILING print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING') ? getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -593,14 +593,14 @@ if ($action == 'edit') { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'mail')) { //print '
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '').'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING').'
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''.getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING').'
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_EMAILING')).'
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING')); } else { @@ -658,7 +658,7 @@ if ($action == 'edit') { // Nothing } else { print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING')); } else { @@ -675,7 +675,7 @@ if ($action == 'edit') { // Nothing } else { print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING')); } else { @@ -773,8 +773,8 @@ if ($action == 'edit') { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test"); - $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); - $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); + $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM')); + $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM')); $formmail->fromid = $user->id; $formmail->fromalsorobot = 1; $formmail->withfromreadonly = 0; diff --git a/htdocs/admin/mails_ingoing.php b/htdocs/admin/mails_ingoing.php index 12bd4d93ce8..734d83f619c 100644 --- a/htdocs/admin/mails_ingoing.php +++ b/htdocs/admin/mails_ingoing.php @@ -127,7 +127,7 @@ print ''; // SMTPS oauth service if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') === "XOAUTH2") { - $text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE]; + $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE')]; if (empty($text)) { $text = $langs->trans("Undefined").img_warning(); } diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index 29c8d203342..5f3b07ce7ee 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -358,7 +358,7 @@ if ($action == 'edit') { // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SENDMODE_PASSWORDRESET', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET); + print $form->selectarray('MAIN_MAIL_SENDMODE_PASSWORDRESET', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET')); } else { $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET')]; if (empty($text)) { @@ -381,7 +381,7 @@ if ($action == 'edit') { print ''; } else { print ''; // AUTH method - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { print ''; } // PW - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { $mainsmtppw = getDolGlobalString('MAIN_MAIL_SMTPS_PW_PASSWORDRESET'); print ''; } else { - print ''; + print ''; } // Port if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET') == 'mail')) { //print ''; } else { - print ''; + print ''; } // AUTH method @@ -612,12 +612,12 @@ if ($action == 'edit') { } // SMTPS ID - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { print ''; } // SMTPS PW - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_PASSWORDRESET') != "XOAUTH2") { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_PASSWORDRESET') != "XOAUTH2") { print ''; } @@ -635,7 +635,7 @@ if ($action == 'edit') { // Nothing } else { print ''; } else { print ''; // AUTH method - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { print ''; } // PW - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { $mainsmtppw = getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET'); print ''; } else { - print ''; + print ''; } // Port if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) { //print ''; } else { - print ''; + print ''; } // AUTH method @@ -610,12 +610,12 @@ if ($action == 'edit') { } // SMTPS ID - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { - print ''; + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { + print ''; } // SMTPS PW - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") { print ''; } @@ -633,7 +633,7 @@ if ($action == 'edit') { // Nothing } else { print '\n"; // Publish member information on public annuary -$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : ''); -print '\n"; +/* Feature disabled by default for security purpose. + $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : ''); + print '\n"; +*/ // Allow members to change type on renewal forms /* To test during next beta From c73cff07816b82b4e902fd59a25c78e51f17a616 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 22:51:11 +0100 Subject: [PATCH 171/259] Debug v21 --- htdocs/core/class/conf.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 02e4d63e5f0..3848b19cc28 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1082,6 +1082,11 @@ class Conf extends stdClass $this->global->USE_STRICT_CSV_RULES = 2; } + // By default, accept to create members with no login + if (!isset($this->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + $this->global->ADHERENT_LOGIN_NOT_REQUIRED = 1; + } + // Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined) if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) { $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1; From 3b93f7ffcc4a248cf0b4635e86cb7c95fac04fec Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 14:17:53 +0100 Subject: [PATCH 172/259] Debug v21 --- htdocs/admin/agenda_extsites.php | 4 ++-- htdocs/admin/agenda_other.php | 4 ++-- htdocs/admin/agenda_reminder.php | 2 +- htdocs/admin/agenda_xcal.php | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index c4490d27cb8..e0cff71b11e 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -223,11 +223,11 @@ if ($selectedvalue == 1) { $selectedvalue = 1; } -print "
'; - $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_PASSWORDRESET : ''); + $mainserver = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_PASSWORDRESET'); $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -413,7 +413,7 @@ if ($action == 'edit') { print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { - $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTP_PORT_PASSWORDRESET : ''); + $mainport = getDolGlobalString('MAIN_MAIL_SMTP_PORT_PASSWORDRESET'); $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -436,7 +436,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; $vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_PASSWORDRESET'; if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { @@ -464,22 +464,22 @@ if ($action == 'edit') { } // ID - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { - $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTPS_ID_PASSWORDRESET : ''); + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { + $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID_PASSWORDRESET'); print '
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); - print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_PASSWORDRESET, $htmltext, 1, 'superadmin'); + print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_ID_PASSWORDRESET'), $htmltext, 1, 'superadmin'); print ''; } print '
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''; // SuperAdministrator access only @@ -494,11 +494,11 @@ if ($action == 'edit') { } // OAUTH service provider - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { print '
'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET); + print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET')); } else { $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET')]; if (empty($text)) { @@ -514,9 +514,9 @@ if ($action == 'edit') { // TLS print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET') ? $conf->global->MAIN_MAIL_EMAIL_TLS_PASSWORDRESET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET') ? getDolGlobalString('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -528,9 +528,9 @@ if ($action == 'edit') { // STARTTLS print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET') ? getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -541,9 +541,9 @@ if ($action == 'edit') { // SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET') ? getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -587,14 +587,14 @@ if ($action == 'edit') { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET') == 'mail')) { //print '
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_PASSWORDRESET : '').'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_PASSWORDRESET').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTP_PORT_PASSWORDRESET : '').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_PORT_PASSWORDRESET').'
'.$langs->trans("MAIN_MAIL_SMTPS_ID").'' . getDolGlobalString('MAIN_MAIL_SMTPS_ID_PASSWORDRESET').'
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_PASSWORDRESET')).'
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET')); } else { @@ -652,7 +652,7 @@ if ($action == 'edit') { // Nothing } else { print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET')); } else { @@ -669,7 +669,7 @@ if ($action == 'edit') { // Nothing } else { print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET')); } else { diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 4ffa822f966..6666861cf89 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -358,7 +358,7 @@ if ($action == 'edit') { // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SENDMODE_TICKET', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_TICKET); + print $form->selectarray('MAIN_MAIL_SENDMODE_TICKET', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')); } else { $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')]; if (empty($text)) { @@ -381,7 +381,7 @@ if ($action == 'edit') { print ''; - $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : ''); + $mainserver = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET'); $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -413,7 +413,7 @@ if ($action == 'edit') { print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { - $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : ''); + $mainport = getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET'); $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -436,7 +436,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; $vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET'; if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { @@ -464,22 +464,22 @@ if ($action == 'edit') { } // ID - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { - $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET') ? $conf->global->MAIN_MAIL_SMTPS_ID_TICKET : ''); + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { + $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET'); print '
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); - print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_TICKET, $htmltext, 1, 'superadmin'); + print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET'), $htmltext, 1, 'superadmin'); print ''; } print '
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''; // SuperAdministrator access only @@ -494,11 +494,11 @@ if ($action == 'edit') { } // OAUTH service provider - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { print '
'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET); + print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')); } else { $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')]; if (empty($text)) { @@ -513,9 +513,9 @@ if ($action == 'edit') { // TLS print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_TLS_TICKET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') ? getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -526,9 +526,9 @@ if ($action == 'edit') { // STARTTLS print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_TICKET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') ? getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -539,9 +539,9 @@ if ($action == 'edit') { // SMTP_ALLOW_SELF_SIGNED_TICKET print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') ? getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -585,14 +585,14 @@ if ($action == 'edit') { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) { //print '
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : '').'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : '').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET').'
'.$langs->trans("MAIN_MAIL_SMTPS_ID").'' . getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET').'
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''.getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET').'
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET')).'
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET')); } else { @@ -650,7 +650,7 @@ if ($action == 'edit') { // Nothing } else { print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET')); } else { @@ -667,7 +667,7 @@ if ($action == 'edit') { // Nothing } else { print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET')); } else { diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index fadbbcad13a..b7eb9066850 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -2144,7 +2144,7 @@ function email_admin_prepare_head() $h++; } - if (getDolGlobalString('MAIN_MAIL_ALLOW_CUSTOM_SENDING_METHOD_FOR_PASSWORD_RESET')) { + if (!getDolGlobalString('MAIN_MAIL_HIDE_CUSTOM_SENDING_METHOD_FOR_PASSWORD_RESET')) { $head[$h][0] = DOL_URL_ROOT."/admin/mails_passwordreset.php"; $head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv("PasswordReset")); $head[$h][2] = 'common_passwordreset'; From 55e387bbbfa88cc5adf5b77ff042bc4b5a96fb90 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 21:48:55 +0100 Subject: [PATCH 166/259] Example --- htdocs/install/upgrade2.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index c612d5367f8..396a0b0061f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -113,6 +113,9 @@ if ((!$versionfrom || preg_match('/version/', $versionfrom)) && (!$versionto || $path = __DIR__.'/'; if (substr($sapi_type, 0, 3) == 'cli') { print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n"; + print 'Example: '.$script_file." 19.0.0 20.0.0\n"; + print 'Example: '.$script_file." 0.0.0 0.0.0 Adherents\n"; + print "\n"; } exit; } From 99a2787efc888b06533fab8ae2666b818ca7bb04 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 21:51:30 +0100 Subject: [PATCH 167/259] Debug v21 --- htdocs/install/upgrade2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 396a0b0061f..47995518803 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -114,7 +114,7 @@ if ((!$versionfrom || preg_match('/version/', $versionfrom)) && (!$versionto || if (substr($sapi_type, 0, 3) == 'cli') { print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n"; print 'Example: '.$script_file." 19.0.0 20.0.0\n"; - print 'Example: '.$script_file." 0.0.0 0.0.0 Adherents\n"; + print 'Example: '.$script_file." 0.0.0 0.0.0 MAIN_MODULE_Adherent\n"; print "\n"; } exit; From 87af64245444b5413d2d94e94d3d1f4abb229de3 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 21:54:09 +0100 Subject: [PATCH 168/259] Fix help --- htdocs/install/upgrade2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 47995518803..31340596a94 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -113,8 +113,8 @@ if ((!$versionfrom || preg_match('/version/', $versionfrom)) && (!$versionto || $path = __DIR__.'/'; if (substr($sapi_type, 0, 3) == 'cli') { print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n"; - print 'Example: '.$script_file." 19.0.0 20.0.0\n"; - print 'Example: '.$script_file." 0.0.0 0.0.0 MAIN_MODULE_Adherent\n"; + print 'Example, upgrade from 19 to 20: '.$script_file." 19.0.0 20.0.0\n"; + print 'Example, enable a module only: '.$script_file." 0.0.0 0.0.0 MAIN_MODULE_Adherent\n"; print "\n"; } exit; From 670e6464e8d08ea4fd26517ebb080bc2d3e4e73c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 22:25:53 +0100 Subject: [PATCH 169/259] Fix selection of state from country in member creation --- htdocs/adherents/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b02702218c8..b5a71fc5484 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1079,9 +1079,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // State if (!getDolGlobalString('MEMBER_DISABLE_STATE')) { print '
'.$langs->trans('State').''; - if ($soc->country_id) { + if ($soc->country_id || GETPOSTISSET('country_id')) { print img_picto('', 'state', 'class="pictofixedwidth"'); - print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOSTINT('state_id') : $soc->state_id, $soc->country_code); + print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOSTINT('state_id') : $soc->state_id, GETPOSTISSET('country_id') ? GETPOSTINT('country_id') : $soc->country_code); } else { print $countrynotdefined; } From 787efd34975caa6e6a0e27424ba38928fa591855 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 22:41:20 +0100 Subject: [PATCH 170/259] Debug v21 --- htdocs/adherents/admin/member.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 472a376635a..b8d13a37377 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -127,7 +127,9 @@ if ($action == 'set_default') { $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity); $res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); - $res7 = dolibarr_set_const($db, 'MEMBER_PUBLIC_ENABLED', GETPOST('MEMBER_PUBLIC_ENABLED', 'alpha'), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MEMBER_PUBLIC_ENABLED')) { + $res7 = dolibarr_set_const($db, 'MEMBER_PUBLIC_ENABLED', GETPOST('MEMBER_PUBLIC_ENABLED', 'alpha'), 'chaine', 0, '', $conf->entity); + } $res8 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', GETPOST('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', 'alpha'), 'chaine', 0, '', $conf->entity); $res9 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_AFTER', GETPOST('MEMBER_SUBSCRIPTION_START_AFTER', 'alpha'), 'chaine', 0, '', $conf->entity); // Use vat for invoice creation @@ -138,7 +140,7 @@ if ($action == 'set_default') { $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); } } - if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0) { + if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0 || $res8 < 0 || $res9 < 0) { setEventMessages('ErrorFailedToSaveData', null, 'errors'); $db->rollback(); } else { @@ -549,10 +551,12 @@ print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', getDolGlobalInt('ADH print "
'.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).''; -print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED'), 1, false, 0, 1); -print "
'.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).''; + print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED'), 1, false, 0, 1); + print "
"; +print "
"; print ""; print '"; -print '"; +print ''; print ""; // Show external agenda diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index fcf6023b834..972ede049d2 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -221,7 +221,7 @@ $def = array(); $sql = "SELECT nom"; $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " WHERE type = 'action'"; -$sql .= " AND entity = ".$conf->entity; +$sql .= " AND entity = ".((int) $conf->entity); $resql = $db->query($sql); if ($resql) { @@ -346,7 +346,7 @@ print '
'.$langs->trans("Parameter")."'.$langs->trans("Value")."
'."\n"; print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; // AGENDA_DEFAULT_VIEW diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index d27d081d66e..68e63d3eb32 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -182,7 +182,7 @@ print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'."\n"; print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; // AGENDA REMINDER BROWSER diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 6c065ba69e3..3d380e11344 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -121,7 +121,7 @@ print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'; print ''; print ""; -print ""; +print ""; //print ""; print ""; print ""; @@ -180,8 +180,8 @@ print "\n"; clearstatcache(); -//if ($mesg) print "
$mesg
"; -print "
"; + +print "

"; // Define $urlwithroot From 1a60e40b9f970711a861c80f476310dbdb364a25 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 14:44:11 +0100 Subject: [PATCH 173/259] Debug v21 --- htdocs/theme/md/dropdown.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index c5c521a3ac5..1b14f471c65 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -41,7 +41,7 @@ div.login_block_tools > div { div#topmenu-login-dropdown { position: fixed; - : 20px; + : 10px; top: 0px; } From 82f54e707e3587debe874138091c0b7f8ef57bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:45:26 +0100 Subject: [PATCH 174/259] Update extrafields.class.php (#32135) --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6aca908bffd..4009a3f749e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1499,7 +1499,7 @@ class ExtraFields $sql .= $sqlwhere; //print $sql; - $sql .= ' ORDER BY '.implode(', ', $fields_label); + $sql .= $this->db->order(implode(',', $fields_label)); dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); $resql = $this->db->query($sql); From 1e213f041495ef06425ece773f14a81f375c1125 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 29 Nov 2024 14:46:21 +0100 Subject: [PATCH 175/259] FIX result is always in error (#32141) * FIX result is always in error * FIX Blank line found at end of control structure --- htdocs/admin/modules.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 6b6faa7d481..f9cde4b5363 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -290,9 +290,8 @@ if ($action == 'install' && $allowonlineinstall) { if (!is_numeric($checkRes) && $checkRes != '') { $langs->load("errors"); setEventMessages($modulename.' : '.$langs->trans($checkRes), null, 'errors'); + $error++; } - - $error++; } catch (Exception $e) { // Nothing done } From 34b2f2587500f670f86b8b9191f1a35282ef799f Mon Sep 17 00:00:00 2001 From: atm-GregM <85485123+atm-GregM@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:47:15 +0100 Subject: [PATCH 176/259] FIX data too long for column signature (#32144) * Fix data too long for column signature * Fix data too long for column signature --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 1 + htdocs/install/mysql/tables/llx_user.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 71037e6248e..5299e018576 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -384,3 +384,4 @@ INSERT INTO llx_c_type_contact (element, source, code, libelle, active ) values ALTER TABLE llx_facture_rec ADD COLUMN fk_societe_rib integer DEFAULT NULL; ALTER TABLE llx_facture ADD COLUMN is_also_delivery_note tinyint DEFAULT 0 NOT NULL; +ALTER TABLE llx_user MODIFY COLUMN signature LONGTEXT; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 065c6bd4f0d..66d3acc0db3 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -60,7 +60,7 @@ create table llx_user email varchar(255), personal_email varchar(255), email_oauth2 varchar(255), -- an email to validate OAuth2 authentication when email differs from the OAuth2 email - signature text DEFAULT NULL, + signature longtext DEFAULT NULL, socialnetworks text DEFAULT NULL, -- json with socialnetworks From 4d885d1e344e81aff0e705ab142802372ec78090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:47:33 +0100 Subject: [PATCH 177/259] add phpdoc (#32136) --- htdocs/core/tpl/onlinepaymentlinks.tpl.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index 59ef1023b2b..3964d67232d 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -14,7 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +/** + * @var Conf $conf + * @var Translate $langs + * @var string $servicename + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; From c0b42287c1180d81bfa8319478d21e147b9cb98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:47:53 +0100 Subject: [PATCH 178/259] add phpdoc (#32137) --- build/phpstan/phpstan-baseline.neon | 78 --------------------------- htdocs/core/tpl/passwordreset.tpl.php | 32 +++++++---- 2 files changed, 23 insertions(+), 87 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 192a9985d69..ba84964cca2 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17598,84 +17598,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$disabled might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$dol_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$focus_element might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 18 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$mode might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$newpass1 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$newpass2 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$passworduidhash might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$setnewpassword might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$urllogo might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$username might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - message: '#^Variable \$db might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php index 61a27c6853a..4754c76c4fb 100644 --- a/htdocs/core/tpl/passwordreset.tpl.php +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -22,7 +22,29 @@ if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', 1); } - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * + * @var string $action + * @var string $captcha + * @var string $disabled + * @var string $dol_url_root + * @var string $focus_element + * @var string $mode + * @var string $message + * @var string $newpass1 + * @var string $newpass2 + * @var string $passworduidhash + * @var string $title + * @var string $urllogo + * @var string $user + * @var string $username + * + * @var int $setnewpassword + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; @@ -38,14 +60,6 @@ if ($size > 10000) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -/** - * @var HookManager $hookmanager - * @var string $action - * @var string $captcha - * @var string $message - * @var string $title - */ - /* * View From 9874e67acb125c737dffa03718c7a3554eeacac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:48:33 +0100 Subject: [PATCH 179/259] add phpdoc (#32138) * add phpdoc * add phpdoc --- build/phpstan/phpstan-baseline.neon | 54 ----------------------- htdocs/core/tpl/passwordforgotten.tpl.php | 27 ++++++++---- 2 files changed, 18 insertions(+), 63 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index ba84964cca2..b4842b6c19e 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17544,60 +17544,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/originproductline.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$disabled might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$dol_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$focus_element might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 10 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$mode might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$urllogo might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$username might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - message: '#^Variable \$db might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 272c21ded9d..d01fb3a5f99 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -23,7 +23,24 @@ if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', 1); } - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * + * @var string $action + * @var string $captcha + * @var string $disabled + * @var string $dol_url_root + * @var string $focus_element + * @var string $mode + * @var string $message + * @var string $title + * @var string $urllogo + * @var string $user + * @var string $username + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; @@ -39,14 +56,6 @@ if ($size > 10000) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -/** - * @var HookManager $hookmanager - * @var string $action - * @var string $captcha - * @var string $message - * @var string $title - */ - /* * View From c983cfff50c962acc110b9f092157a91188d21b5 Mon Sep 17 00:00:00 2001 From: nateogroup-antoine Date: Fri, 29 Nov 2024 14:50:25 +0100 Subject: [PATCH 180/259] Typo in log : SERVICES_ARE_ECOMMERCE_200238EC => SERVICE_ARE_ECOMMERCE_200238EC and set shipment origin for shipment created by api on an order (#32143) * Update functions.lib.php * set shipment origin for shipment created by api on an order --- htdocs/commande/class/api_orders.class.php | 1 + htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 701d9238627..bd39f0fae3f 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -1090,6 +1090,7 @@ class Orders extends DolibarrApi $shipment = new Expedition($this->db); $shipment->socid = $this->commande->socid; $shipment->origin_id = $this->commande->id; + $shipment->origin = $this->commande->element; $result = $shipment->create(DolibarrApiAccess::$user); if ($result <= 0) { throw new RestException(500, 'Error on creating expedition :'.$this->db->lasterror()); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 06ce0567f53..9c411ea7caf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7577,7 +7577,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $buyer_country_code = $thirdparty_buyer->country_code; $buyer_in_cee = isInEEC($thirdparty_buyer); - dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".((string) (int) $seller_in_cee).", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".((string) (int) $buyer_in_cee).", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(getDolGlobalString('SERVICES_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); + dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".((string) (int) $seller_in_cee).", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".((string) (int) $buyer_in_cee).", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICE_ARE_ECOMMERCE_200238EC : '')); // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm) // we use the buyer VAT. From 546a68eafb05f14b639b8af2ab5f38f82029b020 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 15:11:36 +0100 Subject: [PATCH 181/259] Fix the amount in linke is not correctly formatted. --- htdocs/core/lib/payments.lib.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index c299a33ed35..357730cdac7 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -270,12 +270,12 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y } if ($type == 'free') { - $out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '' : '').price2num($amount, 'MT').($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) { if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { $out .= '&securekey='.urlencode(getDolGlobalString('PAYMENT_SECURITY_TOKEN')); } else { - $out .= '&securekey='.urlencode(dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2)); + $out .= '&securekey='.urlencode(dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 'sha1md5')); } } //if ($mode) $out.='&noidempotency=1'; @@ -297,7 +297,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + order_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -320,7 +320,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -343,7 +343,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + contractline_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -351,7 +351,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y } elseif ($type == 'member' || $type == 'membersubscription') { $newtype = 'member'; $out = $urltouse.'/public/payment/newpayment.php?source=member'; - $out .= '&amount='.$amount; + $out .= '&amount='.price2num($amount, 'MT'); $out .= '&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'member_ref'; @@ -365,11 +365,11 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= '&securekey='.urlencode(getDolGlobalString('PAYMENT_SECURITY_TOKEN')); } else { $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) { + if ($mode == 1) { // mode tuto $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$newtype."' + member_ref)"; } - if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $newtype.$ref, 2); + if ($mode == 0) { // mode real + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$newtype.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -392,7 +392,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + donation_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -415,7 +415,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } From 7b0e34ffdd5377cc5926bd5dc71ee6004ff4a9a0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 15:19:51 +0100 Subject: [PATCH 182/259] Fix css of public payment page --- htdocs/public/payment/newpayment.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 2a07fa72ebc..59f4039c6c8 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2108,19 +2108,19 @@ if ($action != 'dopayment') { } if ($source == 'order' && $object->billed) { - print '

'.$langs->trans("OrderBilled").''; + print '

'.$langs->trans("OrderBilled").'
'; } elseif ($source == 'invoice' && $object->paye) { - print '

'.$langs->trans("InvoicePaid").''; + print '

'.$langs->trans("InvoicePaid").'
'; } elseif ($source == 'donation' && $object->paid) { - print '

'.$langs->trans("DonationPaid").''; + print '

'.$langs->trans("DonationPaid").'
'; } else { // Membership can be paid and we still allow to make renewal if (($source == 'member' || $source == 'membersubscription') && $object->datefin > dol_now()) { $langs->load("members"); - print '
'; + print '
'; $s = $langs->trans("MembershipPaid", '{s1}'); print str_replace('{s1}', ''.dol_print_date($object->datefin, 'day').'', $s); - print '
'; + print '
'; print '
'.$langs->trans("PaymentWillBeRecordedForNextPeriod").'
'; print '
'; } From b9e81ef46c442fbdf8fbc946ee05eea59996f73a Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:36:58 +0100 Subject: [PATCH 183/259] Fix search in member list (lastname and company) --- htdocs/adherents/list.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index cf444f1b06a..571445c922d 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -267,7 +267,6 @@ if (empty($reshook)) { $search_filter = ""; $search_status = ""; $search_import_key = ''; - $catid = ""; $search_all = ""; $toselect = array(); $search_datec_start = ''; @@ -521,7 +520,7 @@ if ($search_firstname) { $sql .= natural_search("d.firstname", $search_firstname); } if ($search_lastname) { - $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname); + $sql .= natural_search("d.lastname", $search_lastname); } if ($search_gender != '' && $search_gender != '-1') { $sql .= natural_search("d.gender", $search_gender); @@ -530,7 +529,7 @@ if ($search_login) { $sql .= natural_search("d.login", $search_login); } if ($search_company) { - $sql .= natural_search("s.nom", $search_company); + $sql .= natural_search(array("s.nom", "d.societe"), $search_company); } if ($search_email) { $sql .= natural_search("d.email", $search_email); From eab6a9f97baff3c8ab1f9472c8774b563668c69b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:49:04 +0100 Subject: [PATCH 184/259] Fix name of index --- .../mysql/tables/llx_bookcal_availabilities-bookcal.key.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql b/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql index 79a7fe83472..53f3e91082d 100644 --- a/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql +++ b/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql @@ -16,10 +16,10 @@ -- BEGIN MODULEBUILDER INDEXES ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_rowid (rowid); -ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT fk_bookcal_availabilities_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_status (status); -ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_type (type); -ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_bookcal_calendar FOREIGN KEY (fk_bookcal_calendar) REFERENCES llx_bookcal_calendar(rowid); +ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_fk_bookcal_calendar (fk_bookcal_calendar); +ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT fk_bookcal_availabilities_fk_bookcal_calendar FOREIGN KEY (fk_bookcal_calendar) REFERENCES llx_bookcal_calendar(rowid); -- END MODULEBUILDER INDEXES From 459f631eccf5c4d48032ee94a9f52e7cb3b29305 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:52:53 +0100 Subject: [PATCH 185/259] Reduce length --- htdocs/install/mysql/data/llx_c_holiday_types.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_holiday_types.sql b/htdocs/install/mysql/data/llx_c_holiday_types.sql index 92bc8739968..ef17d8f202c 100644 --- a/htdocs/install/mysql/data/llx_c_holiday_types.sql +++ b/htdocs/install/mysql/data/llx_c_holiday_types.sql @@ -57,7 +57,7 @@ insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '9M-M', 'Ειδική άδεια προστασίας μητρότητας 9 μηνών(χωρίς αποδοχές)', 0, 0, 0, 102, 24, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '4M-M', 'Τετράμηνη γονική Άδεια Ανατροφής Τέκνων(χωρίς αποδοχές)', 0, 0, 0, 102, 25, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '6-8D-SP', 'Εξαήμερη ή Οκταήμερη Άδεια για μονογονεϊκές οικογένειες(με αποδοχές)', 0, 0, 0, 102, 26, 0); -insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '6-8-14D-FC', 'Άδεια για ασθένεια μελών οικογένειας(χωρίς αποδοχές, 6 ημέρες/έτος ένα παιδί - 8 ημέρες/έτος δύο παιδιά και σε 14 ημέρες/έτος τρία (3) παιδιά και πάνω', 0, 0, 0, 102, 27, 0); +insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '6-8-14D-FC', 'Αναρρωτική άδεια (άνευ αποδοχών, 6 ημέρες/έτος για ένα παιδί - 8 ημέρες/έτος για δύο και 14 ημέρες/έτος για τρία ή περισσότερα)', 0, 0, 0, 102, 27, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '10D-CD', 'Δεκαήμερη Γονική Άδεια για παιδί με σοβαρά νοσήματα και λόγω νοσηλείας παιδιών(με αποδοχές)', 0, 0, 0, 102, 28, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '30D-CD', 'Άδεια λόγω νοσηλείας των παιδιών(έως 30 ημέρες/έτος χωρίς αποδοχές)', 0, 0, 0, 102, 29, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '5D-CG', 'Άδεια φροντιστή(έως 5 ημέρες/έτος χωρίς αποδοχές)', 0, 0, 0, 102, 30, 0); From 82ae009e8be7a20082fee514216bd68f67d39327 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:53:45 +0100 Subject: [PATCH 186/259] Fix size too low --- htdocs/install/mysql/tables/llx_c_invoice_subtype.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql b/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql index 201df19923c..c204df3b933 100644 --- a/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql +++ b/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql @@ -16,14 +16,13 @@ -- -- ======================================================================== -CREATE TABLE llx_c_invoice_subtype +CREATE TABLE llx_c_invoice_subtype ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_country integer NOT NULL, code varchar(5) NOT NULL, - label varchar(100), + label varchar(200), active tinyint DEFAULT 1 NOT NULL ) ENGINE=innodb; - From dd67fe7b6d57a0b77e997472961e04734dd5bc48 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:58:39 +0100 Subject: [PATCH 187/259] Fix duplicate record --- htdocs/install/mysql/data/llx_c_type_contact.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_type_contact.sql b/htdocs/install/mysql/data/llx_c_type_contact.sql index b7e649559e9..50a952bbea1 100644 --- a/htdocs/install/mysql/data/llx_c_type_contact.sql +++ b/htdocs/install/mysql/data/llx_c_type_contact.sql @@ -74,9 +74,9 @@ insert into llx_c_type_contact (element, source, code, libelle, active ) values insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'external', 'SHIPPING', 'Contact client livraison commande', 1); -- Shipment / Expedition +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'CUSTOMER', 'Customer shipping contact', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Loading facility', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Delivery facility', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Customer shipping contact', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'DELIVERY', 'Delivery facility', 1); -- Intervention / Fichinter insert into llx_c_type_contact (element, source, code, libelle, active ) values ('fichinter', 'internal', 'INTERREPFOLL', 'Responsable suivi de l''intervention', 1); From 1080d0718c3c62ee4028d28435f5b4f16c3b145f Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Fri, 29 Nov 2024 17:03:25 +0100 Subject: [PATCH 188/259] Fix no display of extrafields in bankentries_list (#32149) * Fix no display of extrafields in bankentries_list * fix error * fix comment --------- Co-authored-by: Hystepik --- htdocs/compta/bank/bankentries_list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index da6630f77e3..13bdf1441d2 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -597,9 +597,9 @@ $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappr $sql .= " b.fk_account, b.fk_type, b.fk_bordereau,"; $sql .= " ba.rowid as bankid, ba.ref as bankref"; // Add fields from extrafields -if (!empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); +if (!empty($extrafields->attributes[$extrafieldsobjectkey]['label'])) { + foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) { + $sql .= ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks @@ -612,8 +612,8 @@ if ($search_bid > 0) { } $sql .= " ".MAIN_DB_PREFIX."bank_account as ba,"; $sql .= " ".MAIN_DB_PREFIX."bank as b"; -if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)"; +if (!empty($extrafields->attributes[$extrafieldsobjectkey]['label']) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$extrafieldsobjectkey."_extrafields as ef on (b.rowid = ef.fk_object)"; } // Add fields from hooks @@ -1831,6 +1831,7 @@ if ($resql) { } // Extra fields + $obj = $objp; // Because extrafield template use $obj and not $objp as object variable name include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters=array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray); From ca5335a71964c79b5a63da6aafcf8dc1a4180212 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 18:13:06 +0100 Subject: [PATCH 189/259] Fix migration --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 5299e018576..47cc3f8d6c0 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -45,7 +45,7 @@ ALTER TABLE llx_c_holiday_types DROP INDEX uk_c_holiday_types; ALTER TABLE llx_c_holiday_types ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; ALTER TABLE llx_c_holiday_types ADD UNIQUE INDEX uk_c_holiday_types (entity, code); -ALTER TABLE llx_hrm_evaluation MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; +ALTER TABLE llx_hrm_evaluation ADD COLUMN model_pdf varchar(255) DEFAULT NULL; -- Add ref_ext to asset_model to use various CommonOjbect methods ALTER TABLE llx_asset_model ADD COLUMN ref_ext varchar(255) AFTER ref; From 5e6ab79990942c7d2ae875aa45ea995bf1158475 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 18:41:56 +0100 Subject: [PATCH 190/259] Fix remove hard constraint that must be soft constraints. --- .../llx_accounting_category_account-accounting.key.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql b/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql index 7c4a543ebc0..a45941697f2 100644 --- a/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql +++ b/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql @@ -14,13 +14,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- Table for connect accounting category with accounting account +-- Table for a relation n-n between c_accounting_category and accounting_account -- =================================================================== ALTER TABLE llx_accounting_category_account ADD INDEX idx_accounting_category_account_fk_accounting_category (fk_accounting_category); -ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_category FOREIGN KEY (fk_accounting_category) REFERENCES llx_c_accounting_category (rowid); +--ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_category FOREIGN KEY (fk_accounting_category) REFERENCES llx_c_accounting_category (rowid); ALTER TABLE llx_accounting_category_account ADD INDEX idx_accounting_category_account_fk_accounting_account (fk_accounting_account); -ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_account FOREIGN KEY (fk_accounting_account) REFERENCES llx_accounting_account (rowid); +--ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_account FOREIGN KEY (fk_accounting_account) REFERENCES llx_accounting_account (rowid); ALTER TABLE llx_accounting_category_account ADD UNIQUE INDEX uk_accounting_category_account (fk_accounting_category, fk_accounting_account); From f2c2b634e31c64eb40930d0bcc6eaa8739080461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 30 Nov 2024 12:51:38 +0100 Subject: [PATCH 191/259] fix CI (#32153) --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b5a71fc5484..a7942735250 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1079,7 +1079,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // State if (!getDolGlobalString('MEMBER_DISABLE_STATE')) { print '
'; print ''; @@ -709,7 +715,7 @@ if ($id > 0 || $ref) { $pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ? GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : '')); print ''; // Price qty min @@ -718,7 +724,7 @@ if ($id > 0 || $ref) { print ''; print ''; print ' '; - print $form->selectPriceBaseType('', "disabled_price_base_type"); + print $form->selectPriceBaseType('', "disabled_price_base_type", 1); print ''; $currencies = array(); @@ -780,7 +786,7 @@ if ($id > 0 || $ref) { print ''; print ''; } From 63e5e0ab77685234ff32f61f2b9bdda7b2c0f020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 30 Nov 2024 12:55:27 +0100 Subject: [PATCH 193/259] add phpdoc (#32139) * add phpdoc * clean baseline --- build/phpstan/phpstan-baseline.neon | 84 --------------------------- htdocs/core/tpl/resource_add.tpl.php | 24 ++++++++ htdocs/core/tpl/resource_view.tpl.php | 28 ++++++++- 3 files changed, 51 insertions(+), 85 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b4842b6c19e..b969325e0aa 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17526,96 +17526,12 @@ parameters: count: 3 path: ../../htdocs/core/tpl/objectlinked_lineimport.tpl.php - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 29 - path: ../../htdocs/core/tpl/onlinepaymentlinks.tpl.php - - - - message: '#^Variable \$servicename might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../htdocs/core/tpl/onlinepaymentlinks.tpl.php - - message: '#^Variable \$langs might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/core/tpl/originproductline.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$element might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$element_id might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$element_ref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$element might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$element_id might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$linked_resources might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$mode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$resource_type might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - message: '#^Variable \$shippingline might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 6b67021096b..3cc89537d5b 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -1,6 +1,30 @@ + * + * 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 . + */ +/** + * @var Conf $conf + * @var DoliDB $db + * @var Translate $langs + * + * @var string $element + * @var int $element_id + * @var string $element_ref + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 42ed0f8139d..454cc61ded6 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -1,6 +1,32 @@ +/* Copyright (C) 2024 MDW + * 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 + * 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 . + */ + +/** + * @var Conf $conf + * @var DoliDB $db + * @var Translate $langs + * + * @var string $element + * @var int $element_id + * @var string $mode + * @var string $resource_type + * @var array,mandatory:int<0,1>}> $linked_resources */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { From 53f566e9f13629b383c1c25944e163fc531d6bd4 Mon Sep 17 00:00:00 2001 From: Joachim Kueter Date: Sat, 30 Nov 2024 13:02:58 +0100 Subject: [PATCH 194/259] Fix #32145 (#32162) Parameter is always "1" or "0" --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 718419e3491..349d6e77951 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -470,7 +470,7 @@ if (empty($reshook)) { // Action to add a message (private or not, with email or not). // This may also send an email (concatenated with email_intro and email footer if checkbox was selected) if ($action == 'add_message' && GETPOSTISSET('btn_add_message') && $permissiontoread) { - $ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "on" ? 1 : 0), 0); + $ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "1" ? 1 : 0), 0); if ($ret > 0) { if (!empty($backtopage)) { From 18775c06ea9bed16c8590f9b0590a96c7cd0e531 Mon Sep 17 00:00:00 2001 From: Joachim Kueter Date: Sat, 30 Nov 2024 13:06:36 +0100 Subject: [PATCH 195/259] FIX #31890 store empty line extrafields (#32152) * FIX #31890 store empty line extrafields If a line extrafield had originally some contents, after deleting it and submitting it as empty, the extrafield was not stored but the original contents kept * corrected whitespace --- htdocs/core/class/extrafields.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d58bcdc5743..a1b1151a15d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2017 Nicolas ZABOURI * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2022 Antonin MARCHAL + * Copyright (C) 2024 Joachim Kueter * * 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 @@ -2415,10 +2416,13 @@ class ExtraFields } $value_key = dol_htmlcleanlastbr(GETPOST($keysuffix."options_".$key.$keyprefix, 'restricthtml')); } else { - if (!GETPOST($keysuffix."options_".$key.$keyprefix)) { + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) { continue; // Value was not provided, we should not set it. } $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); + if ($value_key === '') { + $value_key = null; + } } $array_options[$keysuffix."options_".$key] = $value_key; // No keyprefix here. keyprefix is used only for read. From ddf3431b81078a32b04319984e3771e7a4e2c998 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Sat, 30 Nov 2024 13:31:53 +0100 Subject: [PATCH 196/259] Allow various format of dates on API paiement https://github.com/Dolibarr/dolibarr/issues/32111 --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index b4867e8168a..d0735ce1c87 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1463,7 +1463,7 @@ class Invoices extends DolibarrApi * Add payment line to a specific invoice with the remain to pay as amount. * * @param int $id Id of invoice - * @param string $datepaye {@from body} Payment date {@type timestamp} + * @param string $datepaye {@from body} Payment date * @param int $paymentid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} @@ -1584,7 +1584,7 @@ class Invoices extends DolibarrApi * Example of value for parameter arrayofamounts: {"1": {"amount": "99.99", "multicurrency_amount": ""}, "2": {"amount": "", "multicurrency_amount": "10"}} * * @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice - * @param string $datepaye {@from body} Payment date {@type timestamp} + * @param string $datepaye {@from body} Payment date * @param int $paymentid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} From be9d72e3b6934dce46e1981b8dc62d31e7b91123 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sat, 30 Nov 2024 13:44:24 +0100 Subject: [PATCH 197/259] The $empty param must follow same rules than other select component. --- htdocs/core/class/html.formticket.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 482e6af0088..9573e8c5cb6 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -968,7 +968,7 @@ class FormTicket * @param string $htmlname Name of select component * @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users. * @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code - * @param int $empty 1 = can be empty, 0 = or can't be empty + * @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only * @param int $noadmininfo 0 = ddd admin info, 1 = disable admin info * @param int $maxlength Max length of label * @param string $morecss More CSS @@ -995,7 +995,7 @@ class FormTicket if ($use_multilevel <= 0) { print ''; // Group => Category @@ -469,12 +469,12 @@ class FormTicket if ($public) { $filter = '(public:=:1)'; } - $this->selectGroupTickets($category_code, 'category_code', $filter, 2, 1, 0, 0, 'minwidth200 maxwidth500'); + $this->selectGroupTickets($category_code, 'category_code', $filter, 2, 'ifone', 0, 0, 'minwidth200 maxwidth500'); print ''; // Severity => Priority print ''; if (isModEnabled('knowledgemanagement')) { @@ -869,8 +869,8 @@ class FormTicket * @param string|int[] $selected Id of preselected field or array of Ids * @param string $htmlname Nom de la zone select * @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz)) - * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code - * @param int $empty 1=peut etre vide, 0 sinon + * @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code + * @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only * @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $maxlength Max length of label * @param string $morecss More CSS @@ -896,7 +896,7 @@ class FormTicket print ''; if ($empty) { - print ''; + print ''; } if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) { @@ -1075,7 +1077,7 @@ class FormTicket } print ajax_combobox('select'.$htmlname); - } elseif ($htmlname != '') { + } elseif ($htmlname != '') { // complexe mode using selection of group using a combo for each level (when using a hierarchy of groups). $selectedgroups = array(); $groupvalue = ""; $groupticket = GETPOST($htmlname, 'aZ09'); @@ -1320,14 +1322,14 @@ class FormTicket /** * Return html list of ticket severitys (priorities) * - * @param string $selected Id severity pre-selected - * @param string $htmlname Name of the select area - * @param string $filtertype To filter on field type in llx_c_ticket_severity (array('code'=>xx,'label'=>zz)) - * @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code - * @param int $empty 1 = can be empty, 0 = or not - * @param int $noadmininfo 0 = add admin info, 1 = disable admin info - * @param int $maxlength Max length of label - * @param string $morecss More CSS + * @param string $selected Id severity pre-selected + * @param string $htmlname Name of the select area + * @param string $filtertype To filter on field type in llx_c_ticket_severity (array('code'=>xx,'label'=>zz)) + * @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code + * @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only + * @param int $noadmininfo 0 = add admin info, 1 = disable admin info + * @param int $maxlength Max length of label + * @param string $morecss More CSS * @return void */ public function selectSeveritiesTickets($selected = '', $htmlname = 'ticketseverity', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') @@ -1348,7 +1350,7 @@ class FormTicket print '
".$langs->trans("Parameter")."".$langs->trans("Value")."".$langs->trans("Examples")." 
'.$langs->trans('State').''; - if ($soc->country_id || GETPOSTISSET('country_id')) { + if ($soc->country_id || GETPOSTISSET('country_id')) { print img_picto('', 'state', 'class="pictofixedwidth"'); print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOSTINT('state_id') : $soc->state_id, GETPOSTISSET('country_id') ? GETPOSTINT('country_id') : $soc->country_code); } else { From 51611489be02a7381b65aa5ec24ae3c9f344e348 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sat, 30 Nov 2024 12:52:57 +0100 Subject: [PATCH 192/259] Debug v21 --- htdocs/product/price_suppliers.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/product/price_suppliers.php b/htdocs/product/price_suppliers.php index 82c500e09c1..220f9f667dc 100644 --- a/htdocs/product/price_suppliers.php +++ b/htdocs/product/price_suppliers.php @@ -700,7 +700,13 @@ if ($id > 0 || $ref) { } print $form->selectMultiCurrency($currencycodetouse, "multicurrency_code", 1); print '     '.$langs->trans("CurrencyRate").' '; - print ''; + print ''; print '
'; print ' '; - print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ? GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices + print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ? GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type", 1); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices print '
'.$langs->trans("PriceQtyMin").''; print ' '; - print $form->selectPriceBaseType((GETPOSTISSET('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type"); // We keep 'HT' here, price_base_type is not yet supported for supplier prices + print $form->selectPriceBaseType((GETPOSTISSET('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type", 1); // We keep 'HT' here, price_base_type is not yet supported for supplier prices print '
'; - $this->selectTypesTickets($type_code, 'type_code', '', 2, 1, 0, 0, 'minwidth200 maxwidth500'); + $this->selectTypesTickets($type_code, 'type_code', '', 2, 'ifone', 0, 0, 'minwidth200 maxwidth500'); print '
'; - $this->selectSeveritiesTickets($severity_code, 'severity_code', '', 2, 1, 0, 0, 'minwidth200 maxwidth500'); + $this->selectSeveritiesTickets($severity_code, 'severity_code', '', 2, 'ifone', 0, 0, 'minwidth200 maxwidth500'); print '
'; + $out .= '
'; $out .= ''; $out .= ''; $out .= ''; @@ -1146,9 +1146,12 @@ class ProductFournisseur extends Product } $out .= '
'.($showunitprice ? $langs->trans("Price").' '.$langs->trans("HT") : '').''.($showunitprice ? $langs->trans("QtyMin") : '').''.$langs->trans("Supplier").'
'; } else { - $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").'   (' : ''); - $out .= ($showsuptitle ? ''.$langs->trans("Supplier").': ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->ref_supplier; - $out .= ($showunitprice ? ')' : ''); + $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT") : ''); + if ($user->hasRight("fournisseur", "read")) { // Without permission, never show the best supplier seller + $out .= ($showunitprice ? '   (' : ''); + $out .= ($showsuptitle ? ''.$langs->trans("Supplier").': ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->ref_supplier; + $out .= ($showunitprice ? ')' : ''); + } } return $out; } From 6e4ca0b8518ddfefb6156ae64cb58e9bd074f381 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sat, 30 Nov 2024 16:27:00 +0100 Subject: [PATCH 202/259] FIX with no perm on supplier, must not see supplier of the best price --- htdocs/fourn/class/fournisseur.product.class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 089bfbefdb5..5edfa06eae1 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1078,12 +1078,12 @@ class ProductFournisseur extends Product public function display_price_product_fournisseur($showunitprice = 1, $showsuptitle = 1, $maxlen = 0, $notooltip = 0, $productFournList = array()) { // phpcs:enable - global $conf, $langs; + global $conf, $langs, $user; $out = ''; $langs->load("suppliers"); if (count($productFournList) > 0) { - $out .= ''; + $out .= '
'; $out .= ''; $out .= ''; $out .= ''; @@ -1096,9 +1096,12 @@ class ProductFournisseur extends Product } $out .= '
'.($showunitprice ? $langs->trans("Price").' '.$langs->trans("HT") : '').''.($showunitprice ? $langs->trans("QtyMin") : '').''.$langs->trans("Supplier").'
'; } else { - $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").'   (' : ''); - $out .= ($showsuptitle ? ''.$langs->trans("Supplier").': ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->ref_supplier; - $out .= ($showunitprice ? ')' : ''); + $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT") : ''); + if ($user->hasRight("fournisseur", "read")) { // Without permission, never show the best supplier seller + $out .= ($showunitprice ? '   (' : ''); + $out .= ($showsuptitle ? ''.$langs->trans("Supplier").': ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->ref_supplier; + $out .= ($showunitprice ? ')' : ''); + } } return $out; } From 769027970b1093b6031264c25bdcd8748e32ec96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Sat, 30 Nov 2024 17:18:18 +0100 Subject: [PATCH 203/259] Fix #32155 (#32156) Error forging a SQL request on page eventorganization/conferenceorboothattendee_list.php Co-authored-by: Laurent Destailleur --- .../eventorganization/class/conferenceorboothattendee.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 6e3a3d99bd0..29079ce513d 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -203,7 +203,7 @@ class ConferenceOrBoothAttendee extends CommonObject if (isset($conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE) && getDolGlobalString('EVENTORGANIZATION_FILTERATTENDEES_TYPE') !== '' && getDolGlobalString('EVENTORGANIZATION_FILTERATTENDEES_TYPE') !== '-1') { - $this->fields['fk_soc']['type'] .= ' AND client = '.((int) getDolGlobalInt('EVENTORGANIZATION_FILTERATTENDEES_TYPE', 0)); + $this->fields['fk_soc']['type'] .= ' AND (client:=:'.((int) getDolGlobalInt('EVENTORGANIZATION_FILTERATTENDEES_TYPE', 0) . ')'); } // Example to show how to set values of fields definition dynamically From f933d0f636ad4077b8eda1eb82371edd083ff1eb Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 1 Dec 2024 15:09:27 +0100 Subject: [PATCH 204/259] Missing the placeholder --- htdocs/core/class/commonobject.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7ad7702b9df..8905c7de33e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7469,7 +7469,7 @@ abstract class CommonObject $validationClass = ' --success'; // the -- is use as class state in css : .--success can't be be defined alone it must be define with another class like .my-class.--success or input.--success } - $valuemultiselectinput = array(); + //$valuemultiselectinput = array(); $out = ''; $type = ''; $isDependList = 0; @@ -7538,6 +7538,8 @@ abstract class CommonObject $required = (!empty($this->fields[$key]['required']) ? $this->fields[$key]['required'] : 0); // @phan-suppress-next-line PhanTypeMismatchProperty $autofocusoncreate = (!empty($this->fields[$key]['autofocusoncreate']) ? $this->fields[$key]['autofocusoncreate'] : 0); + // @phan-suppress-next-line PhanTypeMismatchProperty + $placeholder = (!empty($this->fields[$key]['placeholder']) ? $this->fields[$key]['placeholder'] : 0); // @phan-suppress-next-line PhanTypeMismatchProperty $langfile = (!empty($this->fields[$key]['langfile']) ? $this->fields[$key]['langfile'] : ''); @@ -7618,7 +7620,7 @@ abstract class CommonObject } elseif (in_array($type, array('real'))) { $out = ''; } elseif (preg_match('/varchar/', (string) $type)) { - $out = ' 0 ? ' maxlength="'.$size.'"' : '').' value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>'; + $out = ' 0 ? ' maxlength="'.$size.'"' : '').' value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($placeholder?' placeholder="'.dolPrintHTMLForAttribute($placeholder).'"':'').($autofocusoncreate ? ' autofocus' : '').'>'; } elseif (in_array($type, array('email', 'mail', 'phone', 'url', 'ip'))) { $out = ''; } elseif (preg_match('/^text/', (string) $type)) { From 9d62336c954678754556e04d28ab45c52d54d1d2 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 1 Dec 2024 15:12:51 +0100 Subject: [PATCH 205/259] Doc --- htdocs/modulebuilder/template/class/myobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 6ce3e174457..62346cd3976 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -92,9 +92,10 @@ class MyObject extends CommonObject * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage) * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' + * 'placeholder' to set the placeholder of a varchar field. * 'help' and 'helplist' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code like the constructor of the class. * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. From 2388da4e31ec78e8aab3e9f7c5107f0cb5c6ed09 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 1 Dec 2024 15:21:38 +0100 Subject: [PATCH 206/259] Debug v21 --- htdocs/product/card.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2c85b6b141a..c96e53a6279 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1623,8 +1623,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_unit') ? GETPOST('duration_unit', 'alpha') : 'h'), 0, 1); // Mandatory period - print '       '; - print 'mandatory_period == 1 ? ' checked="checked"' : '').'>'; + if ($object->duration_value > 0) { + print '     '; + } + print 'mandatory_period == 1 ? ' checked="checked"' : '').'>'; print '
'.$langs->trans("Duration").''; - print $object->duration_value; + print $object->duration_value ? $object->duration_value : ''; print (!empty($object->duration_unit) && isset($durations[$object->duration_unit]) ? " ".$langs->trans($durations[$object->duration_unit])." " : ''); // Mandatory period - if ($object->duration_value > 0) { - print '       '; - } $htmltooltip = $langs->trans("mandatoryHelper"); if (!getDolGlobalString('SERVICE_STRICT_MANDATORY_PERIOD')) { $htmltooltip .= '
'.$langs->trans("mandatoryHelper2"); } - print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled>'; + if ($object->duration_value > 0) { + print '     '; + } + print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled>'; print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0); print '
'.$langs->trans("Description").''; -if ($action == 'edit') { - $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', true, 1, 1, ROWS_7, '90%'); - $doleditor->Create(0, ''); -} else { - print(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)); -} -print '
'.$langs->trans('ToReceiveEMailForEachVote').''; if ($action == 'edit') { @@ -305,6 +295,16 @@ if ($action == 'edit') { } print '
'.$langs->trans("Description").''; +if ($action == 'edit') { + $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', true, 1, 1, ROWS_7, '90%'); + $doleditor->Create(0, ''); +} else { + print(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)); +} +print '
'; print ''; diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index bb50018291b..92cb723a104 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -1053,7 +1053,7 @@ if (empty($testligneamodifier)) { } // Affichage du bouton de formulaire pour inscrire un nouvel utilisateur dans la base - print '
'.$langs->trans('ThirdParty').''; print $soc->getNomUrl(1); @@ -427,7 +419,7 @@ if ($action == 'create') { print ''.$langs->trans('ThirdParty').''; $filter = '((s.client:IN:1,2,3) AND (status:=:1))'; - print $form->select_company($soc->id, 'socid', $filter, 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + print $form->select_company('', 'socid', $filter, 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer information. Note, this clear other input if (getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) { print ' '; + // Convert $arrayoffiltercriterias into a json object that can be used in jquery to build the search component dynamically + $arrayoffiltercriterias_json = json_encode($arrayoffiltercriterias); + $ret .= ''; + + $arrayoffilterfieldslabel = array(); foreach ($arrayoffiltercriterias as $key => $val) { $arrayoffilterfieldslabel[$key]['label'] = $val['label']; @@ -11356,6 +11363,19 @@ class Form $ret .= $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, ''); $ret .= ''; + // Value selector (will be populated dynamically) based on search_filter_field value if a selected value has an array of values + $ret .= ''; + $ret .= ''; + $ret .= ''; $ret .= '
'; @@ -11390,10 +11410,21 @@ class Form $ret .= '