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 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/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 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/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/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 '
'; print $langs->trans("Foundation").':'; @@ -176,7 +166,7 @@ print $langs->trans("SocialNetworks").':'; print ''; print '
'; 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'); 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,), ), ), ); 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 { 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/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/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/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/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/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/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/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/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/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index e6592e3e841..e63dca604f3 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -271,22 +271,20 @@ 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"'); + $captcha = ''; + if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { + $captcha = getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_HANDLER', 'standard'); } // 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/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')) { diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index f6dd6b91659..90c19f3b6c9 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 @@ -41,14 +41,13 @@ if ($size > 10000) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; ' -@phan-var-force string $captcha_refresh +@phan-var-force string $captcha @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 @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)) { @@ -279,7 +278,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 { + ?>
@@ -290,11 +304,13 @@ if (!empty($captcha)) { - + trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); ?> -
- +
+ '; + echo ''; echo $langs->trans('NeedHelpCenter'); echo ''; } diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index aa30758f3c5..ef1b2b1aec2 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -1,6 +1,6 @@ - * 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 { + ?>
@@ -175,11 +192,13 @@ if (!empty($captcha)) { - + trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); ?> -
- + + - * 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 @@ -196,7 +196,6 @@ if (!empty($disablenofollow)) { + + $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 { + ?>
@@ -216,11 +230,13 @@ if (!empty($captcha)) { - + trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); ?> -
- + + '."\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/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; 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/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. 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) { 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 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/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(); diff --git a/htdocs/support/background.png b/htdocs/support/background.png deleted file mode 100644 index 4d20deebd7b..00000000000 Binary files a/htdocs/support/background.png and /dev/null differ diff --git a/htdocs/support/helpcenter.png b/htdocs/support/helpcenter.png deleted file mode 100644 index 7233060aafd..00000000000 Binary files a/htdocs/support/helpcenter.png and /dev/null differ diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php deleted file mode 100644 index 85a2595d1cd..00000000000 --- a/htdocs/support/inc.php +++ /dev/null @@ -1,274 +0,0 @@ - - * 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 9f923811baf..00000000000 Binary files a/htdocs/support/internet.png and /dev/null differ diff --git a/htdocs/support/mail.png b/htdocs/support/mail.png deleted file mode 100644 index 95f3a5a050a..00000000000 Binary files a/htdocs/support/mail.png and /dev/null differ diff --git a/htdocs/support/pagemaster.png b/htdocs/support/pagemaster.png deleted file mode 100644 index f9e6b2b1ea3..00000000000 Binary files a/htdocs/support/pagemaster.png and /dev/null differ diff --git a/htdocs/support/redstar.png b/htdocs/support/redstar.png deleted file mode 100644 index b1fa6a0a8ed..00000000000 Binary files a/htdocs/support/redstar.png and /dev/null differ diff --git a/htdocs/support/star.png b/htdocs/support/star.png deleted file mode 100644 index 4d319e9e3b3..00000000000 Binary files a/htdocs/support/star.png and /dev/null differ diff --git a/htdocs/support/who.png b/htdocs/support/who.png deleted file mode 100644 index 34c6b87ff94..00000000000 Binary files a/htdocs/support/who.png and /dev/null differ diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 646886f579d..e124242c9fb 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -234,9 +234,9 @@ if (!empty($mysoc->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) 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) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 8bd4b4a0a94..1c5c6e1a19a 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -101,16 +101,14 @@ 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#' - '# (?: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.#' - - '#(?: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\.#'