From 12cc51b0bdeab235583edd088a1fdda122fd3c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 27 Oct 2024 19:24:48 +0100 Subject: [PATCH 01/18] fix service duration in minutes (#31592) * fix service duration in minutes * fix * fix * fix --- htdocs/product/card.php | 20 ++++++++++----- .../product/class/html.formproduct.class.php | 10 ++++---- htdocs/product/class/product.class.php | 10 +++++--- htdocs/product/class/productbatch.class.php | 25 +++++++++++++------ 4 files changed, 43 insertions(+), 22 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c542254c037..058882792e9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2755,14 +2755,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if ($object->isService()) { // Duration + require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; + $measuringUnits = new CUnits($db); + $durations = []; + $plural = ''; + if ($object->duration_value > 1) { + $plural = 's'; + } + $result = $measuringUnits->fetchAll('', 'scale', 0, 0, ['t.active' => 1, 't.unit_type' => 'time']); + if ($result !== -1) { + foreach ($measuringUnits->records as $record) { + $durations[$record->short_label] = dol_ucfirst($record->label) . $plural; + } + } print ''.$langs->trans("Duration").''; print $object->duration_value; - if ($object->duration_value > 1) { - $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); - } elseif ($object->duration_value > 0) { - $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); - } - print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : ''); + print (!empty($object->duration_unit) && isset($durations[$object->duration_unit]) ? " ".$langs->trans($durations[$object->duration_unit])." " : ''); // Mandatory period if ($object->duration_value > 0) { diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index acc5665fbc3..8176e229662 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2015-2017 Francis Appels - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW +/* Copyright (C) 2008-2009 Laurent Destailleur + * Copyright (C) 2015-2017 Francis Appels + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -589,7 +589,7 @@ class FormProduct $result = $measuringUnits->fetchAll( '', - '', + 'scale', 0, 0, $filter diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9feaf9a16ee..ac5a5640c04 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2843,8 +2843,8 @@ class Product extends CommonObject $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export, ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; } - //For MultiCompany - //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity + // For MultiCompany + // PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. $visibleWarehousesEntities = $conf->entity; @@ -2969,8 +2969,10 @@ class Product extends CommonObject $this->fk_default_bom = $obj->fk_default_bom; $this->duration = $obj->duration; - $this->duration_value = $obj->duration ? (int) (substr($obj->duration, 0, dol_strlen($obj->duration) - 1)) : 0; - $this->duration_unit = $obj->duration ? substr($obj->duration, -1) : null; + $matches = []; + preg_match('/(\d+)(\w+)/', $obj->duration, $matches); + $this->duration_value = !empty($matches[1]) ? (int) $matches[1] : 0; + $this->duration_unit = !empty($matches[2]) ? (string) $matches[2] : null; $this->canvas = $obj->canvas; $this->net_measure = $obj->net_measure; $this->net_measure_units = $obj->net_measure_units; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index bf0ddcda975..681cac1ed8b 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2013-2014 Cedric GROSS - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 Ferran Marcet - * Copyright (C) 2024 MDW +/* Copyright (C) 2007-2023 Laurent Destailleur + * Copyright (C) 2013-2014 Cedric GROSS + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Ferran Marcet + * 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 @@ -48,12 +48,19 @@ class Productbatch extends CommonObject public $fk_product_stock; + /** + * @var string batch number + */ public $batch = ''; /** * @var float Quantity */ public $qty; + + /** + * @var int warehouse ID + */ public $warehouseid; /** @@ -61,8 +68,12 @@ class Productbatch extends CommonObject */ public $fk_product; - // Properties of the lot - public $lotid; // ID in table of the details of properties of each lots + /** + * + * @var int Properties of the lot + * ID in table of the details of properties of each lots + */ + public $lotid; /** * @var int|string From 1c3f428705805e2ab07700f6e6ae2e0e3a61581e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Oct 2024 21:40:33 +0100 Subject: [PATCH 02/18] Travis php8.4 --- .travis.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 728682c1123..ad037e8fe31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,7 @@ cache: jobs: fast_finish: true allow_failures: - - php: '8.3' + - php: '8.4' include: - stage: PHP min and max if: type = push @@ -94,6 +94,9 @@ before_install: if [ "$TRAVIS_PHP_VERSION" = '8.3' ]; then sudo apt install unzip apache2 php8.3 php8.3-cli php8.3-curl php8.3-mysql php8.3-pgsql php8.3-gd php8.3-imap php8.3-intl php8.3-ldap php8.3-xml php8.3-mbstring php8.3-xml php8.3-zip libapache2-mod-php8.3 fi + if [ "$TRAVIS_PHP_VERSION" = '8.4' ]; then + sudo apt install unzip apache2 php8.4 php8.4-cli php8.4-curl php8.4-mysql php8.4-pgsql php8.4-gd php8.4-imap php8.4-intl php8.4-ldap php8.4-xml php8.4-mbstring php8.4-xml php8.4-zip libapache2-mod-php8.4 + fi - | echo Install pgsql if run is for pgsql @@ -164,7 +167,7 @@ install: squizlabs/php_codesniffer ^3 fi # phpunit 9 is required for php 8 - if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = '8.3' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = '8.3' ] || [ "$TRAVIS_PHP_VERSION" = '8.4' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then sudo composer self-update 2.4.4 composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \ php-parallel-lint/php-parallel-lint ^1.2 \ @@ -354,6 +357,13 @@ script: --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --exclude htdocs/includes/webklex --blame . fi + if [ "$TRAVIS_PHP_VERSION" = "8.4" ]; then + parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ + --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ + --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ + --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ + --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --exclude htdocs/includes/webklex --blame . + fi set +e echo @@ -373,6 +383,9 @@ script: if [ "$TRAVIS_PHP_VERSION" = "8.3" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --severity=1 ${CACHE_OPT} --runtime-set ignore_warnings_on_exit true .; fi + if [ "$TRAVIS_PHP_VERSION" = "8.4" ]; then + phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --severity=1 ${CACHE_OPT} --runtime-set ignore_warnings_on_exit true .; + fi set +e echo @@ -391,6 +404,9 @@ script: if [ "$TRAVIS_PHP_VERSION" = "8.3" ]; then var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php . fi + if [ "$TRAVIS_PHP_VERSION" = "8.4" ]; then + var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php . + fi set +e echo From 850f1ef14334655deab054d917f4062e37ecee0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Oct 2024 23:02:45 +0100 Subject: [PATCH 03/18] Update README.md --- dev/setup/pre-commit/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dev/setup/pre-commit/README.md b/dev/setup/pre-commit/README.md index 9ebe65c8a58..5dd6defd12a 100644 --- a/dev/setup/pre-commit/README.md +++ b/dev/setup/pre-commit/README.md @@ -75,14 +75,16 @@ git commit -a -m "My message" --no-verify ``` If you want to skip certain checks for whatever reason, you can set the SKIP -environment variable: +environment variable into the .git/hooks/pre-commit file: ```bash -SKIP=no-commit-to-branch git commit -a -m "My message" +export SKIP=no-commit-to-branch +``` -or +You can also switch output to text only, by setting the PRE_COMMIT_COLOR in .git/hooks/pre-commit file: -export SKIP=no-commit-to-branch # In your .bashrc or session. +```bash +export PRE_COMMIT_COLOR=never ``` There is much more you can do with pre-commit, check out its From 3baa3c85ad7cae692216765dac728d0d4edf8588 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Oct 2024 23:05:23 +0100 Subject: [PATCH 04/18] css --- htdocs/admin/ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index b9318aeb2a6..e79949b51b8 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -631,7 +631,7 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswers print ''; print ''; -print '
'; +print ''; print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition'); From e269c133ca17caffdf50f2c18095d28e64665be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 28 Oct 2024 00:28:04 +0100 Subject: [PATCH 05/18] fix phpstan (#31591) * fix phpstan * fix phpstan --- htdocs/core/class/html.formmail.class.php | 6 ++++-- phpstan.neon.dist | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 1993ee8156c..d88c24fd9b6 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Anthony Berton - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * * This program is free software; you can redistribute it and/or modify @@ -244,10 +244,12 @@ class FormMail extends Form * @var array */ public $substit = array(); + /** - * @var string[] + * @var array> */ public $substit_lines = array(); + /** * @var array{}|array{models:string,langsmodels?:string,fileinit?:string[],returnurl:string} */ diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 8bd4b4a0a94..d00dfaa653f 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -110,7 +110,6 @@ parameters: - '# (?:Common(?:DocGenerator::get(?:(?:ExtrafieldsInHtml|_substitutionarray_lines)\(\))|Object::printO(?:(?:bject|rigin)Line\(\)))) expects CommonObjectLine#' - '#Call to function array_key_exists.. with .error. .* will always evaluate to false.#' - '#function dolGetButtonAction expects array\{confirm\?: array.*confirm: true} given.#' - - '#(?:make_substitutions expects array,) string given\.#' - '#Method (?:(?:(?:(?:AgendaEve|BankAccou)nt|Bom|C(?:ategorie|ont(?:r?act))|Do(?:cument|libarrApiAcces|nation)|ExpenseReport|In(?:tervention|voice))s|KnowledgeManagement|Login|M(?:(?:ultiCurrencie|o)s)|(?:Order|P(?:artnership|ro(?:duct|posal))|Salarie)s|S(?:etup|(?:hipment|t(?:atu|ockMovement)|upplier(?:Invoice|Order|Proposal))s)|T(?:(?:ask|hirdpartie|icket)s)|W(?:arehouses|ebhook|orkstations)|Zapier)::.*) no value type specified in iterable type array#' - '#Property (?:(?:(?:(?:AgendaEven|Cont(?:r?ac))t|Do(?:libarrApiAcces|nation)|ExpenseReport|In(?:tervention|voice)|Order|Pro(?:duct|posal)|S(?:alarie|(?:hip|tockMove)ment|upplier(?:Invoice|Order|Proposal))|T(?:ask|hirdpartie|icket)|Warehouse)s|Webhook|Zapier)::.*) no value type specified in iterable type array#' - '#Property RemiseCheque::\$account_id \(int\) does not accept string\.#' From 9317a9e314f70335890fd20514b4d527dc4c9399 Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Mon, 28 Oct 2024 00:35:06 +0100 Subject: [PATCH 06/18] FIX Asset Module Update depreciation_options_edit.tpl.php (#31590) The AssetDepreciationOptionAmountBaseDepreciationHT (Base Amortissable) and 2 others fields AssetDepreciationOptionAmountBaseDeductibleHT, AssetDepreciationOptionTotalAmountLastDepreciationHT did not get their default value executed when using the following TPL: asset/tpl/depreciation_options_edit.tpl.php --- htdocs/asset/tpl/depreciation_options_edit.tpl.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/asset/tpl/depreciation_options_edit.tpl.php b/htdocs/asset/tpl/depreciation_options_edit.tpl.php index 6809a5a5437..22b7055f98e 100644 --- a/htdocs/asset/tpl/depreciation_options_edit.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_edit.tpl.php @@ -1,6 +1,7 @@ +/* Copyright (C) 2021 Open-Dsi * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 José * * 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 @@ -137,7 +138,7 @@ if (empty($reshook)) { } $value = GETPOSTISSET($html_name) ? GETPOST($html_name, $check) : $assetdepreciationoptions->$field_key; } elseif ($field_info['type'] == 'price') { - $value = GETPOSTISSET($html_name) ? price2num(GETPOST($html_name)) : ($assetdepreciationoptions->$field_key ? price2num($assetdepreciationoptions->$field_key) : (!empty($field_info['default']) ? $field_info['default'] : 0)); + $value = GETPOSTISSET($html_name) ? price2num(GETPOST($html_name)) : ($assetdepreciationoptions->$field_key ? price2num($assetdepreciationoptions->$field_key) : (!empty($field_info['default']) ? dol_eval($field_info['default'], 1) : 0)); } elseif ($field_key == 'lang') { $value = GETPOSTISSET($html_name) ? GETPOST($html_name, 'aZ09') : $assetdepreciationoptions->lang; } else { From 2ae4bdcecbac80b1276e4ebda8dc4f6a4dc80cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 28 Oct 2024 00:35:26 +0100 Subject: [PATCH 07/18] fix phpstan (#31588) --- htdocs/societe/class/client.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 6bc7a0bcdcb..090392efd70 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020 Open-Dsi - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ class Client extends Societe public $next_prev_filter = "te.client in (1,2,3)"; /** - * @var array + * @var array */ public $cacheprospectstatus = array(); From 10935d4fc4b448396cc3a6c8072f84a7aba9b4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 28 Oct 2024 00:35:59 +0100 Subject: [PATCH 08/18] add last_main_doc to bom_bom (#31586) * add last_main_doc to bom_bom * fix warning * fix warning * fix wording --- htdocs/bom/bom_card.php | 4 ++-- htdocs/core/actions_addupdatedelete.inc.php | 7 ++++--- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 1 + htdocs/install/mysql/tables/llx_bom_bom-bom.sql | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index ff00bf61fd1..5e7812d0186 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2023 Charlene Benke * Copyright (C) 2024 MDW * @@ -372,7 +372,7 @@ if (($id || $ref) && $action == 'edit') { print dol_get_fiche_end(); - print $form->buttonsSaveCancel("Create"); + print $form->buttonsSaveCancel("Update"); print ''; } diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 39ad76ff8ee..5c10a40db4e 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -1,6 +1,7 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2017-2019 Laurent Destailleur + * 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 @@ -312,7 +313,7 @@ if ($action == 'update' && !empty($permissiontoadd)) { } $object->$key = $value; - if ($val['notnull'] > 0 && $object->$key == '' && (!isset($val['default']) || is_null($val['default']))) { + if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && (!isset($val['default']) || is_null($val['default']))) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors'); } 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 ad47c2bac29..b22cd603119 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 @@ -55,6 +55,7 @@ DROP TABLE llx_contratdet_log; ALTER TABLE llx_societe_rib MODIFY COLUMN iban_prefix varchar(60); +ALTER TABLE llx_bom_bom ADD COLUMN last_main_doc varchar(255) AFTER model_pdf; -- add billable attribute to project task ALTER TABLE llx_projet_task ADD COLUMN billable smallint DEFAULT 1; diff --git a/htdocs/install/mysql/tables/llx_bom_bom-bom.sql b/htdocs/install/mysql/tables/llx_bom_bom-bom.sql index 6b2efad15bc..5545ba3d34b 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom-bom.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom-bom.sql @@ -37,6 +37,7 @@ CREATE TABLE llx_bom_bom( fk_user_valid integer, import_key varchar(14), model_pdf varchar(255), + last_main_doc varchar(255), -- relative filepath+filename of last main generated document status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; From e771bbfbe1cc29f9a299b0fea4af32b90795bdfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 28 Oct 2024 00:40:01 +0100 Subject: [PATCH 09/18] fix phpstan phpdoc (#31587) * fix phpstan phpdoc * fix phpstan phpdoc * fix phpstan phpdoc * fix phpstan phpdoc * fix phpstan phpdoc * fix phpstan phpdoc --- .../sociales/class/chargesociales.class.php | 36 +++++-- htdocs/loan/card.php | 16 ++-- htdocs/loan/class/loan.class.php | 93 ++++++++++++++++--- htdocs/loan/payment/payment.php | 4 +- 4 files changed, 116 insertions(+), 33 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index cb464d87482..7aa08227626 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -1,10 +1,10 @@ - * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2016-2024 Frédéric France - * Copyright (C) 2017 Alexandre Spangaro - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW +/* Copyright (C) 2002 Rodolphe Quiedeville + * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2016-2024 Frédéric France + * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2021 Gauthier VERDOL + * 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 @@ -39,6 +39,11 @@ class ChargeSociales extends CommonObject */ public $element = 'chargesociales'; + /** + * @var string Name of table without prefix where object is stored + * @deprecated Use $table_element + * @see $table_element + */ public $table = 'chargesociales'; /** @@ -65,18 +70,22 @@ class ChargeSociales extends CommonObject * @var string label */ public $label; + /** * @var int */ public $type; + /** * @var string */ public $type_label; + /** * @var string */ public $type_code; + /** * @var string */ @@ -86,15 +95,18 @@ class ChargeSociales extends CommonObject * @var int|string */ public $amount; + /** * @var int<0,1> */ public $paye; + /** * @deprecated Use $period * @var int|string */ public $periode; + /** * @var int|string */ @@ -102,7 +114,7 @@ class ChargeSociales extends CommonObject /** * @var string - * @deprecated Use label instead + * @deprecated Use $label instead */ public $lib; @@ -125,10 +137,12 @@ class ChargeSociales extends CommonObject * @var int ID */ public $mode_reglement_id; + /** * @var string */ public $mode_reglement_code; + /** * @var string */ @@ -154,8 +168,14 @@ class ChargeSociales extends CommonObject */ public $totalpaid; - + /** + * @var int + */ const STATUS_UNPAID = 0; + + /** + * @var int + */ const STATUS_PAID = 1; diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 2d8b5f89b2f..83e7d7b052a 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2024 MDW @@ -108,8 +108,8 @@ if (empty($reshook)) { if (!$cancel) { $datestart = dol_mktime(12, 0, 0, GETPOSTINT('startmonth'), GETPOSTINT('startday'), GETPOSTINT('startyear')); $dateend = dol_mktime(12, 0, 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear')); - $capital = price2num(GETPOST('capital')); - $rate = price2num(GETPOST('rate')); + $capital = (float) price2num(GETPOST('capital')); + $rate = (float) price2num(GETPOST('rate')); if (!$capital) { $error++; @@ -138,7 +138,7 @@ if (empty($reshook)) { $object->capital = $capital; $object->datestart = $datestart; $object->dateend = $dateend; - $object->nbterm = GETPOST('nbterm'); + $object->nbterm = (float) price2num(GETPOST('nbterm')); $object->rate = $rate; $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); @@ -183,7 +183,7 @@ if (empty($reshook)) { $datestart = dol_mktime(12, 0, 0, GETPOSTINT('startmonth'), GETPOSTINT('startday'), GETPOSTINT('startyear')); $dateend = dol_mktime(12, 0, 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear')); - $capital = price2num(GETPOST('capital')); + $capital = (float) price2num(GETPOST('capital')); if (!$capital) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); @@ -192,9 +192,9 @@ if (empty($reshook)) { $object->datestart = $datestart; $object->dateend = $dateend; $object->capital = $capital; - $object->nbterm = GETPOSTINT("nbterm"); - $object->rate = price2num(GETPOST("rate", 'alpha')); - $object->insurance_amount = price2num(GETPOSTINT('insurance_amount')); + $object->nbterm = (float) price2num(GETPOSTINT("nbterm")); + $object->rate = (float) price2num(GETPOST("rate", 'alpha')); + $object->insurance_amount = (float) price2num(GETPOSTINT('insurance_amount')); $accountancy_account_capital = GETPOST('accountancy_account_capital'); $accountancy_account_insurance = GETPOST('accountancy_account_insurance'); diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index cd1b9311166..86e236ffc92 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -1,7 +1,7 @@ - * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2024 MDW +/* Copyright (C) 2014-2018 Alexandre Spangaro + * Copyright (C) 2015-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 @@ -35,6 +35,11 @@ class Loan extends CommonObject */ public $element = 'loan'; + /** + * @var string Name of table without prefix where object is stored + * @deprecated Use $table_element + * @see $table_element + */ public $table = 'loan'; /** @@ -52,7 +57,14 @@ class Loan extends CommonObject */ public $rowid; + /** + * @var int|'' date start + */ public $datestart; + + /** + * @var int|'' + */ public $dateend; /** @@ -60,17 +72,59 @@ class Loan extends CommonObject */ public $label; + /** + * @var float capital + */ public $capital; + + /** + * @var float nb terms + */ public $nbterm; + + /** + * @var float rate + */ public $rate; + + /** + * @var int<0,1> paid + */ public $paid; + + /** + * @var string account_capital + */ public $account_capital; + + /** + * @var string account_insurance + */ public $account_insurance; + + /** + * @var string account_interest + */ public $account_interest; + + /** + * @var string accountancy_account_capital + */ public $accountancy_account_capital; + + /** + * @var string accountancy_account_insurance + */ public $accountancy_account_insurance; + + /** + * @var string accountancy_account_interest + */ public $accountancy_account_interest; + /** + * @var float insurance amount + */ public $insurance_amount; /** @@ -98,8 +152,19 @@ class Loan extends CommonObject */ public $totalpaid; + /** + * @var int + */ const STATUS_UNPAID = 0; + + /** + * @var int + */ const STATUS_PAID = 1; + + /** + * @var int + */ const STATUS_STARTED = 2; @@ -135,11 +200,11 @@ class Loan extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->datestart = $this->db->jdate($obj->datestart); - $this->dateend = $this->db->jdate($obj->dateend); - $this->label = $obj->label; - $this->capital = $obj->capital; + $this->dateend = $this->db->jdate($obj->dateend); + $this->label = $obj->label; + $this->capital = $obj->capital; $this->nbterm = $obj->nbterm; - $this->rate = $obj->rate; + $this->rate = $obj->rate; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->insurance_amount = $obj->insurance_amount; @@ -147,8 +212,8 @@ class Loan extends CommonObject $this->fk_bank = $obj->fk_bank; $this->account_capital = $obj->accountancy_account_capital; - $this->account_insurance = $obj->accountancy_account_insurance; - $this->account_interest = $obj->accountancy_account_interest; + $this->account_insurance = $obj->accountancy_account_insurance; + $this->account_interest = $obj->accountancy_account_interest; $this->fk_project = $obj->fk_project; $this->db->free($resql); @@ -601,8 +666,6 @@ class Loan extends CommonObject */ public function initAsSpecimen() { - global $user, $langs, $conf; - $now = dol_now(); // Initialise parameters @@ -610,13 +673,13 @@ class Loan extends CommonObject $this->fk_bank = 1; $this->label = 'SPECIMEN'; $this->specimen = 1; - $this->account_capital = 16; - $this->account_insurance = 616; - $this->account_interest = 518; + $this->account_capital = '16'; + $this->account_insurance = '616'; + $this->account_interest = '518'; $this->datestart = $now; $this->dateend = $now + (3600 * 24 * 365); $this->note_public = 'SPECIMEN'; - $this->capital = 20000; + $this->capital = 20000.80; $this->nbterm = 48; $this->rate = 4.3; diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index cbb1c84fce4..647198d9b5e 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2018 Frédéric France + * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2020 Maxime DEMAREST * * This program is free software; you can redistribute it and/or modify @@ -183,7 +183,7 @@ if ($action == 'add_payment' && $permissiontoadd) { if (!$error && !empty($line)) { // If payment values are modified, recalculate schedule if (($line->amount_capital != $pay_amount_capital) || ($line->amount_insurance != $pay_amount_insurance) || ($line->amount_interest != $pay_amount_interest)) { - $arr_term = loanCalcMonthlyPayment(($pay_amount_capital + $pay_amount_interest), $remaindertopay, ($loan->rate / 100), $echance, $loan->nbterm); + $arr_term = loanCalcMonthlyPayment(($pay_amount_capital + $pay_amount_interest), $remaindertopay, ($loan->rate / 100), $echance, (int) $loan->nbterm); foreach ($arr_term as $k => $v) { // Update fk_bank for current line if ($k == $echance) { From 0fa6eb329eee889c68d6da0593f6e477b021034f Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Mon, 28 Oct 2024 00:42:22 +0100 Subject: [PATCH 10/18] FIX Asset Module Update assetdepreciationoptions.class.php (#31589) Issue avoidind displaying Asset Depreciation Fields and avoiding CalculationDepreciation --- .../class/assetdepreciationoptions.class.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index 6a6bfed6ef2..27ea30d1392 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -1,6 +1,7 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2021 Open-Dsi + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Jose * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -84,9 +85,9 @@ class AssetDepreciationOptions extends CommonObject 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDurationTypeAnnual', 1 => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => 1,), 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => 1, 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'computed' => '$object->asset_depreciation_options->getRate("economic")',), 'accelerated_depreciation_option' => array('type' => 'boolean', 'label' => 'AssetDepreciationOptionAcceleratedDepreciation', 'enabled' => 1, 'position' => 60, 'column_break' => true, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => 1,), - 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => 1, 'validate' => 1,), - 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), - 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 110, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object) && get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => 1, 'validate' => 1,), + 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object) && get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object) && get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 110, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), ), ), 'accelerated_depreciation' => array( @@ -99,9 +100,9 @@ class AssetDepreciationOptions extends CommonObject 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDurationTypeAnnual', 1 => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => 1,), 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => 1, 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',), - 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 80, 'column_break' => true, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => 1, 'validate' => 1,), - 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), - 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object) && get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 80, 'column_break' => true, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => 1, 'validate' => 1,), + 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object) && get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object) && get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), ), ), ); From 0bcb54fd7e53533b4261213911c63c5cd61d271c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 28 Oct 2024 00:50:51 +0100 Subject: [PATCH 11/18] fix phpstan (#31596) * fix phpstan * fix phpstan --- htdocs/comm/propal/card.php | 4 ++-- htdocs/resource/element_resource.php | 1 + phpstan.neon.dist | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 373c3d0027c..c3d43361c81 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1395,8 +1395,8 @@ if (empty($reshook)) { } // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $tva_npr); + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); // Margin $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index f10db268366..e001bbf16ff 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -506,6 +506,7 @@ if (!$ret) { $socstatic = fetchObjectByElement($element_id, $element, $element_ref); if (is_object($socstatic)) { '@phan-var-force Societe $socstatic'; + /** @var Societe $socstatic */ $savobject = $object; $object = $socstatic; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index d00dfaa653f..49fc4f0f5a4 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -106,7 +106,6 @@ parameters: - '#(?:ldap_(?:(?:ad|bin)d|delete|err(?:no|or)|first_entry|get_(?:(?:attribut|entri)es|(?:optio|values_le)n)|mod_(?:add|del|replace)|rename|set_option|unbind)) expects LDAP\\Connection#' - '#(?:MultiCurrencies::_cleanObjectDatasRate\(\)) expects MultiCurrency#' - '# (?:pg_(?:affected_rows|f(?:etch_(?:array|object|row)|ree_result)|num_rows)) expects PgSql\\Result#' - - '# (?:Holiday::getNextNumRef\(\)|get_localtax|pdf_pagefoot|societe_prepare_head) expects Societe#' - '# (?:Common(?:DocGenerator::get(?:(?:ExtrafieldsInHtml|_substitutionarray_lines)\(\))|Object::printO(?:(?:bject|rigin)Line\(\)))) expects CommonObjectLine#' - '#Call to function array_key_exists.. with .error. .* will always evaluate to false.#' - '#function dolGetButtonAction expects array\{confirm\?: array.*confirm: true} given.#' From 475976a73320aaf805c9952704b39258272c6697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 28 Oct 2024 00:53:03 +0100 Subject: [PATCH 12/18] fix phpstan (#31597) * fix phpstan * fix phpstan * fix phpstan --- htdocs/core/lib/ecm.lib.php | 21 +++++++++---------- htdocs/ecm/index.php | 2 +- htdocs/ecm/index_auto.php | 2 +- htdocs/ecm/index_medias.php | 2 +- .../llx_ecm_directories_extrafields.key.sql | 2 +- .../llx_ecm_directories_extrafields.sql | 3 +-- .../tables/llx_ecm_files_extrafields.key.sql | 2 +- .../tables/llx_ecm_files_extrafields.sql | 3 +-- ...nowledgemanagement_knowledgerecord.lib.php | 2 +- phpstan.neon.dist | 2 +- 10 files changed, 19 insertions(+), 22 deletions(-) diff --git a/htdocs/core/lib/ecm.lib.php b/htdocs/core/lib/ecm.lib.php index fb4c0b241c0..8c421b7c26f 100644 --- a/htdocs/core/lib/ecm.lib.php +++ b/htdocs/core/lib/ecm.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2022 Frédéric France + * Copyright (C) 2022-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -28,10 +28,9 @@ /** * Prepare array with list of different ecm main dashboard * - * @param object $object Object related to tabs * @return array Array of tabs to show */ -function ecm_prepare_dasboard_head($object) +function ecm_prepare_dasboard_head() { global $langs, $conf, $user, $form; @@ -73,9 +72,9 @@ function ecm_prepare_dasboard_head($object) // 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 // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'ecm'); - complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'ecm', 'remove'); return $head; } @@ -84,9 +83,9 @@ function ecm_prepare_dasboard_head($object) /** * Prepare array with list of tabs * - * @param object $object Object related to tabs - * @param string $module Module - * @param string $section Section + * @param EcmDirectory $object Object related to tabs + * @param string $module Module + * @param string $section Section * @return array Array of tabs to show */ function ecm_prepare_head($object, $module = 'ecm', $section = '') @@ -113,12 +112,12 @@ function ecm_prepare_head($object, $module = 'ecm', $section = '') /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param EcmFiles $object Object related to tabs * @return array Array of tabs to show */ function ecm_file_prepare_head($object) { - global $langs, $conf, $user; + global $langs; $h = 0; $head = array(); @@ -149,7 +148,7 @@ function ecm_file_prepare_head($object) /** * Prepare array with list of tabs * - * @param object $object Object related to tabs + * @param EcmDirectory $object Object related to tabs * @return array Array of tabs to show */ function ecm_prepare_head_fm($object) diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 2f05b88bef3..7ec0fd4c50d 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -334,7 +334,7 @@ $moreheadjs .= ''."\n"; llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', 0, 0, $morejs, '', '', 'mod-ecm page-index'); -$head = ecm_prepare_dasboard_head(null); +$head = ecm_prepare_dasboard_head(); print dol_get_fiche_head($head, 'index', '', -1, ''); diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index e43612b658c..f5da98947f6 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -409,7 +409,7 @@ if (!getDolGlobalString('ECM_AUTO_TREE_HIDEN')) { } } -$head = ecm_prepare_dasboard_head(null); +$head = ecm_prepare_dasboard_head(); print dol_get_fiche_head($head, 'index_auto', '', -1, ''); diff --git a/htdocs/ecm/index_medias.php b/htdocs/ecm/index_medias.php index a86d5b4a233..90bb00de6dc 100644 --- a/htdocs/ecm/index_medias.php +++ b/htdocs/ecm/index_medias.php @@ -304,7 +304,7 @@ $moreheadjs .= ''."\n"; llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', 0, 0, $morejs, '', '', 'mod-ecm page-index_medias'); -$head = ecm_prepare_dasboard_head(null); +$head = ecm_prepare_dasboard_head(); print dol_get_fiche_head($head, 'index_medias', '', -1, ''); diff --git a/htdocs/install/mysql/tables/llx_ecm_directories_extrafields.key.sql b/htdocs/install/mysql/tables/llx_ecm_directories_extrafields.key.sql index 54a6552cc5e..3f704fcd65d 100644 --- a/htdocs/install/mysql/tables/llx_ecm_directories_extrafields.key.sql +++ b/htdocs/install/mysql/tables/llx_ecm_directories_extrafields.key.sql @@ -1,5 +1,5 @@ -- =================================================================== --- Copyright (C) 2020 Frédéric France +-- Copyright (C) 2020 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 diff --git a/htdocs/install/mysql/tables/llx_ecm_directories_extrafields.sql b/htdocs/install/mysql/tables/llx_ecm_directories_extrafields.sql index 8bb7d98c592..d1318232517 100644 --- a/htdocs/install/mysql/tables/llx_ecm_directories_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_ecm_directories_extrafields.sql @@ -1,5 +1,5 @@ -- ======================================================================== --- Copyright (C) 2020 Frédéric France +-- Copyright (C) 2020 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 @@ -23,4 +23,3 @@ CREATE TABLE llx_ecm_directories_extrafields fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; - diff --git a/htdocs/install/mysql/tables/llx_ecm_files_extrafields.key.sql b/htdocs/install/mysql/tables/llx_ecm_files_extrafields.key.sql index e2d8419647a..cac4f2df996 100644 --- a/htdocs/install/mysql/tables/llx_ecm_files_extrafields.key.sql +++ b/htdocs/install/mysql/tables/llx_ecm_files_extrafields.key.sql @@ -1,5 +1,5 @@ -- =================================================================== --- Copyright (C) 2020 Frédéric France +-- Copyright (C) 2020 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 diff --git a/htdocs/install/mysql/tables/llx_ecm_files_extrafields.sql b/htdocs/install/mysql/tables/llx_ecm_files_extrafields.sql index 485db3a0f72..ccd6b9c6bbf 100644 --- a/htdocs/install/mysql/tables/llx_ecm_files_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_ecm_files_extrafields.sql @@ -1,5 +1,5 @@ -- ======================================================================== --- Copyright (C) 2020 Frédéric France +-- Copyright (C) 2020 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 @@ -23,4 +23,3 @@ CREATE TABLE llx_ecm_files_extrafields fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; - diff --git a/htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php b/htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php index 9b3c22b1194..5b91a0675b6 100644 --- a/htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php +++ b/htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 49fc4f0f5a4..1c5c6e1a19a 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -101,7 +101,7 @@ parameters: - '# (Odf) constructor expects #' - '# Stripe[^ ]+::all\(\) expects #' - '#expects resource#' - - '# (?:(?:BordereauChequeBlochet::_pagefoot|(?:Order|Product|SupplierOrder)s::_cleanObjectDatas)\(\)|ecm_prepare_dasboard_head|formatObject) expects object#' + - '# (?:(?:BordereauChequeBlochet::_pagefoot|(?:Order|Product|SupplierOrder)s::_cleanObjectDatas)\(\)|formatObject) expects object#' - '#(?:ftp_(?:c(?:dup|hdir|lose)|delete|get|mkdir|put|rmdir)) expects FTP\\Connection#' - '#(?:ldap_(?:(?:ad|bin)d|delete|err(?:no|or)|first_entry|get_(?:(?:attribut|entri)es|(?:optio|values_le)n)|mod_(?:add|del|replace)|rename|set_option|unbind)) expects LDAP\\Connection#' - '#(?:MultiCurrencies::_cleanObjectDatasRate\(\)) expects MultiCurrency#' From 7f73b63c7abae772e1ebe89a1a7f4737317b18b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 28 Oct 2024 00:53:28 +0100 Subject: [PATCH 13/18] fix phpstan (#31594) --- htdocs/webservices/server_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index e066bf36cca..43ce6b9769c 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -685,7 +685,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) * Set password of an user * * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information - * @param array $shortuser Array of login/password info + * @param array{login:string,password:string} $shortuser Array of login/password info * @return mixed */ function setUserPassword($authentication, $shortuser) From 6b29450de75c2d156c0dc9fbec0b688a6120a391 Mon Sep 17 00:00:00 2001 From: Zephyriony <142790847+zephyriony@users.noreply.github.com> Date: Mon, 28 Oct 2024 01:29:29 +0100 Subject: [PATCH 14/18] NEW Authorize modification of a partially shipped order (#31423) * NEW Authorize modification of a partially shipped order * Update errors.lang * Update commonobject.class.php * Update commonobject.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/commande/card.php | 11 ++++++++++- htdocs/core/class/commonobject.class.php | 11 +++++++++++ htdocs/langs/en_US/errors.lang | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f3fb59cbbc1..24da1be5d19 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1331,6 +1331,15 @@ if (empty($reshook)) { $action = 'editline'; } + $object->loadExpeditions(); + if (isset($object->expeditions[GETPOST('lineid', 'int')])) { + if ($qty < $object->expeditions[GETPOST('lineid', 'int')]) { + setEventMessages($langs->trans('ErrorQtyOrderedLessQtyShipped'), null, 'errors'); + $error++; + $action = 'editline'; + } + } + if (!$error) { if (!$user->hasRight('margins', 'creer')) { foreach ($object->lines as &$line) { @@ -3015,7 +3024,7 @@ if ($action == 'create' && $usercancreate) { } } // Edit - if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) { + if (($object->statut == Commande::STATUS_VALIDATED || ($object->statut == Commande::STATUS_SHIPMENTONPROCESS && getDolGlobalString('EDIT_ORDER_SHIPMENT_ON_PROCESS'))) && $usercancreate) { print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=modif&token='.newToken().'&id='.$object->id, ''); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1b66f907d58..3f7786e758b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5236,6 +5236,10 @@ abstract class CommonObject } $extrafields->fetch_name_optionals_label($this->table_element_line); + if (method_exists($this, 'loadExpeditions')) { + $this->loadExpeditions(); + } + $parameters = array('num' => $num, 'dateSelector' => $dateSelector, 'seller' => $seller, 'buyer' => $buyer, 'selected' => $selected, 'table_element_line' => $this->table_element_line); $reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { @@ -5365,6 +5369,13 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook printObjectLine and printObjectSubLine. + + $qty_shipped = 0; + if (isset($this->expeditions[$line->id])) { + $qty_shipped = $this->expeditions[$line->id]; + } + $disableedit = $qty_shipped >= $line->qty; + $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { $res = 0; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 3d43e231d68..bcff62c8c80 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -343,6 +343,7 @@ ErrorEndHourIsNull=End date field cannot be empty ErrorStartHourIsNull=Start date field cannot be empty ErrorTooManyLinesToProcessPleaseUseAMoreSelectiveFilter=Too many lines to process. Please use a more selective filter. ErrorEmptyValueForQty=Quantity cannot be zero. +ErrorQtyOrderedLessQtyShipped = The quantity ordered cannot be less than the quantity shipped. # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From 7dd60bd93035cda2b1d27b8c830a95f641c0975f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Oct 2024 01:47:39 +0100 Subject: [PATCH 15/18] Position of menu --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 291f4d6f12e..4ce4aa1d797 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1191,7 +1191,6 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2); $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2); $newmenu->add('/admin/system/filecheck.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('FileCheck'), 2); - $newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('ExternalResources'), 2); } $newmenu->add('/admin/system/browser.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoBrowser'), 1); $newmenu->add('/admin/system/os.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoOS'), 1); @@ -1206,6 +1205,7 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = $newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"), 1); $newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"), 1); $newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"), 1); + $newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('ExternalResources'), 1); /* Already into menu Tools if (isModEnabled('blockedlog')) { From 34eb56ba533c4c815702670c3adcc1e0c9548b87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Oct 2024 02:04:21 +0100 Subject: [PATCH 16/18] Removed the deprecated page MAIN_HELPCENTER_DISABLELINK --- build/exe/doliwamp/index.php.install | 3 +- htdocs/admin/ihm.php | 2 + htdocs/admin/system/about.php | 12 +- htdocs/core/lib/security2.lib.php | 4 +- htdocs/core/tpl/login.tpl.php | 13 +- htdocs/support/background.png | Bin 85 -> 0 bytes htdocs/support/helpcenter.png | Bin 2212 -> 0 bytes htdocs/support/inc.php | 274 --------------------------- htdocs/support/index.php | 238 ----------------------- htdocs/support/internet.png | Bin 2808 -> 0 bytes htdocs/support/mail.png | Bin 3845 -> 0 bytes htdocs/support/pagemaster.png | Bin 1548 -> 0 bytes htdocs/support/redstar.png | Bin 509 -> 0 bytes htdocs/support/star.png | Bin 286 -> 0 bytes htdocs/support/who.png | Bin 980 -> 0 bytes 15 files changed, 10 insertions(+), 536 deletions(-) delete mode 100644 htdocs/support/background.png delete mode 100644 htdocs/support/helpcenter.png delete mode 100644 htdocs/support/inc.php delete mode 100644 htdocs/support/index.php delete mode 100644 htdocs/support/internet.png delete mode 100644 htdocs/support/mail.png delete mode 100644 htdocs/support/pagemaster.png delete mode 100644 htdocs/support/redstar.png delete mode 100644 htdocs/support/star.png delete mode 100644 htdocs/support/who.png diff --git a/build/exe/doliwamp/index.php.install b/build/exe/doliwamp/index.php.install index 2ccd4a5ff66..ef0d7e899d7 100644 --- a/build/exe/doliwamp/index.php.install +++ b/build/exe/doliwamp/index.php.install @@ -562,12 +562,11 @@ a:hover { diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 30204770698..5341f712f32 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -666,10 +666,12 @@ if ($mode == 'login') { print ''; // Hide helpcenter link on login page + /* print '' . $langs->trans("DisableLinkToHelpCenter") . ''; print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '', 'login'); print ''; print ''; + */ // Message on login page $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user')); diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index ebe0549a902..c821372ae71 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -146,16 +146,6 @@ print ''; print '
'; -print '
'; -print $langs->trans("HelpCenter").':'; -print '
    '; -print '
  • '; -//print $langs->trans("SeeWikiPage",'http://wiki.dolibarr.org/index.php/List_of_OpenSource_Software_companies_and_freelancers'); -print ''.$langs->trans("HelpCenter").''; -print '
  • '; -print '
'; -print '
'; - print '
'; print $langs->trans("Foundation").':'; @@ -176,7 +166,7 @@ print $langs->trans("SocialNetworks").':'; print ''; print '
'; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index e6592e3e841..627a6ac4634 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -281,12 +281,12 @@ if (!function_exists('dol_loginfunction')) { // Extra link $forgetpasslink = 0; $helpcenterlink = 0; - if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK') || !getDolGlobalString('MAIN_HELPCENTER_DISABLELINK')) { + if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK') || getDolGlobalString('MAIN_HELPCENTER_LINKTOUSE')) { if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) { $forgetpasslink = 1; } - if (!getDolGlobalString('MAIN_HELPCENTER_DISABLELINK')) { + if (getDolGlobalString('MAIN_HELPCENTER_LINKTOUSE')) { $helpcenterlink = 1; } } diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index f6dd6b91659..0dad08cad4e 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011-2022 Laurent Destailleur +/* Copyright (C) 2009-2015 Regis Houssin + * Copyright (C) 2011-2022 Laurent Destailleur * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -48,7 +48,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @phan-var-force int<0,1> $dol_optimize_smallscreen @phan-var-force int<0,1> $dol_use_jmobile @phan-var-force string $focus_element -@phan-var-force string $helpcenterlink @phan-var-force string $login @phan-var-force string $main_authentication @phan-var-force string $main_home @@ -58,7 +57,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @phan-var-force string $urllogo @phan-var-force int<0,1> $forgetpasslink -@phan-var-force int<0,1> $helpcenterlink '; @@ -150,6 +148,7 @@ if (getDolGlobalInt('MAIN_MODULE_OPENIDCONNECT', 0) > 0 && isset($conf->file->ma top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); +$helpcenterlink = getDolGlobalString('MAIN_HELPCENTER_LINKTOUSE'); $colorbackhmenu1 = '60,70,100'; // topmenu if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) { @@ -369,11 +368,7 @@ if ($forgetpasslink || $helpcenterlink) { } if ($helpcenterlink) { - $url = DOL_URL_ROOT.'/support/index.php'.$moreparam; - if (getDolGlobalString('MAIN_HELPCENTER_LINKTOUSE')) { - $url = getDolGlobalString('MAIN_HELPCENTER_LINKTOUSE'); - } - echo ''; + echo ''; echo $langs->trans('NeedHelpCenter'); echo ''; } diff --git a/htdocs/support/background.png b/htdocs/support/background.png deleted file mode 100644 index 4d20deebd7bd090d579e4c8626566ce9e310aee4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 85 zcmeAS@N?(olHy`uVBq!ia0vp^j6j^i!2~2v_?A;>KHs-{an^LB{Ts5Azc=5 diff --git a/htdocs/support/helpcenter.png b/htdocs/support/helpcenter.png deleted file mode 100644 index 7233060aafda95cca32a5e7ba321e55664a86a43..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2212 zcmV;V2wV4wP)wA9nY#>KInn|hd*bdHQ^mXvOuoP4UO z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x{+(wio^2@+}sNDK#NnXUR|`?8Yu>V5=rxvav4^W z5u$iS8IGU;@-(tIpYn=IEDsRL7)j(3tRm#b@l|0=gaRNhPZMidU4zvERwr)6`fbVv zgl;5O8#S=DsTpekBv0GYO1offz!1-ccAC{e5=(QTu5BAeXLNQc0Kl@l7P|sqq6iyk zP7krvky@%3QLA?(CnxCv`udqd4#410&axuJR?w_rk`Oj9RS}{XxfFvWjdqV!_afCW zzGGsdPg(@uNt!c7kZZUaOwaTe7th-9<`gL3JWMa3m2q)iS_g{;nss^|v6f^L3>_}K zc6~x{V`gmZW?r$)A{Lb=N#N^8Gj2H$2($gv-QFuQ3n~?;+5=d1_9)>4)pscx012_R-@2ktYDE+9SN~I+=t|)Ea`1Pbbln ze8fgX4^N|y@uEQ^lZsu-$8Wmd@Jw!Q-f%>u>G{(#!Ba4GJ|GEm#)fUkt`~jBUK)Az z`pwMQx16&xTA37T_(;MB$NMMwq^2mS%o~?R*`ys~m>My_; zEbQ$qv;vOFQrMqv-+2oA+V|wrW%aiXp zUpSBE-#_KvWc2s0rxf+HD+ay$Kf&h9SFT)5aE^%ZzLuPP{l?8U23+8lRSes0krfeW zU~k%;D|g*juJo6_cOM8IJY>KFavtsFKnJW+X_p^M3$gmeJ-Kt|>9glAUgFmODve(e z69~Aze&hLe@7{Os-(LZP4>%2Ia;e1zTuy)dRCh4?^A#xgf?fBAmtXsmI - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Sebastien DiCintio - * Copyright (C) 2007-2012 Laurent Destailleur - * - * 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 . - */ - -/** - * \file htdocs/support/inc.php - * \ingroup core - * \brief File that define environment for support pages - */ - -// Define DOL_DOCUMENT_ROOT -if (!defined('DOL_DOCUMENT_ROOT')) { - define('DOL_DOCUMENT_ROOT', '..'); -} - -require_once DOL_DOCUMENT_ROOT.'/core/class/conf.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - -$conf = new Conf(); - -// Force $_REQUEST["logtohtml"] -$_REQUEST["logtohtml"] = 1; - -// Correction PHP_SELF (ex pour apache via caudium) car PHP_SELF doit valoir URL relative -// et non path absolu. -if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"]) { - $_SERVER["PHP_SELF"] = $_SERVER["DOCUMENT_URI"]; -} - - -$includeconferror = ''; - -// Define vars -$conffiletoshowshort = "conf.php"; -// Define localization of conf file -$conffile = "../conf/conf.php"; -$conffiletoshow = "htdocs/conf/conf.php"; -// For debian/redhat like systems -/* -if (!file_exists($conffile)) { - $conffile = "/etc/dolibarr/conf.php"; - $conffiletoshow = "/etc/dolibarr/conf.php"; -} -*/ - -// Load conf file if it is already defined -if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) { // Test on filesize is to ensure that conf file is more that an empty template with just global->MAIN_LOGTOHTML = 1; - -// Define prefix -if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) { - $dolibarr_main_db_prefix = 'llx_'; -} -define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : '')); - -define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir -define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : '')); -define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root -$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* -$suburi = strstr($uri, '/'); // $suburi contains url without domain -if ($suburi == '/') { - $suburi = ''; // If $suburi is /, it is now '' -} -define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) - -if (empty($character_set_client)) { - $character_set_client = "UTF-8"; -} -$conf->file->character_set_client = strtoupper($character_set_client); -if (empty($dolibarr_main_db_character_set)) { - $dolibarr_main_db_character_set = ($conf->db->type == 'mysqli' ? 'utf8' : ''); // Old installation -} -$conf->db->character_set = $dolibarr_main_db_character_set; -if (empty($dolibarr_main_db_collation)) { - $dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : ''); // Old installation -} -$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation; -if (empty($dolibarr_main_db_encryption)) { - $dolibarr_main_db_encryption = 0; -} -$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; -if (empty($dolibarr_main_db_cryptkey)) { - $dolibarr_main_db_cryptkey = ''; -} -$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; - -if (empty($conf->db->user)) { - $conf->db->user = ''; -} - - -// Defini object langs -$langs = new Translate('..', $conf); -if (GETPOST('lang', 'aZ09')) { - $langs->setDefaultLang(GETPOST('lang', 'aZ09')); -} else { - $langs->setDefaultLang('auto'); -} - - -/** - * Load conf file (file must exists) - * - * @param string $dolibarr_main_document_root Root directory of Dolibarr bin files - * @return int Return integer <0 if KO, >0 if OK - */ -function loadconf($dolibarr_main_document_root) -{ - global $conf; - global $dolibarr_main_db_type; - global $dolibarr_main_db_host; - global $dolibarr_main_db_port; - global $dolibarr_main_db_name; - global $dolibarr_main_db_user; - global $dolibarr_main_db_pass; - global $character_set_client; - - $return = 1; - if (!class_exists('Conf')) { - $return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; - } - if (!$return) { - return -1; - } - - $conf = new Conf(); - $conf->db->type = trim($dolibarr_main_db_type); - $conf->db->host = trim($dolibarr_main_db_host); - $conf->db->port = trim($dolibarr_main_db_port); - $conf->db->name = trim($dolibarr_main_db_name); - $conf->db->user = trim($dolibarr_main_db_user); - $conf->db->pass = trim($dolibarr_main_db_pass); - - if (empty($conf->db->dolibarr_main_db_collation)) { - $conf->db->dolibarr_main_db_collation = 'utf8_unicode_ci'; - } - - return 1; -} - - -/** - * Show HTML header - * - * @param string $soutitre Title - * @param string $next Next - * @param string $action Action code - * @return void - */ -function pHeader($soutitre, $next, $action = 'none') -{ - global $conf, $langs; - - $langs->loadLangs(array("main", "admin")); - - // On force contenu dans format sortie - header("Content-type: text/html; charset=".$conf->file->character_set_client); - - // Security options - header("X-Content-Type-Options: nosniff"); - header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks) - - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''.$langs->trans("DolibarrHelpCenter").''."\n"; - print ''."\n"; - - print ''."\n"; - - print '
'; - print 'logohelpcenter

'; - print ''.$soutitre.''."\n"; - print '

'; -} - -/** - * Print HTML footer - * - * @param integer $nonext No button "Next step" - * @param string $setuplang Language code - * @return void - */ -function pFooter($nonext = 0, $setuplang = '') -{ - global $langs; - $langs->load("main"); - $langs->load("admin"); - - print ''."\n"; - print ''."\n"; -} diff --git a/htdocs/support/index.php b/htdocs/support/index.php deleted file mode 100644 index 7956389ef6a..00000000000 --- a/htdocs/support/index.php +++ /dev/null @@ -1,238 +0,0 @@ - - * Copyright (C) 2008-2012 Regis Houssin - * Copyright (C) 2012 Juanjo Menent - * add german links 2020 Udo Tamm - * - * 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 . - */ - -/** - * \file htdocs/support/index.php - * \ingroup support - * \brief Provide an Online Help support - */ - - -// Use its own include to not share the include of Dolibarr -// This is a standalone feature with no information from Dolibarr to show -// and no database access to do. -include_once 'inc.php'; - -$uri = preg_replace('/^http(s?):\/\//i', '', $dolibarr_main_url_root); -$pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine -if ($pos == '/') { - $pos = ''; // si $pos vaut /, on le met a '' -} -if (!defined('DOL_URL_ROOT')) { - define('DOL_URL_ROOT', $pos); // URL racine relative -} - -$langs->loadLangs(array("other", "help")); - - -/* - * View - */ - -pHeader($langs->trans("DolibarrHelpCenter"), $_SERVER["PHP_SELF"]); - -print '
'.$langs->trans("HelpCenterDesc1")."
\n"; -print $langs->trans("HelpCenterDesc2")."

\n"; - -print '
'; - -$homeurl = DOL_URL_ROOT.'/'; -if (GETPOST('dol_hide_toptmenu')) { - $homeurl .= (strpos($homeurl, '?') === false ? '?' : '&').'dol_hide_toptmenu=1'; -} -if (GETPOST('dol_hide_leftmenu')) { - $homeurl .= (strpos($homeurl, '?') === false ? '?' : '&').'dol_hide_leftmenu=1'; -} -if (GETPOST('dol_no_mouse_hover')) { - $homeurl .= (strpos($homeurl, '?') === false ? '?' : '&').'dol_no_mouse_hover=1'; -} -if (GETPOST('dol_use_jmobile')) { - $homeurl .= (strpos($homeurl, '?') === false ? '?' : '&').'dol_use_jmobile=1'; -} -// If a global var $dolibarr_main_url_root exists, install is done and complete, we can show the link to home page -if (!empty($dolibarr_main_url_root)) { - print $langs->trans("ToGoBackToDolibarr", $homeurl); -} - -print '

'; - -$style1 = 'color: #333344; font-size: 16px; font-weight: bold'; -$style2 = 'color: #5D4455; font-weight: bold;'; - -print "\n"; -print '
'; -print "\n"; - -// Forum/wiki support -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''."\n"; -print "\n"; - -print '
'; - -// EMail support -print ''; -print ''; -print ''; -print ''; -$urlwiki = 'https://partners.dolibarr.org'; -print ''; -print ''; -print ''."\n"; - - -print '
'; - - -// Other support -print ''; -print ''; -print ''; -print ''; -$urlwiki = 'https://partners.dolibarr.org'; -print ''; -print ''; -print ''."\n"; -print "\n"; - - -print '
'; -print '
'; - - -pFooter(); diff --git a/htdocs/support/internet.png b/htdocs/support/internet.png deleted file mode 100644 index 9f923811baf5cb07b2b64015f51b96b10dd12b94..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2808 zcmV(a)!!@9P)v#Zn7)A;!H^Yin|%EhdxrPtWi?eFl})zqV# zmV$Y6%)`2*nd|+uPf$rK4$LTrV&#YGq@~!L;7q;p*zy^PA||iP^=Ib8~aGwYqe1Ys16C%gf8QwwaHJSgoL8!meZB z%!2FVo9g1F@a3fB*{5V;Rcvf?ySuxyva^|>vU-J@W_5n2rirbwpR}!!!n>8%%%_`< zi(Fk{x3|QNk&dRQsB3|vR&<@Tsf4+)hHGnTSX4)Ka%E^_Qa3w6QdVHq)!LJjldP+( zz`(txtG$Velv8VzV|t&Sp{B~rvf$L0^6HvRQCER{ZFFi^QB6iYLQE|*IC^}8e}I5? zba{k+frN#MqoSkL+u?|pvr1-@a)hRPd1`BFV@69;#l^~mgo9gKTVrEmdwYA#%+Y0i zr9xeg+SR9LXj6uQZDna?9wss5BtZ*XryK0IY*X{D8DoR*wtXlxZ48Yd_xJwZ7O6A=ar z3oR`$W?)FArm3Q$w5g@2VpcpE9wCj5w3?c<9U&zQ4iKTAy{4wRt*x`2oWZWGy|}f# zs;a|UP&q+8G&eXmH8U(QE+<1jEyBLRd2@MVUSZnT*oKOVEJr+T00001bW%=J06^y0 zW&i*Orb$FWRCocrQG=T6KoqXxqz-GWZQHhO+qP}ne#C2=JD*19C+|5HUmz3#e>@Ee zAs9iiKb*!11cG3(a%odhb);6|w_70ASg@f!z!XVq$&c;u8|Bl9KhVDXD2c=+0!3o{^cAZIPAbK(Z3b zWaI6flbaWp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!ty{Mizya2(RVx;Pl!=l&pT__g z-@ku! z#`5LMrCz;y6siDLovxGd2p|G|l9M)&J#pd$WMs;eDWpn(JhjB?GY(TQtloC`sg4=w z8B(T9IZYHy$iz%=8d!0O-v zR6mn47&4HB^xCy+W&Qf~vT4&M(nwmgXdwXM6tAU??FIr_VM3oHojP^m?u-Cw)20o7 zM=w=>D#xj95`@*6(`N81;*1db5GzqhZH9>Zo`}q6p$%XCSO3TSh4slDdm%gxC{P{ z(XddvcI{fPW9xb#Y0{+2*rvz?FfqaB3^*2P)46kJpG<}f86X@WZ$59GDrP~t96Wf? zh%zsQ>aRRGf9~8lY0{*LsL9y;1Qt&=?9iXvnSfPvgOLevg#d~ZfI^%V{IX zePDiXD{thP%O%h1yX47$=#mGOD_3R*N|=DHkd27|Y!4EpN|h3Tx6?;CqZM%msN4F_%2M6{D1aTWFDZ_76(=bl^&vAVGp7Y&Q>!j*YUiR-BOIe!FJP8Uf5f zEfEosXXOFnV~QFzYP_SAyBK#9a2!HW2!Kf75>N0M#^uhP8()(T0NU{zO7~;;B`-I!)3`O~+Zdb{v>H@K} zEYooP6XMfHw`*s#OyMtIpMw3zE}OvYX)wpf6oeE3AhMx1kgcZgXDR11rU%0bgMaX@rg5CS~7FYy01 zT8Z~{%nZ*(ym;}haDoDR6Tp_Uo%Yr&I$ZMDU4w4cP=w}eX@(SJ`<;g-I| z_($JV-_Q%sEp@Xyy1KXcU4{IkUGYu*++B@dG~VO6&h!7TG0FRnh!whv#tqq7LfR>s z+R))bf09BYB@z1Bey8p|}sXp|4l9V7e;$!P0yRP%^r00000NkvXX Hu0mjfUs_UW diff --git a/htdocs/support/pagemaster.png b/htdocs/support/pagemaster.png deleted file mode 100644 index f9e6b2b1ea3687d18709d0ce4af99fdf0e810eba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1548 zcmV+n2J`ueP)?dIm@y1KiZoSd7Vy1l;9uCc{tX^BQjYBf1xl$4as&CSox&%eLF z#l^*zn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#zv(YSv{ArJx0Ls55fZRf!i<@?tZg3#u|{d<52#Mr(hbL0H0w(JN5j#o?y$qFrlY%Qb(8O=nPCtF)Ucq!1Kr`b zPwxaOTHWHiwj~&dHgpFptMa;g_Be{76PsrNMb|W^+&X;-h?X@ZEi3jqv~~fCqAiok kATEHTy$h!UK~#7Fgw%tdE7=kU@cNV9Tcr!95!+)=GS{|muC29g+qP|6AFPe+rn@uS zJ;8iq{Q8`#N*dbv{>yhBzv0|7&c5)*M_>Q!YnaUocU^e$jwPd|Os3E`vADMP+=rl> zTTkAyXtXaMGnt6k2!Y<0BlY35HJJFj-gmfaL1`#APyX+ch@7nDP`eUXr6DuYW zW^M!}vE)8z=fZWBf`!CH{4e?s=T3$;&RkFmE1pIkX7yHRarRVF5it{s%v^yZ+hL~j z=cg2k*nyT6SVnILzq?lC?M@=uUu9xK`({H-oB@7k3a;8#lv5hB^_ zV>2@%yLncN!RMjH5fRZeY6zTY3y`M}9(u@M!n}|OYv^n^GPZ2Ryu6$w;uOK8N$*|Y zb?3aGvm+FYtiAoiAHV|>MP-j5xsdNLec_+xa!^d>q}TCbf%cx3mz}7j0t%l z{eSRP>i=D`x3SKL6I{6r9f3b^CL>8w* zY%F{VysAl_uC5`Fy61)yPhxWWpp5+4;Inr$W+>t5fTr)*^nYg3kcmi)^jetV)+0;$ zb75h3P8^67InZo?#1`M#?gX>FY?4b=Zg}mA0+LNa6W2mJSB-@j(cV$?^1tg}*PPLy z*?R=qy0#KgWW&(G&;EL59@_yUv+fCK>*jee#pFn?IyB`hpb~R0hxX3xGpPv?iJU;8 z1|6&lYRx~jC_D+>hLz5T_MTa6QKR$j3e677&|T0$Ek+I};Re*i Date: Mon, 28 Oct 2024 03:06:35 +0100 Subject: [PATCH 17/18] Work on generic captcha architecture --- htdocs/admin/security_captcha.php | 68 +++++++++++++++-------- htdocs/core/lib/security2.lib.php | 8 ++- htdocs/core/tpl/login.tpl.php | 21 ++++++- htdocs/core/tpl/passwordforgotten.tpl.php | 26 +++++++-- htdocs/core/tpl/passwordreset.tpl.php | 24 ++++++-- 5 files changed, 112 insertions(+), 35 deletions(-) diff --git a/htdocs/admin/security_captcha.php b/htdocs/admin/security_captcha.php index 84b3faf29f2..18a9e51e240 100644 --- a/htdocs/admin/security_captcha.php +++ b/htdocs/admin/security_captcha.php @@ -105,7 +105,7 @@ print "
\n"; // Load array with all captcha generation modules -$dir = "../core/modules/security/captcha"; +$dir = DOL_DOCUMENT_ROOT."/core/modules/security/captcha"; clearstatcache(); $handle = opendir($dir); $i = 1; @@ -142,23 +142,41 @@ print '
'; print $langs->trans("UseCaptchaCode"); -if (function_exists("imagecreatefrompng")) { - if (!empty($conf->use_javascript_ajax)) { - print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA', array(), null, 0, 0, 1); - } else { - if (!getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; - } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; - } - } +if (!empty($conf->use_javascript_ajax)) { + print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA', array(), null, 0, 0, 1); } else { - $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning'); - print $desc; + if (!getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } else { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } } +if (isModEnabled('ticket')) { + print '
'; + print $langs->trans("TicketUseCaptchaCodeHelp"); + if (!empty($conf->use_javascript_ajax)) { + print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA_TICKET', array(), null, 0, 0, 1); + } else { + if (!getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } else { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } + } +} +$showavailablecaptcha = 0; if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { + $showavailablecaptcha = 1; +} +if (isModEnabled('ticket') && getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) { + $showavailablecaptcha = 1; +} + +$selectedcaptcha = getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_HANDLER', 'standard'); + +if ($showavailablecaptcha) { print '
'; print '
'; print '
'; @@ -171,13 +189,6 @@ if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { print ''.$langs->trans("Status").''; print ''; - $arrayofcaptcha = array( - 'standard' => array('label' => 'Standard', 'picto' => 'ee') - ); - //$arrayofcaptcha['google'] = array('label' => 'Google'); - - $selectedcaptcha = 'standard'; - // Loop on each available captcha foreach ($arrayhandler as $key => $module) { print ''; @@ -192,9 +203,22 @@ if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { print $module->getExample().'
'; print ''; print ''; - if ($key == $selectedcaptcha) { - print 'On'; + + if (function_exists("imagecreatefrompng")) { + if ($key != $selectedcaptcha) { + print ''; + } else { + print ''; + } + } else { + $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning'); + print $desc; } + print ''; print ''; } diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 627a6ac4634..7a6b9c14f72 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -273,9 +273,11 @@ if (!function_exists('dol_loginfunction')) { // Security graphical code $captcha = 0; $captcha_refresh = ''; - if (function_exists("imagecreatefrompng") && getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { - $captcha = 1; - $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); + if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { + $captcha = getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_HANDLER', 'standard'); + if ($captcha == 'standard') { + $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); + } } // Extra link diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 0dad08cad4e..94ff4126872 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -41,6 +41,7 @@ if ($size > 10000) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; ' +@phan-var-force string $captcha @phan-var-force string $captcha_refresh @phan-var-force int<0,1> $dol_hide_leftmenu @phan-var-force int<0,1> $dol_hide_topmenu @@ -278,7 +279,22 @@ if (!empty($captcha)) { } else { $php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog'); } - // TODO: provide accessible captcha variants?> + + $classfile = DOL_DOCUMENT_ROOT."/core/modules/security/captcha/modCaptcha".ucfirst($captcha).'.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $captchaobj = null; + if (dol_is_file($classfile)) { + // Charging the numbering class + $classname = "modCaptcha".ucfirst($captcha); + require_once $classfile; + + $captchaobj = new $classname($db, $conf, $langs, $user); + } + + if (is_object($captchaobj) && method_exists($captchaobj, 'getCaptchaCodeForForm')) { + // TODO: get this code using a method of captcha + } else { + ?>
@@ -293,7 +309,8 @@ if (!empty($captcha)) {
- - * Copyright (C) 2011-2013 Laurent Destailleur +/* Copyright (C) 2009-2010 Regis Houssin + * Copyright (C) 2011-2024 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -17,6 +17,8 @@ * along with this program. If not, see . */ +// Page to ask email for password forgotten + if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', 1); } @@ -164,7 +166,22 @@ if (!empty($captcha)) { } else { $php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog'); } - // TODO: provide accessible captcha variants?> + + $classfile = DOL_DOCUMENT_ROOT."/core/modules/security/captcha/modCaptcha".ucfirst($captcha).'.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $captchaobj = null; + if (dol_is_file($classfile)) { + // Charging the numbering class + $classname = "modCaptcha".ucfirst($captcha); + require_once $classfile; + + $captchaobj = new $classname($db, $conf, $langs, $user); + } + + if (is_object($captchaobj) && method_exists($captchaobj, 'getCaptchaCodeForForm')) { + // TODO: get this code using a method of captcha + } else { + ?>
@@ -179,7 +196,8 @@ if (!empty($captcha)) {
- - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2022 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 @@ -205,7 +205,22 @@ if (!empty($captcha)) { } else { $php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog'); } - // TODO: provide accessible captcha variants?> + + $classfile = DOL_DOCUMENT_ROOT."/core/modules/security/captcha/modCaptcha".ucfirst($captcha).'.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $captchaobj = null; + if (dol_is_file($classfile)) { + // Charging the numbering class + $classname = "modCaptcha".ucfirst($captcha); + require_once $classfile; + + $captchaobj = new $classname($db, $conf, $langs, $user); + } + + if (is_object($captchaobj) && method_exists($captchaobj, 'getCaptchaCodeForForm')) { + // TODO: get this code using a method of captcha + } else { + ?>
@@ -220,7 +235,8 @@ if (!empty($captcha)) {
- Date: Mon, 28 Oct 2024 03:30:44 +0100 Subject: [PATCH 18/18] Work on generic captcha architecture --- htdocs/core/class/html.formticket.class.php | 37 ++++++++++++++++----- htdocs/core/lib/security2.lib.php | 6 +--- htdocs/core/tpl/login.tpl.php | 6 ++-- htdocs/core/tpl/passwordforgotten.tpl.php | 5 +-- htdocs/core/tpl/passwordreset.tpl.php | 6 ++-- htdocs/user/passwordforgotten.php | 6 ++-- 6 files changed, 42 insertions(+), 24 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 4a55e8ec7f5..5f07cc83a50 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -569,16 +569,37 @@ class FormTicket $doleditor->Create(); print ''; + $captcha = ''; if ($public && getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) { + print ''; + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').''; - print ''; + $captcha = getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_HANDLER', 'standard'); + + $classfile = DOL_DOCUMENT_ROOT."/core/modules/security/captcha/modCaptcha".ucfirst($captcha).'.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $captchaobj = null; + if (dol_is_file($classfile)) { + // Charging the numbering class + $classname = "modCaptcha".ucfirst($captcha); + require_once $classfile; + + $captchaobj = new $classname($this->db, $conf, $langs, $user); + } + + if (is_object($captchaobj) && method_exists($captchaobj, 'getCaptchaCodeForForm')) { + // TODO: get this code using a method of captcha + } else { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').''; + print ''; + } + print ''; } diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 7a6b9c14f72..e63dca604f3 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -271,13 +271,9 @@ if (!function_exists('dol_loginfunction')) { } // Security graphical code - $captcha = 0; - $captcha_refresh = ''; + $captcha = ''; if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { $captcha = getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_HANDLER', 'standard'); - if ($captcha == 'standard') { - $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); - } } // Extra link diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 94ff4126872..90c19f3b6c9 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -42,7 +42,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; ' @phan-var-force string $captcha -@phan-var-force string $captcha_refresh @phan-var-force int<0,1> $dol_hide_leftmenu @phan-var-force int<0,1> $dol_hide_topmenu @phan-var-force int<0,1> $dol_no_mouse_hover @@ -305,10 +304,11 @@ if (!empty($captcha)) { - + trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); ?> -
+ + - + trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); ?> - + + - + trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); ?> - + + logo_small) && is_readable($conf->mycompany->dir_output.'/log } // Security graphical code -if (function_exists("imagecreatefrompng") && !$disabled) { - $captcha = 1; - $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); +$captcha = ''; +if (!$disabled) { + $captcha = getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_HANDLER', 'standard'); } // Execute hook getPasswordForgottenPageOptions (for table)