diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c2b29ef90af9d..01430ba721293 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,7 +43,7 @@ repos: - id: end-of-file-fixer # Check that there are no completely merged file conflicts - id: check-merge-conflict - stages: [pre-commit, pre-rebase, pre-commit, pre-merge-commit] + stages: [commit, pre-rebase, pre-commit, pre-merge-commit] # Check that files with shebangs have the executable bit set (in git) - id: check-executables-have-shebangs # Check that shell files are executables @@ -252,7 +252,7 @@ repos: rev: 3.1.0 hooks: - id: sqlfluff-lint - stages: [pre-commit, manual] # manual needed for ci + stages: [commit, manual] # manual needed for ci exclude: (?x)^ (dev/initdemo/mysqldump_.*\.sql |htdocs/core/menus/init_menu_auguria\.sql diff --git a/.travis.yml b/.travis.yml index 162e0480659b6..ad037e8fe3121 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 @@ -47,16 +47,16 @@ jobs: - TRAVIS_PHP_VERSION=7.1 - stage: PHP min and max if: type = pull_request OR type = push - php: '8.2' + php: '8.3' env: - DB=mysql - - TRAVIS_PHP_VERSION=8.2 - - stage: PHP 8.3 + - TRAVIS_PHP_VERSION=8.3 + - stage: PHP 8.4 if: type = push AND branch = develop - php: '8.3' + php: '8.4' env: - DB=mysql - - TRAVIS_PHP_VERSION=8.3 + - TRAVIS_PHP_VERSION=8.4 notifications: email: @@ -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/ChangeLog b/ChangeLog index 4fc1a6136811f..e205c90cda546 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ The following changes may create regressions for some external modules, but were be set (not allowed by PHP 8.2). A module can already return an array with key 'no_button_delete', 'no_button_edit', 'no_button_copy' for same purpose. * The old function dol_bc($var, $moreclass = '') has been removed. If you called it, just stop to call it. * The trigger code CATEGORY_LINK and CATEGORY_UNLINK has been replaced with code CATEGORY_MODIFY. You can read ->context['linkto'] or ->context['unlinkoff' to detect we want to make a link or unlink. +* The property ->domiciliation and ->propio on bank accounts has been deprecated and replaced with property ->address and ->owner_name ***** ChangeLog for 20.0.1 compared to 20.0.0 ***** diff --git a/build/exe/doliwamp/index.php.install b/build/exe/doliwamp/index.php.install index 2ccd4a5ff660c..ef0d7e899d706 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 9ebe65c8a58ae..5dd6defd12a43 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/dev/tools/codespell/codespell-ignore.txt b/dev/tools/codespell/codespell-ignore.txt index 85595e74857a6..f8205fc6495fa 100644 --- a/dev/tools/codespell/codespell-ignore.txt +++ b/dev/tools/codespell/codespell-ignore.txt @@ -89,6 +89,7 @@ datee # Translation keys addin amountin +alltime # other blacklists diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index b180a5d9434e7..5aa893ed55826 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,51 +9,55 @@ */ return [ // # Issue statistics: - // PhanUndeclaredProperty : 640+ occurrences - // PhanPluginUnknownPropertyType : 630+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 580+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 400+ occurrences + // PhanUndeclaredProperty : 560+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 540+ occurrences + // PhanPluginUnknownPropertyType : 410+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 350+ occurrences // PhanUndeclaredGlobalVariable : 350+ occurrences - // PhanPluginUnknownArrayMethodReturnType : 300+ occurrences - // PhanPluginUnknownArrayMethodParamType : 250+ occurrences - // PhanPossiblyUndeclaredVariable : 200+ occurrences - // PhanTypeMismatchProperty : 170+ occurrences - // PhanPluginUnknownArrayFunctionParamType : 95+ occurrences - // PhanTypeMismatchArgumentNullableInternal : 70+ occurrences + // PhanPluginUnknownArrayMethodReturnType : 230+ occurrences + // PhanPossiblyUndeclaredVariable : 180+ occurrences + // PhanPluginUnknownArrayMethodParamType : 160+ occurrences + // PhanTypeMismatchProperty : 160+ occurrences + // PhanPluginUnknownArrayFunctionParamType : 90+ occurrences // PhanPluginUndeclaredVariableIsset : 65+ occurrences - // PhanPluginUnknownArrayPropertyType : 55+ occurrences + // PhanTypeMismatchArgumentNullableInternal : 60+ occurrences // PhanPluginUnknownArrayFunctionReturnType : 50+ occurrences // PhanRedefineFunction : 50+ occurrences // PhanPluginEmptyStatementIf : 45+ occurrences // PhanTypeExpectedObjectPropAccess : 40+ occurrences // PhanTypeInvalidDimOffset : 35+ occurrences // PhanTypeMismatchDimFetch : 30+ occurrences + // PhanPluginUnknownArrayPropertyType : 20+ occurrences // PhanPluginUnknownObjectMethodCall : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences - // PhanUndeclaredMethod : 15+ occurrences // PhanEmptyForeach : 10+ occurrences - // PhanPluginConstantVariableNull : 10+ occurrences - // PhanPossiblyNullTypeMismatchProperty : 10+ occurrences // PhanTypeArraySuspiciousNull : 10+ occurrences // PhanTypeComparisonFromArray : 10+ occurrences // PhanTypeMismatchDimFetchNullable : 10+ occurrences + // PhanUndeclaredMethod : 10+ occurrences + // PhanPluginSuspiciousParamPosition : 9 occurrences // PhanPluginBothLiteralsBinaryOp : 8 occurrences - // PhanPluginSuspiciousParamPosition : 8 occurrences + // PhanPossiblyNullTypeMismatchProperty : 8 occurrences // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences + // PhanPluginConstantVariableNull : 6 occurrences // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences - // PhanTypeExpectedObjectPropAccessButGotNull : 3 occurrences + // PhanTypeExpectedObjectPropAccessButGotNull : 2 occurrences // PhanAccessMethodProtected : 1 occurrence + // PhanParamTooFew : 1 occurrence // PhanTypeConversionFromArray : 1 occurrence + // PhanTypeMismatchReturn : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ 'htdocs/accountancy/class/accountancycategory.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanUndeclaredProperty'], 'htdocs/adherents/list.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/admin/fckeditor.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/adherents/type.php' => ['PhanTypeMismatchProperty'], + 'htdocs/admin/agenda_other.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/admin/defaultvalues.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/api/class/api_access.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], 'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], @@ -61,8 +65,7 @@ return [ 'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/asset/admin/setup.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset'], - 'htdocs/asset/class/assetaccountancycodes.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanTypeInvalidDimOffset'], + 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'], 'htdocs/asset/depreciation.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/asset/disposal.php' => ['PhanPluginEmptyStatementIf'], @@ -77,7 +80,6 @@ return [ 'htdocs/bom/bom_card.php' => ['PhanUndeclaredProperty'], 'htdocs/bom/bom_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bom/class/api_boms.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/bom/class/bom.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/bom/tpl/objectline_edit.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/bom/tpl/objectline_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/bookcal/availabilities_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -91,14 +93,13 @@ return [ 'htdocs/categories/edit.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/index.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/info.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/categories/photos.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch'], + 'htdocs/categories/photos.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/traduction.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/viewcat.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/collab/index.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'], - 'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], + 'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/comm/action/class/api_agendaevents.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/class/cactioncomm.class.php' => ['PhanPluginUnknownArrayPropertyType'], - 'htdocs/comm/action/class/ical.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/comm/action/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/comm/action/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/info.php' => ['PhanUndeclaredProperty'], @@ -107,14 +108,10 @@ return [ 'htdocs/comm/action/peruser.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray'], 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/comm/mailing/class/advtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/comm/mailing/class/html.formadvtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/comm/mailing/class/mailing.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/comm/propal/class/propal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/comm/propal/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/comm/propal/list.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/propal/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/class/api_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'], @@ -127,9 +124,8 @@ return [ 'htdocs/compta/bank/annuel.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/bank/bankentries_list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/bank/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/bank/class/account.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/compta/bank/class/account.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/bank/class/api_bankaccounts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/bank/class/bankcateg.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/compta/bank/graph.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/bank/line.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/bank/releve.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -143,43 +139,36 @@ return [ 'htdocs/compta/cashcontrol/cashcontrol_list.php' => ['PhanTypeMismatchProperty'], 'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/deplacement/class/deplacement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/compta/deplacement/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginEmptyStatementIf'], - 'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'], + 'htdocs/compta/facture/card.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/facture/class/facturestats.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/compta/facture/class/paymentterm.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/facture/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/invoicetemplate_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/note.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/prelevement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/facture/tpl/linkedobjectblock.tpl.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], + 'htdocs/compta/facture/tpl/linkedobjectblock.tpl.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/journal/purchasesjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/journal/sellsjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/localtax/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/localtax/class/localtax.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/localtax/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/localtax/index.php' => ['PhanRedefineFunction'], 'htdocs/compta/localtax/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetch'], 'htdocs/compta/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/paiement/cheque/card.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/compta/paiement/cheque/class/remisecheque.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod'], - 'htdocs/compta/paiement/cheque/list.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/compta/paiement/class/cpaiement.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/compta/paiement/class/paiement.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/paiement/cheque/list.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/paiement/class/paiement.class.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/compta/paiement/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement_charge.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/paiement_vat.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/payment_vat/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/prelevement/class/rejetprelevement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], 'htdocs/compta/prelevement/demandes.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/factures.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/line.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -189,8 +178,6 @@ return [ 'htdocs/compta/resultat/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/resultat/result.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/sociales/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], - 'htdocs/compta/sociales/class/cchargesociales.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], - 'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/sociales/list.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/compta/sociales/payments.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/byratecountry.php' => ['PhanPluginEmptyStatementIf'], @@ -202,15 +189,12 @@ return [ 'htdocs/compta/stats/supplier_turnover_by_prodserv.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/supplier_turnover_by_thirdparty.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/tva/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/compta/tva/class/tva.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/tva/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/tva/index.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchProperty'], - 'htdocs/contact/canvas/actions_contactcard_common.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], - 'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/contact/class/contact.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], + 'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/perso.php' => ['PhanTypeMismatchProperty'], @@ -219,11 +203,8 @@ return [ 'htdocs/contrat/class/api_contracts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/contrat/messaging.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contrat/services_list.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/contrat/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], - 'htdocs/core/actions_builddoc.inc.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/actions_comments.inc.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/core/actions_extrafields.inc.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/actions_lineupdown.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/actions_massactions.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -232,7 +213,6 @@ return [ 'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/ajax/ajaxdirpreview.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/ajax/fileupload.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/ajax/onlineSign.php' => ['PhanPluginUnknownArrayFunctionParamType'], 'htdocs/core/ajax/selectobject.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/ajax/selectsearchbox.php' => ['PhanPluginUndeclaredVariableIsset'], @@ -257,62 +237,28 @@ return [ 'htdocs/core/boxes/box_task.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/boxes/box_validated_projects.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/canvas.class.php' => ['PhanParamTooMany', 'PhanUndeclaredMethod'], - 'htdocs/core/class/ccountry.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/cgenericdic.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'], + 'htdocs/core/class/ccountry.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/class/cgenericdic.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayPropertyType'], + 'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/commonsocialnetworks.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/commonstickergenerator.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/conf.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchProperty'], - 'htdocs/core/class/cproductnature.class.php' => ['PhanPluginUnknownArrayPropertyType'], - 'htdocs/core/class/ctypent.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/class/ctyperesource.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/cunits.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/class/diasporahandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/core/class/discount.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/class/doleditor.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/class/dolgeoip.class.php' => ['PhanTypeMismatchProperty'], + 'htdocs/core/class/ctyperesource.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/class/cunits.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/class/dolgraph.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/dolreceiptprinter.class.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/class/emailsenderprofile.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/class/events.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/class/extrafields.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/core/class/extralanguages.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/core/class/fediverseparser.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/class/fileupload.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'], - 'htdocs/core/class/fiscalyear.class.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/class/emailsenderprofile.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/hookmanager.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/html.formaccounting.class.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/class/html.formbarcode.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/class/html.formcategory.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/html.formfile.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/class/html.formldap.class.php' => ['PhanPluginUnknownArrayMethodParamType'], + 'htdocs/core/class/html.formfile.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/html.formmargin.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/html.formprojet.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/class/html.formsetup.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/core/class/html.formwebsite.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/class/ldap.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/class/link.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/openid.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/class/reddithandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/smtps.class.php' => ['PhanTypeConversionFromArray'], - 'htdocs/core/class/socialnetworkmanager.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/class/stats.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'], 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/class/translate.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/class/utils.class.php' => ['PhanPluginConstantVariableNull', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/customreports.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable'], 'htdocs/core/datepicker.php' => ['PhanTypeInvalidDimOffset'], - 'htdocs/core/db/Database.interface.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/db/mysqli.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray'], - 'htdocs/core/db/pgsql.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/db/sqlite3.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeComparisonFromArray', 'PhanUndeclaredProperty'], + 'htdocs/core/db/sqlite3.class.php' => ['PhanTypeMismatchReturn'], 'htdocs/core/extrafieldsinimport.inc.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeInvalidDimOffset'], 'htdocs/core/lib/accounting.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], @@ -354,7 +300,7 @@ return [ 'htdocs/core/modules/barcode/modules_barcode.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/cheque/doc/pdf_blochet.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanUndeclaredMethod'], + 'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanParamTooFew', 'PhanPluginSuspiciousParamPosition'], 'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/modules_commande.php' => ['PhanPluginUnknownPropertyType'], @@ -377,7 +323,7 @@ return [ 'htdocs/core/modules/mailings/modules_mailings.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/member/doc/doc_generic_member_odt.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/member/doc/pdf_standard_member.class.php' => ['PhanPluginUnknownArrayMethodParamType'], + 'htdocs/core/modules/member/doc/pdf_standard_member.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/member/modules_cards.php' => ['PhanPluginUnknownArrayFunctionParamType'], 'htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -385,8 +331,8 @@ return [ 'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/modules/printing/modules_printing.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/printing/printgcp.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php' => ['PhanPluginUnknownArrayMethodParamType'], + 'htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchProperty'], + 'htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/printsheet/modules_labels.php' => ['PhanParamTooMany'], 'htdocs/core/modules/product/doc/pdf_standard.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'], @@ -431,10 +377,9 @@ return [ 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/list_print_total.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/notes.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/objectline_title.tpl.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/tpl/notes.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/onlinepaymentlinks.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/passwordforgotten.tpl.php' => ['PhanUndeclaredGlobalVariable'], @@ -462,13 +407,12 @@ return [ 'htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolibarrCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/debugbar/class/TraceableDB.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/delivery/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/delivery/class/delivery.class.php' => ['PhanUndeclaredProperty'], 'htdocs/delivery/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/document.php' => ['PhanRedefineFunction'], 'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'], - 'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], + 'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/class/api_donations.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], 'htdocs/don/class/paymentdonation.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -480,7 +424,7 @@ return [ 'htdocs/don/paiement/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/don/payment/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/don/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/don/tpl/linkedobjectblock.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/don/tpl/linkedobjectblock.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/ecm/class/ecmdirectory.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/ecm/class/ecmfiles.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/ecm/class/htmlecm.form.class.php' => ['PhanPluginUnknownArrayMethodParamType'], @@ -491,7 +435,7 @@ return [ 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], 'htdocs/emailcollector/class/emailcollectoraction.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/emailcollector/class/emailcollectorfilter.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -503,12 +447,11 @@ return [ 'htdocs/expedition/class/expedition.class.php' => ['PhanUndeclaredProperty'], 'htdocs/expedition/class/expeditionlinebatch.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/expedition/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/expedition/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/expedition/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expedition/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expedition/list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/expedition/note.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expedition/shipment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/expedition/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/expensereport/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -532,16 +475,14 @@ return [ 'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/class/fournisseur.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], - 'htdocs/fourn/class/fournisseur.facture-rec.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/fourn/class/paiementfourn.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/commande/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/fourn/commande/contact.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fourn/commande/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/fourn/commande/dispatch.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/commande/document.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/commande/info.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/commande/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/commande/note.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/fourn/contact.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/facture/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/fourn/facture/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], @@ -553,11 +494,11 @@ return [ 'htdocs/fourn/paiement/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ftp/admin/ftpclient.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/ftp/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/holiday/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], + 'htdocs/holiday/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/holiday/card_group.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/holiday/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/holiday/view_log.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/hrm/admin/admin_hrm.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/hrm/admin/admin_hrm.php' => ['PhanEmptyForeach'], 'htdocs/hrm/class/evaluation.class.php' => ['PhanUndeclaredProperty'], 'htdocs/hrm/class/evaluationdet.class.php' => ['PhanUndeclaredProperty'], 'htdocs/hrm/class/job.class.php' => ['PhanUndeclaredProperty'], @@ -568,7 +509,6 @@ return [ 'htdocs/hrm/compare.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/hrm/core/tpl/objectline_view.tpl.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/hrm/evaluation_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/hrm/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/hrm/job_agenda.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/hrm/job_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/hrm/job_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -579,7 +519,7 @@ return [ 'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/imports/import.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanRedefineFunction'], 'htdocs/install/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/install/repair.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], @@ -614,7 +554,7 @@ return [ 'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/mrp/tpl/originproductline.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/multicurrency/class/multicurrency.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/multicurrency/class/multicurrency.class.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/opcachepreload.php' => ['PhanEmptyForeach'], 'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], @@ -634,12 +574,11 @@ return [ 'htdocs/product/admin/product.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/ajax/products.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/canvas/service/actions_card_service.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/card.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/product/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/product/class/api_products.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], - 'htdocs/product/class/html.formproduct.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/product/class/html.formproduct.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/product/class/productbatch.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], - 'htdocs/product/class/productcustomerprice.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/product/class/propalmergepdfproduct.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/product/document.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable'], @@ -664,8 +603,8 @@ return [ 'htdocs/product/stock/class/productstockentrepot.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/product/stock/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/product.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/productlot_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -674,7 +613,7 @@ return [ 'htdocs/product/stock/stats/expedition.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/stats/mo.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/stats/reception.php' => ['PhanUndeclaredProperty'], - 'htdocs/product/stock/stockatdate.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/product/stock/stockatdate.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/stock/stocktransfer/class/stocktransferline.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/stocktransfer/stocktransfer_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/product/stock/stocktransfer/stocktransfer_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -726,7 +665,7 @@ return [ 'htdocs/public/payment/paymentko.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/project/index.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/project/new.php' => ['PhanRedefineFunction', 'PhanUndeclaredProperty'], + 'htdocs/public/project/new.php' => ['PhanRedefineFunction'], 'htdocs/public/project/suggestbooth.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/public/project/suggestconference.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], @@ -745,10 +684,9 @@ return [ 'htdocs/reception/class/reception.class.php' => ['PhanUndeclaredProperty'], 'htdocs/reception/class/receptionstats.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/reception/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/reception/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/reception/note.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/reception/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach'], 'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall'], 'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], @@ -767,23 +705,21 @@ return [ 'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/resource/class/dolresource.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/resource/class/html.formresource.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeExpectedObjectPropAccess'], - 'htdocs/resource/element_resource.php' => ['PhanUndeclaredProperty'], 'htdocs/salaries/admin/salaries.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/salaries/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/salaries/class/api_salaries.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/salaries/class/paymentsalary.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/salaries/class/salariesstats.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/salaries/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/salaries/info.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/salaries/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/salaries/paiement_salary.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/salaries/virement_request.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/salaries/virement_request.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/societe/admin/societe.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], 'htdocs/societe/ajax/company.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/societe/checkvat/checkVatPopup.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/societe/class/api_contacts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/societe/class/client.class.php' => ['PhanPluginUnknownArrayPropertyType'], + 'htdocs/societe/class/societe.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/societe/class/societeaccount.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -797,16 +733,14 @@ return [ 'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/supplier_proposal/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/support/inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanRedefineFunction'], 'htdocs/takepos/admin/orderprinters.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/index.php' => ['PhanPluginUndeclaredVariableIsset'], - 'htdocs/takepos/invoice.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/takepos/invoice.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/takepos/pay.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/takepos/public/menu.php' => ['PhanUndeclaredProperty'], 'htdocs/takepos/split.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/theme/eldy/badges.inc.php' => ['PhanRedefineFunction'], 'htdocs/theme/eldy/btn.inc.php' => ['PhanUndeclaredGlobalVariable'], @@ -826,10 +760,8 @@ return [ 'htdocs/ticket/class/api_tickets.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'], 'htdocs/ticket/class/ticket.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/ticket/class/ticketstats.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/ticket/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/ticket/list.php' => ['PhanTypeComparisonFromArray'], - 'htdocs/ticket/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/user/bank.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/user/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/user/class/api_users.class.php' => ['PhanTypeMismatchProperty'], @@ -851,8 +783,6 @@ return [ 'htdocs/webportal/class/controller.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/webportal/class/webportalinvoice.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/webportal/class/webportalmember.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/webportal/class/webportalpropal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/webservices/server_actioncomm.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_category.php' => ['PhanUndeclaredProperty'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 712e14e87b7fa..476b3a85580b7 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -223,6 +223,7 @@ 'simplify_ast' => true, 'analyzed_file_extensions' => ['php','inc'], 'globals_type_map' => [ + '_Avery_Labels' => 'array', 'action' => 'string', 'actioncode' => 'string', 'badgeStatus0' => 'string', diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst index 1002aae7500ef..dde64cf4b71d6 100644 --- a/dev/translation/ignore_translation_keys.lst +++ b/dev/translation/ignore_translation_keys.lst @@ -1004,7 +1004,6 @@ VideoGeneration ##################################################################### ##################################################################### AddService -AnHelpMessage Analytic AnalyticLabel BankId @@ -1036,6 +1035,7 @@ FailedToLogin First GroupCreate GroupUpdate +HelpMessage INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID @@ -1073,6 +1073,10 @@ MYMODULE_MYPARAM6 MYMODULE_MYPARAM7 MYMODULE_MYPARAM8 MYMODULE_MYPARAM9 +MYMODULE_MYPARAM10 +MYMODULE_MYPARAM11 +MYMODULE_MYPARAM12 +MYMODULE_MYPARAM13 ManufacturingOrders MemberCreate MemberTypeCreate @@ -1113,8 +1117,6 @@ TicketMessageMailSignatureText TicketSetupPage Tiers Timeline -TotalDiscount -TotalHTBeforeDiscount Transfer TryAnotherConnectionMode UndefinedKey diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 8836134a316cf..163091a55e5a3 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -70,10 +70,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 98fac8de0feb4..ba2e66b40907a 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -68,10 +68,11 @@ $sortfield = GETPOST("sortfield", 'aZ09comma'); $sortorder = GETPOST("sortorder", 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $listlimit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index be56ccd7a9639..7204b54e65b65 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -635,7 +635,7 @@ } // Title line with search boxes - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -954,7 +954,7 @@ */ function fieldListAccountingCategories($fieldlist, $obj = null, $tabname = '', $context = '') { - global $conf, $langs, $db; + global $db; global $form, $mysoc; $formadmin = new FormAdmin($db); diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php index 982222bf20d5a..2f5a8aa4c40e2 100644 --- a/htdocs/accountancy/admin/closure.php +++ b/htdocs/accountancy/admin/closure.php @@ -121,6 +121,11 @@ // Define main accounts for closure print ''; +print ''; +print ''; +print ''; + foreach ($list_account_main as $key) { print ''; // Param diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php deleted file mode 100644 index 8764dea999b18..0000000000000 --- a/htdocs/accountancy/admin/export.php +++ /dev/null @@ -1,263 +0,0 @@ - - * Copyright (C) 2013-2024 Alexandre Spangaro - * Copyright (C) 2014 Florian Henry - * Copyright (C) 2014 Marcos García - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2017-2018 Frédéric France - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/accountancy/admin/export.php - * \ingroup Accountancy (Double entries) - * \brief Setup page to configure accounting export module - */ -require '../../main.inc.php'; - -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; - -// Load translation files required by the page -$langs->loadLangs(array("compta", "bills", "admin", "accountancy")); - -// Security access -if (!$user->hasRight('accounting', 'chartofaccount')) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); - -// Parameters ACCOUNTING_EXPORT_* -$main_option = array( - 'ACCOUNTING_EXPORT_PREFIX_SPEC', -); - -$accountancyexport = new AccountancyExport($db); -$configuration = $accountancyexport->getTypeConfig(); - -$listparam = $configuration['param']; - -$listformat = $configuration['format']; - -$listcr = $configuration['cr']; - - -$model_option = array( - '1' => array( - 'label' => 'ACCOUNTING_EXPORT_FORMAT', - 'param' => $listformat, - ), - '2' => array( - 'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV', - 'param' => '', - ), - '3' => array( - 'label' => 'ACCOUNTING_EXPORT_ENDLINE', - 'param' => $listcr, - ), - '4' => array( - 'label' => 'ACCOUNTING_EXPORT_DATE', - 'param' => '', - ), -); - - -/* - * Actions - */ - -if ($action == 'update') { - $error = 0; - - $modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV'); - - if (!empty($modelcsv)) { - if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { - $error++; - } - //if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) { - // dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity); - //} - } else { - $error++; - } - - foreach ($main_option as $constname) { - $constvalue = GETPOST($constname, 'alpha'); - - if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { - $error++; - } - } - - foreach ($listparam[$modelcsv] as $key => $value) { - $constante = $key; - - if (strpos($constante, 'ACCOUNTING') !== false) { - $constvalue = GETPOST($key, 'alpha'); - if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) { - $error++; - } - } - } - - if (!$error) { - // reload - $configuration = $accountancyexport->getTypeConfig(); - $listparam = $configuration['param']; - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - - - -/* - * View - */ - -$form = new Form($db); - -$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -$title = $langs->trans('ExportOptions'); -llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_export'); - -$linkback = ''; -// $linkback = '' . $langs->trans("BackToModuleList") . ''; -print load_fiche_titre($langs->trans('ExportOptions'), $linkback, 'accountancy'); - - -print "\n".''."\n"; - -print '
'; -print ''; -print ''; - -/* - * Main Options - */ - -print '
'.$langs->trans("Parameter").''; +print '
'; -print ''; -print ''; -print "\n"; - -$num = count($main_option); -if ($num) { - foreach ($main_option as $key) { - print ''; - - // Param - $label = $langs->trans($key); - print ''; - - // Value - print ''; - } -} - -print ''; -print ''; -if (!$conf->use_javascript_ajax) { - print '"; -} else { - print ''; -} -print ""; - - -$num2 = count($model_option); -if ($num2) { - foreach ($model_option as $key) { - print ''; - - // Param - $label = $key['label']; - print ''; - - // Value - print ''; - } - - print "
'.$langs->trans('ExportOptions').'
'.dol_escape_htmltag($label).''; - print ''; - print '
'.$langs->trans("Selectmodelcsv").''; - print $langs->trans("NotAvailableWhenAjaxDisabled"); - print "'; - $listofexporttemplates = $accountancyexport->getType(1); - print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listofexporttemplates, getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV'), 0, 0, 0, '', 0, 0, 0, '', '', 1); - print '
'.$langs->trans($label).''; - if (is_array($key['param'])) { - print $form->selectarray($label, $key['param'], getDolGlobalString($label), 0); - } else { - print ''; - } - - print '
\n"; -} - -print '
'; - -print ''; - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 9d6ffb239bde0..d99ba3169f348 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -32,10 +32,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -130,7 +131,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'calendar', 0, $newcardbutton, '', $limit, 1); print '
'; - print ''; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 517a43158545c..3fea898df79a6 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; // Load translation files required by the page $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other")); @@ -60,6 +61,37 @@ 'ACCOUNTING_LABEL_OPERATION_ON_TRANSFER' ); +// Parameters for export options +$main_option = array( + 'ACCOUNTING_EXPORT_PREFIX_SPEC', +); + +$accountancyexport = new AccountancyExport($db); +$configuration = $accountancyexport->getTypeConfig(); + +$listparam = $configuration['param']; +$listformat = $configuration['format']; +$listcr = $configuration['cr']; + +$model_option = array( + '1' => array( + 'label' => 'ACCOUNTING_EXPORT_FORMAT', + 'param' => $listformat, + ), + '2' => array( + 'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV', + 'param' => '', + ), + '3' => array( + 'label' => 'ACCOUNTING_EXPORT_ENDLINE', + 'param' => $listcr, + ), + '4' => array( + 'label' => 'ACCOUNTING_EXPORT_DATE', + 'param' => '', + ), +); + $error = 0; @@ -116,13 +148,50 @@ } } - if ($error) { - setEventMessages($langs->trans("Error"), null, 'errors'); + // Export options + $modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV'); + + if (!empty($modelcsv)) { + if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { + $error++; + } + //if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) { + // dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity); + //} + } else { + $error++; + } + + foreach ($main_option as $constname) { + $constvalue = GETPOST($constname, 'alpha'); + + if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { + $error++; + } + } + + foreach ($listparam[$modelcsv] as $key => $value) { + $constante = $key; + + if (strpos($constante, 'ACCOUNTING') !== false) { + $constvalue = GETPOST($key, 'alpha'); + if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) { + $error++; + } + } + } + + if (!$error) { + // reload + $configuration = $accountancyexport->getTypeConfig(); + $listparam = $configuration['param']; } } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -268,7 +337,6 @@ //$linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($title, $linkback, 'accountancy'); -print '
'; // Show message if accountancy hidden options are activated to help to resolve some problems if (!$user->admin) { @@ -292,6 +360,7 @@ print ''; print ''; print ''; +print ''; // Params print '
'; @@ -379,9 +448,12 @@ } print '
'.$langs->trans("Ref").''.$langs->trans("Label").'
'; + +print '
'; + print '
'; -print '
'; +print '

'; // Binding params print '
'; @@ -489,10 +561,12 @@ print ''; print '
'; +print '
'; + // Show advanced options -print '
'; +print '

'; // Advanced params @@ -568,7 +642,120 @@ print ''; -print '
'; +print '
'; + +print '

'; + + +// Export options + +print "\n".''."\n"; + +// Main Options + +print ''; +print ''; +print ''; +print "\n"; + +$num = count($main_option); +if ($num) { + foreach ($main_option as $key) { + print ''; + + // Param + $label = $langs->trans($key); + print ''; + + // Value + print ''; + } +} + +print ''; +print ''; +if (!$conf->use_javascript_ajax) { + print '"; +} else { + print ''; +} +print ""; + + +$num2 = count($model_option); +if ($num2) { + foreach ($model_option as $key) { + print ''; + + // Param + $label = $key['label']; + print ''; + + // Value + print ''; + } + + print "
'.$langs->trans('ExportOptions').'
'.dol_escape_htmltag($label).''; + print ''; + print '
'.$langs->trans("Selectmodelcsv").''; + print $langs->trans("NotAvailableWhenAjaxDisabled"); + print "'; + $listofexporttemplates = $accountancyexport->getType(1); + print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listofexporttemplates, getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV'), 0, 0, 0, '', 0, 0, 0, '', '', 1); + print '
'.$langs->trans($label).''; + if (is_array($key['param'])) { + print $form->selectarray($label, $key['param'], getDolGlobalString($label), 0); + } else { + print ''; + } + + print '
\n"; +} + +print '
'; + print ''; diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 0f7c57339f54c..d4e20b71edbe6 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -65,10 +65,11 @@ $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $listlimit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index a0d23a13beb58..5c66c576b7628 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -87,10 +87,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : getDolGlobalInt('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 8c2909385897c..d53add7fa8692 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -58,10 +58,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index eacc1a1632e71..5f3289e9fc71f 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -68,9 +68,9 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { - // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } $offset = $limit * $page; diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 7d2476878c470..84c6700088273 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -825,7 +825,7 @@ if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { // If 0 or not set, we NOT check by default. - $checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE')); + $checked = getDolGlobalString('ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE'); $form_question['notifiedvalidationdate'] = array( 'name' => 'notifiedvalidationdate', 'type' => 'checkbox', diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 33e35a6a7c4d1..f31530907c583 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -858,7 +858,7 @@ print ''; print '
'; -print ''; +print '
'; // Filters lines print ''; diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index a916328aaeb87..f7cf45ce0b111 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -621,8 +621,8 @@ public function deleteCptCat($cpt_id) * Function to show result of an accounting account from the ledger with a direction and a period * * @param int|array $cpt Accounting account or array of accounting account - * @param string $date_start Date start - * @param string $date_end Date end + * @param int $date_start Date start + * @param int $date_end Date end * @param int<0,1> $sens Sens of the account: 0: credit - debit (use this by default), 1: debit - credit * @param string $thirdparty_code Third party code * @param int $month Specific month - Can be empty diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 3c8e8fdb6e14b..53e6efa493495 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2616,7 +2616,8 @@ public function getFiscalPeriods($filter = '') } /** - * Get list of count by month into the fiscal period + * Get list of count by month into the fiscal period. + * This function can be called by step 1 of closure process. * * @param int $date_start Date start * @param int $date_end Date end @@ -2624,6 +2625,8 @@ public function getFiscalPeriods($filter = '') */ public function getCountByMonthForFiscalPeriod($date_start, $date_end) { + global $conf; + $total = 0; $list = array(); @@ -2639,12 +2642,11 @@ public function getCountByMonthForFiscalPeriod($date_start, $date_end) // Get count for each month into the fiscal period if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { - // TODO Analyse is done by finding record not into a closed period // Loop on each closed period - $sql .= " AND b.doc_date BETWEEN 0 AND 0"; + $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX.'accounting_fiscalyear as af WHERE b.doc_date >= af.date_start AND b.doc_date <= af.date_end AND af.entity = '.((int) $conf->entity)." AND af.statut = 1)"; } else { - // Analyse closed record using the unitary flag/date on each record - $sql .= " AND date_validated IS NULL"; + // Filter on the unitary flag/date lock on each record + $sql .= " AND date_validated IS NULL"; // not locked } $sql .= " GROUP BY YEAR(b.doc_date)"; diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 16031d1962bf2..6058c37eeefbd 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -230,7 +230,8 @@ $form_question, '', 1, - 300 + 300, + 600 ); } elseif ($action == 'step_2') { $form_question = array(); @@ -267,7 +268,8 @@ $form_question, '', 1, - 300 + 300, + 600 ); } elseif ($action == 'step_3') { $form_question = array(); @@ -310,7 +312,8 @@ $form_question, '', 1, - 300 + 300, + 600 ); } } @@ -340,72 +343,80 @@ if (empty($current_fiscal_period)) { print $langs->trans('ErrorNoFiscalPeriodActiveFound', $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("FiscalPeriod")); } else { - // Step 1 - $head = array(); - $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; - $head[0][1] = $langs->trans("AccountancyClosureStep1"); - $head[0][2] = 'step1'; - print dol_get_fiche_head($head, 'step1', '', -1, ''); + if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { + // Step 1 + $head = array(); + $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; + $head[0][1] = $langs->trans("Step").' 1 - '.$langs->trans("AccountancyClosureStep1"); + $head[0][2] = 'step1'; + print dol_get_fiche_head($head, 'step1', '', -1, ''); - print '' . $langs->trans("AccountancyClosureStep1Desc") . '
'; + print '' . $langs->trans("AccountancyClosureStep1Desc") . '
'; - $count_by_month = $object->getCountByMonthForFiscalPeriod($current_fiscal_period['date_start'], $current_fiscal_period['date_end']); - if (!is_array($count_by_month)) { - setEventMessages($object->error, $object->errors, 'errors'); - } + $count_by_month = $object->getCountByMonthForFiscalPeriod($current_fiscal_period['date_start'], $current_fiscal_period['date_end']); - if (empty($count_by_month['total'])) { - $buttonvalidate = '' . $langs->trans("ValidateMovements") . ''; - } else { - $buttonvalidate = '' . $langs->trans("ValidateMovements") . ''; - } - print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 0); + if (!is_array($count_by_month)) { + setEventMessages($object->error, $object->errors, 'errors'); + } - print '
'; - print '
'; + if (empty($count_by_month['total'])) { + $buttonvalidate = '' . $langs->trans("ValidateMovements") . ''; + } else { + $buttonvalidate = '' . $langs->trans("ValidateMovements") . ''; + } + print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 0); - print ''; - $nb_years = is_array($count_by_month['list']) ? count($count_by_month['list']) : 0; - if ($nb_years > 1) { - print ''; - } - for ($i = 1; $i <= 12; $i++) { - print ''; - } - print ''; - print ''; - - if (is_array($count_by_month['list'])) { - foreach ($count_by_month['list'] as $info) { - print ''; - if ($nb_years > 1) { - print ''; - } - for ($i = 1; $i <= 12; $i++) { - print ''; + print '
'; + print '
' . $langs->trans("Year") . '' . $langs->trans('MonthShort' . str_pad((string) $i, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $info['year'] . '' . ((int) $info['count'][$i]) . '
'; + + print ''; + $nb_years = is_array($count_by_month['list']) ? count($count_by_month['list']) : 0; + if ($nb_years > 1) { + print ''; + } + for ($i = 1; $i <= 12; $i++) { + print ''; + } + print ''; + print ''; + + if (is_array($count_by_month['list'])) { + foreach ($count_by_month['list'] as $info) { + print ''; + if ($nb_years > 1) { + print ''; + } + for ($i = 1; $i <= 12; $i++) { + print ''; + } + print ''; } - print ''; } - } - print "
' . $langs->trans("Year") . '' . $langs->trans('MonthShort' . str_pad((string) $i, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $info['year'] . '' . ((int) $info['count'][$i]) . '' . $info['total'] . '
' . $info['total'] . '
\n"; - print '
'; + print "\n"; + print ''; - print '
'; + print '
'; + } // Step 2 $head = array(); $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; - $head[0][1] = $langs->trans("AccountancyClosureStep2"); + $head[0][1] = $langs->trans("Step").(getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '1' : '2').' - '.$langs->trans("AccountancyClosureStep2"); $head[0][2] = 'step2'; print dol_get_fiche_head($head, 'step2', '', -1, ''); + $button = ''; // print '' . $langs->trans("AccountancyClosureStep2Desc") . '
'; - - if (empty($count_by_month['total']) && empty($current_fiscal_period['status'])) { - $button = '' . $langs->trans("AccountancyClosureClose") . ''; + if ((empty($count_by_month['total']) || getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) && empty($current_fiscal_period['status'])) { + // If no unlocked record and period still open + $button = '' . $langs->trans("AccountancyClosureClose") . ''; } else { - $button = '' . $langs->trans("AccountancyClosureClose") . ''; + if (!empty($current_fiscal_period['status'])) { + $button = '' . $langs->trans("AccountancyClosureClose") . ''; + } elseif (!empty($count_by_month['total'])) { + $button = '' . $langs->trans("AccountancyClosureClose") . ''; + } } print_barre_liste('', '', '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0); @@ -414,7 +425,7 @@ // Step 3 $head = array(); $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; - $head[0][1] = $langs->trans("AccountancyClosureStep3"); + $head[0][1] = $langs->trans("Step").(getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '2' : '3').' - '.$langs->trans("AccountancyClosureStep3"); $head[0][2] = 'step3'; print dol_get_fiche_head($head, 'step3', '', -1, ''); @@ -423,7 +434,7 @@ if (empty($current_fiscal_period['status'])) { $button = '' . $langs->trans("AccountancyClosureAccountingReversal") . ''; } else { - $button = '' . $langs->trans("AccountancyClosureAccountingReversal") . ''; + $button = '' . $langs->trans("AccountancyClosureAccountingReversal") . ''; } print_barre_liste('', '', '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0); } diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index cb14e29cce5ac..4a0fccb491b58 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -387,10 +387,9 @@ print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - print ''.$langs->trans("DescVentilDoneCustomer").'
'; + print_barre_liste($langs->trans("InvoiceLinesDone").'
'.$langs->trans("DescVentilDoneCustomer").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); - print '
'.$langs->trans("ChangeAccount").'
'; + print '
'.$langs->trans("ChangeAccount").'
'; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print '
'; @@ -498,12 +497,16 @@ print ''; if ($productstatic->id > 0) { print $productstatic->getNomUrl(1); + } else { + print ' '; } - if ($productstatic->id > 0 && $objp->product_label) { + //if ($productstatic->id > 0 && $objp->product_label) { print '
'; - } + //} if ($objp->product_label) { print ''.$objp->product_label.''; + } else { + print ' '; } print ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 7185ef0b283d4..64470e4884784 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -471,7 +471,7 @@ print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($langs->trans("InvoiceLines").'
'.$langs->trans("DescVentilTodoCustomer").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); if ($massaction == 'set_default_account') { $formquestion = array(); @@ -482,8 +482,6 @@ print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1); } - print ''.$langs->trans("DescVentilTodoCustomer").'

'; - if (!empty($msg)) { print $msg.'
'; } diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index fdd9b4d75fb4b..bb5fd15790f4f 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -315,10 +315,9 @@ print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - print ''.$langs->trans("DescVentilDoneExpenseReport").'
'; + print_barre_liste($langs->trans("ExpenseReportLinesDone").'
'.$langs->trans("DescVentilDoneExpenseReport").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); - print '
'.$langs->trans("ChangeAccount").'
'; + print '
'.$langs->trans("ChangeAccount").'
'; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print '
'; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 7be5d5bf6a8f5..2ec1f595db8c4 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -385,9 +385,7 @@ print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - - print ''.$langs->trans("DescVentilTodoExpenseReport").'

'; + print_barre_liste($langs->trans("ExpenseReportLines").'
'.$langs->trans("DescVentilTodoExpenseReport").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); if (!empty($msg)) { print $msg.'
'; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index b80276bb527e1..157444f2387c0 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -400,12 +400,12 @@ if ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; - $paymentstatic->ref = $links[$key]['url_id']; + $paymentstatic->ref = (string) $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this $tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id; } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; - $paymentsupplierstatic->ref = $links[$key]['url_id']; + $paymentsupplierstatic->ref = (string) $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsupplierstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsupplierid"] = $paymentsupplierstatic->id; } elseif ($links[$key]['type'] == 'company') { @@ -451,7 +451,7 @@ } } elseif ($links[$key]['type'] == 'sc') { $chargestatic->id = $links[$key]['url_id']; - $chargestatic->ref = $links[$key]['url_id']; + $chargestatic->ref = (string) $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2); $reg = array(); @@ -486,14 +486,14 @@ } } elseif ($links[$key]['type'] == 'payment_donation') { $paymentdonstatic->id = $links[$key]['url_id']; - $paymentdonstatic->ref = $links[$key]['url_id']; + $paymentdonstatic->ref = (string) $links[$key]['url_id']; $paymentdonstatic->fk_donation = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id; $tabtp[$obj->rowid][$account_pay_donation] = isset($tabtp[$obj->rowid][$account_pay_donation]) ? $tabtp[$obj->rowid][$account_pay_donation] + $amounttouse : $amounttouse; } elseif ($links[$key]['type'] == 'member') { $paymentsubscriptionstatic->id = $links[$key]['url_id']; - $paymentsubscriptionstatic->ref = $links[$key]['url_id']; + $paymentsubscriptionstatic->ref = (string) $links[$key]['url_id']; $paymentsubscriptionstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id; @@ -501,14 +501,14 @@ $tabtp[$obj->rowid][$account_pay_subscription] = isset($tabtp[$obj->rowid][$account_pay_subscription]) ? $tabtp[$obj->rowid][$account_pay_subscription] + $amounttouse : $amounttouse; } elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT $paymentvatstatic->id = $links[$key]['url_id']; - $paymentvatstatic->ref = $links[$key]['url_id']; + $paymentvatstatic->ref = (string) $links[$key]['url_id']; $paymentvatstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id; $tabtp[$obj->rowid][$account_pay_vat] = isset($tabtp[$obj->rowid][$account_pay_vat]) ? $tabtp[$obj->rowid][$account_pay_vat] + $amounttouse : $amounttouse; } elseif ($links[$key]['type'] == 'payment_salary') { $paymentsalstatic->id = $links[$key]['url_id']; - $paymentsalstatic->ref = $links[$key]['url_id']; + $paymentsalstatic->ref = (string) $links[$key]['url_id']; $paymentsalstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsalstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id; @@ -556,7 +556,7 @@ $tabpay[$obj->rowid]["paymentexpensereport"] = $paymentexpensereportstatic->id; } elseif ($links[$key]['type'] == 'payment_various') { $paymentvariousstatic->id = $links[$key]['url_id']; - $paymentvariousstatic->ref = $links[$key]['url_id']; + $paymentvariousstatic->ref = (string) $links[$key]['url_id']; $paymentvariousstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvariousstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id; @@ -567,7 +567,7 @@ $tabtp[$obj->rowid][$account_subledger] = isset($tabtp[$obj->rowid][$account_subledger]) ? $tabtp[$obj->rowid][$account_subledger] + $amounttouse : $amounttouse; } elseif ($links[$key]['type'] == 'payment_loan') { $paymentloanstatic->id = $links[$key]['url_id']; - $paymentloanstatic->ref = $links[$key]['url_id']; + $paymentloanstatic->ref = (string) $links[$key]['url_id']; $paymentloanstatic->fk_loan = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id; @@ -580,9 +580,9 @@ $resultmid = $db->query($sqlmid); if ($resultmid) { $objmid = $db->fetch_object($resultmid); - $tabtp[$obj->rowid][$objmid->accountancy_account_capital] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_capital]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_capital] - $objmid->amount_capital : $amounttouse; - $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_insurance]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] - $objmid->amount_insurance : $amounttouse; - $tabtp[$obj->rowid][$objmid->accountancy_account_interest] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_interest]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_interest] - $objmid->amount_interes : $amounttouse; + $tabtp[$obj->rowid][$objmid->accountancy_account_capital] = isset($objmid->amount_capital) ? $tabtp[$obj->rowid][$objmid->accountancy_account_capital] - $objmid->amount_capital : 0; + $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] = isset($objmid->amount_insurance) ? $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] - $objmid->amount_insurance : 0; + $tabtp[$obj->rowid][$objmid->accountancy_account_interest] = isset($objmid->amount_interest) ? $tabtp[$obj->rowid][$objmid->accountancy_account_interest] - $objmid->amount_interest : 0; } } elseif ($links[$key]['type'] == 'banktransfert') { $accountLinestatic->fetch($links[$key]['url_id']); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 44ba2ce010feb..62eeec69680b2 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -395,10 +395,9 @@ print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - print ''.$langs->trans("DescVentilDoneSupplier").'
'; + print_barre_liste($langs->trans("InvoiceLinesDone").'
'.$langs->trans("DescVentilDoneSupplier").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); - print '
'.$langs->trans("ChangeAccount").'
'; + print '
'.$langs->trans("ChangeAccount").'
'; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print '
'; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 0691dce7a09fe..06dc49e82f4a6 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -478,7 +478,7 @@ print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($langs->trans("InvoiceLines").'
'.$langs->trans("DescVentilTodoCustomer").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); if ($massaction == 'set_default_account') { $formquestion = array(); @@ -489,8 +489,6 @@ print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1); } - print ''.$langs->trans("DescVentilTodoCustomer").'

'; - if (!empty($msg)) { print $msg.'
'; } diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index cc81b058d87e7..b0a879232d3ab 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -46,10 +46,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index fe705fa99b851..da8fadb6bb0d4 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -2096,16 +2096,9 @@ function initfieldrequired() { $somethingshown = $formfile->numoffiles; // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription')); + //$tmparray = $form->showLinkToObjectBlock($object, null, array('subscription'), 1); //$somethingshown = $form->showLinkedObjectBlock($object, ''); - // Show links to link elements - /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); - if ($linktoelem) { - print ($somethingshown?'':'
').$linktoelem; - } - */ - // Show online payment link // The list can be complete by the hook 'doValidatePayment' executed inside getValidOnlinePaymentMethods() include_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 8afcd57d5c80a..ede57e3971652 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -48,10 +48,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/adherents/messaging.php b/htdocs/adherents/messaging.php index e5aaa491bb204..201b3125832d1 100644 --- a/htdocs/adherents/messaging.php +++ b/htdocs/adherents/messaging.php @@ -59,10 +59,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 8b927da7f4b7a..95395cb5a356c 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -154,14 +154,15 @@ // Print array print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print ''; + +print '
'; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; if (!$foundphy) { diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 30e958d7b8323..11422351013b8 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -309,15 +309,15 @@ if ($mode) { // Print array print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table - print '
'.$langs->trans("MemberNature").''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").')'.$langs->trans("NbOfActiveMembers").''.$langs->trans("LastMemberDate").''.$langs->trans("NbOfSubscriptions").''.$langs->trans("LatestSubscriptionDate").''.$langs->trans("MemberNature").''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").')'.$langs->trans("NbOfActiveMembers").''.$langs->trans("LastMemberDate").''.$langs->trans("NbOfSubscriptions").''.$langs->trans("LatestSubscriptionDate").'
'; + print '
'; print ''; - print ''; + print ''; if (isset($label2)) { - print ''; + print ''; } - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; foreach ($data as $val) { diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index e15dbc4924c24..8942d20d99ac1 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -58,10 +58,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 17e8b2f75c37e..014dc3439fdc6 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -395,13 +395,9 @@ $somethingshown = $formfile->numoffiles; */ // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription')); + //$tmparray = $form->showLinkToObjectBlock($object, null, array('subscription'), 1); $somethingshown = $form->showLinkedObjectBlock($object, ''); - // Show links to link elements - /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); - if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; - */ print '
'; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 1f2916e0957b3..2f4d21c5e2074 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -328,7 +328,7 @@ $moreforfilter = ''; print '
'; - print '
'.$label.''.$label.''.$label2.''.$label2.''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").')'.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").')'.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").'
'."\n"; + print '
'."\n"; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index c32c4af437660..344d635c4b2c2 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -192,7 +192,7 @@ } } } -'@phan-var-force array $barcodelist'; +'@phan-var-force array $barcodelist'; // Select barcode numbering module diff --git a/htdocs/admin/debugbar.php b/htdocs/admin/debugbar.php index 1f0ae7679caf3..ce41dd013340e 100644 --- a/htdocs/admin/debugbar.php +++ b/htdocs/admin/debugbar.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2013 Juanjo Menent + * 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 @@ -60,7 +61,7 @@ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessages($error, null, 'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index ff93e3f229a88..988feac4c0817 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -1,6 +1,7 @@ * Copyright (C) 2017-2018 Regis Houssin + * 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 @@ -141,13 +142,13 @@ if (!$error) { if ($action == 'add' || (GETPOST('add') && $action != 'update')) { - $object->type=$mode; - $object->user_id=0; - $object->page=$defaulturl; - $object->param=$defaultkey; - $object->value=$defaultvalue; - $object->entity=$conf->entity; - $result=$object->create($user); + $object->type = $mode; + $object->user_id = 0; + $object->page = $defaulturl; + $object->param = $defaultkey; + $object->value = $defaultvalue; + $object->entity = $conf->entity; + $result = $object->create($user); if ($result < 0) { $action = ''; setEventMessages($object->error, $object->errors, 'errors'); @@ -160,14 +161,14 @@ } } if (GETPOST('actionmodify')) { - $object->id=$id; - $object->type=$mode; - $object->page=$urlpage; - $object->param=$key; - $object->value=$value; - $object->entity=$conf->entity; - $result=$object->update($user); - if ($result<0) { + $object->id = $id; + $object->type = $mode; + $object->page = $urlpage; + $object->param = $key; + $object->value = $value; + $object->entity = $conf->entity; + $result = $object->update($user); + if ($result < 0) { $action = ''; setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -183,9 +184,9 @@ // Delete line from delete picto if ($action == 'delete') { - $object->id=$id; - $result=$object->delete($user); - if ($result<0) { + $object->id = $id; + $result = $object->delete($user); + if ($result < 0) { $action = ''; setEventMessages($object->error, $object->errors, 'errors'); } @@ -356,7 +357,7 @@ print ''."\n"; print ''."\n"; -$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode, 't.entity'=>array($user->entity,$conf->entity))); +$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type' => $mode, 't.entity' => array($user->entity,$conf->entity))); if (!is_array($result) && $result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -396,7 +397,7 @@ // Multicompany print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 4c5e0689a304e..5c0604a1df796 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -658,6 +658,7 @@ continue; } $tabcomplete[$key]['id'] = $i; + // TODO Comment this lines when data is stored into the tabcomplete array $tabcomplete[$key]['cond'] = $tabcond[$i]; $tabcomplete[$key]['rowid'] = $tabrowid[$i]; @@ -1825,13 +1826,13 @@ } print '
'; - print '
'; if (isModEnabled('multicompany')) { - print dol_escape_htmltag($defaultvalue->entity); + print dol_escape_htmltag((string) $defaultvalue->entity); } print '
'; + print '
'; $colspan = 0; // Title line with search input fields print ''."\n"; - print ''; + print ''; // Action button if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 2a5253869d0f5..5599f9a6361f0 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -413,7 +413,7 @@ } else { $keyforprovider = ''; } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; if (!empty($supportedoauth2array)) { @@ -623,6 +623,7 @@ // Common attributes //$keyforbreak='fieldkeytoswithonsecondcolumn'; + $nounderbanner = 1; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Other attributes @@ -639,7 +640,7 @@ // Filters print '
'; - print '
'; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index db18b396bcb73..967b86fefd311 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -53,13 +53,12 @@ 'NOTE_PUBLIC' => 'FCKeditorForNotePublic', 'NOTE_PRIVATE' => 'FCKeditorForNotePrivate', 'SOCIETE' => 'FCKeditorForCompany', - //'PRODUCTDESC' => 'FCKeditorForProduct', 'DETAILS' => 'FCKeditorForProductDetails', 'USERSIGN' => 'FCKeditorForUserSignature', 'MAILING' => 'FCKeditorForMailing', 'MAIL' => 'FCKeditorForMail', 'TICKET' => 'FCKeditorForTicket', - 'SPECIALCHAR' => 'SpecialCharActivation', + //'SPECIALCHAR' => 'SpecialCharActivation', ); // Conditions for the option to be offered $conditions = array( @@ -72,7 +71,7 @@ 'MAILING' => isModEnabled('mailing'), 'MAIL' => (isModEnabled('invoice') || isModEnabled("propal") || isModEnabled('order')), 'TICKET' => isModEnabled('ticket'), - 'SPECIALCHAR' => 1, + //'SPECIALCHAR' => 1, ); // Picto $picto = array( @@ -85,7 +84,7 @@ 'MAILING' => 'email', 'MAIL' => 'email', 'TICKET' => 'ticket', - 'SPECIALCHAR' => 'generic' + //'SPECIALCHAR' => 'generic' ); @@ -152,12 +151,12 @@ print '
'; if (empty($conf->use_javascript_ajax)) { - setEventMessages(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), null, 'errors'); + setEventMessages(null, array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), 'errors'); } else { print '
'.img_picto('', 'filter', 'class="pictofixedwidth opacitymedium"').$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'
'; print ''; print ''; - print ''; + print ''; print "\n"; // Modules @@ -193,15 +192,45 @@ print '
'."\n"; + + // Other options + print '
'.$langs->trans("ActivateFCKeditor").''.$langs->trans("Action").'
'; + print ''; + print ''; + print ''; + print "\n"; + + $constante = 'FCKEDITOR_ENANLE_SPECIALCHAR'; + print ''."\n"; + print ''; + print ''; + print '"; + print ''; + + print '
'.$langs->trans("Other").'
'; + print $langs->trans('SpecialCharActivation'); + print ''; + $value = getDolGlobalInt($constante, 0); + if ($value == 0) { + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + } elseif ($value == 1) { + print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; + } + + print "
'."\n"; + + print '
'."\n"; + + print '
'."\n"; print ''; print ''; // Skins - show_skin(null, 1); - print '
'."\n"; + //show_skin(null, 1); + //print '
'."\n"; - $listofmodes = array('dolibarr_mailings', 'dolibarr_notes', 'dolibarr_details', 'dolibarr_readonly', 'Full', 'Full_inline'); + $listofmodes = array('dolibarr_readonly', 'dolibarr_details', 'dolibarr_notes', 'dolibarr_mailings', 'Full', 'Full_inline'); $linkstomode = ''; foreach ($listofmodes as $newmode) { if ($linkstomode) { diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 3020477069874..5341f712f320b 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -666,10 +666,12 @@ 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/mails_templates.php b/htdocs/admin/mails_templates.php index 48aa3b76946c0..64908830b931f 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -62,6 +62,7 @@ $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $mode = GETPOST('mode', 'aZ09'); $optioncss = GETPOST('optioncss', 'alpha'); +$contextpage = GETPOST('contextpage', 'aZ09'); $id = $rowid = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('rowid')); $search_label = GETPOST('search_label', 'alphanohtml'); // Must allow value like 'Abc Def' or '(MyTemplateName)' @@ -1160,7 +1161,7 @@ if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%', ($action != 'edit' ? 1 : 0)); + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%', ($action != 'edit' ? 1 : 0)); print $doleditor->Create(1); } if ($tmpfieldlist == 'content_lines') { @@ -1170,7 +1171,7 @@ if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%'); + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%'); print $doleditor->Create(1); } } @@ -1231,8 +1232,7 @@ print ''.img_view().''; } if ($iserasable) { - print ''.img_delete().''; - //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin + print ''.img_delete().''; } print ''; } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 989a42524c384..496f1921c2cac 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -338,6 +338,30 @@ } } + /* + if (!$error) { + if (GETPOST('checkforcompliance')) { + $dir = $dirins; + $file = $modulenameval; + // $installedmodule + try { + $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. + $modName = substr($file, 0, dol_strlen($file) - 10); + if ($modName) { + if (class_exists($modName)) { + $objMod = new $modName($db); + '@phan-var-force DolibarrModules $objMod'; + + //var_dump($objMod); + } + } + } catch(Exception $e) { + // Nothing done + } + } + } + */ + if (!$error) { $searchParams = array( 'search_keyword' => $modulenameval, @@ -1417,7 +1441,7 @@ $(document).ready(function() { jQuery("#fileinstall").on("change", function() { if(this.files[0].size > '.($maxmin * 1024).') { - alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'"); + alert("'.dol_escape_js($langs->transnoentitiesnoconv("ErrorFileSizeTooLarge")).'"); this.value = ""; } }); diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 421d0876fc18a..686ca033a058b 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -125,8 +125,20 @@ $tokenobj = null; // Load OAUth libraries require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; + + $keyforsupportedoauth2array = $OAUTH_SERVICENAME; + if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { + $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); + } else { + $keyforprovider = ''; + } + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); + $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; + + $keyforparamtenant = 'OAUTH_'.strtoupper(empty($supportedoauth2array[$keyforsupportedoauth2array]['callbackfile']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['callbackfile']).($keyforprovider ? '-'.$keyforprovider : '').'_TENANT'; + // Dolibarr storage - $storage = new DoliStorage($db, $conf, $keyforprovider); + $storage = new DoliStorage($db, $conf, $keyforprovider, getDolGlobalString($keyforparamtenant)); try { // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' print ''."\n"; @@ -161,8 +173,15 @@ //$httpClient->setCurlParameters($params); $serviceFactory->setHttpClient($httpClient); + $scopes = array(); + if (preg_match('/^Microsoft/', $OAUTH_SERVICENAME)) { + //$extraparams = $tokenobj->getExtraParams(); + $tmp = explode('-', $OAUTH_SERVICENAME); + $scopes = explode(',', getDolGlobalString('OAUTH_'.strtoupper($tmp[0]).(empty($tmp[1]) ? '' : '-'.$tmp[1]).'_SCOPE')); + } + // ex service is Google-Emails we need only the first part Google - $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); + $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, $scopes); if ($apiService instanceof OAuth\OAuth2\Service\AbstractService || $apiService instanceof OAuth\OAuth1\Service\AbstractService) { // ServiceInterface does not provide refreshAccessToekn, AbstractService does @@ -254,7 +273,7 @@ $keybeforeprovider = $keyforsupportedoauth2array; $keyforprovider = ''; } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; $nameofservice = ucfirst(strtolower(empty($supportedoauth2array[$keyforsupportedoauth2array]['callbackfile']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'])); diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index 9e397724dcbb3..01b5175304230 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -71,7 +71,7 @@ if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; - $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->owner_address,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; */ } else { diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 62a925ff6cc41..fe8ceb4cd2dd9 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -1,12 +1,13 @@ - * Copyright (C) 2004-2022 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021-2022 Anthony Berton - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Nick Fragoulis +/* Copyright (C) 2001-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2022 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2017 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021-2022 Anthony Berton + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Nick Fragoulis + * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -548,8 +549,18 @@ } print ''; -// Hide Ref +// Hide accounting customer code +print ''.$langs->trans("MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE"); +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE", $arrval, getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE')); +} +print ''; +// Hide Ref print ''.$langs->trans("HideRefOnPDF").''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_REF'); diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 9435eacd0c908..9553528474da7 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -72,7 +72,7 @@ if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; - $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->owner_address,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; */ } else { diff --git a/htdocs/admin/security_captcha.php b/htdocs/admin/security_captcha.php index 84b3faf29f248..18a9e51e2406b 100644 --- a/htdocs/admin/security_captcha.php +++ b/htdocs/admin/security_captcha.php @@ -105,7 +105,7 @@ // 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 $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 (isModEnabled('ticket')) { + print '
'; + print $langs->trans("TicketUseCaptchaCodeHelp"); if (!empty($conf->use_javascript_ajax)) { - print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA', array(), null, 0, 0, 1); + print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA_TICKET', array(), null, 0, 0, 1); } else { - if (!getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + if (!getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) { + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } -} else { - $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning'); - print $desc; } - +$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 @@ 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 @@ 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 a9f36965ca13a..c821372ae715d 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -62,7 +62,7 @@ print '
'; print '
'; -print '
'.img_picto_common('', 'dolibarr_box.png', 'height="100"').'
'; +print '
'.img_picto_common('', 'dolibarr_box.png', 'height="100"').'
'; print $langs->trans("DolibarrLicense").' : '; 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 ''; print '
'; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 9671d5a682858..67b69d3149d95 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -121,7 +121,7 @@ print "PHP short_open_tag = ".((empty(ini_get('short_open_tag')) || ini_get('short_open_tag') == 'Off') ? img_picto('', 'tick').' '.yn(0) : img_warning().' '.yn(1)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).')'."
\n"; -print "PHP allow_url_fopen = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No"))." but may be required by some external modules)
\n"; +print "PHP allow_url_fopen = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).", except if Yes is required by some external modules)
\n"; print "PHP allow_url_include = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : img_picto('', 'tick').' '.yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
\n"; //print "PHP safe_mode = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).'   '.$langs->trans("Deprecated")." (removed in PHP 5.4)
\n"; @@ -662,8 +662,24 @@ print 'MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE = '.getDolGlobalString('MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE', ''.$langs->trans("Undefined").'').'   ('.$langs->trans("Recommended").': 1)
'; print '
'; +print 'MAIN_SECURITY_ANTI_SSRF_SERVER_IP = '.getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': List of static IPs of server separated with coma - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)')."
"; +print '
'; + +print 'MAIN_SECURITY_CSRF_WITH_TOKEN = '.getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN', ''.$langs->trans("Undefined").'').'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 2)'."
"; + +print '
'; + + +print '
'; +print '
'; + + +print load_fiche_titre($langs->trans("DatabaseEncryption"), '', 'folder'); + +print '
'; + //print ''.$langs->trans("PasswordEncryption").': '; -print 'MAIN_SECURITY_HASH_ALGO = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO', ''.$langs->trans("Undefined").'')."   "; +print ''.$langs->trans("AlgorithmFor", $langs->transnoentitiesnoconv("Passwords")).' (non reversible encryption, defined into MAIN_SECURITY_HASH_ALGO) = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO', ''.$langs->trans("Undefined").'')."   "; if (!getDolGlobalString('MAIN_SECURITY_HASH_ALGO')) { print '     (If unset: \'md5\')'; } @@ -683,10 +699,22 @@ } print '
'; -print 'MAIN_SECURITY_ANTI_SSRF_SERVER_IP = '.getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': List of static IPs of server separated with coma - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)')."
"; -print '
'; +$action = GETPOST('action'); +$exampletodecrypt = GETPOST('exampletodecrypt', 'password'); -print 'MAIN_SECURITY_CSRF_WITH_TOKEN = '.getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN', ''.$langs->trans("Undefined").'').'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 2)'."
"; +print ''.$langs->trans("AlgorithmFor", $langs->transnoentitiesnoconv("SensitiveData")).' (reversible encryption done with dolEncrypt/dolDecrypt) = '.constant('MAIN_SECURITY_REVERSIBLE_ALGO').' with key defined into conf.php file in $dolibarr_main_instance_unique_id
'; +print ''; +print ''; +print ''; +print ''; +print $langs->trans("ToolToDecryptAString").': '; +print ''; +print ''; +if ($action == 'doldecrypt' && $user->admin && $exampletodecrypt) { + usleep(200); + print ' => '; +} +print ''; print '
'; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index b9318aeb2a6c8..e79949b51b854 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -631,7 +631,7 @@ print ''; print ''; -print '
'; +print ''; print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition'); diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 162151102e255..fa1b2fc64e146 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -342,6 +342,7 @@ print img_info().' '.$langs->trans("SomeTranslationAreUncomplete"); $urlwikitranslatordoc = 'https://wiki.dolibarr.org/index.php/Translator_documentation'; print ' ('.str_replace('{s1}', ''.$langs->trans("Here").'', $langs->trans("SeeAlso", '{s1}')).')
'; + print '
'; print $langs->trans("TranslationOverwriteDesc", $langs->transnoentitiesnoconv("Language"), $langs->transnoentitiesnoconv("TranslationKey"), $langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n"; print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."
\n"; print '
'; @@ -511,7 +512,7 @@ print '
'; print ''; - print ''."\n"; diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 7c7c624603bbd..9cc2258a4dfc3 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -738,7 +738,7 @@ public function post($filename, $modulepart, $ref = '', $subdir = '', $fileconte // Fetching the tasks project is required because its out_dir might be a sub-directory of the project if ($task_result > 0) { - $project_result = $object->fetch_projet(); + $project_result = $object->fetchProject(); if ($project_result >= 0) { $tmpreldir = dol_sanitizeFileName($object->project->ref).'/'; diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 2be78c1682096..c9e42b09ca31f 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -407,7 +407,11 @@ } // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('asset')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('asset'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index e02474b495eff..25b591d1c7239 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 MDW + * Copyright (C) 2024 Jose MARTINEZ * * 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 @@ -256,7 +257,7 @@ class Asset extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs; + global $langs; $this->db = $db; @@ -343,13 +344,7 @@ public function createFromClone(User $user, $fromid) // // // Load source object // $result = $object->fetchCommon($fromid); - // if ($result > 0 && !empty($object->table_element_line)) { - // $object->fetchLines(); - // } // - // // get lines so they will be clone - // //foreach($this->lines as $line) - // // $line->fetch_optionals(); // // // Reset some properties // unset($object->id); @@ -420,6 +415,7 @@ public function createFromClone(User $user, $fromid) // $this->db->rollback(); // return -1; // } + return -1; } @@ -434,10 +430,6 @@ public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); if ($result > 0) { - if (!empty($this->table_element_line)) { - $this->fetchLines(); - } - $res = $this->hasDepreciationLinesInBookkeeping(); if ($res < 0) { return -1; @@ -454,18 +446,6 @@ public function fetch($id, $ref = null) return $result; } - /** - * Load object lines in memory from the database - * - * @return int Return integer <0 if KO, 0 if not found, >0 if OK - */ - public function fetchLines() - { - $this->lines = array(); - - return 1; - } - /** * Load list of objects in memory from the database. @@ -945,6 +925,7 @@ public function calculationDepreciation() // Get fiscal period require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; + // @FIXME getCurrentPeriodOfFiscalYear return the first period found. What if there is several ? And what if not closed ? And what if end date not yet defined. $dates = getCurrentPeriodOfFiscalYear($this->db, $conf, $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition); $init_fiscal_period_start = $dates['date_start']; $init_fiscal_period_end = $dates['date_end']; @@ -1027,7 +1008,7 @@ public function calculationDepreciation() // Get depreciation period $depreciation_date_start = $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition; - $depreciation_date_end = dol_time_plus_duree((int) $depreciation_date_start, $fields['duration'], $fields['duration_type'] == 1 ? 'm' : ($fields['duration_type'] == 2 ? 'd' : 'y')); + $depreciation_date_end = dol_time_plus_duree(dol_time_plus_duree((int) $depreciation_date_start, $fields['duration'], $fields['duration_type'] == 1 ? 'm' : ($fields['duration_type'] == 2 ? 'd' : 'y')), -1, 'd'); $depreciation_amount = $fields['amount_base_depreciation_ht']; if ($fields['duration_type'] == 2) { // Daily $fiscal_period_start = $depreciation_date_start; @@ -1040,7 +1021,7 @@ public function calculationDepreciation() $fiscal_period_start = $init_fiscal_period_start; $fiscal_period_end = $init_fiscal_period_end; } - $cumulative_depreciation_ht = $last_cumulative_depreciation_ht; + $cumulative_depreciation_ht = (float) $last_cumulative_depreciation_ht; $depreciation_period_amount = $depreciation_amount - (float) $this->reversal_amount_ht; $start_date = $depreciation_date_start; $disposal_date = isset($this->disposal_date) && $this->disposal_date !== "" ? $this->disposal_date : ""; @@ -1128,9 +1109,19 @@ public function calculationDepreciation() } } $depreciation_ht = (float) price2num($period_amount * $nb_days / $nb_days_in_month, 'MT'); - } else { // Annually - $nb_days = min($nb_days_in_year, num_between_day($begin_date, $end_date, 1)); - $depreciation_ht = (float) price2num($period_amount * $nb_days / $nb_days_in_year, 'MT'); + } else { // Annually, taking care for adjustments to shortened or extended periods (e.g., fiscal years of 9 or 15 months) + $nb_days_real = num_between_day($begin_date, $end_date, 1); + if (($nb_days_real > 366) || (num_between_day($fiscal_period_start, $fiscal_period_end, 1) < $nb_days_in_year)) { // FY Period changed + $nb_days = $nb_days_real; + } else { + $nb_days = min($nb_days_in_year, $nb_days_real); + } + $depreciation_ht = (double) price2num($period_amount * $nb_days / $nb_days_in_year, 'MT'); + } + if (getDolGlobalInt('ASSET_ROUND_INTEGER_NUMBER_UPWARDS') == 1) { + if ($idx_loop < $max_loop) { // avoid last depreciation value + $depreciation_ht = ceil($depreciation_ht); + } } if ($fiscal_period_start <= $depreciation_date_end && $depreciation_date_end <= $fiscal_period_end) { // last period @@ -1149,12 +1140,13 @@ public function calculationDepreciation() // Next fiscal period (+1 day/month/year) $fiscal_period_start = dol_time_plus_duree($fiscal_period_end, 1, 'd'); + $dates_fiscal_period = getCurrentPeriodOfFiscalYear($this->db, $conf, $fiscal_period_start, 'gmt'); if ($fields['duration_type'] == 2) { // Daily $fiscal_period_end = $fiscal_period_start; } elseif ($fields['duration_type'] == 1) { // Monthly $fiscal_period_end = dol_time_plus_duree(dol_time_plus_duree($fiscal_period_start, 1, 'm'), -1, 'd'); } else { // Annually - $fiscal_period_end = dol_time_plus_duree(dol_time_plus_duree($fiscal_period_start, 1, 'y'), -1, 'd'); + $fiscal_period_end = $dates_fiscal_period['date_end']; } $last_period_date = $disposal_date !== "" && $disposal_date < $depreciation_date_end ? $disposal_date : $depreciation_date_end; } while ($fiscal_period_start < $last_period_date); @@ -1590,18 +1582,6 @@ public function initAsSpecimen() return $this->initAsSpecimenCommon(); } - /** - * Create an array of lines - * - * @return array|int array of lines if OK, <0 if KO - */ - public function getLinesArray() - { - $this->lines = array(); - - return $this->lines; - } - /** * Returns the reference to the following non used object depending on the active numbering module. * diff --git a/htdocs/asset/class/assetaccountancycodes.class.php b/htdocs/asset/class/assetaccountancycodes.class.php index 88c71d8688917..7dd2ad2ef80b5 100644 --- a/htdocs/asset/class/assetaccountancycodes.class.php +++ b/htdocs/asset/class/assetaccountancycodes.class.php @@ -1,5 +1,6 @@ + * 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 @@ -29,7 +30,7 @@ class AssetAccountancyCodes extends CommonObject { /** - * @var array Array with all accountancy codes info by mode. + * @var array>> Array with all accountancy codes info by mode. * Note : 'economic' mode is mandatory and is the primary accountancy codes * 'depreciation_asset' and 'depreciation_expense' is mandatory and is used for write depreciation in bookkeeping */ @@ -64,7 +65,7 @@ class AssetAccountancyCodes extends CommonObject ); /** - * @var array Array with all accountancy codes by mode. + * @var array> Array with all accountancy codes by mode. */ public $accountancy_codes = array(); @@ -81,7 +82,7 @@ public function __construct(DoliDB $db) /** * Fill accountancy_codes property of object (using for data sent by forms) * - * @return array Array of values + * @return array> Array of values */ public function setAccountancyCodesFromPost() { diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index eefaf8e3a2b8a..27ea30d139238 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 @@ -70,8 +71,8 @@ class AssetDepreciationOptions extends CommonObject public $fields = array(); /** - * @var array Array with all deprecation options info by mode. - * Note : economic mode is mandatory and is the primary options + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}>}> + * Note : economic mode is mandatory and is the primary option */ public $deprecation_options_fields = array( 'economic' => array( @@ -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,), ), ), ); @@ -119,7 +120,7 @@ class AssetDepreciationOptions extends CommonObject public $fk_user_modif; /** - * @var array Array with all deprecation options by mode. + * @var array> Array with all deprecation options by mode. */ public $deprecation_options = array(); @@ -174,7 +175,7 @@ public function __construct(DoliDB $db) * Set object infos for a mode * * @param string $mode Depreciation mode (economic, accelerated_depreciation, ...) - * @param int $class_type Type (0:asset, 1:asset model) + * @param int<0,1> $class_type Type (0:asset, 1:asset model) * @param bool $all_field Get all fields * @return int Return integer <0 if KO, >0 if OK */ diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index 5e9e32e7fa523..c39d6eb47f54f 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2021 Open-Dsi - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2021 Open-Dsi + * 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 @@ -263,13 +263,6 @@ public function createFromClone(User $user, $fromid) // Load source object $result = $object->fetchCommon($fromid); - if ($result > 0 && !empty($object->table_element_line)) { - $object->fetchLines(); - } - - // get lines so they will be clone - //foreach($this->lines as $line) - // $line->fetch_optionals(); // Reset some properties unset($object->id); @@ -354,25 +347,10 @@ public function createFromClone(User $user, $fromid) public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); - } - return $result; - } - - /** - * Load object lines in memory from the database - * - * @return int Return integer <0 if KO, 0 if not found, >0 if OK - */ - public function fetchLines() - { - $this->lines = array(); - return 1; + return $result; } - /** * Load list of objects in memory from the database. * @@ -383,7 +361,7 @@ public function fetchLines() * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return AssetModel[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -810,46 +788,4 @@ public function initAsSpecimen() return $this->initAsSpecimenCommon(); } - - /** - * Create an array of lines - * - * @return array|int array of lines if OK, <0 if KO - */ - public function getLinesArray() - { - $this->lines = array(); - - return $this->lines; - } - - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - //global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } } diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 6f03403c7405b..a94c80e1e382a 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -457,7 +457,7 @@ $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print '
'; + print '
'; //print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1); print $formadmin->select_language($langcode, 'langcode', 0, array(), 0, 0, 0, 'maxwidth250', 1); print '
'."\n"; +print '
'."\n"; // Fields title search diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index a936c9e8e4638..77209a4ed8e7c 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -461,7 +461,7 @@ $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print '
'."\n"; +print '
'."\n"; // Fields title search diff --git a/htdocs/asset/tpl/depreciation_options_edit.tpl.php b/htdocs/asset/tpl/depreciation_options_edit.tpl.php index 6809a5a543710..22b7055f98ec9 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 @@ } $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/asset/tpl/depreciation_options_view.tpl.php b/htdocs/asset/tpl/depreciation_options_view.tpl.php index a99d0ec3090d2..e065f7890e04f 100644 --- a/htdocs/asset/tpl/depreciation_options_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_view.tpl.php @@ -77,7 +77,8 @@ } } // Discard if extrafield is a hidden field on form - if (abs($field_info['visible']) != 1 && abs($field_info['visible']) != 3 && abs($field_info['visible']) != 4 && abs($field_info['visible']) != 5) { + $isVisibleAbs = array_key_exists('visible', $field_info) ? abs((int) $field_info['visible']) : 0; + if (!in_array($isVisibleAbs, array(1, 3, 4, 5))) { continue; } if (array_key_exists('enabled', $field_info) && isset($field_info['enabled']) && !verifCond($field_info['enabled'])) { diff --git a/htdocs/asset/tpl/depreciation_view.tpl.php b/htdocs/asset/tpl/depreciation_view.tpl.php index 3480a91b0b5dd..1c5ebdfcba42e 100644 --- a/htdocs/asset/tpl/depreciation_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_view.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,8 @@ } } // Discard if extrafield is a hidden field on form - if (abs($field_info['visible']) != 1 && abs($field_info['visible']) != 3 && abs($field_info['visible']) != 4 && abs($field_info['visible']) != 5) { + $isVisibleAbs = array_key_exists('visible', $field_info) ? abs((int) $field_info['visible']) : 0; + if (!in_array($isVisibleAbs, array(1, 3, 4, 5))) { continue; } if (array_key_exists('enabled', $field_info) && isset($field_info['enabled']) && !verifCond($field_info['enabled'])) { diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index 6ca7a795f990e..77c75620ef00c 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -58,8 +58,8 @@ * @param string $target Target to use on links * @param int $disablejs More content into html header * @param int $disablehead More content into html header - * @param array|string $arrayofjs Array of complementary js files - * @param array|string $arrayofcss Array of complementary css files + * @param string[]|string $arrayofjs Array of complementary js files + * @param string[]|string $arrayofcss Array of complementary css files * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) * @param string $morecssonbody More CSS on body tag. For example 'classforhorizontalscrolloftabs'. * @param string $replacemainareaby Replace call to main_area() by a print of this string diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 8a886c78e114f..5cff6b6f7af38 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -161,7 +161,7 @@ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Year")), null, "errors"); $error++; } else { - // Get ID of first line + // Get the ID of the first line qualified $sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data"; $sql .= " FROM ".MAIN_DB_PREFIX."blockedlog"; $sql .= " WHERE entity = ".$conf->entity; @@ -190,6 +190,37 @@ } } + if (! $error) { + // We record the export as a new line into the unalterable logs + require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; + $b = new BlockedLog($db); + + $object = new stdClass(); + $object->id = 0; + $object->element = 'module'; + $object->ref = 'systemevent'; + $object->entity = $conf->entity; + $object->date = dol_now(); + + $object->label = 'Export unalterable logs - Period: year='.GETPOSTINT('yeartoexport').(GETPOSTINT('monthtoexport') ? ' month='.GETPOSTINT('monthtoexport') : ''); + + $action = 'BLOCKEDLOG_EXPORT'; + $result = $b->setObjectData($object, $action, 0, $user); + //var_dump($b); exit; + + if ($result < 0) { + setEventMessages('Failed to insert the export int the unalterable log', null, 'errors'); + $error++; + } + + $res = $b->create($user); + + if ($res < 0) { + setEventMessages('Failed to insert the export int the unalterable log', null, 'errors'); + $error++; + } + } + if (!$error) { // Now restart request with all data = no limit(1) in sql request $sql = "SELECT rowid, date_creation, tms, user_fullname, action, amounts, element, fk_object, date_object, ref_object, signature, fk_user, object_data, object_version"; @@ -333,7 +364,18 @@ print dol_get_fiche_head($head, 'fingerprints', '', -1); } -print '
'.$langs->trans("FingerprintsDesc")."
\n"; +print '
'; + +print $langs->trans("FingerprintsDesc")."
"; + +print '
'; + +$s = $langs->trans("FilesIntegrityDesc", '{s}'); +$s = str_replace('{s}', DOL_URL_ROOT.'/admin/system/filecheck.php', $s); +print $s; +print "
\n"; + +print "
\n"; print '
'; @@ -492,7 +534,7 @@ print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ')."\n"; -print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp').'
'.$langs->trans('DataOfArchivedEventHelp2'), 1)."\n"; print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; @@ -573,7 +615,8 @@ print ''; // Action - print '
'; + $labelofaction = $langs->transnoentitiesnoconv('log'.$block->action); + print ''; // Ref print ''; // Link to source object - print ''; + $out .= ''; $documenturl = DOL_URL_ROOT.'/document.php'; if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) { @@ -1113,20 +1127,20 @@ public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = // Define relative path for download link (depends on module) $relativepath = $file["name"]; // Cas general if ($modulesubdir) { - $relativepath = $modulesubdir."/".$file["name"]; // Cas propal, facture... + $relativepath = (string) $modulesubdir."/".$file["name"]; // Cas propal, facture... } // Autre cas if ($modulepart == 'donation') { - $relativepath = get_exdir($modulesubdir, 2, 0, 0, null, 'donation').$file["name"]; + $relativepath = (string) get_exdir($modulesubdir, 2, 0, 0, null, 'donation').$file["name"]; } if ($modulepart == 'export') { - $relativepath = $file["name"]; + $relativepath = (string) $file["name"]; } $this->infofiles['nboffiles']++; $this->infofiles['files'][] = $file['fullname']; - $ext = pathinfo($file['name'], PATHINFO_EXTENSION); - if (empty($this->infofiles['extensions'][$ext])) { + $ext = (string) pathinfo($file['name'], PATHINFO_EXTENSION); // pathinfo returns a string here (cast for static analysis) + if (!array_key_exists($ext, $this->infofiles['extensions'])) { $this->infofiles['extensions'][$ext] = 1; } else { $this->infofiles['extensions'][$ext]++; @@ -1179,14 +1193,14 @@ public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = * Show list of documents in $filearray (may be they are all in same directory but may not) * This also sync database if $upload_dir is defined. * - * @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this. - * @param Object|null $object Object on which document is linked to. + * @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this. + * @param ?CommonObject $object Object on which document is linked to. * @param string $modulepart Value for modulepart used by download or viewimage wrapper. * @param string $param Parameters on sort links (param must start with &, example &aaa=bbb&ccc=ddd) - * @param int $forcedownload Force to open dialog box "Save As" when clicking on file. + * @param int<0,1> $forcedownload Force to open dialog box "Save As" when clicking on file. * @param string $relativepath Relative path of docs (autodefined if not provided), relative to module dir, not to MAIN_DATA_ROOT. - * @param int $permonobject Permission on object (so permission to delete or crop document) - * @param int $useinecm Change output to add more information: + * @param int<0,1> $permonobject Permission on object (so permission to delete or crop document) + * @param int<0,6> $useinecm Change output to add more information: * 0, 4, 5, 6: Add a preview column. Show also a rename button. Show also a crop button for some values of $modulepart (must be supported into hard coded list in this function + photos_resize.php + restrictedArea + checkUserAccessToObject) * 1: Add link to edit ECM entry * 2: Add rename and crop link @@ -1195,23 +1209,24 @@ public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = * @param int $maxlength Maximum length of file name shown. * @param string $title Title before list. Use 'none' to disable title. * @param string $url Full url to use for click links ('' = autodetect) - * @param int $showrelpart 0=Show only filename (default), 1=Show first level 1 dir - * @param int $permtoeditline Permission to edit document line (You must provide a value, -1 is deprecated and must not be used any more) + * @param int<0,1> $showrelpart 0=Show only filename (default), 1=Show first level 1 dir + * @param int<-1,1> $permtoeditline Permission to edit document line (You must provide a value, -1 is deprecated and must not be used any more) * @param string $upload_dir Full path directory so we can know dir relative to MAIN_DATA_ROOT. Fill this to complete file data with database indexes. * @param string $sortfield Sort field ('name', 'size', 'position', ...) * @param string $sortorder Sort order ('ASC' or 'DESC') - * @param int $disablemove 1=Disable move button, 0=Position move is possible. - * @param int $addfilterfields Add the line with filters - * @param int $disablecrop Disable crop feature on images (-1 = auto, prefer to set it explicitly to 0 or 1) + * @param int<0,1> $disablemove 1=Disable move button, 0=Position move is possible. + * @param int<0,1> $addfilterfields Add the line with filters + * @param int<-1,1> $disablecrop Disable crop feature on images (-1 = auto, prefer to set it explicitly to 0 or 1) * @param string $moreattrondiv More attributes on the div for responsive. Example 'style="height:280px; overflow: auto;"' + * @param array $moreoptions Add more options like array('afteruploadtitle', ...) * @return int Return integer <0 if KO, nb of files shown if OK * @see list_of_autoecmfiles() */ - public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1, $moreattrondiv = '') + public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1, $moreattrondiv = '', $moreoptions = array()) { // phpcs:enable global $user, $conf, $langs, $hookmanager, $form; - global $sortfield, $sortorder, $maxheightmini; + global $sortfield, $sortorder; global $dolibarr_main_url_root; if ($disablecrop == -1) { @@ -1295,15 +1310,25 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '', $permtoeditline = 0; $permonobject = 0; } + if (empty($url)) { + $url = $_SERVER["PHP_SELF"]; + } + + + // Show title of list of existing files + $morehtmlright = ''; + if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { + $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); }', '', $permtoeditline); + } - // Show list of existing files if ((empty($useinecm) || $useinecm == 3 || $useinecm == 6) && $title != 'none') { - print load_fiche_titre($title ? $title : $langs->trans("AttachedFiles"), '', 'file-upload', 0, '', 'table-list-of-attached-files'); + print load_fiche_titre($title ? $title : $langs->trans("AttachedFiles"), $morehtmlright, 'file-upload', 0, '', 'table-list-of-attached-files'); } - if (empty($url)) { - $url = $_SERVER["PHP_SELF"]; + if (!empty($moreoptions) && $moreoptions['afteruploadtitle']) { + print '
'.$moreoptions['afteruploadtitle'].'
'; } + // Show the table print ''."\n"; if (GETPOST('action', 'aZ09') == 'editfile' && $permtoeditline) { print ''; @@ -1674,7 +1699,7 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '', if ($nboflines > 1 && is_object($object)) { if (!empty($conf->use_javascript_ajax) && $permtoeditline) { - $table_element_line = 'ecm_files'; + $table_element_line = 'ecm_files'; // used by ajaxrow.tpl.php include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } } @@ -1695,7 +1720,7 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '', * Show list of documents in a directory of ECM module. * * @param string $upload_dir Directory that was scanned. This directory will contains files into subdirs REF/files - * @param array $filearray Array of files loaded by dol_dir_list function before calling this function + * @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this. * @param string $modulepart Value for modulepart used by download wrapper. Value can be $object->table_name (that is 'myobject' or 'mymodule_myobject') or $object->element.'-'.$module (for compatibility purpose) * @param string $param Parameters on sort links * @param int $forcedownload Force to open dialog box "Save As" when clicking on file @@ -2088,16 +2113,18 @@ public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $para /** * Show array with linked files * - * @param Object $object Object - * @param int $permissiontodelete Deletion is allowed - * @param string $action Action - * @param string $selected ??? - * @param string $param More param to add into URL + * @param CommonObject $object Object + * @param int<0,1> $permissiontodelete Deletion is allowed + * @param ?string $action Action + * @param ?string $selected ??? + * @param string $param More param to add into URL + * @param string $htmlname Html name of component + * @param array $moreoptions Add more options like array('afterlinktitle', ...) * @return int Number of links */ - public function listOfLinks($object, $permissiontodelete = 1, $action = null, $selected = null, $param = '') + public function listOfLinks($object, $permissiontodelete = 1, $action = null, $selected = null, $param = '', $htmlname = 'formaddlink', $moreoptions = array()) { - global $user, $conf, $langs, $user; + global $conf, $langs; global $sortfield, $sortorder; $langs->load("link"); @@ -2115,12 +2142,23 @@ public function listOfLinks($object, $permissiontodelete = 1, $action = null, $s $res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder); $param .= (isset($object->id) ? '&id='.$object->id : ''); + $permissiontoedit = $permissiontodelete; + print ''."\n"; + $morehtmlright = ''; + if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { + $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open addlink form"); jQuery(".divlinkfile").toggle();', '', $permissiontoedit); + } + // Show list of associated links - print load_fiche_titre($langs->trans("LinkedFiles"), '', 'link', 0, '', 'table-list-of-links'); + print load_fiche_titre($langs->trans("LinkedFiles"), $morehtmlright, 'link', 0, '', 'table-list-of-links'); + + if (!empty($moreoptions) && $moreoptions['afterlinktitle']) { + print '
'.$moreoptions['afterlinktitle'].'
'; + } - print ''; + print ''; print ''; print '
'.$langs->trans('log'.$block->action).''.dolPrintHTML($labelofaction).''; @@ -581,7 +624,7 @@ print ''; + print ''; print ''; // $object_link can be a ''; @@ -594,8 +637,8 @@ // Fingerprint print ''; - $texttoshow = $langs->trans("Fingerprint").' - '.$langs->trans("Saved").':
'.$block->signature; - $texttoshow .= '

'.$langs->trans("Fingerprint").' - Recalculated sha256(previoushash * data):
'.$checkdetail[$block->id]['calculatedsignature']; + $texttoshow = $langs->trans("Fingerprint").' - '.$langs->trans("SavedOnLine").' =
'.$block->signature; + $texttoshow .= '

'.$langs->trans("Fingerprint").' - Recalculated sha256('.$langs->trans("PreviousHash").' on line '.($block->id - 1).' + data) =
'.$checkdetail[$block->id]['calculatedsignature']; $texttoshow .= '
'.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].''; //$texttoshow .= '
keyforsignature='.$checkdetail[$block->id]['keyforsignature']; print $form->textwithpicto(dol_trunc($block->signature, 8), $texttoshow, 1, 'help', '', 0, 2, 'fingerprint'.$block->id); diff --git a/htdocs/blockedlog/ajax/block-add.php b/htdocs/blockedlog/ajax/block-add.php index 1318447ee35f8..6538c1fe2ee41 100644 --- a/htdocs/blockedlog/ajax/block-add.php +++ b/htdocs/blockedlog/ajax/block-add.php @@ -60,7 +60,7 @@ exit; } -if ($element === 'facture') { +if ($element === 'facture') { // Test on permission done in top of page require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 1844fb55d83a7..46820f95ea37a 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -350,6 +350,8 @@ public function getObjectLink() } else { $this->error = (string) (((int) $this->error) + 1); } + } elseif ($this->action == 'BLOCKEDLOG_EXPORT') { + return ''.$langs->trans("logBLOCKEDLOG_EXPORT").''; } elseif ($this->action == 'MODULE_SET') { return ''.$langs->trans("BlockedLogEnabled").''; } elseif ($this->action == 'MODULE_RESET') { @@ -975,7 +977,7 @@ public function create($user, $forcesignature = '') $sql .= "'".$this->db->escape($this->signature)."',"; $sql .= "'".$this->db->escape($this->signature_line)."',"; $sql .= "'".$this->db->escape($this->element)."',"; - $sql .= $this->fk_object.","; + $sql .= (int) $this->fk_object.","; $sql .= "'".$this->db->idate($this->date_object)."',"; $sql .= "'".$this->db->escape($this->ref_object)."',"; $sql .= "'".$this->db->escape($this->dolEncodeBlockedData($this->object_data))."',"; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index ee23d88b81c41..5e7812d018686 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 @@ print dol_get_fiche_end(); - print $form->buttonsSaveCancel("Create"); + print $form->buttonsSaveCancel("Update"); print ''; } @@ -806,7 +806,11 @@ print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('bom')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('bom'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index b3595c3b43f48..30de29d295ba9 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -590,7 +590,7 @@ public function delete(User $user, $notrigger = 1) * @param ?int $fk_bom_child Id of BOM Child * @param ?string $import_key Import Key * @param int $fk_unit Unit - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param ?int $fk_default_workstation Default workstation * @return int<-3,max> Return integer <0 if KO, Id of created object if OK */ @@ -698,7 +698,7 @@ public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_chang * @param int<-1,max> $position Position of BOM-Line in BOM-Lines * @param ?string $import_key Import Key * @param int $fk_unit Unit of line - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param ?int $fk_default_workstation Default workstation * @return int<-3,max> Return integer <0 if KO, Id of updated BOM-Line if OK */ @@ -1299,7 +1299,7 @@ public function getLinesArray() * @param int<0,1> $hidedetails Hide details of lines * @param int<0,1> $hidedesc Hide description * @param int<0,1> $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param ?array $moreparams Array to provide more information * @return int<0,1> 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) @@ -1489,7 +1489,7 @@ public function calculateCosts() $reg = array(); $qtyhourservice = 0; if (preg_match('/^(\d+)([a-z]+)$/', $defaultdurationofservice, $reg)) { - $qtyhourservice = convertDurationtoHour((int) $reg[1], $reg[2]); + $qtyhourservice = convertDurationtoHour((float) $reg[1], $reg[2]); } if ($qtyhourservice) { diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php index 512fd618c4482..c548901716ba1 100644 --- a/htdocs/bookcal/availabilities_card.php +++ b/htdocs/bookcal/availabilities_card.php @@ -589,7 +589,11 @@ } // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('availabilities')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('availabilities'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/bookcal/calendar_card.php b/htdocs/bookcal/calendar_card.php index 30e3bf7b8e458..37bb9d64e8e7e 100644 --- a/htdocs/bookcal/calendar_card.php +++ b/htdocs/bookcal/calendar_card.php @@ -531,7 +531,11 @@ } // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('calendar')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('calendar'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index b96e8aca1759b..364292d9c11a8 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -200,26 +200,26 @@ $entry = ''; $entry .= ''; - $entry .= ''; // Add column counter $entry .= $counter; - $entry .= ''; $entry .= ''; $entry .= '
'; + $entry .= ''; $entry .= ''.$li.''; - $entry .= ''; + $entry .= ''; + $entry .= ''; $entry .= ''.img_view().''; - $entry .= ''; - $entry .= ''; + $entry .= ''; + $entry .= ''; if ($user->hasRight('categorie', 'creer')) { $entry .= '' . img_edit() . ''; } - $entry .= ''; - $entry .= ''; + $entry .= ''; + $entry .= ''; if ($user->hasRight('categorie', 'supprimer')) { $entry .= '' . img_delete() . ''; } - $entry .= ''; + $entry .= '
'; @@ -238,7 +238,7 @@ } -print ''; +print '
'; print '"; - - if ($savingdocmask) { - //add a global variable for disable the auto renaming on upload - $rename = (!getDolGlobalString('MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT') ? 'checked' : ''); - - $out .= ''; - if (!empty($options)) { - $out .= ''; - } - $out .= ''; - $out .= ''; - } + $out .= "\n\n"; - $out .= "
'.$langs->trans("Categories").''; if ($morethan1level && !empty($conf->use_javascript_ajax)) { print '
'; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 67007b7dad399..da93b74bb1776 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -6,6 +6,7 @@ * Copyright (C) 2014 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -193,7 +194,7 @@ if ($action == 'ajout_photo' && $user->hasRight('categorie', 'creer') && getDolGlobalString('MAIN_UPLOAD_DOC')) { // Affiche formulaire upload $formfile = new FormFile($db); - $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type, $langs->trans("AddPhoto"), 1, '', $user->hasRight('categorie', 'creer'), 50, $object, '', false, '', 0); + $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type, $langs->trans("AddPhoto"), 1, 0, $user->hasRight('categorie', 'creer'), 50, $object, '', false, '', 0); } // Affiche photos diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 843ccc4057593..2d202898b67f9 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -8,8 +8,8 @@ * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2024 MDW + * Copyright (C) 2019 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 @@ -1797,7 +1797,7 @@ function selectremindertype() { } $result2 = $object->fetch_thirdparty(); - $result2 = $object->fetch_projet(); + $result2 = $object->fetchProject(); $result3 = $object->fetch_contact(); $result4 = $object->fetch_userassigned(); $result5 = $object->fetch_optionals(); diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 7054b13febe57..8c2476b973946 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur + * 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 @@ -55,7 +56,7 @@ class CActionComm /** * @var string label - * @deprecated + * @deprecated Use $label * @see $label */ public $libelle; @@ -87,7 +88,7 @@ class CActionComm /** - * @var array Used to return value by some methods + * @var array{id:array,code:array,all:array} Used to return value by some methods */ public $liste_array; @@ -148,13 +149,13 @@ public function fetch($id) /** * Return list of event types: array(id=>label) or array(code=>label) * - * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter) - * @param string $idorcode 'id' or 'code' or 'all' - * @param string $excludetype Type to exclude ('system' or 'systemauto') - * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1 or -2=Keep details and add a combined line per calendar (Default, Auto, BoothConf, ...) + * @param ''|int<0,1> $active 1 or 0 to filter on event state active or not ('' by default = no filter) + * @param 'id'|'code'|'all' $idorcode 'id' or 'code' or 'all' + * @param string $excludetype Type to exclude ('system' or 'systemauto') + * @param int<-2,1> $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1 or -2=Keep details and add a combined line per calendar (Default, Auto, BoothConf, ...) * @param string $morefilter Add more SQL filter - * @param int $shortlabel 1=Get short label instead of long label - * @return array|int Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. + * @param int<0,1> $shortlabel 1=Get short label instead of long label + * @return int<-1,-1>|array{id:array,code:array,all:array,AC_OTH_AUTO?:mixed} Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. */ public function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0) { @@ -307,24 +308,24 @@ public function liste_array($active = '', $idorcode = 'id', $excludetype = '', $ if (($onlyautoornot == -1 || $onlyautoornot == -2) && getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { // Add a group of elements if ($typecalendar == 'system' || $typecalendar == 'user') { - $label = '   '.$label; + //$label = '   '.$label; $TSystem['id'][-99] = $langs->trans("ActionAC_MANUAL"); - $TSystem['code']['AC_NON_AUTO'] = '-- '.$langs->trans("ActionAC_MANUAL").''; + $TSystem['code']['AC_NON_AUTO'] = '-- '.$langs->trans("ActionAC_MANUAL").''; } if ($typecalendar == 'systemauto') { - $label = '   '.$label; + //$label = '   '.$label; $TSystemAuto['id'][-98] = $langs->trans("ActionAC_AUTO"); - $TSystemAuto['code']['AC_ALL_AUTO'] = '-- '.$langs->trans("ActionAC_AUTO").''; + $TSystemAuto['code']['AC_ALL_AUTO'] = '-- '.$langs->trans("ActionAC_AUTO").''; } if ($typecalendar == 'module') { $module = preg_replace('/^[^@]+@/', '', $obj->module); - $label = '   '.$label; + //$label = '   '.$label; if (!isset($TModule['id'][-1 * $idforallfornewmodule])) { // If first time for this module $idforallfornewmodule--; } $TModule['id'][-1 * $idforallfornewmodule] = $langs->trans("ActionAC_ALL_".strtoupper($module)); - $TModule['code']['AC_ALL_'.strtoupper($module)] = '-- '.$langs->trans("Module").' '.ucfirst($module).''; + $TModule['code']['AC_ALL_'.strtoupper($module)] = '-- '.$langs->trans("Module").' '.ucfirst($module).''; } } // Add element diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index c6ee7f7908698..da00314965723 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -45,7 +45,7 @@ class ICal public $file_text; /** - * @var array Array to save iCalendar parse data + * @var array>>>|array>>>|array>>|array>> Array to save iCalendar parse data */ public $cal; @@ -138,7 +138,7 @@ public function get_todo_count() * @param string $uri Url * @param string $usecachefile Full path of a cache file to use a cache file * @param int $delaycache Delay in seconds for cache (by default 3600 secondes) - * @return array|string + * @return string|array>>>|array>>>|array>>|array>> */ public function parse($uri, $usecachefile = '', $delaycache = 3600) { @@ -277,12 +277,15 @@ public function add_to_array($type, $key, $value) $key = $this->last_key; switch ($type) { case 'VEVENT': + // @phan-suppress-next-line PhanTypeMismatchDimFetch $value = $this->cal[$type][$this->event_count][$key].$value; break; case 'VFREEBUSY': + // @phan-suppress-next-line PhanTypeMismatchDimFetch $value = $this->cal[$type][$this->freebusy_count][$key].$value; break; case 'VTODO': + // @phan-suppress-next-line PhanTypeMismatchDimFetch $value = $this->cal[$type][$this->todo_count][$key].$value; break; } @@ -303,18 +306,22 @@ public function add_to_array($type, $key, $value) switch ($type) { case "VTODO": + // @phan-suppress-next-line PhanTypeMismatchReturn $this->cal[$type][$this->todo_count][$key] = $value; break; case "VEVENT": + // @phan-suppress-next-line PhanTypeMismatchReturn $this->cal[$type][$this->event_count][$key] = $value; break; case "VFREEBUSY": + // @phan-suppress-next-line PhanTypeMismatchReturn $this->cal[$type][$this->freebusy_count][$key] = $value; break; default: + // @phan-suppress-next-line PhanTypeMismatchProperty $this->cal[$type][$key] = $value; break; } @@ -326,7 +333,7 @@ public function add_to_array($type, $key, $value) * Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value"); * * @param string $text Text - * @return array + * @return array{0:string,1:string} */ public function retun_key_value($text) { @@ -351,7 +358,7 @@ public function retun_key_value($text) * Parse RRULE return array * * @param string $value string - * @return array + * @return array */ public function ical_rrule($value) { @@ -425,14 +432,14 @@ public function ical_dt_date($key, $value) /** * Return sorted eventlist as array or false if calendar is empty * - * @return array|false + * @return array>|false */ public function get_sort_event_list() { // phpcs:enable $temp = $this->get_event_list(); if (!empty($temp)) { - usort($temp, array(&$this, "ical_dtstart_compare")); + usort($temp, array($this, "ical_dtstart_compare")); // false-positive @phpstan-ignore-line return $temp; } else { return false; @@ -443,9 +450,9 @@ public function get_sort_event_list() /** * Compare two unix timestamp * - * @param array $a Operand a - * @param array $b Operand b - * @return integer + * @param array{DTSTART:array{unixtime:string}} $a Operand a + * @param array{DTSTART:array{unixtime:string}} $b Operand b + * @return int */ public function ical_dtstart_compare($a, $b) { @@ -457,7 +464,7 @@ public function ical_dtstart_compare($a, $b) /** * Return eventlist array (not sorted eventlist array) * - * @return array + * @return array> */ public function get_event_list() { @@ -469,7 +476,7 @@ public function get_event_list() /** * Return freebusy array (not sort eventlist array) * - * @return array + * @return array> */ public function get_freebusy_list() { @@ -481,7 +488,7 @@ public function get_freebusy_list() /** * Return to do array (not sorted todo array) * - * @return array + * @return array> */ public function get_todo_list() { @@ -493,7 +500,7 @@ public function get_todo_list() /** * Return base calendar data * - * @return array + * @return array> */ public function get_calender_data() { @@ -505,7 +512,7 @@ public function get_calender_data() /** * Return array with all data * - * @return array + * @return array>>>|array>>>|array>>|array>> */ public function get_all_data() { diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f58894c212c10..13a77fdcb0af2 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1548,7 +1548,7 @@ print '
'; print '
'; - print ''; + print '
'; print ' '; // Column title of weeks numbers echo ' '; @@ -1659,7 +1659,7 @@ print ''; print '
'; - print '
#
'; + print '
'; print ' '; $i = 0; while ($i < 7) { @@ -1727,7 +1727,7 @@ print ''; print '
'; - echo '
'; + echo '
'; echo ' '; echo ' \n"; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 1274346b70fd8..014c728e5c405 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -836,7 +836,7 @@ $colorsbytype = array(); while ($currentdaytoshow < $lastdaytoshow) { - echo '
'.$langs->trans("Day".$arraytimestamp['wday'])."
'; + echo '
'; echo ''; echo ''; print ''; print ''; @@ -3228,7 +3240,10 @@ print $formfile->showdocuments('propal', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object); // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, array(), array('propal')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('propal'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; $compatibleImportElementsList = false; if ($user->hasRight('propal', 'creer') && $object->statut == Propal::STATUS_DRAFT) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f84defd8390a3..c2a66d70ed283 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -111,7 +111,7 @@ class Propal extends CommonObject /** * Ref from thirdparty * @var string - * @deprecated + * @deprecated Use $ref_customer * @see $ref_customer */ public $ref_client; @@ -144,7 +144,7 @@ class Propal extends CommonObject /** * @var int|'' - * @deprecated + * @deprecated Use $date_creation * @see $date_creation */ public $datec; @@ -205,18 +205,21 @@ class Propal extends CommonObject public $author; /** - * @deprecated + * @var float + * @deprecated See $total_ht * @see $total_ht */ public $price; /** - * @deprecated + * @var float + * @deprecated See $total_tva * @see $total_tva */ public $tva; /** - * @deprecated + * @var float + * @deprecated See $total_ttc * @see $total_ttc */ public $total; @@ -293,6 +296,9 @@ class Propal extends CommonObject */ public $availability; + /** + * @var int|string + */ public $duree_validite; /** @@ -483,7 +489,7 @@ public function add_product($idproduct, $qty, $remise_percent = 0) $productdesc = $prod->description; - $tva_tx = get_default_tva($mysoc, $this->thirdparty, $prod->id); + $tva_tx = (string) get_default_tva($mysoc, $this->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $this->thirdparty, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; @@ -556,7 +562,7 @@ public function insert_discount($idremise) $line->desc = $remise->description; // Description ligne $line->vat_src_code = $remise->vat_src_code; $line->tva_tx = $remise->tva_tx; - $line->subprice = -$remise->amount_ht; + $line->subprice = -(float) $remise->amount_ht; $line->fk_product = 0; // Id produit predefined $line->qty = 1; $line->remise_percent = 0; @@ -564,11 +570,11 @@ public function insert_discount($idremise) $line->info_bits = 2; // TODO deprecated - $line->price = -$remise->amount_ht; + $line->price = -(float) $remise->amount_ht; - $line->total_ht = -$remise->amount_ht; - $line->total_tva = -$remise->amount_tva; - $line->total_ttc = -$remise->amount_ttc; + $line->total_ht = -(float) $remise->amount_ht; + $line->total_tva = -(float) $remise->amount_tva; + $line->total_ttc = -(float) $remise->amount_ttc; $result = $line->insert(); if ($result > 0) { @@ -619,11 +625,11 @@ public function insert_discount($idremise) * @param string $label ??? * @param int|string $date_start Start date of the line * @param int|string $date_end End date of the line - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one * @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'.... * @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id - * @param double $pu_ht_devise Unit price in currency + * @param float $pu_ht_devise Unit price in currency * @param int $fk_remise_except Id discount if line is from a discount * @param int $noupdateafterinsertline No update after insert of line * @return int >0 if OK, <0 if KO @@ -868,11 +874,11 @@ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txloca * @param int $type 0/1=Product/service * @param int|string $date_start Start date of the line * @param int|string $date_end End date of the line - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param double $pu_ht_devise Unit price in currency + * @param float $pu_ht_devise Unit price in currency * @param int $notrigger disable line update trigger - * @param integer $rang line rank + * @param int $rang line rank * @return int 0 if OK, <0 if KO */ public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0) @@ -1488,14 +1494,14 @@ public function createFromClone(User $user, $socid = 0, $forceentity = null, $up if ($res > 0) { if ($update_prices === true) { $pu_ht = $prod->price; - $tva_tx = get_default_tva($mysoc, $objsoc, $prod->id); + $tva_tx = (string) get_default_tva($mysoc, $objsoc, $prod->id); $remise_percent = $objsoc->remise_percent; if (getDolGlobalString('PRODUIT_MULTIPRICES') && $objsoc->price_level > 0) { $pu_ht = $prod->multiprices[$objsoc->price_level]; if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) { - $tva_tx = $prod->multiprices_tva_tx[$objsoc->price_level]; + $tva_tx = (string) $prod->multiprices_tva_tx[$objsoc->price_level]; } } } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { @@ -1681,7 +1687,7 @@ public function fetch($rowid, $ref = '', $ref_ext = '', $forceentity = 0) $this->thirdparty = null; // Clear if another value was already set by fetch_thirdparty $this->fk_project = $obj->fk_project; - $this->project = null; // Clear if another value was already set by fetch_projet + $this->project = null; // Clear if another value was already set by fetchProject $this->model_pdf = $obj->model_pdf; $this->last_main_doc = $obj->last_main_doc; @@ -2975,7 +2981,7 @@ public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $so /** * Returns an array with the numbers of related invoices * - * @return array Array of invoices + * @return CommonInvoice[] Array of invoices */ public function getInvoiceArrayList() { @@ -2987,7 +2993,7 @@ public function getInvoiceArrayList() * Returns an array with id and ref of related invoices * * @param int $id Id propal - * @return array|int Array of invoices id + * @return CommonInvoice[]|int Array of invoices id */ public function InvoiceArrayList($id) { @@ -3738,7 +3744,7 @@ public function getTooltipContentArray($params) if (!$nofetch) { $langs->load('project'); if (is_null($this->project) || (is_object($this->project) && $this->project->isEmpty())) { - $res = $this->fetch_project(); + $res = $this->fetchProject(); if ($res > 0 && $this->project instanceof Project) { $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1); } @@ -3917,10 +3923,10 @@ public function getLinesArray($sqlforgedfilters = '') * * @param string $modele Force model to use ('' to not force) * @param Translate $outputlangs Object langs to use for output - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param int<0,1> $hidedetails Hide details of lines + * @param int<0,1> $hidedesc Hide description + * @param int<0,1> $hideref Hide ref + * @param ?array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 0d39226861c4f..c03db0740826e 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -49,10 +49,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 78b69f1308224..e609fc209956f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -2027,7 +2027,7 @@ // Availability if (!empty($arrayfields['ava.rowid']['checked'])) { print '
'; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/commande/agenda.php b/htdocs/commande/agenda.php index b8d5e64e7a05f..bdb2698ab96e5 100644 --- a/htdocs/commande/agenda.php +++ b/htdocs/commande/agenda.php @@ -53,10 +53,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7712718b5c177..24da1be5d19ce 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -859,7 +859,7 @@ $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; $tva_tx = $prodcustprice->lines[0]->tva_tx; - if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { + if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', (string) $tva_tx)) { $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; } $tva_npr = $prodcustprice->lines[0]->recuperableonly; @@ -871,7 +871,7 @@ setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } - if ( !$pricebycustomerexist && !empty($object->thirdparty->price_level)) { //// If price per segment + if (!$pricebycustomerexist && !empty($object->thirdparty->price_level)) { //// If price per segment $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; @@ -1331,6 +1331,15 @@ $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) { @@ -2136,7 +2145,7 @@ print ''; print ''; @@ -2147,7 +2156,7 @@ print ''; print ''; @@ -3015,7 +3024,7 @@ } } // 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, ''); } @@ -3161,7 +3170,10 @@ // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, array(), array('order')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('order'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; $compatibleImportElementsList = false; if ($usercancreate diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 14b44008580b7..58aa8d1843f40 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2056,17 +2056,17 @@ public function insert_discount($idremise) $line->desc = $remise->description; // Description ligne $line->vat_src_code = $remise->vat_src_code; $line->tva_tx = $remise->tva_tx; - $line->subprice = -$remise->amount_ht; - $line->price = -$remise->amount_ht; + $line->subprice = -(float) $remise->amount_ht; + $line->price = -(float) $remise->amount_ht; $line->fk_product = 0; // Id produit predefini $line->qty = 1; $line->remise_percent = 0; $line->rang = -1; $line->info_bits = 2; - $line->total_ht = -$remise->amount_ht; - $line->total_tva = -$remise->amount_tva; - $line->total_ttc = -$remise->amount_ttc; + $line->total_ht = -(float) $remise->amount_ht; + $line->total_tva = -(float) $remise->amount_tva; + $line->total_ttc = -(float) $remise->amount_ttc; $result = $line->insert(); if ($result > 0) { @@ -3804,7 +3804,7 @@ public function getTooltipContentArray($params) if (!$nofetch) { $langs->load('project'); if (is_null($this->project) || (is_object($this->project) && $this->project->isEmpty())) { - $res = $this->fetch_project(); + $res = $this->fetchProject(); if ($res > 0 && $this->project instanceof Project) { $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1); } diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 34fda8fefd672..d4a9067ea2f73 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -50,10 +50,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index ed2f577389e91..0c4b3b967c5a1 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -49,10 +49,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 6576b0155be67..9519590f6d2be 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2844,7 +2844,7 @@ if (!empty($arrayfields['c.facture']['checked'])) { print ''; if (!$i) { diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 04285cb126db4..3264a39c2aa00 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1682,7 +1682,7 @@ // Third party if (!empty($arrayfields['s.nom']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -2193,7 +2193,11 @@ // Billed if (!empty($arrayfields['c.facture']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index a94a6fe98f6bf..0d1fd60eede71 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -54,8 +54,9 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } $offset = $limit * $page; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index cb23d053bf1a4..944065d0456af 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -100,14 +100,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -$pageplusone = GETPOSTINT("pageplusone"); -if ($pageplusone) { - $page = $pageplusone - 1; -} -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -1494,7 +1491,7 @@ } $banklinestatic->id = $objp->rowid; - $banklinestatic->ref = $objp->rowid; + $banklinestatic->ref = (string) $objp->rowid; print ''; @@ -1551,25 +1548,25 @@ print $banktransferstatic->getNomUrl(0).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; - $paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment + $paymentstatic->ref = (string) $links[$key]['url_id']; // FIXME This is id, not ref of payment $paymentstatic->date = $db->jdate($objp->do); print $paymentstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; - $paymentsupplierstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment + $paymentsupplierstatic->ref = (string) $links[$key]['url_id']; // FIXME This is id, not ref of payment print $paymentsupplierstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_sc') { $paymentscstatic->id = $links[$key]['url_id']; - $paymentscstatic->ref = $links[$key]['url_id']; + $paymentscstatic->ref = (string) $links[$key]['url_id']; $paymentscstatic->label = $links[$key]['label']; print $paymentscstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_vat') { $paymentvatstatic->id = $links[$key]['url_id']; - $paymentvatstatic->ref = $links[$key]['url_id']; + $paymentvatstatic->ref = (string) $links[$key]['url_id']; print $paymentvatstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_salary') { $paymentsalstatic->id = $links[$key]['url_id']; - $paymentsalstatic->ref = $links[$key]['url_id']; + $paymentsalstatic->ref = (string) $links[$key]['url_id']; $paymentsalstatic->label = $links[$key]['label']; print $paymentsalstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_loan') { @@ -1578,15 +1575,15 @@ print ''.($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_donation') { $paymentdonationstatic->id = $links[$key]['url_id']; - $paymentdonationstatic->ref = $links[$key]['url_id']; + $paymentdonationstatic->ref = (string) $links[$key]['url_id']; print $paymentdonationstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_expensereport') { $paymentexpensereportstatic->id = $links[$key]['url_id']; - $paymentexpensereportstatic->ref = $links[$key]['url_id']; + $paymentexpensereportstatic->ref = (string) $links[$key]['url_id']; print $paymentexpensereportstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_various') { $paymentvariousstatic->id = $links[$key]['url_id']; - $paymentvariousstatic->ref = $links[$key]['url_id']; + $paymentvariousstatic->ref = (string) $links[$key]['url_id']; print $paymentvariousstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'banktransfert') { // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index d4de338baaaaf..85f91c5760c89 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2014-2017 Alexandre Spangaro + * Copyright (C) 2014-2024 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García * Copyright (C) 2018-2024 Frédéric France @@ -145,9 +145,7 @@ $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; $object->address = trim(GETPOST("account_address", "alphanohtml")); - $object->domiciliation = $object->address; // deprecated - $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_name = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml')); $object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml')); @@ -263,7 +261,6 @@ $object->iban = trim(GETPOST("iban")); $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; - $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_name = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml')); $object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml')); @@ -951,7 +948,7 @@ // Ref print ''; - print ''; + print ''; // Label print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index ef4d39c06f732..17971d298bac5 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -56,8 +56,8 @@ class Account extends CommonObject public $picto = 'account'; /** - * @var int Use id instead of rowid - * @deprecated + * @var int + * @deprecated Use $id instead of $rowid * @see $id */ public $rowid; @@ -71,7 +71,7 @@ class Account extends CommonObject /** * Bank account type. Check TYPE_ constants * @var int - * @deprecated + * @deprecated Use $type * @see $type */ public $courant; @@ -149,7 +149,7 @@ class Account extends CommonObject * IBAN number * * @var string - * @deprecated see $iban + * @deprecated See $iban */ public $iban_prefix; @@ -162,7 +162,7 @@ class Account extends CommonObject /** * Name of account holder * @var string - * @deprecated + * @deprecated Use $owner_name * @see $owner_name */ public $proprio; @@ -190,13 +190,19 @@ class Account extends CommonObject * @var string */ public $owner_town; + /** + * @var int + */ public $owner_country_id; + /** + * @var string + */ public $owner_country_code; /** * Address of the bank account * @var string - * @deprecated + * @deprecated See $address * @see $address */ public $domiciliation; @@ -206,15 +212,27 @@ class Account extends CommonObject * @var string */ public $address; + /** + * @var int + */ public $state_id; + /** + * @var string + */ public $state_code; + /** + * @var string + */ public $state; + /** + * @var int + */ public $country_id; /** * Variable containing all account types with their respective translated label. * Defined in __construct - * @var array + * @var array */ public $type_lib = array(); @@ -517,7 +535,7 @@ public function add_url_line($line_id, $url_id, $url, $label, $type) * @param int $fk_bank To search using bank transaction id * @param int $url_id To search using link to * @param string $type To search using type - * @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error + * @return int<-1,-1>|array Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error */ public function get_url($fk_bank = 0, $url_id = 0, $type = '') { @@ -737,20 +755,11 @@ public function create($user, $notrigger = 0) if (empty($balance)) { $balance = 0; } - if (empty($this->address && !empty($this->domiciliation))) { - dol_syslog(get_class($this)."::create domiciliation is deprecated use address", LOG_NOTICE); - $this->address = $this->domiciliation; - } if (empty($this->status && !empty($this->clos))) { dol_syslog(get_class($this)."::create clos is deprecated use status", LOG_NOTICE); $this->status = $this->clos; } - if (empty($this->address && !empty($this->domiciliation))) { - dol_syslog(get_class($this)."::create domiciliation is deprecated use address", LOG_NOTICE); - $this->address = $this->domiciliation; - } - // Load the library to validate/check a BAN account require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; @@ -804,7 +813,7 @@ public function create($user, $notrigger = 0) $sql .= ", '".$this->db->escape($this->iban)."'"; $sql .= ", '".$this->db->escape($this->address)."'"; $sql .= ", ".((int) $this->pti_in_ctti); - $sql .= ", '".$this->db->escape($this->owner_name ? $this->owner_name : $this->proprio)."'"; + $sql .= ", '".$this->db->escape($this->owner_name)."'"; $sql .= ", '".$this->db->escape($this->owner_address)."'"; $sql .= ", '".$this->db->escape($this->owner_zip)."'"; $sql .= ", '".$this->db->escape($this->owner_town)."'"; @@ -928,7 +937,7 @@ public function update($user, $notrigger = 0) $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'"; $sql .= ",domiciliation='".$this->db->escape($this->address)."'"; $sql .= ",pti_in_ctti=".((int) $this->pti_in_ctti); - $sql .= ",proprio = '".$this->db->escape($this->owner_name ? $this->owner_name : $this->proprio)."'"; + $sql .= ",proprio = '".$this->db->escape($this->owner_name)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; $sql .= ",owner_zip = '".$this->db->escape($this->owner_zip)."'"; $sql .= ",owner_town = '".$this->db->escape($this->owner_town)."'"; @@ -1035,8 +1044,8 @@ public function update_bban($user = null) $sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'"; $sql .= ",bic='".$this->db->escape($this->bic)."'"; $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'"; - $sql .= ",domiciliation='".$this->db->escape($this->address ? $this->address : $this->domiciliation)."'"; - $sql .= ",proprio = '".$this->db->escape($this->owner_name ? $this->owner_name : $this->proprio)."'"; + $sql .= ",domiciliation='".$this->db->escape($this->address)."'"; + $sql .= ",proprio = '".$this->db->escape($this->owner_name)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; $sql .= ",owner_zip = '".$this->db->escape($this->owner_zip)."'"; $sql .= ",owner_town = '".$this->db->escape($this->owner_town)."'"; @@ -1108,7 +1117,7 @@ public function fetch($id, $ref = '') $this->courant = $obj->type; $this->bank = $obj->bank; $this->clos = $obj->status; - $this->status = $obj->status; + $this->status = $obj->status; $this->rappro = $obj->rappro; $this->url = $obj->url; @@ -1118,16 +1127,17 @@ public function fetch($id, $ref = '') $this->cle_rib = $obj->cle_rib; $this->bic = $obj->bic; $this->iban = $obj->iban; - $this->domiciliation = $obj->address; $this->address = $obj->address; - $this->pti_in_ctti = $obj->pti_in_ctti; - $this->proprio = $obj->owner_name; + $this->owner_name = $obj->owner_name; + $this->proprio = $this->owner_name; $this->owner_address = $obj->owner_address; $this->owner_zip = $obj->owner_zip; $this->owner_town = $obj->owner_town; $this->owner_country_id = $obj->owner_country_id; + $this->pti_in_ctti = $obj->pti_in_ctti; + $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; $this->state = $obj->state; @@ -1858,8 +1868,8 @@ public function info($id) * * Some countries show less or more bank account properties to the user * - * @param int $includeibanbic 1=Return also key for IBAN and BIC - * @return array Array of fields to show + * @param int<0,1> $includeibanbic 1=Return also key for IBAN and BIC + * @return string[] Array of fields to show * @see useDetailedBBAN() */ public function getFieldsToShow($includeibanbic = 0) @@ -1899,7 +1909,7 @@ public function getFieldsToShow($includeibanbic = 0) * - BankAccountNumberKey * - DeskCode * - * @return array + * @return string[] */ public static function getAccountNumberOrder() { @@ -1961,19 +1971,18 @@ public function initAsSpecimen() $this->bank = 'MyBank'; $this->address = 'Rue de Paris'; - $this->proprio = 'Owner'; $this->owner_name = 'Owner'; $this->owner_address = 'Owner address'; $this->owner_zip = 'Owner zip'; $this->owner_town = 'Owner town'; - $this->owner_country_id = 'Owner country_id'; + $this->owner_country_id = 1; $this->country_id = 1; return 1; } /** - * Function used to replace a thirdparty id with another one. + * Function used to replace a third party id with another one. * * @param DoliDB $dbs Database handler * @param int $origin_id Old thirdparty id @@ -2180,6 +2189,7 @@ class AccountLine extends CommonObjectLine /** * User author of the reconciliation * TODO: variable used only by method info() => is it the same as $fk_user_rappro ? + * @var int */ public $user_rappro; diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index 1e28275239ca9..c97fb2e4416f4 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -58,12 +58,12 @@ class BankCateg // extends CommonObject public $error; /** - * @var array errors + * @var string[] errors */ public $errors; /** - * @var array context + * @var array context */ public $context; diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 52932b749a0f4..d0befa6c10f36 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -849,9 +849,9 @@ public function getKanbanView($option = '', $arraydata = null) } if (property_exists($this, 'datep')) { $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->datep), 'day').''; - } - if (property_exists($this, 'type_payment') && !empty($this->type_payment)) { - $return .= '
'.$langs->trans("Payment", $this->type_payment).' : '.$this->type_payment.''; + if ($this->type_payment) { + $return .= ' - '.$this->type_payment.''; + } } if (property_exists($this, 'accountancy_code')) { $return .= '
'.$langs->trans("Account").' : '.$this->accountancy_code.''; diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 3c38b99de6605..7c3834c05a606 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -54,8 +54,9 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } $offset = $limit * $page; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 94af3bf823e30..42b7617d28420 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -79,10 +79,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 773b840b1cd81..454f1e66e3991 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -164,7 +164,7 @@ 'datep' => array('label' => "DatePayment", 'checked' => 1, 'position' => 120), 'datev' => array('label' => "DateValue", 'checked' => -1, 'position' => 130), 'type' => array('label' => "PaymentMode", 'checked' => 1, 'position' => 140), - 'project' => array('label' => "Project", 'checked' => 1, 'position' => 200, "enabled" => isModEnabled('project')), + 'project' => array('label' => "Project", 'checked' => -1, 'position' => 200, "enabled" => isModEnabled('project')), 'bank' => array('label' => "BankAccount", 'checked' => 1, 'position' => 300, "enabled" => isModEnabled("bank")), 'entry' => array('label' => "BankTransactionLine", 'checked' => 1, 'position' => 310, "enabled" => isModEnabled("bank")), 'account' => array('label' => "AccountAccountingShort", 'checked' => 1, 'position' => 400, "enabled" => isModEnabled('accounting')), @@ -306,8 +306,12 @@ if ($search_accountancy_account > 0) { $sql .= " AND v.accountancy_code = ".((int) $search_accountancy_account); } -if ($search_accountancy_subledger > 0) { - $sql .= " AND v.subledger_account = ".((int) $search_accountancy_subledger); +if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { + $sql .= " AND v.subledger_account = '".$db->escape($search_accountancy_subledger)."'"; +} else { + if ($search_accountancy_subledger != '' && $search_accountancy_subledger != '-1') { + $sql .= natural_search("v.subledger_account", $search_accountancy_subledger); + } } if ($search_type_id > 0) { $sql .= " AND v.fk_typepayment=".((int) $search_type_id); @@ -315,6 +319,7 @@ if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } + //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -475,11 +480,11 @@ print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print '
'; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 082614b4cec08..1031227499919 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -103,10 +103,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 47f23fac914eb..0fd4ea09ccde5 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -2,6 +2,7 @@ /* Advance Targeting Emailing for mass emailing module * Copyright (C) 2013 Florian Henry * 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 @@ -85,12 +86,12 @@ class AdvanceTargetingMailing extends CommonObject public $fk_user_mod; /** - * @var array select target type + * @var array select target type */ public $select_target_type = array(); /** - * @var array type status comm prospect + * @var array type status comm prospect */ public $type_statuscommprospect = array(); @@ -129,7 +130,7 @@ public function __construct($db) $customerStatic->loadCacheOfProspStatus(); if (!empty($customerStatic->cacheprospectstatus)) { foreach ($customerStatic->cacheprospectstatus as $dataProspectSt) { - $this->type_statuscommprospect[$dataProspectSt['id']]=$dataProspectSt['label']; + $this->type_statuscommprospect[$dataProspectSt['id']] = $dataProspectSt['label']; } } else { $this->type_statuscommprospect = array( @@ -184,13 +185,13 @@ public function create($user, $notrigger = 0) $sql .= "fk_user_mod"; $sql .= ") VALUES ("; $sql .= " ".(!isset($this->name) ? 'NULL' : "'".$this->db->escape($this->name)."'").","; - $sql .= " ".$conf->entity.","; + $sql .= " ".((int) $conf->entity).","; $sql .= " ".(!isset($this->fk_element) ? 'NULL' : "'".$this->db->escape($this->fk_element)."'").","; $sql .= " ".(!isset($this->type_element) ? 'NULL' : "'".$this->db->escape($this->type_element)."'").","; $sql .= " ".(!isset($this->filtervalue) ? 'NULL' : "'".$this->db->escape($this->filtervalue)."'").","; - $sql .= " ".$user->id.","; + $sql .= " ".((int) $user->id).","; $sql .= " '".$this->db->idate(dol_now())."',"; - $sql .= " ".$user->id; + $sql .= " ".((int) $user->id); $sql .= ")"; $this->db->begin(); @@ -398,9 +399,9 @@ public function fetch_by_element($id = 0, $type_element = 'mailing') /** * Update object into database * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that modifies + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, >0 if OK */ public function update($user, $notrigger = 0) { @@ -428,11 +429,11 @@ public function update($user, $notrigger = 0) $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_advtarget SET"; $sql .= " name=".(isset($this->name) ? "'".$this->db->escape($this->name)."'" : "''").","; - $sql .= " entity=".$conf->entity.","; + $sql .= " entity=".((int) $conf->entity).","; $sql .= " fk_element=".(isset($this->fk_element) ? $this->fk_element : "null").","; $sql .= " type_element=".(isset($this->type_element) ? "'".$this->db->escape($this->type_element)."'" : "null").","; $sql .= " filtervalue=".(isset($this->filtervalue) ? "'".$this->db->escape($this->filtervalue)."'" : "null").","; - $sql .= " fk_user_mod=".$user->id; + $sql .= " fk_user_mod=".((int) $user->id); $sql .= " WHERE rowid=".((int) $this->id); @@ -461,9 +462,9 @@ public function update($user, $notrigger = 0) /** * Delete object in database * - * @param User $user User that deletes - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that deletes + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, >0 if OK */ public function delete($user, $notrigger = 0) { @@ -503,7 +504,7 @@ public function delete($user, $notrigger = 0) * Save query in database to retrieve it * * @param User $user User that deletes - * @param array $arrayquery All element to Query + * @param array $arrayquery All element to Query * @return int Return integer <0 if KO, >0 if OK */ public function savequery($user, $arrayquery) @@ -531,7 +532,7 @@ public function savequery($user, $arrayquery) /** * Load object in memory from database * - * @param array $arrayquery All element to Query + * @param array $arrayquery All element to Query * @return int Return integer <0 if KO, >0 if OK */ public function query_thirdparty($arrayquery) @@ -638,7 +639,7 @@ public function query_thirdparty($arrayquery) } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') { if ($arrayquery['options_'.$key] > 0) { - $sqlwhere[]= " (te.".$key." = ".((int) $arrayquery["options_".$key]).")"; + $sqlwhere[] = " (te.".$key." = ".((int) $arrayquery["options_".$key]).")"; } } else { if (is_array($arrayquery['options_'.$key])) { @@ -685,8 +686,8 @@ public function query_thirdparty($arrayquery) /** * Load object in memory from database * - * @param array $arrayquery All element to Query - * @param int $withThirdpartyFilter add contact with tridparty filter + * @param array $arrayquery All element to Query + * @param int $withThirdpartyFilter add contact with third party filter * @return int Return integer <0 if KO, >0 if OK */ public function query_contact($arrayquery, $withThirdpartyFilter = 0) diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index b66f031449064..8061c973877ef 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -53,7 +53,7 @@ public function __construct($db) /** * Affiche un champs select contenant une liste * - * @param array $selected_array à preselectionner + * @param string[] $selected_array à preselectionner * @param string $htmlname select field * @return string select field */ @@ -92,7 +92,7 @@ public function multiselectProspectionStatus($selected_array = array(), $htmlnam * Return combo list of activated countries, into language of user * * @param string $htmlname of html select object - * @param array $selected_array or Code or Label of preselected country + * @param string[] $selected_array or Code or Label of preselected country * @return string HTML string with select */ public function multiselectState($htmlname = 'state_id', $selected_array = array()) @@ -153,7 +153,7 @@ public function multiselectState($htmlname = 'state_id', $selected_array = array * Return combo list of activated countries, into language of user * * @param string $htmlname of html select object - * @param array $selected_array or Code or Label of preselected country + * @param string[] $selected_array or Code or Label of preselected country * @return string HTML string with select */ public function multiselectCountry($htmlname = 'country_id', $selected_array = array()) @@ -213,7 +213,7 @@ public function multiselectCountry($htmlname = 'country_id', $selected_array = a * Return select list for categories (to use in form search selectors) * * @param string $htmlname control name - * @param array $selected_array array of data + * @param string[] $selected_array array of data * @param User $user User action * @return string combo list code */ @@ -259,7 +259,7 @@ public function multiselectselectSalesRepresentatives($htmlname, $selected_array * Return select list for categories (to use in form search selectors) * * @param string $htmlname of combo list (example: 'search_sale') - * @param array $selected_array selected array + * @param string[] $selected_array selected array * @return string combo list code */ public function multiselectselectLanguage($htmlname = '', $selected_array = array()) @@ -351,7 +351,7 @@ public function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), * Return combo list with people title * * @param string $htmlname Name of HTML select combo field - * @param array $selected_array Array + * @param string[] $selected_array Array * @return string HTML combo */ public function multiselectCivility($htmlname = 'civilite_id', $selected_array = array()) @@ -391,8 +391,8 @@ public function multiselectCivility($htmlname = 'civilite_id', $selected_array = * Return multiselect list of entities. * * @param string $htmlname select - * @param array $options_array to manage - * @param array $selected_array to manage + * @param array $options_array to manage + * @param string[] $selected_array to manage * @param int $showempty show empty * @return string HTML combo */ diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 70d219562f12a..facaec0753fdd 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -90,7 +90,7 @@ class Mailing extends CommonObject /** * @var int status - * @deprecated + * @deprecated Use $status */ public $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely @@ -150,17 +150,17 @@ class Mailing extends CommonObject public $extraparams = array(); /** - * @var array statut dest + * @var array statut dest */ public $statut_dest = array(); /** - * @var array substitutionarray + * @var array substitutionarray */ public $substitutionarray; /** - * @var array substitutionarrayfortest + * @var array substitutionarrayfortest */ public $substitutionarrayfortest; diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index cf73c2f803993..d7267c81a6fff 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -53,10 +53,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index c70f8e846b9f3..c3d43361c8142 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -107,7 +107,7 @@ if ($ret > 0) { $ret = $object->fetch_thirdparty(); if ($ret > 0 && isset($object->fk_project)) { - $ret = $object->fetch_project(); + $ret = $object->fetchProject(); } } if ($ret <= 0) { @@ -156,7 +156,6 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (empty($reshook)) { $backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php'; @@ -1396,8 +1395,8 @@ } // 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) : ''); @@ -1721,7 +1720,20 @@ $result = $object->set_demand_reason($user, GETPOSTINT('demand_reason_id')); } elseif ($action == 'setconditions' && $usercancreate) { // Terms of payment - $result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTINT('cond_reglement_id_deposit_percent')); + $sql = "SELECT code "; + $sql .= "FROM " . $db->prefix() . "c_payment_term"; + $sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int')); + $result = $db->query($sql); + if ($result) { + $obj = $db->fetch_object($result); + if ($obj->code == 'DEP30PCTDEL') { + $result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTFLOAT('cond_reglement_id_deposit_percent')); + } else { + $object->deposit_percent = 0; + $object->update($user); + $result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), $object->deposit_percent); + } + } //} elseif ($action == 'setremisepercent' && $usercancreate) { // $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2)); //} elseif ($action == 'setremiseabsolue' && $usercancreate) { @@ -2173,7 +2185,7 @@ print ''.$langs->trans('NotePublic').''; $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (getDolGlobalString('PROPALE_ADDON_NOTE_PUBLIC_DEFAULT') ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null)), 'restricthtml'); - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); // Private note @@ -2182,7 +2194,7 @@ print ''.$langs->trans('NotePrivate').''; $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc)) ? $objectsrc->note_private : null)); - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); // print ' print '
'; - $form->form_availability('', $obj->availability, 'none', 1); + $form->form_availability(0, $obj->availability, 'none', 1); print ''.$langs->trans('NotePublic').''; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); // print ''; print '
'.$langs->trans('NotePrivate').''; - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); // print ''; print '
'; if ($obj->billed) { - print yn($obj->billed, 4); + print yn($obj->billed, $langs->trans("Billed")); } print ''; + print ''; print $getNomUrl_cache[$obj->socid]; // If module invoices enabled and user with invoice creation permissions @@ -1771,8 +1771,8 @@ } // Plannned date of delivery if (!empty($arrayfields['c.date_delivery']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_delivery), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_delivery), 'day'); print ''.yn($obj->billed).''; + if ($obj->billed) { + print yn($obj->billed, $langs->trans("Billed")); + } + print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'."\n"; +print '
'."\n"; // Fields title search // -------------------------------------------------------------------- -print ''; +print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 9f6e08cbe3918..c483a47db8578 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -446,7 +446,7 @@ $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print '
'; @@ -572,7 +577,13 @@ if (!empty($arrayfields['subledger']['checked'])) { print ''; print '
'; - print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200'); + + if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { + print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth150'); + } else { + print ''; + } + print '
'; print '
'."\n"; +print '
'."\n"; // Fields title search diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index b575cc8678b2b..a8ab833cde1a7 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -300,7 +300,7 @@ public function valid(User $user, $notrigger = 0) $sql = "UPDATE ".MAIN_DB_PREFIX."pos_cash_fence"; $sql .= " SET status = ".self::STATUS_VALIDATED.","; $sql .= " date_valid='".$this->db->idate($now)."',"; - $sql .= " fk_user_valid = ".$user->id; + $sql .= " fk_user_valid = ".((int) $user->id); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index e61d302f6befd..d976c63c5f5f2 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -53,8 +53,17 @@ class Deplacement extends CommonObject */ public $fk_element = ''; + /** + * @var int + */ public $fk_soc; + /** + * @var int|string + */ public $date; + /** + * @var string + */ public $type; /** @@ -408,7 +417,7 @@ public function getNomUrl($withpicto = 0) * List of types * * @param int $active Active or not - * @return array + * @return array */ public function listOfTypes($active = 1) { diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 0e86ea1d235b3..1f212f85e7479 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1128,7 +1128,7 @@ print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'); print ''; print ''; print ''; @@ -1398,35 +1398,6 @@ } print ''; - // Help of substitution key - $dateexample = dol_now(); - if (!empty($object->frequency) && !empty($object->date_when)) { - $dateexample = $object->date_when; - } - - // Help of substitution key - $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object); - - $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')'; - $substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')'; - $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')'; - $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')'; - $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')'; - $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')'; - $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')'; - $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')'; - $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')'; - // Only on template invoices - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour').')'; - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour').')'; - $substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $object->nb_gen_done; - $substitutionarray['__INVOICE_COUNTER_MAX__'] = $object->nb_gen_max; - - $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; - foreach ($substitutionarray as $key => $val) { - $htmltext .= $key.' = '.$langs->trans($val).'
'; - } - $htmltext .= '
'; // Bank Account print ''; - print ''; - // Note private - print ''; - print ''; // Model pdf print ''; print ''; print ''; @@ -6098,7 +6098,10 @@ function js_recalculate_revenuestamp(){ $somethingshown = $formfile->numoffiles; // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, array(), array('invoice')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('invoice'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; $compatibleImportElementsList = false; if ($usercancreate diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index db5378949d1e1..ef5939be02ffe 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2020 Thibault FOUCART - * Copyright (C) 2023 Joachim Kueter +/* Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2020 Thibault FOUCART + * Copyright (C) 2023 Joachim Kueter * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ class Invoices extends DolibarrApi private $invoice; /** - * @var FactureRec $templte_invoice {@type FactureRec} + * @var FactureRec $template_invoice {@type FactureRec} */ private $template_invoice; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index a724d2001ff12..816077ab08a74 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -2003,6 +2003,15 @@ public function setNextDate($date, $increment_nb_gen_done = 0, $notrigger = 0) $this->date_when = $date; if ($increment_nb_gen_done > 0) { $this->nb_gen_done++; + + if (getDolGlobalInt('MAIN_SUSPEND_FACTURE_REC_ON_MAX_GEN_REACHED') && $this->isMaxNbGenReached()) { + $resSuspend = $this->setValueFrom('suspended', 1); + + if ($resSuspend <= 0) { + dol_syslog(__METHOD__ . '::setValueFrom Error : ' . $this->error, LOG_ERR); + return -1; + } + } } if (!$notrigger) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 748ca9a08c86d..1149f4e150546 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -20,8 +20,8 @@ * Copyright (C) 2022 Sylvain Legrand * Copyright (C) 2023 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * 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 @@ -128,7 +128,7 @@ class Facture extends CommonInvoice /** * @var string customer ref - * @deprecated + * @deprecated Use $ref_customer * @see $ref_customer */ public $ref_client; @@ -2664,7 +2664,7 @@ public function insert_discount($idremise) $facligne->desc = $remise->description; // Description ligne $facligne->vat_src_code = $remise->vat_src_code; $facligne->tva_tx = $remise->tva_tx; - $facligne->subprice = -$remise->amount_ht; + $facligne->subprice = -(float) $remise->amount_ht; $facligne->fk_product = 0; // Id produit predefini $facligne->qty = 1; $facligne->remise_percent = 0; @@ -2689,14 +2689,14 @@ public function insert_discount($idremise) $facligne->pa_ht = $arraytmp['pa_total']; } - $facligne->total_ht = -$remise->amount_ht; - $facligne->total_tva = -$remise->amount_tva; - $facligne->total_ttc = -$remise->amount_ttc; + $facligne->total_ht = -(float) $remise->amount_ht; + $facligne->total_tva = -(float) $remise->amount_tva; + $facligne->total_ttc = -(float) $remise->amount_ttc; - $facligne->multicurrency_subprice = -$remise->multicurrency_subprice; - $facligne->multicurrency_total_ht = -$remise->multicurrency_amount_ht; - $facligne->multicurrency_total_tva = -$remise->multicurrency_amount_tva; - $facligne->multicurrency_total_ttc = -$remise->multicurrency_amount_ttc; + $facligne->multicurrency_subprice = -(float) $remise->multicurrency_subprice; + $facligne->multicurrency_total_ht = -(float) $remise->multicurrency_amount_ht; + $facligne->multicurrency_total_tva = -(float) $remise->multicurrency_amount_tva; + $facligne->multicurrency_total_ttc = -(float) $remise->multicurrency_amount_ttc; $lineid = $facligne->insert(); if ($lineid > 0) { diff --git a/htdocs/compta/facture/class/factureligne.class.php b/htdocs/compta/facture/class/factureligne.class.php index f4191f693ba5f..356c1ab382d02 100644 --- a/htdocs/compta/facture/class/factureligne.class.php +++ b/htdocs/compta/facture/class/factureligne.class.php @@ -291,9 +291,9 @@ public function fetch($rowid) /** * Insert line into database * - * @param int $notrigger 1 no triggers - * @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another - * @return int Return integer <0 if KO, >0 if OK + * @param int<0,1> $notrigger 1 no triggers + * @param int<0,1> $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another + * @return int Return integer <0 if KO, >0 if OK */ public function insert($notrigger = 0, $noerrorifdiscountalreadylinked = 0) { diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 9750fff5f5b8f..e6d8b689ac2b7 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -34,7 +34,13 @@ */ class FactureStats extends Stats { + /** + * @var int + */ public $socid; + /** + * @var int + */ public $userid; /** @@ -42,9 +48,21 @@ class FactureStats extends Stats */ public $table_element; + /** + * @var string + */ public $from; + /** + * @var string + */ public $field; + /** + * @var string + */ public $where = ''; + /** + * @var string + */ public $join; diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index c79e400db93e3..7cd3648e7718f 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,6 +46,9 @@ class PaymentTerm // extends CommonObject //public $element='c_payment_term'; //!< Id that identify managed objects //public $table_element='c_payment_term'; //!< Name of table without prefix where object is stored + /** + * @var array + */ public $context = array(); /** @@ -58,13 +62,37 @@ class PaymentTerm // extends CommonObject */ public $entity; + /** + * @var string + */ public $code; + /** + * @var string + */ public $sortorder; + /** + * @var string + */ public $active; + /** + * @var string + */ public $libelle; + /** + * @var string + */ public $libelle_facture; + /** + * @var string + */ public $type_cdr; + /** + * @var string + */ public $nbjour; + /** + * @var string + */ public $decalage; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 7c13b8a44fbd4..d60f5fdc9d57a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1021,8 +1021,10 @@ if ($search_fk_fac_rec_source) { $object = new FactureRec($db); - $object->id = (int) $search_fk_fac_rec_source; + $object->fetch((int) $search_fk_fac_rec_source); + $head = invoice_rec_prepare_head($object); + print dol_get_fiche_head($head, 'generated', $langs->trans('InvoicesGeneratedFromRec'), -1, 'bill'); // Add a div } @@ -1249,8 +1251,11 @@ $newcardbutton = ''; if ($contextpage != 'poslist') { $url = DOL_URL_ROOT.'/compta/facture/card.php?action=create'; - if (!empty($socid)) { - $url .= '&socid='.$socid; + if (!empty($object->socid)) { + $url .= '&socid='.urlencode((string) $object->socid); + } + if (!empty($object->id)) { + $url .= '&fac_rec='.urlencode((string) $object->id); } $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); diff --git a/htdocs/compta/facture/note-rec.php b/htdocs/compta/facture/note-rec.php new file mode 100644 index 0000000000000..03ad7f844b374 --- /dev/null +++ b/htdocs/compta/facture/note-rec.php @@ -0,0 +1,208 @@ + + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2017 Ferran Marcet + * + * 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/compta/facture/note-rec.php + * \ingroup invoice + * \brief Fiche de notes sur une facture recurrent + */ + +// Load Dolibarr environment +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; + +if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +} +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + + +// Load translation files required by the page +$langs->loadLangs(array('companies', 'bills')); + +$id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility +$ref = GETPOST('ref', 'alpha'); +$socid = GETPOSTINT('socid'); +$action = GETPOST('action', 'aZ09'); + +$objecttype = 'facture_rec'; +if ($action == "create" || $action == "add") { + $objecttype = ''; +} + +$object = new FactureRec($db); +// Load object +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); +} + +$permissionnote = $user->hasRight('facture', 'creer'); // Used by the include of actions_setnotes.inc.php + +// Security check +$socid = 0; +if ($user->socid) { + $socid = $user->socid; +} +$hookmanager->initHooks(array('invoicenote')); + +$result = restrictedArea($user, 'facture', $object->id, $objecttype); + +$usercancreate = $user->hasRight("facture", "creer"); + + +/* + * Actions + */ + +$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} +if (empty($reshook)) { + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once' +} + + + +/* + * View + */ + +$form = new Form($db); + +if (empty($object->id)) { + $title = $object->ref." - ".$langs->trans('Notes'); +} else { + $title = $langs->trans('Notes'); +} +$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; + +llxHeader('', $title, $helpurl); + +if (empty($object->id)) { + $langs->load('errors'); + echo '
'.$langs->trans("ErrorRecordNotFound").'
'; + llxFooter(); + exit; +} + + +if ($id > 0 ) { + $object = new FactureRec($db); + $object->fetch($id); + + $object->fetch_thirdparty(); + + $head = invoice_rec_prepare_head($object); + + $totalpaid = $object->getSommePaiement(); + + print dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'); + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = ''; + if ($action != 'editref') { + $morehtmlref .= $form->editfieldkey($object->ref, 'ref', $object->ref, $object, 0, '', '', 0, 2); + } else { + $morehtmlref .= $form->editfieldval('', 'ref', $object->ref, $object, 0, 'string'); + } + + $morehtmlref .= '
'; + // Thirdparty + $morehtmlref .= $object->thirdparty->getNomUrl(1); + // Project + if (isModEnabled('project')) { + $langs->load("projects"); + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } + } + } + $morehtmlref .= '
'; + + $morehtmlstatus = ''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlstatus); + + print '
'; + print '
'; + + + $cssclass = "titlefield"; + + // Help of substitution key + $dateexample = dol_now(); + if (!empty($object->frequency) && !empty($object->date_when)) { + $dateexample = $object->date_when; + } + + $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object); + + $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m') . ')'; + $substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%m') . ')'; + $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m') . ')'; + $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B') . ')'; + $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%B') . ')'; + $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B') . ')'; + $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y') . ')'; + $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%Y') . ')'; + $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y') . ')'; + // Only on template invoices + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour') . ')'; + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour') . ')'; + $substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $object->nb_gen_done; + $substitutionarray['__INVOICE_COUNTER_MAX__'] = $object->nb_gen_max; + + $htmltext = '' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':
'; + foreach ($substitutionarray as $key => $val) { + $htmltext .= $key . ' = ' . $langs->trans($val) . '
'; + } + $htmltext .= '
'; + + $textNotePub = $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic', 2); + $textNotePrive = $form->textwithpicto($langs->trans("NotePrivate"), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'); + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print dol_get_fiche_end(); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 91c63cc50fbaa..dbc6b86161194 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -377,11 +377,11 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if ($type == 'bank-transfer') { if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; + $morehtmlref .= ' '; } } else { if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; + $morehtmlref .= ' '; } } // Project diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 18d443d596f7d..398c7f443ccf7 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -45,10 +45,22 @@ class Localtax extends CommonObject */ public $picto = 'payment'; + /** + * @var int + */ public $ltt; + /** + * @var int|string + */ public $datep; + /** + * @var int|string + */ public $datev; + /** + * @var string + */ public $amount; /** @@ -61,6 +73,9 @@ class Localtax extends CommonObject */ public $fk_type; + /** + * @var string + */ public $paymenttype; /** @@ -535,7 +550,7 @@ public function addPayment($user) dol_print_error($this->db); } - $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs((float) $this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs((float) $this->amount), '', 0, $user); // Update fk_bank into llx_localtax so we know the line of localtax used to generate the bank entry. if ($bank_line_id > 0) { diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 0eb1559c2c65c..17527a265914a 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -50,18 +50,47 @@ class RemiseCheque extends CommonObject */ public $picto = 'payment'; + /** + * @var string + */ public $num; + /** + * @var string + */ public $intitule; - //! Numero d'erreur Plage 1024-1279 + /** + * @var int<-1033,-1024>|int<-18,-18>|int<-2,0> Error number from 1024 to 1279 + */ public $errno; + /** + * @var string + */ public $type = 'CHQ'; // 'CHQ', 'TRA', ... + /** + * @var float + */ public $amount; + /** + * @var int|string + */ public $date_bordereau; + /** + * @var int + */ public $account_id; + /** + * @var string + */ public $account_label; + /** + * @var int + */ public $author_id; + /** + * @var int + */ public $nbcheque; /** @@ -143,7 +172,7 @@ public function fetch($id, $ref = '') * @param User $user User making creation * @param int $account_id Bank account for cheque receipt * @param int $limit Limit ref of cheque to this - * @param array $toRemise array with cheques to remise + * @param int[] $toRemise array with cheques to remise * @return int Return integer <0 if KO, >0 if OK */ public function create($user, $account_id, $limit, $toRemise) @@ -268,7 +297,7 @@ public function create($user, $account_id, $limit, $toRemise) } else { $this->errno = -1; $this->error = $this->db->lasterror(); - $this->errno = $this->db->lasterrno(); + // $this->errno = $this->db->lasterrno(); } if (!$this->errno && (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_CHEQUE'))) { diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index a8a49ca43d3e0..ad4cb13dfdb64 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,14 +47,26 @@ class Cpaiement extends CommonDict /** * @var string - * @deprecated + * @deprecated Use $label * @see $label */ public $libelle; + /** + * @var string + */ public $type; + /** + * @var int<0,1> + */ public $active; + /** + * @var string + */ public $accountancy_code; + /** + * @var string + */ public $module; @@ -225,9 +238,9 @@ public function fetch($id, $ref = null) /** * Update object into database * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that modifies + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, >0 if OK */ public function update(User $user, $notrigger = 0) { diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 03512da69a326..3230ce19918fc 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -79,14 +79,16 @@ class Paiement extends CommonObject public $date; /** - * @deprecated + * @deprecated Use $amount, $amounts * @see $amount, $amounts + * @var float */ public $total; /** - * @deprecated + * @deprecated Use $amount, $amounts * @see $amount, $amounts + * @var float */ public $montant; @@ -101,7 +103,7 @@ class Paiement extends CommonObject public $multicurrency_amount; /** - * @var float[] array: invoice ID => amount for that invoice (in the main currency) + * @var array array: invoice ID => amount for that invoice (in the main currency) */ public $amounts = array(); @@ -125,6 +127,9 @@ class Paiement extends CommonObject */ public $pos_change = 0.0; + /** + * @var int + */ public $author; /** @@ -774,12 +779,12 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom $label, $totalamount, // Sign must be positive when we receive money (customer payment), negative when you give money (supplier invoice or credit note) $this->num_payment, - '', + 0, $user, $emetteur_nom, $emetteur_banque, $accountancycode, - null, + 0, '', $totalamount_main_currency ); @@ -969,9 +974,6 @@ public function update_date($date) $this->error = 'Error -1 '.$this->db->error(); } - if (!$error) { - } - if (!$error) { $this->datepaye = $date; $this->date = $date; @@ -1104,7 +1106,7 @@ public function info($id) * Return list of invoices the payment is related to. * * @param string $filter Filter - * @return int|array Return integer <0 if KO or array of invoice id + * @return int|int[] Return integer <0 if KO or array of invoice id * @see getAmountsArray() */ public function getBillsArray($filter = '') @@ -1138,7 +1140,7 @@ public function getBillsArray($filter = '') /** * Return list of amounts of payments. * - * @return int|array Array of amount of payments + * @return int|array Array of amount of payments * @see getBillsArray() */ public function getAmountsArray() diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php index 0e55d526a34cc..9090fa2ea4124 100644 --- a/htdocs/compta/paiement/info.php +++ b/htdocs/compta/paiement/info.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2013 Marcos García +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2013 Marcos García * * 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 @@ -36,6 +36,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); +$socid = GETPOSTINT('socid'); $object = new Paiement($db); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 89919a8b1d519..2f2b52b87b8cd 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1176,6 +1176,7 @@ public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL' while ($i < $num) { $row = $this->db->fetch_row($resql); // TODO Replace with fetch_object() + '@phan-var-force array,string> $row'; $factures[$i] = $row; // All fields if ($row[7] == 0) { @@ -1247,7 +1248,7 @@ public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL' //dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG); } else { if ($type != 'bank-transfer') { - $tmpsoc->id = $fac[2]; + $tmpsoc->id = (int) $fac[2]; $tmpsoc->name = $fac[8]; $invoice_url = "" . $fac[9] . ""; $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); @@ -1255,7 +1256,7 @@ public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL' $error++; } if ($type == 'bank-transfer' && $sourcetype != 'salary') { - $tmpsoc->id = $fac[2]; + $tmpsoc->id = (int) $fac[2]; $tmpsoc->name = $fac[8]; $invoice_url = "" . $fac[9] . ""; $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); @@ -1263,7 +1264,7 @@ public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL' $error++; } if ($type == 'bank-transfer' && $sourcetype == 'salary') { - $tmpuser->id = $fac[2]; + $tmpuser->id = (int) $fac[2]; $tmpuser->firstname = $fac[8]; $salary_url = "" . $fac[0] . ""; $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); @@ -1458,7 +1459,7 @@ public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL' $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456" - $this->raison_sociale = $account->proprio; + $this->raison_sociale = $account->owner_name; } $this->factures = $factures_prev_id; $this->context['factures_prev'] = $factures_prev; @@ -2533,7 +2534,7 @@ public function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrL $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; - $this->raison_sociale = $account->proprio; + $this->raison_sociale = $account->owner_name; } // Get pending payments diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 0db8f92ffef5e..41c80211eb02f 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -42,9 +42,21 @@ class RejetPrelevement */ public $db; + /** + * @var 'direct-debit'|'bank-transfer' + */ public $type; //prelevement or bank transfer + /** + * @var int + */ public $bon_id; + /** + * @var User + */ public $user; + /** + * @var int|string + */ public $date_rejet; /** @@ -70,7 +82,7 @@ class RejetPrelevement * * @param DoliDB $db Database handler * @param User $user Object user - * @param string $type Type ('direct-debit' for direct debit or 'bank-transfer' for credit transfer) + * @param 'direct-debit'|'bank-transfer' $type Type ('direct-debit' for direct debit or 'bank-transfer' for credit transfer) */ public function __construct($db, $user, $type) { @@ -105,7 +117,7 @@ public function __construct($db, $user, $type) * @param string $motif Motif * @param int $date_rejet Date reject * @param int $bonid Bon id - * @param int $facturation 1=Bill the reject + * @param int<0,1> $facturation 1=Bill the reject * @return int Return >=0 if OK, <0 if KO */ public function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0) @@ -304,8 +316,9 @@ private function _send_email($fac) /** * Retrieve the list of invoices * - * @param int $amounts If you want to get the amount of the order for each invoice - * @return array Array List of invoices related to the withdrawal line + * @param int<0,1> $amounts If you want to get the amount of the order for each invoice + + * @return array Array List of invoices related to the withdrawal line * @todo A withdrawal line is today linked to one and only one invoice. So the function should return only one object ? */ private function getListInvoices($amounts = 0) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index faa4c2e26d677..1abd800de5032 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -861,7 +861,7 @@ } // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object, null, array('myobject')); + //$tmparray = $form->showLinkToObjectBlock($object, null, array('myobject'), 1); //$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index b532bf4209552..d6cb25828ce67 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,8 +36,14 @@ */ class Cchargesociales { + /** + * @var DoliDB + */ public $db; + /** + * @var int + */ public $id; /** @@ -51,7 +58,7 @@ class Cchargesociales /** * @var string Label - * @deprecated + * @deprecated Use $label */ public $libelle; @@ -60,8 +67,17 @@ class Cchargesociales */ public $label; + /** + * @var string + */ public $deductible; + /** + * @var string + */ public $active; + /** + * @var string + */ public $code; /** @@ -73,10 +89,13 @@ class Cchargesociales * @var string module */ public $module; + /** + * @var string + */ public $accountancy_code; /** - * @var array array of errors + * @var string[] array of errors */ public $errors = array(); @@ -151,13 +170,13 @@ public function create(User $user, $notrigger = 0) $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); //if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) $error++; - //// End call triggers + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) $error++; + //// End call triggers //} } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index cb464d87482be..7aa082276268a 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/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 712175abb4a19..1d9910fec7d7a 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -598,7 +598,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom $label, $total, $this->num_payment, - '', + 0, $user, $emetteur_nom, $emetteur_banque diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 03ac361feada0..b3636f64cdb75 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -849,7 +849,7 @@ } // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object, null, array('myobject')); + //$tmparray = $form->showLinkToObjectBlock($object, null, array('myobject'), 1); //$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index 5f2098ce80e34..77893f543b0e2 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -54,8 +54,14 @@ class PaymentVAT extends CommonObject */ public $fk_tva; + /** + * @var int|'' + */ public $datec = ''; + /** + * @var int|'' + */ public $datep = ''; /** @@ -597,7 +603,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom $label, $total, $this->num_payment, - '', + 0, $user, $emetteur_nom, $emetteur_banque diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index f8a06cf0837fd..9ed504b6a138d 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -679,9 +679,9 @@ public function addPayment($user) } if ($this->amount > 0) { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs((float) $this->amount), $this->num_payment, '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs((float) $this->amount), $this->num_payment, 0, $user); } else { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs((float) $this->amount), $this->num_payment, '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs((float) $this->amount), $this->num_payment, 0, $user); } // Update fk_bank into llx_tva. So we know vat line used to generate bank transaction diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 76180fc314d35..2c04649e2b0cd 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -100,10 +100,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 7aac94c5ba614..28a9186b4e647 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -33,14 +33,31 @@ abstract class ActionsContactCardCommon */ public $db; + /** + * @var string + */ public $dirmodule; + /** + * @var string + */ public $targetmodule; + /** + * @var string + */ public $canvas; + /** + * @var string + */ public $card; - //! Template container + /** + * @var array Template container + */ public $tpl = array(); - //! Object container + //! + /** + * @var Contact Object container + */ public $object; /** @@ -295,13 +312,13 @@ private function assign_post() $this->object->zip = GETPOST("zipcode"); $this->object->town = GETPOST("town"); $this->object->country_id = GETPOST("country_id") ? GETPOST("country_id") : $mysoc->country_id; - $this->object->state_id = GETPOST("state_id"); + $this->object->state_id = GETPOSTINT("state_id"); $this->object->phone_pro = GETPOST("phone_pro"); $this->object->phone_perso = GETPOST("phone_perso"); $this->object->phone_mobile = GETPOST("phone_mobile"); $this->object->fax = GETPOST("fax"); $this->object->email = GETPOST("email"); - $this->object->priv = GETPOST("priv"); + $this->object->priv = GETPOSTINT("priv"); $this->object->note = GETPOST("note", "restricthtml"); $this->object->canvas = GETPOST("canvas"); @@ -309,14 +326,17 @@ private function assign_post() if ($this->object->country_id) { $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".((int) $this->object->country_id); $resql = $this->db->query($sql); + $obj = null; if ($resql) { $obj = $this->db->fetch_object($resql); } else { dol_print_error($this->db); } - $this->object->country_id = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; - $this->object->country_code = $obj->code; - $this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; + if ($obj !== null) { + $this->object->country_id = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; + $this->object->country_code = $obj->code; + $this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; + } } } } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index c08400b749ea3..81d566c9b4966 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1174,13 +1174,13 @@ function init_check_no_email(input) { // Note Public print '
'; // Note Private print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 553cd49ddf521..08041134de3e4 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -129,8 +129,17 @@ class Contact extends CommonObject 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -1, 'position' => 1000), ); + /** + * @var string + */ public $civility_id; // In fact we store civility_code + /** + * @var string + */ public $civility_code; + /** + * @var string + */ public $civility; /** @@ -150,7 +159,7 @@ class Contact extends CommonObject /** * @var string The civilite code, not an integer - * @deprecated + * @deprecated Use $civility_code * @see $civility_code */ public $civilite; @@ -204,6 +213,9 @@ class Contact extends CommonObject * @var int Thirdparty ID */ public $socid; // both socid and fk_soc are used + /** + * @var int + */ public $fk_soc; // both socid and fk_soc are used /** @@ -216,6 +228,9 @@ class Contact extends CommonObject */ public $statut; + /** + * @var string + */ public $code; /** @@ -227,7 +242,7 @@ class Contact extends CommonObject /** * Email * @var string - * @deprecated + * @deprecated Use $email * @see $email */ public $mail; @@ -247,7 +262,7 @@ class Contact extends CommonObject /** * Array of social-networks - * @var array + * @var array */ public $socialnetworks; @@ -333,13 +348,16 @@ class Contact extends CommonObject * Old copy * @var static */ - public $oldcopy; // To contains a clone of this when we need to save old properties of object + public $oldcopy; // To contain a clone of this when we need to save old properties of object /** - * @var array roles + * @var array roles */ public $roles; + /** + * @var array + */ public $cacheprospectstatus = array(); /** @@ -347,8 +365,14 @@ class Contact extends CommonObject */ public $fk_prospectlevel; + /** + * @var int + */ public $stcomm_id; + /** + * @var string + */ public $statut_commercial; /** @@ -755,11 +779,11 @@ public function update($id, $user = null, $notrigger = 0, $action = 'update', $n /** * Return DN string complete in the LDAP directory for the object * - * @param array $info Info string loaded by _load_ldap_info - * @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) - * 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb) - * 2=Return key only (uid=qqq) - * @return string DN + * @param array $info Info array loaded by _load_ldap_info + * @param int<0,2> $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) + * 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb) + * 2=Return key only (uid=qqq) + * @return string DN */ public function _load_ldap_dn($info, $mode = 0) { @@ -782,7 +806,7 @@ public function _load_ldap_dn($info, $mode = 0) /** * Initialize info table (LDAP attributes table) * - * @return array Attributes info table + * @return array Attributes info table */ public function _load_ldap_info() { @@ -1867,7 +1891,7 @@ public function fetchRoles() * Get thirdparty contact roles of a given contact * * @param string $element Element type - * @return array|int Array of contact roles or -1 + * @return array|int<-1,-1> Array of contact roles or -1 * @throws Exception */ public function getContactRoles($element = '') diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 44a4b4247e9f7..b2a71087bba4a 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -53,10 +53,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 598c92d620a4e..259d7ec71c05c 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -56,10 +56,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/contact/messaging.php b/htdocs/contact/messaging.php index 9ec768fd56a5a..b24f61db4d667 100644 --- a/htdocs/contact/messaging.php +++ b/htdocs/contact/messaging.php @@ -98,10 +98,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 8731ffa4354bf..7d48c26e5e16f 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -73,10 +73,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 92ecbc68ad77d..6c14667af5e1f 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1295,13 +1295,13 @@ } print ''; if (empty($user->socid)) { print ''; } @@ -2344,7 +2344,11 @@ // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, array(), array('contrat')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('contrat'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); // Show online signature link diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e12ea91752d23..81371d0556e95 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -41,7 +41,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonsignedobject.class.php'; /** - * Class to manage contracts + * Class to manage contracts + * * @property int $signed_status * @static array $SIGNED_STATUSES */ @@ -551,7 +552,6 @@ public function validate(User $user, $force_number = '', $notrigger = 0) if ($num) { $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET ref = '".$this->db->escape($num)."', statut = 1"; - //$sql.= ", fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'"; $sql .= " WHERE rowid = ".((int) $this->id)." AND statut = 0"; dol_syslog(get_class($this)."::validate", LOG_DEBUG); @@ -1397,7 +1397,7 @@ public function update($user, $notrigger = 0) $sql .= " ref_customer=".(isset($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : "null").","; $sql .= " ref_supplier=".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "null").","; $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").","; - $sql .= " entity=".$conf->entity.","; + $sql .= " entity=".((int) $conf->entity).","; $sql .= " date_contrat=".(dol_strlen($this->date_contrat) != 0 ? "'".$this->db->idate($this->date_contrat)."'" : 'null').","; $sql .= " statut=".(isset($this->statut) ? $this->statut : (isset($this->status) ? $this->status : "null")).","; $sql .= " fk_soc=".($this->socid > 0 ? $this->socid : "null").","; @@ -2066,7 +2066,7 @@ public function getTooltipContentArray($params) if (!$nofetch) { $langs->load('project'); if (is_null($this->project) || (is_object($this->project) && $this->project->isEmpty())) { - $res = $this->fetch_project(); + $res = $this->fetchProject(); if ($res > 0 && $this->project instanceof Project) { $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1); } diff --git a/htdocs/contrat/class/contratligne.class.php b/htdocs/contrat/class/contratligne.class.php index a29539d11010e..713497af42ea1 100644 --- a/htdocs/contrat/class/contratligne.class.php +++ b/htdocs/contrat/class/contratligne.class.php @@ -722,11 +722,11 @@ public function update($user, $notrigger = 0) $sql .= " fk_remise_except = ".($this->fk_remise_except > 0 ? $this->fk_remise_except : "null").","; $sql .= " subprice = ".($this->subprice != '' ? $this->subprice : "null").","; $sql .= " price_ht = ".($this->price_ht != '' ? $this->price_ht : "null").","; - $sql .= " total_ht = ".$this->total_ht.","; - $sql .= " total_tva = ".$this->total_tva.","; - $sql .= " total_localtax1 = ".$this->total_localtax1.","; - $sql .= " total_localtax2 = ".$this->total_localtax2.","; - $sql .= " total_ttc = ".$this->total_ttc.","; + $sql .= " total_ht = ".((float) $this->total_ht).","; + $sql .= " total_tva = ".((float) $this->total_tva).","; + $sql .= " total_localtax1 = ".((float) $this->total_localtax1).","; + $sql .= " total_localtax2 = ".((float) $this->total_localtax2).","; + $sql .= " total_ttc = ".((float) $this->total_ttc).","; $sql .= " fk_product_fournisseur_price = ".(!empty($this->fk_fournprice) ? $this->fk_fournprice : "NULL").","; $sql .= " buy_price_ht = '".price2num($this->pa_ht)."',"; $sql .= " info_bits = '".$this->db->escape($this->info_bits)."',"; diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 8b4ad58593747..677f7c1794cb0 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -56,10 +56,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/contrat/messaging.php b/htdocs/contrat/messaging.php index 6880ad9dffc8b..29626527dd146 100644 --- a/htdocs/contrat/messaging.php +++ b/htdocs/contrat/messaging.php @@ -60,10 +60,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 39ad76ff8eecc..5c10a40db4e05 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 @@ } $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/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 816699e898908..1cbe46885d76e 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -24,9 +24,11 @@ * \brief Code for actions on extrafields admin pages */ + /** @var ExtraFields $extrafields */ $maxsizestring = 255; $maxsizeint = 10; -$mesg = array(); +$mesg = ''; +$mesgs = array(); $extrasize = GETPOST('size', 'intcomma'); $type = GETPOST('type', 'alphanohtml'); @@ -69,61 +71,61 @@ if (!$type) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); + $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); $action = 'create'; } if ($type == 'varchar' && $extrasize <= 0) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size")); + $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size")); $action = 'edit'; } if ($type == 'varchar' && $extrasize > $maxsizestring) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring); + $mesgs[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring); $action = 'create'; } if ($type == 'int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint); + $mesgs[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint); $action = 'create'; } if ($type == 'stars' && ($extrasize < 1 || $extrasize > 10)) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeForStarsType"); + $mesgs[] = $langs->trans("ErrorSizeForStarsType"); $action = 'create'; } if ($type == 'select' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForSelectType"); + $mesgs[] = $langs->trans("ErrorNoValueForSelectType"); $action = 'create'; } if ($type == 'sellist' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForSelectListType"); + $mesgs[] = $langs->trans("ErrorNoValueForSelectListType"); $action = 'create'; } if ($type == 'checkbox' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForCheckBoxType"); + $mesgs[] = $langs->trans("ErrorNoValueForCheckBoxType"); $action = 'create'; } if ($type == 'link' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForLinkType"); + $mesgs[] = $langs->trans("ErrorNoValueForLinkType"); $action = 'create'; } if ($type == 'radio' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForRadioType"); + $mesgs[] = $langs->trans("ErrorNoValueForRadioType"); $action = 'create'; } if ((($type == 'radio') || ($type == 'checkbox')) && $param) { @@ -136,13 +138,13 @@ if (count($matches[0]) > 1) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); + $mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'create'; } } else { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); + $mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'create'; } } @@ -153,7 +155,7 @@ if (strlen(GETPOST('attrname', 'aZ09')) < 3) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3); + $mesgs[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3); $action = 'create'; } } @@ -163,7 +165,7 @@ if (in_array(strtoupper(GETPOST('attrname', 'aZ09')), $listofreservedwords)) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09')); + $mesgs[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09')); $action = 'create'; } } @@ -233,17 +235,18 @@ } else { $error++; $mesg = $extrafields->error; - setEventMessages($mesg, null, 'errors'); + $mesgs = array_merge($mesgs, $extrafields->errors); + setEventMessages($mesg, $mesgs, 'errors'); } } else { $error++; $langs->load("errors"); $mesg = $langs->trans("ErrorFieldCanNotContainSpecialNorUpperCharacters", $langs->transnoentities("AttributeCode")); - setEventMessages($mesg, null, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); $action = 'create'; } } else { - setEventMessages($mesg, null, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); } } } @@ -255,55 +258,55 @@ if (!$type) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); + $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); $action = 'edit'; } if ($type == 'varchar' && $extrasize <= 0) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size")); + $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size")); $action = 'edit'; } if ($type == 'varchar' && $extrasize > $maxsizestring) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring); + $mesgs[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring); $action = 'edit'; } if ($type == 'int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint); + $mesgs[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint); $action = 'edit'; } if ($type == 'select' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForSelectType"); + $mesgs[] = $langs->trans("ErrorNoValueForSelectType"); $action = 'edit'; } if ($type == 'sellist' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForSelectListType"); + $mesgs[] = $langs->trans("ErrorNoValueForSelectListType"); $action = 'edit'; } if ($type == 'stars' && ($extrasize < 1|| $extrasize > 10)) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorSizeForStarsType"); + $mesgs[] = $langs->trans("ErrorSizeForStarsType"); $action = 'edit'; } if ($type == 'checkbox' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForCheckBoxType"); + $mesgs[] = $langs->trans("ErrorNoValueForCheckBoxType"); $action = 'edit'; } if ($type == 'radio' && !$param) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorNoValueForRadioType"); + $mesgs[] = $langs->trans("ErrorNoValueForRadioType"); $action = 'edit'; } if ((($type == 'radio') || ($type == 'checkbox')) && $param) { @@ -316,13 +319,13 @@ if (count($matches[0]) > 1) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); + $mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'edit'; } } else { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); + $mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'edit'; } } @@ -333,7 +336,7 @@ if (strlen(GETPOST('attrname', 'aZ09')) < 3 && !getDolGlobalString('MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE')) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3); + $mesgs[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3); $action = 'edit'; } } @@ -343,7 +346,7 @@ if (in_array(strtoupper(GETPOST('attrname', 'aZ09')), $listofreservedwords) && !getDolGlobalString('MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE')) { $error++; $langs->load("errors"); - $mesg[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09')); + $mesgs[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09')); $action = 'edit'; } } @@ -416,7 +419,8 @@ } else { $error++; $mesg = $extrafields->error; - setEventMessages($mesg, null, 'errors'); + $mesgs = array_merge($mesgs, $extrafields->errors); + setEventMessages($mesg, $mesgs, 'errors'); } } else { $error++; @@ -425,7 +429,7 @@ setEventMessages($mesg, null, 'errors'); } } else { - setEventMessages($mesg, null, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); } } } @@ -443,6 +447,7 @@ exit; } else { $mesg = $extrafields->error; + $mesgs = array_merge($mesgs, $extrafields->errors); } } else { $error++; diff --git a/htdocs/core/actions_fetchobject.inc.php b/htdocs/core/actions_fetchobject.inc.php index 2492ab3dbe6d8..85573c4da5e3f 100644 --- a/htdocs/core/actions_fetchobject.inc.php +++ b/htdocs/core/actions_fetchobject.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-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 diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 1d8fec0b090b7..8aaee476005f6 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -503,8 +503,8 @@ //var_dump($oneemailperrecipient); var_dump($listofqualifiedobj); var_dump($listofqualifiedref); foreach ($looparray as $objectid => $objecttmp) { // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object // Make substitution in email content - if (isModEnabled('project') && method_exists($objecttmp, 'fetch_projet') && is_null($objecttmp->project)) { - $objecttmp->fetch_projet(); + if (isModEnabled('project') && method_exists($objecttmp, 'fetchProject') && is_null($objecttmp->project)) { + $objecttmp->fetchProject(); } $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $objecttmp); $substitutionarray['__ID__'] = ($oneemailperrecipient ? implode(', ', array_keys($listofqualifiedobj)) : $objecttmp->id); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 1e6cbedd4fca9..3ffbd79633676 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -411,7 +411,7 @@ // When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param // When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath // var_dump("section=".$section." title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm(permtoeditline)=".$perm." relativepath=".$relativepath." param=".$param." url=".$url); - $formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm, '', $sortfield, $sortorder); + $formfile->list_of_documents($filearray, null, $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm, '', $sortfield, $sortorder); } } diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 0ea8d1821695e..6290659b95564 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -53,9 +53,15 @@ if (GETPOSTISSET('option')) { $params['option'] = GETPOST('option', 'restricthtml'); } - +$element_ref = ''; +if (is_numeric($id)) { + $id = (int) $id; +} else { + $element_ref = $id; + $id = 0; +} // Load object according to $element -$object = fetchObjectByElement($id, $objecttype); +$object = fetchObjectByElement($id, $objecttype, $element_ref); if (empty($object->element)) { httponly_accessforbidden('Failed to get object with fetchObjectByElement(id='.$id.', objecttype='.$objecttype.')'); } diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php index 1324096d3d534..5771e4edbe905 100644 --- a/htdocs/core/ajax/box.php +++ b/htdocs/core/ajax/box.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007-2012 Laurent Destailleur * 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 @@ -44,7 +45,10 @@ $boxid = GETPOSTINT('boxid'); $boxorder = GETPOST('boxorder'); -$zone = GETPOST('zone'); // Can be '0' or '1' or 'pagename'... +$zone = GETPOST('zone'); // Can be key for zone +if ($zone !== '') { + $zone = (int) $zone; +} $userid = GETPOSTINT('userid'); // Security check diff --git a/htdocs/core/ajax/editextrafield.php b/htdocs/core/ajax/editextrafield.php index 1cc4178fbc8b7..3982b54244193 100644 --- a/htdocs/core/ajax/editextrafield.php +++ b/htdocs/core/ajax/editextrafield.php @@ -1,5 +1,6 @@ +/* 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 @@ -51,7 +52,14 @@ $value = GETPOST('value', 'aZ09'); $module = getElementProperties($objectType)['module']; -$object = fetchObjectByElement($objectId, $objectType); +$element_ref = ''; +if (is_numeric($objectId)) { + $objectId = (int) $objectId; +} else { + $element_ref = $objectId; + $objectId = 0; +} +$object = fetchObjectByElement($objectId, $objectType, $element_ref); // Security check if (!$user->hasRight($module, $object->element, 'write') && !$user->hasRight($module, 'write')) { diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index da926556250f1..949c018d353a4 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -1,6 +1,7 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2011-2014 Regis Houssin + * 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 @@ -42,10 +43,16 @@ $element = GETPOST('element', 'alpha'); $table_element = GETPOST('table_element', 'alpha'); $fk_element = GETPOST('fk_element', 'alpha'); -$id = $fk_element; // Load object according to $id and $element -$object = fetchObjectByElement($id, $element); +$element_ref = ''; +if (is_numeric($fk_element)) { + $id = (int) $fk_element; +} else { + $element_ref = $fk_element; + $id = 0; +} +$object = fetchObjectByElement($id, $element, $element_ref); $module = $object->module; $element = $object->element; diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index 5caa21f0cfc26..eba220a9d9b2d 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -1,6 +1,7 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2011-2012 Regis Houssin + * 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 @@ -57,7 +58,14 @@ */ // Load object according to $id and $element -$object = fetchObjectByElement($id, $element); +$element_ref = ''; +if (is_numeric($fk_element)) { + $id = (int) $fk_element; +} else { + $element_ref = $fk_element; + $id = 0; +} +$object = fetchObjectByElement($id, $element, $element_ref); $module = $object->module; $element = $object->element; diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 4d9954669eb9b..d1f8411f3acc1 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2014 Charles-Fr BENKE - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-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/core/boxes/box_actions_future.php b/htdocs/core/boxes/box_actions_future.php index 88293dfff4c51..43eeed62e9519 100644 --- a/htdocs/core/boxes/box_actions_future.php +++ b/htdocs/core/boxes/box_actions_future.php @@ -3,8 +3,8 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2014 Charles-Fr BENKE - * Copyright (C) 2015 Frederic France - * Copyright (C) 2024 MDW + * 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 diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index e62e49fe3a679..9ab9544671e0d 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2015 Laurent Destailleur - * Copyright (C) 2014-2021 Frederic France + * Copyright (C) 2014-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/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 3ab3863fdb6e2..edf35d08df134 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2015-2023 Frederic France + * Copyright (C) 2015-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/core/boxes/box_boms.php b/htdocs/core/boxes/box_boms.php index 99ca90917e268..75d929e0b1ae9 100644 --- a/htdocs/core/boxes/box_boms.php +++ b/htdocs/core/boxes/box_boms.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-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/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index ddaf6749dfd4d..dea4675db3f4b 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-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/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 179eaaf2edbb8..43a4bee56b958 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -1,5 +1,6 @@ + * 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 @@ -30,13 +31,25 @@ */ class Ccountry extends CommonDict { + /** + * @var string + */ public $element = 'ccountry'; //!< Id that identify managed objects + /** + * @var string + */ public $table_element = 'c_country'; //!< Name of table without prefix where object is stored + /** + * @var string + */ public $code_iso; + /** + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> + */ public $fields = array( - 'label' => array('type'=>'varchar(250)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>15, 'notnull'=>-1, 'showoncombobox'=>'1') + 'label' => array('type' => 'varchar(250)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 15, 'notnull' => -1, 'showoncombobox' => 1) ); diff --git a/htdocs/core/class/cgenericdic.class.php b/htdocs/core/class/cgenericdic.class.php index c39f8cbbf2378..9c4e331777530 100644 --- a/htdocs/core/class/cgenericdic.class.php +++ b/htdocs/core/class/cgenericdic.class.php @@ -48,6 +48,9 @@ class CGenericDic extends CommonDict */ public $lines = array(); + /** + * @var string + */ public $code; /** @@ -55,6 +58,9 @@ class CGenericDic extends CommonDict */ public $label; + /** + * @var int<0,1> + */ public $active; @@ -344,9 +350,9 @@ public function update(User $user, $notrigger = 0) // Update request $sql = "UPDATE ".$this->db->prefix().$this->table_element.' SET'; $sql .= " code = ".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").','; - $sql .= " ".$fieldlabel." = ".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").','; + $sql .= " ".$this->db->sanitize($fieldlabel)." = ".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").','; $sql .= " active = ".(isset($this->active) ? $this->active : "null"); - $sql .= " WHERE ".$fieldrowid." = ".((int) $this->id); + $sql .= " WHERE ".$this->db->sanitize($fieldrowid)." = ".((int) $this->id); $this->db->begin(); diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 9ffa0d60a1e36..c1e3f61379d23 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -249,14 +249,14 @@ public function update(User $user, $notrigger = 0) // Update request $sql = "UPDATE ".$this->db->prefix().$this->table_element." SET"; - $sql .= " description=".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").","; - $sql .= " datec=".($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null').","; - $sql .= " fk_element=".(isset($this->fk_element) ? $this->fk_element : "null").","; - $sql .= " element_type='".$this->db->escape($this->element_type)."',"; - $sql .= " fk_user_modif=".$user->id.","; - $sql .= " entity=".(!empty($this->entity) ? $this->entity : '1').","; - $sql .= " import_key=".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); - $sql .= " WHERE rowid=".((int) $this->id); + $sql .= " description = ".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").","; + $sql .= " datec = ".($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null').","; + $sql .= " fk_element = ".(isset($this->fk_element) ? $this->fk_element : "null").","; + $sql .= " element_type = '".$this->db->escape($this->element_type)."',"; + $sql .= " fk_user_modif = ".((int) $user->id).","; + $sql .= " entity = ".(!empty($this->entity) ? $this->entity : '1').","; + $sql .= " import_key = ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); + $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index ca60491f6d1d1..d966f7853038e 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -760,7 +760,7 @@ public function get_substitutionarray_object($object, $outputlangs, $array_key = $resarray[$array_key.'_bank_bic'] = (empty($bank_account) ? '' : $bank_account->bic); $resarray[$array_key.'_bank_label'] = (empty($bank_account) ? '' : $bank_account->label); $resarray[$array_key.'_bank_number'] = (empty($bank_account) ? '' : $bank_account->number); - $resarray[$array_key.'_bank_proprio'] = (empty($bank_account) ? '' : $bank_account->proprio); + $resarray[$array_key.'_bank_proprio'] = (empty($bank_account) ? '' : $bank_account->owner_name); $resarray[$array_key.'_bank_address'] = (empty($bank_account) ? '' : $bank_account->address); $resarray[$array_key.'_bank_state'] = (empty($bank_account) ? '' : $bank_account->state); $resarray[$array_key.'_bank_country'] = (empty($bank_account) ? '' : $bank_account->country); @@ -777,7 +777,7 @@ public function get_substitutionarray_object($object, $outputlangs, $array_key = // Fetch project information if there is a project assigned to this object if ($object->element != "project" && !empty($object->fk_project) && $object->fk_project > 0) { if (!is_object($object->project)) { - $object->fetch_projet(); + $object->fetchProject(); } $resarray[$array_key.'_project_ref'] = $object->project->ref; diff --git a/htdocs/core/class/commonhookactions.class.php b/htdocs/core/class/commonhookactions.class.php index 8b5067f03cf9a..dc22ca652fed4 100644 --- a/htdocs/core/class/commonhookactions.class.php +++ b/htdocs/core/class/commonhookactions.class.php @@ -50,8 +50,8 @@ abstract class CommonHookActions /** * Check context of hook - * @param array $parameters Hook parameters. - * @param array|string $allContexts Context to check + * @param array $parameters Hook parameters. + * @param string[]|string $allContexts Context to check * @return bool */ protected function isContext($parameters, $allContexts) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 64d2223ec1ee1..6e8041ac21063 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -1760,6 +1760,7 @@ public function buildEPCQrCodeString() // Add the amount and reference $lines[] = 'EUR' . $totalTTCString; // Amount (optional) + $lines[] = ''; // Purpose (optional) $lines[] = ''; // Payment reference (optional) $lines[] = $this->ref; // Remittance Information (optional) @@ -1884,7 +1885,7 @@ public function buildSwitzerlandQRString() // If a bank account is provided and we ask to use it as creditor, we use the bank address // TODO In a future, we may always use this address, and if name/address/zip/town/country differs from $mysoc, we can use the address of $mysoc into the final seller field ? $s .= "S\n"; - $s .= dol_trunc($bankaccount->proprio, 70, 'right', 'UTF-8', 1)."\n"; + $s .= dol_trunc($bankaccount->owner_name, 70, 'right', 'UTF-8', 1)."\n"; $addresslinearray = explode("\n", $bankaccount->owner_address); $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 015b0d7ba2d33..3eed4eb5e0163 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1369,7 +1369,7 @@ public function update_contact($rowid, $statut, $type_contact_id = 0, $fk_socpeo // phpcs:enable // Insert into database $sql = "UPDATE ".$this->db->prefix()."element_contact set"; - $sql .= " statut = ".$statut; + $sql .= " statut = ".((int) $statut); if ($type_contact_id) { $sql .= ", fk_c_type_contact = ".((int) $type_contact_id); } @@ -1377,6 +1377,7 @@ public function update_contact($rowid, $statut, $type_contact_id = 0, $fk_socpeo $sql .= ", fk_socpeople = ".((int) $fk_socpeople); } $sql .= " where rowid = ".((int) $rowid); + $resql = $this->db->query($sql); if ($resql) { return 0; @@ -1988,27 +1989,13 @@ public function fetch_barcode() return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Load the project with id $this->fk_project into this->project - * - * @return int<-1,1> Return integer <0 if KO, >=0 if OK - */ - public function fetch_project() - { - // phpcs:enable - return $this->fetch_projet(); - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Load the project with id $this->fk_project into this->project + * Load the project with id $this->fk_project into this->project * - * @return int Return integer <0 if KO, >=0 if OK + * @return int<-1,1> Return integer <0 if KO, >=0 if OK */ - public function fetch_projet() + public function fetchProject() { - // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (empty($this->fk_project) && !empty($this->fk_projet)) { @@ -2023,9 +2010,38 @@ public function fetch_projet() $this->projet = $project; // deprecated $this->project = $project; + return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load the project with id $this->fk_project into this->project + * + * @return int<-1,1> Return integer <0 if KO, >=0 if OK + * @deprecated + * @see fetchProject() + */ + public function fetch_project() + { + // phpcs:enable + return $this->fetchProject(); + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load the project with id $this->fk_project into this->project + * + * @return int Return integer <0 if KO, >=0 if OK + * @deprecated + * @see fetchProject() + */ + public function fetch_projet() + { + // phpcs:enable + return $this->fetchProject(); + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load the product with id $this->fk_product into this->product @@ -4087,11 +4103,11 @@ public function update_price($exclspec = 0, $roundingadjust = 'auto', $nodatabas if (!$error && empty($nodatabaseupdate)) { $sql = "UPDATE ".$this->db->prefix().$this->table_element.' SET'; - $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht, 'MT', 1)).","; - $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva, 'MT', 1)).","; - $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1, 'MT', 1)).","; - $sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2, 'MT', 1)).","; - $sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc, 'MT', 1)); + $sql .= " ".$this->db->sanitize($fieldht)." = ".((float) price2num($this->total_ht, 'MT', 1)).","; + $sql .= " ".$this->db->sanitize($fieldtva)." = ".((float) price2num($this->total_tva, 'MT', 1)).","; + $sql .= " ".$this->db->sanitize($fieldlocaltax1)." = ".((float) price2num($this->total_localtax1, 'MT', 1)).","; + $sql .= " ".$this->db->sanitize($fieldlocaltax2)." = ".((float) price2num($this->total_localtax2, 'MT', 1)).","; + $sql .= " ".$this->db->sanitize($fieldttc)." = ".((float) price2num($this->total_ttc, 'MT', 1)); $sql .= ", multicurrency_total_ht = ".((float) price2num($this->multicurrency_total_ht, 'MT', 1)); $sql .= ", multicurrency_total_tva = ".((float) price2num($this->multicurrency_total_tva, 'MT', 1)); $sql .= ", multicurrency_total_ttc = ".((float) price2num($this->multicurrency_total_ttc, 'MT', 1)); @@ -5221,6 +5237,10 @@ public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateS } $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)) { @@ -5350,6 +5370,13 @@ public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $ // 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; @@ -11237,7 +11264,7 @@ public function deleteEcmFiles($mode = 0) case 'project_task': require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; - $project_result = $this->fetch_projet(); + $project_result = $this->fetchProject(); if ($project_result >= 0) { $element = 'projet/'.dol_sanitizeFileName($this->project->ref).'/'; } diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index 0f82d2a5fe480..f7c59dc82773e 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -110,14 +110,15 @@ abstract class CommonOrderLine extends CommonObjectLine { /** * Custom label of line. Not used by default. - * @deprecated + * @deprecated Use $product_label + * @var string */ public $label; /** * Product ref * @var string - * @deprecated Use product_ref + * @deprecated Use $product_ref * @see $product_ref */ public $ref; @@ -249,10 +250,28 @@ abstract class CommonOrderLine extends CommonObjectLine */ public $special_code = 0; + /** + * @var int + */ public $fk_multicurrency; + /** + * @var string + */ public $multicurrency_code; + /** + * @var float + */ public $multicurrency_subprice; + /** + * @var float + */ public $multicurrency_total_ht; + /** + * @var float + */ public $multicurrency_total_tva; + /** + * @var float + */ public $multicurrency_total_ttc; } diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index ab048d5ab6a5c..4e722c21dc34c 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -68,6 +68,9 @@ abstract class CommonStickerGenerator extends CommonDocGenerator */ public $db; + /** + * @var string + */ public $code; // Code of format // phpcs:disable PEAR.NamingConventions.ValidVariableName.PublicUnderscore @@ -103,10 +106,13 @@ abstract class CommonStickerGenerator extends CommonDocGenerator protected $_COUNTX = 1; protected $_COUNTY = 1; protected $_First = 1; + /** + * @var array{name:string,paper-size:string,orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:float,custom_x:float,custom_y:float} + */ public $Tformat; /** - * @var array + * @var array */ public $_Avery_Labels; // phpcs:enable @@ -125,7 +131,7 @@ public function __construct($db) /** * Function to build PDF on disk, then output on HTTP stream. * - * @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) + * @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) * @param Translate $outputlangs Lang object for output language * @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $outputdir Output directory for pdf file @@ -137,9 +143,9 @@ abstract public function write_file($arrayofrecords, $outputlangs, $srctemplatep /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) * - * @param TCPDF $pdf PDF reference + * @param TCPDF $pdf PDF reference * @param Translate $outputlangs Output langs - * @param array $param Associative array containing label content and optional parameters + * @param array $param Associative array containing label content and optional parameters * @return void */ abstract public function addSticker(&$pdf, $outputlangs, $param); @@ -253,7 +259,7 @@ protected function _Croix(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaiss * Convert units (in to mm, mm to in) * $src and $dest must be 'in' or 'mm' * - * @param int $value value + * @param float $value value * @param string $src from ('in' or 'mm') * @param string $dest to ('in' or 'mm') * @return float value value after conversion diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index d44aba190296e..d081c926b9727 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1,9 +1,10 @@ - * Copyright (C) 2003 Xavier Dutoit - * Copyright (C) 2004-2020 Laurent Destailleur - * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2006 Jean Heimburger +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2003 Xavier Dutoit + * Copyright (C) 2004-2020 Laurent Destailleur + * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2006 Jean Heimburger + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,9 +55,20 @@ class Conf extends stdClass //! To store some setup of generic modules public $mycompany; + + /** + * @var stdClass + */ public $admin; + + /** + * @var stdClass + */ public $medias; - //! To store properties of multi-company + + /** + * @var stdClass To store properties of multi-company + */ public $multicompany; //! To store module status of special module names @@ -64,26 +76,34 @@ class Conf extends stdClass public $delivery_note; - //! To store if javascript/ajax is enabked + //! To store if javascript/ajax is enabled public $use_javascript_ajax; - //! To store if javascript/ajax is enabked + //! To store if compute is enabled public $disable_compute; - //! Used to store current currency (ISO code like 'USD', 'EUR', ...). To get the currency symbol: $langs->getCurrencySymbol($this->currency) + + /** + * @var string Used to store current currency (ISO code like 'USD', 'EUR', ...). To get the currency symbol: $langs->getCurrencySymbol($this->currency) + */ public $currency; /** - * @var string + * @var string Contains current theme ("eldy", "auguria", ...) */ - public $theme; // Contains current theme ("eldy", "auguria", ...) - //! Used to store current css (from theme) + public $theme; + /** - * @var string + * @var string Contains full path of css page ("/theme/eldy/style.css.php", ...) */ - public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...) + public $css; + /** + * @var string + */ public $email_from; - //! Used to store current menu handler + /** + * @var string Used to store current menu handler + */ public $standard_menu; /** @@ -119,15 +139,34 @@ class Conf extends stdClass * @var int Used to store running instance for multi-company (default 1) */ public $entity = 1; + /** * @var int[] Used to store list of entities to use for each element */ public $entities = array(); - public $dol_hide_topmenu; // Set if we force param dol_hide_topmenu into login url - public $dol_hide_leftmenu; // Set if we force param dol_hide_leftmenu into login url - public $dol_optimize_smallscreen; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone - public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone + /** + * @var int Set if we force param dol_hide_topmenu into login url + */ + public $dol_hide_topmenu; + + /** + * @var int Set if we force param dol_hide_leftmenu into login url + */ + public $dol_hide_leftmenu; + + /** + * @var int Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone + */ + public $dol_optimize_smallscreen; + + /** + * @var int Set if we force param dol_no_mouse_hover into login url or if browser is smartphone + */ + public $dol_no_mouse_hover; + /** + * @var int + */ public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url. 0=default, 1=to say we use app from a webview app, 2=to say we use app from a webview app and keep ajax public $format_date_short; // Format of day with PHP/C tags (strftime functions) @@ -141,10 +180,20 @@ class Conf extends stdClass public $format_date_hour_text_short; public $format_date_hour_text; + /** + * @var int limit for list + */ public $liste_limit; + + /** + * @var int checkboxes are on left column if 1 + */ public $main_checkbox_left_column; - public $tzuserinputkey = 'tzserver'; // Use 'tzuserrel' to always store date in GMT and show date in time zone of user. + /** + * @var string Use 'tzuserrel' to always store date in GMT and show date in time zone of user. + */ + public $tzuserinputkey = 'tzserver'; // TODO Remove this part. @@ -160,46 +209,127 @@ class Conf extends stdClass public $product; /** + * @var stdClass * @deprecated Use product */ public $produit; + + /** + * @var stdClass service + */ public $service; + /** + * @var stdClass * @deprecated Use contract */ public $contrat; + + /** + * @var stdClass Contract + */ public $contract; + + /** + * @var stdClass + */ public $actions; + + /** + * @var stdClass + */ public $agenda; + + /** + * @var stdClass + */ public $propal; + /** + * @var stdClass * @deprecated Use order */ public $commande; + + /** + * @var stdClass + */ public $order; + /** + * @var stdClass * @deprecated Use invoice */ public $facture; + + /** + * @var stdClass + */ public $invoice; + + /** + * @var stdClass + */ public $user; + /** + * @var stdClass * @deprecated Use member */ public $adherent; + + /** + * @var stdClass + */ public $member; + + /** + * @var stdClass + */ public $bank; + + /** + * @var stdClass + */ public $notification; + + /** + * @var stdClass + */ public $expensereport; + + /** + * @var stdClass + */ public $productbatch; /** * @deprecated Use project */ public $projet; + + /** + * @var stdClass + */ public $project; + + /** + * @var stdClass + */ public $supplier_proposal; + + /** + * @var stdClass + */ public $supplier_order; + + /** + * @var stdClass + */ public $supplier_invoice; + + /** + * @var stdClass + */ public $category; diff --git a/htdocs/core/class/cproductnature.class.php b/htdocs/core/class/cproductnature.class.php index 749b07b402905..69c7f80e6c54c 100644 --- a/htdocs/core/class/cproductnature.class.php +++ b/htdocs/core/class/cproductnature.class.php @@ -33,7 +33,7 @@ class CProductNature extends CommonDict { /** - * @var array record + * @var CProductNature[] record */ public $records = array(); @@ -156,9 +156,9 @@ public function fetch($id, $code = '') * @param string $sortfield Sort field * @param int $limit Limit * @param int $offset Offset - * @param string $filter Filter USF + * @param string|array $filter Filter USF * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK + * @return CProductNature[]|int<-1,-1> int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index 26c5e07b2cfc6..ef4f927b0b006 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -1,5 +1,6 @@ + * 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,7 +36,13 @@ class Ctypent extends CommonDict */ public $country_id; + /** + * @var string + */ public $libelle; + /** + * @var string + */ public $module; /** diff --git a/htdocs/core/class/ctyperesource.class.php b/htdocs/core/class/ctyperesource.class.php index 076b71983538e..a050d72e4b7ae 100644 --- a/htdocs/core/class/ctyperesource.class.php +++ b/htdocs/core/class/ctyperesource.class.php @@ -199,7 +199,7 @@ public function fetch($id, $code = '', $label = '') * @param string $sortfield Sort field * @param int $limit Limit * @param int $offset Offset limit - * @param string|array $filter filter array + * @param string|array $filter Filter array * @param string $filtermode filter mode (AND or OR) * @return int Return integer <0 if KO, >0 if OK */ @@ -473,7 +473,7 @@ class CtyperesourceLine public $id; /** - * @var mixed Sample line property 1 + * @var string Sample line property 1 */ public $code; @@ -482,5 +482,8 @@ class CtyperesourceLine */ public $label; + /** + * @var int + */ public $active; } diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 2ea5a74f530c8..b55457159d561 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -31,6 +31,9 @@ */ class CUnits extends CommonDict { + /** + * @var CUnits[] + */ public $records = array(); //var $element='ctypent'; //!< Id that identify managed objects @@ -38,14 +41,26 @@ class CUnits extends CommonDict /** * @var string label - * @deprecated + * @deprecated Use $label * @see $label */ public $libelle; + /** + * @var string + */ public $sortorder; + /** + * @var string + */ public $short_label; + /** + * @var string + */ public $unit_type; + /** + * @var string + */ public $scale; @@ -63,9 +78,9 @@ public function __construct($db) /** * Create object into database * - * @param User $user User that create - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, Id of created object if OK + * @param User $user User that create + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, Id of created object if OK */ public function create($user, $notrigger = 0) { @@ -212,9 +227,9 @@ public function fetch($id, $code = '', $short_label = '', $unit_type = '') * @param string $sortfield Sort field * @param int $limit Limit * @param int $offset Offset - * @param string|array $filter Filter USF + * @param string|array $filter Filter USF * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK + * @return CUnits[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -306,9 +321,9 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = /** * Update object into database * - * @param User $user User that modify - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that modify + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, >0 if OK */ public function update($user = null, $notrigger = 0) { @@ -378,8 +393,8 @@ public function update($user = null, $notrigger = 0) /** * Delete object in database * - * @param User $user User that delete - * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @param User $user User that delete + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers * @return int Return integer <0 if KO, >0 if OK */ public function delete($user, $notrigger = 0) @@ -430,10 +445,10 @@ public function getUnitFromCode($code, $mode = 'code', $unit_type = '') /** * Unit converter - * @param double $value value to convert + * @param float $value value to convert * @param int $fk_unit current unit id of value * @param int $fk_new_unit the id of unit to convert in - * @return double + * @return float */ public function unitConverter($value, $fk_unit, $fk_new_unit = 0) { diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index a71da0914409b..0efdc0fc5c728 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -240,10 +240,10 @@ public function fetch($id) * @param string $sortfield Sort field * @param int $limit limit * @param int $offset Offset - * @param string|array $filter Filter as an Universal Search string or Array (array use is deprecated) + * @param string $filter Filter as an Universal Search string or Array (array use is deprecated) * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return DefaultValues[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { diff --git a/htdocs/core/class/diasporahandler.class.php b/htdocs/core/class/diasporahandler.class.php index b309228c6c571..13b9794af17d2 100644 --- a/htdocs/core/class/diasporahandler.class.php +++ b/htdocs/core/class/diasporahandler.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,13 +24,13 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/socialnetworkmanager.class.php'; - /** - * Class for handling Diaspora API interactions - */ +/** +* Class for handling Diaspora API interactions +*/ class DiasporaHandler { /** - * @var array Posts fetched from the API + * @var array Posts fetched from the API */ private $posts = []; @@ -38,15 +39,15 @@ class DiasporaHandler */ public $error = ''; - /** - * @var array Authentication parameters, including cookie name and value - */ + /** + * @var array Authentication parameters, including cookie name and value + */ private $params = []; - /** - * Check if the provided cookie in params is valid. - * @return bool True if a valid cookie is found in params, false otherwise. - */ + /** + * Check if the provided cookie in params is valid. + * @return bool True if a valid cookie is found in params, false otherwise. + */ private function isCookieValid() { return !empty($this->getCookieFromParams()); @@ -54,7 +55,7 @@ private function isCookieValid() /** * Get the cookie value from params, regardless of the exact key name. - * @return string|null The cookie string if found, null otherwise. + * @return ?string The cookie string if found, null otherwise. */ private function getCookieFromParams() { @@ -73,7 +74,7 @@ private function getCookieFromParams() * @param int $maxNb Maximum number of posts to retrieve (default is 5). * @param int $cacheDelay Number of seconds to use cached data (0 to disable caching). * @param string $cacheDir Directory to store cached data. - * @param array $authParams Authentication parameters including login URL, username, and password. + * @param array $authParams Authentication parameters including login URL, username, and password. * @return bool Status code: False if error, true if success. */ public function fetch($urlAPI, $maxNb = 5, $cacheDelay = 60, $cacheDir = '', $authParams = []) @@ -146,8 +147,8 @@ public function fetch($urlAPI, $maxNb = 5, $cacheDelay = 60, $cacheDir = '', $au /** * Normalize data of retrieved posts. * - * @param array $postData Data of a single post. - * @return array Normalized post data. + * @param array $postData Data of a single post. + * @return array{}|array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar:string} Normalized post data. */ public function normalizeData($postData) { @@ -179,7 +180,7 @@ private function formatDate($dateString) /** * Get the list of retrieved posts. * - * @return array List of posts. + * @return array Posts fetched from the API */ public function getPosts() { diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 6d83cb7183d1a..3b267092dd0a6 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -48,22 +48,64 @@ class DiscountAbsolute extends CommonObject */ public $discount_type; // 0 => customer discount, 1 => supplier discount + /** + * @var float + */ public $total_ht; + /** + * @var float + */ public $total_tva; + /** + * @var float + */ public $total_ttc; + /** + * @var string|float + * @deprecated + */ public $amount_ht; // deprecated + /** + * @var string|float + * @deprecated + */ public $amount_tva; // deprecated + /** + * @var string|float + * @deprecated + */ public $amount_ttc; // deprecated + /** + * @var float + */ public $multicurrency_total_ht; + /** + * @var float + */ public $multicurrency_total_tva; + /** + * @var float + */ public $multicurrency_total_ttc; + /** + * @var string|float + * @deprecated + */ public $multicurrency_amount_ht; // deprecated + /** + * @var string|float + * @deprecated + */ public $multicurrency_amount_tva; // deprecated + /** + * @var string|float + * @deprecated + */ public $multicurrency_amount_ttc; // deprecated /** - * @var double + * @var float */ public $multicurrency_subprice; @@ -77,8 +119,13 @@ class DiscountAbsolute extends CommonObject */ public $fk_invoice_supplier_line; - // Vat rate + /** + * @var string|float Vat rate + */ public $tva_tx; + /** + * @var string + */ public $vat_src_code; /** @@ -94,7 +141,7 @@ class DiscountAbsolute extends CommonObject /** * Date creation record (datec) * - * @var integer + * @var int */ public $datec; @@ -112,11 +159,26 @@ class DiscountAbsolute extends CommonObject * @var int ID credit note or deposit used to create the discount */ public $fk_facture_source; + /** + * @var string + */ public $ref_facture_source; // Ref credit note or deposit used to create the discount + /** + * @var int + */ public $type_facture_source; + /** + * @var int + */ public $fk_invoice_supplier_source; + /** + * @var string + */ public $ref_invoice_supplier_source; // Ref credit note or deposit used to create the discount + /** + * @var int + */ public $type_invoice_supplier_source; /** diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 94eef750223cc..8d287b33a81dc 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -31,23 +31,65 @@ */ class DolEditor { + /** + * @var string + */ public $tool; // Store the selected tool // If using fckeditor + /** + * @var Object - Note: seems to be unused + */ public $editor; // If not using fckeditor + /** + * @var string + */ public $content; + /** + * @var string + */ public $htmlname; + /** + * @var string + */ public $toolbarname; + /** + * @var bool + */ public $toolbarstartexpanded; + /** + * @var int + */ public $rows; + /** + * @var string + */ public $cols; + /** + * @var int + */ public $height; + /** + * @var string + */ public $width; + /** + * @var int<0,1>|bool + */ public $uselocalbrowser; + /** + * @var int<0,1> + */ public $readonly; + /** + * @var int + */ public $posx; + /** + * @var int + */ public $posy; @@ -60,14 +102,14 @@ class DolEditor * @param int $height Height in pixel of edit area (200px by default) * @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly'). * @param string $toolbarlocation Deprecated. Not used - * @param boolean $toolbarstartexpanded Bar is visible or not at start - * @param boolean|int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content. - * @param boolean|int|string $okforextendededitor 1 or True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace. + * @param bool $toolbarstartexpanded Bar is visible or not at start + * @param bool|int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content. + * @param bool|int|string $okforextendededitor 1 or True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace. * Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave". * @param int $rows Size of rows for textarea tool * @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%') - * @param int $readonly 0=Read/Edit, 1=Read only - * @param array $poscursor Array for initial cursor position array('x'=>x, 'y'=>y). + * @param int<0,1> $readonly 0=Read/Edit, 1=Read only + * @param array{x?:string,y?:string,find?:string} $poscursor Array for initial cursor position array('x'=>x, 'y'=>y). * array('find'=> 'word') can be used to go to line were the word has been found */ public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = 1, $okforextendededitor = true, $rows = 0, $cols = '', $readonly = 0, $poscursor = array()) @@ -102,7 +144,7 @@ public function __construct($htmlname, $content, $width = '', $height = 200, $to $this->tool = 'textarea'; } - if ( isset($poscursor['find']) ) { + if (isset($poscursor['find'])) { $posy = 0; $lines = explode("\n", $content); $nblines = count($lines); @@ -112,7 +154,9 @@ public function __construct($htmlname, $content, $width = '', $height = 200, $to break; } } - if ($posy != 0 ) $poscursor['y'] = $posy; + if ($posy != 0) { + $poscursor['y'] = $posy; + } } // Define some properties @@ -230,7 +274,7 @@ public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $ toolbar: \''.dol_escape_js($this->toolbarname).'\', toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').', width: '.($this->width ? '\''.dol_escape_js($this->width).'\'' : '\'\'').', - height: '.dol_escape_js($this->height).', + height: '.dol_escape_js((string) $this->height).', skin: \''.dol_escape_js($skin).'\', '.$scaytautostartup.' language: \''.dol_escape_js($langs->defaultlang).'\', diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index 9ab52db0b86db..26d24a0dfb856 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,7 @@ class DolGeoIP { /** - * @var GeoIp2\Database\Reader|string + * @var \GeoIp2\Database\Reader|\GeoIP|string */ public $gi; @@ -52,7 +53,7 @@ class DolGeoIP /** * Constructor * - * @param string $type 'country' or 'city' + * @param 'country'|'city' $type 'country' or 'city' * @param string $datfile Data file */ public function __construct($type, $datfile) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 8c69f9c018f45..6a2d4e131a5be 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -140,6 +140,9 @@ class dolReceiptPrinter extends Printer * @var \Mike42\Escpos\Printer */ public $printer; + /** + * @var string + */ public $template; /** @@ -150,13 +153,13 @@ class dolReceiptPrinter extends Printer /** * Array with list of printers - * @var array List of printers + * @var array List of printers */ public $listprinters; /** * Array with list of printer templates - * @var array List of printer templates + * @var array List of printer templates */ public $listprinterstemplates; @@ -772,7 +775,11 @@ public function sendToPrinter($object, $templateid, $printerid) //var_dump($object); $vatarray = array(); foreach ($object->lines as $line) { - $vatarray[$line->tva_tx] += $line->total_tva; + $vat_rate = $line->tva_tx; + if (!array_key_exists($vat_rate, $vatarray)) { + $vatarray[$vat_rate] = 0; + } + $vatarray[$vat_rate] += $line->total_tva; } foreach ($vatarray as $vatkey => $vatvalue) { $spacestoadd = $nbcharactbyline - strlen($vatkey) - 12; diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 97276335625ed..5d98275fa21a6 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -50,6 +50,9 @@ class EmailSenderProfile extends CommonObject */ public $picto = 'emailsenderprofile'; + /** + * @var int + */ public $fk_user_creat; @@ -114,11 +117,26 @@ class EmailSenderProfile extends CommonObject */ public $label; + /** + * @var string + */ public $email; + /** + * @var int + */ public $private; + /** + * @var string + */ public $signature; + /** + * @var int + */ public $position; + /** + * @var int + */ public $active; // END MODULEBUILDER PROPERTIES diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index 3b001c6267112..4879faf93f014 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -56,6 +56,11 @@ * * AUTHOR INFORMATION * Copyright 2005, Miles Kaufmann. + * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * LICENSE * Redistribution and use in source and binary forms, with or without @@ -95,22 +100,40 @@ */ class EvalMath { + /** + * @var bool + */ public $suppress_errors = false; + /** + * @var ?string + */ public $last_error = null; + /** + * @var ?array{0:int,1:null|string|array{0:?mixed,1:int}} + */ public $last_error_code = null; + /** + * @var array variables (and constants) + */ public $v = array('e' => 2.71, 'pi' => 3.14159); - // variables (and constants) + /** + * @var array}> user-defined functions + */ public $f = array(); - // user-defined functions + /** + * @var string[] constants + */ public $vb = array('e', 'pi'); - // constants - public $fb = array( // built-in functions + /** + * @var string[] built-in functions + */ + public $fb = array( 'sin', 'sinh', 'arcsin', 'asin', 'arcsinh', 'asinh', 'cos', 'cosh', 'arccos', 'acos', 'arccosh', 'acosh', 'tan', 'tanh', 'arctan', 'atan', 'arctanh', 'atanh', 'sqrt', 'abs', 'ln', 'log', 'intval', 'ceil', ); @@ -198,7 +221,7 @@ public function evaluate($expr) /** * Function vars * - * @return array Output + * @return array Output */ public function vars() { @@ -211,7 +234,7 @@ public function vars() /** * Function funcs * - * @return array Output + * @return string[] Output */ private function funcs() // @phpstan-ignore-line { @@ -228,7 +251,7 @@ private function funcs() // @phpstan-ignore-line * Convert infix to postfix notation * * @param string $expr Expression - * @return boolean|array Output + * @return boolean|array Output */ private function nfx($expr) { @@ -372,9 +395,9 @@ private function nfx($expr) /** * Evaluate postfix notation * - * @param array $tokens Expression - * @param array $vars Array - * @return string|false Output or false if error + * @param string[] $tokens Expression + * @param array $vars Array + * @return string|false Output or false if error */ private function pfx($tokens, $vars = array()) { @@ -459,9 +482,9 @@ private function pfx($tokens, $vars = array()) /** * trigger an error, but nicely, if need be * - * @param string $code Code - * @param string $msg Msg - * @param string|null $info String + * @param int $code Code + * @param string $msg Msg + * @param null|string|array{0:?mixed,1:int} $info String * @return false */ public function trigger($code, $msg, $info = null) diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index a5dc47bb64c8f..3331cceedfa56 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2023 William Mead * 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 @@ -70,6 +71,9 @@ class Events // extends CommonObject */ public $entity; + /** + * @var int|string + */ public $dateevent; /** @@ -103,31 +107,33 @@ class Events // extends CommonObject public $authentication_method; - // List of all Audit/Security events supported by triggers + /** + * @var array}> List of all Audit/Security events supported by triggers + */ public $eventstolog = array( - array('id'=>'USER_LOGIN', 'test'=>1), - array('id'=>'USER_LOGIN_FAILED', 'test'=>1), - array('id'=>'USER_LOGOUT', 'test'=>1), - array('id'=>'USER_CREATE', 'test'=>1), - array('id'=>'USER_MODIFY', 'test'=>1), - array('id'=>'USER_NEW_PASSWORD', 'test'=>1), - array('id'=>'USER_ENABLEDISABLE', 'test'=>1), - array('id'=>'USER_DELETE', 'test'=>1), - array('id'=>'USERGROUP_CREATE', 'test'=>1), - array('id'=>'USERGROUP_MODIFY', 'test'=>1), - array('id'=>'USERGROUP_DELETE', 'test'=>1), + array('id' => 'USER_LOGIN', 'test' => 1), + array('id' => 'USER_LOGIN_FAILED', 'test' => 1), + array('id' => 'USER_LOGOUT', 'test' => 1), + array('id' => 'USER_CREATE', 'test' => 1), + array('id' => 'USER_MODIFY', 'test' => 1), + array('id' => 'USER_NEW_PASSWORD', 'test' => 1), + array('id' => 'USER_ENABLEDISABLE', 'test' => 1), + array('id' => 'USER_DELETE', 'test' => 1), + array('id' => 'USERGROUP_CREATE', 'test' => 1), + array('id' => 'USERGROUP_MODIFY', 'test' => 1), + array('id' => 'USERGROUP_DELETE', 'test' => 1), ); // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20), - 'prefix_session'=>array('type'=>'varchar(255)', 'label'=>'PrefixSession', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'index'=>0, 'position'=>1000), - 'user_agent' =>array('type'=>'varchar(255)', 'label'=>'UserAgent', 'enabled'=>1, 'visible'=>-1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => '1', 'index' => 1, 'position' => 20), + 'prefix_session' => array('type' => 'varchar(255)', 'label' => 'PrefixSession', 'enabled' => 1, 'visible' => -1, 'notnull' => -1, 'index' => 0, 'position' => 1000), + 'user_agent' => array('type' => 'varchar(255)', 'label' => 'UserAgent', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000), ); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 50f45ceb010d2..8560d1af9e3ac 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Antonin MARCHAL * Copyright (C) 2024 MDW + * Copyright (C) 2024 Benoît PASCAL * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,7 +51,7 @@ class ExtraFields public $attributes = array(); /** - * @var array Array with boolean of status of groups + * @var array> Array with boolean of status of groups */ public $expand_display; @@ -80,6 +81,7 @@ class ExtraFields 'double' => 'Float', 'date' => 'Date', 'datetime' => 'DateAndTime', + 'duration' => 'Duration', //'datetimegmt'=>'DateAndTimeUTC', 'boolean' => 'Boolean', 'price' => 'ExtrafieldPrice', @@ -119,15 +121,15 @@ public function __construct($db) * * @param string $attrname Code of attribute * @param string $label label of attribute - * @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datetime','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...) + * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime', 'duration', 'price', 'pricecy', 'phone', 'mail', 'password', 'url', 'select', 'checkbox', 'separate',...) * @param int $pos Position of attribute * @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma. * @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...) - * @param int $unique Is field unique or not - * @param int $required Is field required or not + * @param int<0,1> $unique Is field unique or not + * @param int<0,1> $required Is field required or not * @param string $default_value Defaulted value (In database. use the default_value feature for default value on screen. Example: '', '0', 'null', 'avalue') - * @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) - * @param int $alwayseditable Is attribute always editable regardless of the document status + * @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) + * @param int<0,1> $alwayseditable Is attribute always editable regardless of the document status * @param string $perms Permission to check * @param string $list Visibility ('0'=never visible, '1'=visible on list+forms, '2'=list only, '3'=form only or 'eval string') * @param string $help Text with help tooltip @@ -135,9 +137,9 @@ public function __construct($db) * @param string $entity Entity of extrafields (for multicompany modules) * @param string $langfile Language file * @param string $enabled Condition to have the field enabled or not - * @param int $totalizable Is a measure. Must show a total on lists - * @param int $printable Is extrafield displayed on PDF - * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...) + * @param int<0,1> $totalizable Is a measure. Must show a total on lists + * @param int<0,1> $printable Is extrafield displayed on PDF + * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...) * @return int Return integer <=0 if KO, >0 if OK */ public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array()) @@ -195,15 +197,15 @@ public function addExtraField($attrname, $label, $type, $pos, $size, $elementtyp * * @param string $attrname Code of attribute * @param string $label label of attribute - * @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datetime','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...) + * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime', 'duration', 'price', 'pricecy', 'phone', 'mail', 'password', 'url', 'select', 'checkbox', 'separate',...) * @param int $pos Position of attribute * @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma. * @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...) - * @param int $unique Is field unique or not - * @param int $required Is field required or not + * @param int<0,1> $unique Is field unique or not + * @param int<0,1> $required Is field required or not * @param string $default_value Defaulted value (In database. use the default_value feature for default value on screen. Example: '', '0', 'null', 'avalue') - * @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) - * @param int $alwayseditable Is attribute always editable regardless of the document status + * @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) + * @param int<0,1> $alwayseditable Is attribute always editable regardless of the document status * @param string $perms Permission to check * @param string $list Visibility ('0'=never visible, '1'=visible on list+forms, '2'=list only, '3'=form only or 'eval string') * @param string $help Text with help tooltip @@ -211,9 +213,9 @@ public function addExtraField($attrname, $label, $type, $pos, $size, $elementtyp * @param string $entity Entity of extrafields (for multicompany modules) * @param string $langfile Language file * @param string $enabled Condition to have the field enabled or not - * @param int $totalizable Is a measure. Must show a total on lists - * @param int $printable Is extrafield displayed on PDF - * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...) + * @param int<0,1> $totalizable Is a measure. Must show a total on lists + * @param int<0,1> $printable Is extrafield displayed on PDF + * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...) * @return int Return integer <=0 if KO, >0 if OK */ public function updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array()) @@ -267,18 +269,18 @@ public function updateExtraField($attrname, $label, $type, $pos, $size, $element * This is a private method. For public method, use addExtraField. * * @param string $attrname code of attribute - * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime', 'price', 'pricecy', 'phone', 'mail', 'password', 'url', 'select', 'checkbox', ...) + * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime', 'duration', 'price', 'pricecy', 'phone', 'mail', 'password', 'url', 'select', 'checkbox', ...) * @param string $length Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) - * @param int $unique Is field unique or not - * @param int $required Is field required or not + * @param int<0,1> $unique Is field unique or not + * @param int<0,1> $required Is field required or not * @param string $default_value Default value for field (in database) - * @param array $param Params for field (ex for select list : array('options'=>array('value'=>'label of option')) + * @param array $param Params for field (ex for select list : array('options'=>array('value'=>'label of option')) * @param string $perms Permission * @param string $list Into list view by default * @param string $computed Computed value * @param string $help Help on tooltip - * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) + * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) * @return int Return integer <=0 if KO, >0 if OK */ private function create($attrname, $type = 'varchar', $length = '255', $elementtype = '', $unique = 0, $required = 0, $default_value = '', $param = array(), $perms = '', $list = '0', $computed = '', $help = '', $moreparams = array()) @@ -320,6 +322,9 @@ private function create($attrname, $type = 'varchar', $length = '255', $elementt } elseif ($type == 'link') { $typedb = 'int'; $lengthdb = '11'; + } elseif ($type == 'duration') { + $typedb = 'int'; + $lengthdb = '11'; } elseif ($type == 'point') { $typedb = 'point'; $lengthdb = ''; @@ -355,10 +360,10 @@ private function create($attrname, $type = 'varchar', $length = '255', $elementt 'default' => $default_value ); - $result = $this->db->DDLAddField($this->db->prefix().$table, $attrname, $field_desc); + $result = $this->db->DDLAddField($this->db->prefix().$this->db->sanitize($table), $attrname, $field_desc); if ($result > 0) { if ($unique) { - $sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")"; + $sql = "ALTER TABLE ".$this->db->prefix().$this->db->sanitize($table)." ADD UNIQUE INDEX uk_".$this->db->sanitize($table)."_".$attrname." (".$attrname.")"; $resql = $this->db->query($sql, 1, 'dml'); } return 1; @@ -382,10 +387,10 @@ private function create($attrname, $type = 'varchar', $length = '255', $elementt * @param int $pos Position of attribute * @param string $size Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) - * @param int $unique Is field unique or not - * @param int $required Is field required or not - * @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) - * @param int $alwayseditable Is attribute always editable regardless of the document status + * @param int<0,1> $unique Is field unique or not + * @param int<0,1> $required Is field required or not + * @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) + * @param int<0,1> $alwayseditable Is attribute always editable regardless of the document status * @param string $perms Permission to check * @param string $list Visibility * @param string $help Help on tooltip @@ -394,9 +399,9 @@ private function create($attrname, $type = 'varchar', $length = '255', $elementt * @param string $entity Entity of extrafields * @param string $langfile Language file * @param string $enabled Condition to have the field enabled or not - * @param int $totalizable Is a measure. Must show a total on lists - * @param int $printable Is extrafield displayed on PDF - * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) + * @param int<0,1> $totalizable Is a measure. Must show a total on lists + * @param int<0,1> $printable Is extrafield displayed on PDF + * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) * @return int Return integer <=0 if KO, >0 if OK * @throws Exception */ @@ -583,7 +588,7 @@ public function delete($attrname, $elementtype = '') if (empty($error)) { return $result; } else { - return $error*-1; + return $error * -1; } } else { return 0; @@ -634,13 +639,13 @@ private function delete_label($attrname, $elementtype = '') * * @param string $attrname Name of attribute * @param string $label Label of attribute - * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime','price','phone','mail','password','url','select','checkbox', ...) + * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime', 'duration', 'price', 'phone', 'mail', 'password', 'url', 'select', 'checkbox', ...) * @param string $length Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) - * @param int $unique Is field unique or not - * @param int $required Is field required or not - * @param int $pos Position of attribute - * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) + * @param int<0,1> $unique Is field unique or not + * @param int<0,1> $required Is field required or not + * @param int<0,1> $pos Position of attribute + * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) * @param int $alwayseditable Is attribute always editable regardless of the document status * @param string $perms Permission to check * @param string $list Visibility @@ -650,9 +655,9 @@ private function delete_label($attrname, $elementtype = '') * @param string $entity Entity of extrafields * @param string $langfile Language file * @param string $enabled Condition to have the field enabled or not - * @param int $totalizable Is extrafield totalizable on list - * @param int $printable Is extrafield displayed on PDF - * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) + * @param int<0,1> $totalizable Is extrafield totalizable on list + * @param int<0,1> $printable Is extrafield displayed on PDF + * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) * @return int >0 if OK, <=0 if KO * @throws Exception */ @@ -703,6 +708,9 @@ public function update($attrname, $label, $type, $length, $elementtype, $unique } elseif ($type == 'link') { $typedb = 'int'; $lengthdb = '11'; + } elseif ($type == 'duration') { + $typedb = 'int'; + $lengthdb = '11'; } elseif ($type == 'point') { $typedb = 'point'; $lengthdb = ''; @@ -792,11 +800,11 @@ public function update($attrname, $label, $type, $length, $elementtype, $unique * @param string $type Type of attribute * @param string $size Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) - * @param int $unique Is field unique or not - * @param int $required Is field required or not + * @param int<0,1> $unique Is field unique or not + * @param int<0,1> $required Is field required or not * @param int $pos Position of attribute - * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) - * @param int $alwayseditable Is attribute always editable regardless of the document status + * @param array> $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) + * @param int<0,1> $alwayseditable Is attribute always editable regardless of the document status * @param string $perms Permission to check * @param string $list Visibility * @param string $help Help on tooltip. @@ -805,9 +813,9 @@ public function update($attrname, $label, $type, $length, $elementtype, $unique * @param string $entity Entity of extrafields * @param string $langfile Language file * @param string $enabled Condition to have the field enabled or not - * @param int $totalizable Is extrafield totalizable on list - * @param int $printable Is extrafield displayed on PDF - * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) + * @param int<0,1> $totalizable Is extrafield totalizable on list + * @param int<0,1> $printable Is extrafield displayed on PDF + * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) * @return int Return integer <=0 if KO, >0 if OK * @throws Exception */ @@ -919,11 +927,11 @@ private function update_label($attrname, $label, $type, $size, $elementtype, $un $sql .= " '".$this->db->escape($type)."',"; $sql .= " '".$this->db->escape($size)."',"; $sql .= " '".$this->db->escape($elementtype)."',"; - $sql .= " ".$unique.","; - $sql .= " ".$required.","; + $sql .= " ".((int) $unique).","; + $sql .= " ".((int) $required).","; $sql .= " ".($perms ? "'".$this->db->escape($perms)."'" : "null").","; $sql .= " ".($langfile ? "'".$this->db->escape($langfile)."'" : "null").","; - $sql .= " ".$pos.","; + $sql .= " ".((int) $pos).","; $sql .= " '".$this->db->escape($alwayseditable)."',"; $sql .= " '".$this->db->escape($params)."',"; $sql .= " '".$this->db->escape($list)."',"; @@ -931,8 +939,8 @@ private function update_label($attrname, $label, $type, $size, $elementtype, $un $sql .= " ".($totalizable ? 'TRUE' : 'FALSE').","; $sql .= " ".(($default != '') ? "'".$this->db->escape($default)."'" : "null").","; $sql .= " ".($computed ? "'".$this->db->escape($computed)."'" : "null").","; - $sql .= " ".$user->id.","; - $sql .= " ".$user->id.","; + $sql .= " ".((int) $user->id).","; + $sql .= " ".((int) $user->id).","; $sql .= "'".$this->db->idate(dol_now())."',"; $sql .= "'".$this->db->escape($enabled)."',"; $sql .= " ".($help ? "'".$this->db->escape($help)."'" : "null").","; @@ -1067,7 +1075,7 @@ public function fetch_name_optionals_label($elementtype, $forceload = false, $at * Code very similar with showInputField of common object * * @param string $key Key of attribute - * @param string|array $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value); for dates in filter mode, a range array('start'=>, 'end'=>) should be provided + * @param string|array{start:int,end:int} $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value); for dates in filter mode, a range array('start'=>, 'end'=>) should be provided * @param string $moreparam To add more parameters on html input tag * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) @@ -1283,6 +1291,9 @@ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $ } $out = ' '; $out .= $form->selectCurrency($currency, $keyprefix.$key.$keysuffix.'currency_id'); + } elseif ($type == 'duration') { + $value = intval($value); + $out = $form->select_duration($keyprefix . $key, $value, 0, 'text', 0, 1); } elseif ($type == 'double') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value = price($value); @@ -1559,7 +1570,7 @@ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $ if (!is_array($value)) { $value_arr = explode(',', $value); } - $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, '', 0, '', 0, '100%'); + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, 0, 0, '', 0, '100%'); } elseif ($type == 'radio') { $out = ''; foreach ($param['options'] as $keyopt => $val) { @@ -1823,14 +1834,14 @@ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $ } $this->db->free($resql); - $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, '', 0, '100%'); } else { print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.
'; } } else { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); - $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, '', 0, '100%'); } } } elseif ($type == 'link') { @@ -1990,6 +2001,12 @@ public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjec if ($value !== '') { $value = dol_print_date($value, 'dayhour', 'tzuserrel'); } + } elseif ($type == 'duration') { + $showsize = 10; + if ($value !== '') { + $value = intval($value); + $value = convertSecondToTime($value); + } } elseif ($type == 'datetimegmt') { $showsize = 19; if ($value !== '') { @@ -2290,7 +2307,7 @@ public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjec } else { $value = ''; } - } elseif (in_array($type, ['multipts','linestrg', 'polygon'])) { + } elseif (in_array($type, ['multipts', 'linestrg', 'polygon'])) { if (!empty($value)) { require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeophp.class.php'; $dolgeophp = new DolGeoPHP($this->db); @@ -2393,7 +2410,7 @@ public function getAlignFlag($key, $extrafieldsobjectkey = '') if (in_array($type, array('date', 'datetime', 'datetimegmt',))) { $cssstring = "center"; - } elseif (in_array($type, array('int', 'price', 'double'))) { + } elseif (in_array($type, array('int', 'price', 'double', 'duration'))) { $cssstring = "right"; } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip', 'icon'))) { $cssstring = "center"; @@ -2511,8 +2528,8 @@ public function showSeparator($key, $object, $colspan = 2, $display_type = 'card /** * Fill array_options property of object by extrafields value (using for data sent by forms) * - * @param array|null $extralabels Deprecated (old $array of extrafields, now set this to null) - * @param object $object Object + * @param null $extralabels Deprecated (old $array of extrafields, now set this to null) + * @param CommonObject $object Object * @param string $onlykey Only some keys are filled: * 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset. * '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset. @@ -2537,7 +2554,7 @@ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '', $tod continue; } - if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'checkbox', 'chkbxlst', 'point', 'multipts', 'linestrg', 'polygon')))) { + if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'checkbox', 'chkbxlst', 'point', 'multipts', 'linestrg', 'polygon', 'duration')))) { //when unticking boolean field, it's not set in POST continue; } @@ -2567,13 +2584,13 @@ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '', $tod && in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'checkbox', 'chkbxlst')) && in_array(abs($enabled), array(2, 5)) && ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided - ) - ) { - continue; + ) + ) { + continue; } - $visibility_abs = abs($visibility); - // not modify if extra field is not in update form (0 : never, 2 or -2 : list only, 5 or - 5 : list and view only) + $visibility_abs = abs($visibility); + // not modify if extra field is not in update form (0 : never, 2 or -2 : list only, 5 or - 5 : list and view only) if (empty($visibility_abs) || $visibility_abs == 2 || $visibility_abs == 5) { continue; } @@ -2584,9 +2601,9 @@ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '', $tod if ($this->attributes[$object->table_element]['required'][$key]) { // Value is required // Check if functionally empty without using GETPOST (depending on the type of extrafield, a // technically non-empty value may be treated as empty functionally). - // value can be alpha, int, array, etc... - $v = $_POST["options_".$key] ?? null; - $type = $this->attributes[$object->table_element]['type'][$key]; + // value can be alpha, int, array, etc... + $v = $_POST["options_".$key] ?? null; + $type = $this->attributes[$object->table_element]['type'][$key]; if (self::isEmptyValue($v, $type)) { //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; @@ -2609,6 +2626,10 @@ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '', $tod } elseif (in_array($key_type, array('datetimegmt'))) { // Clean parameters $value_key = dol_mktime(GETPOSTINT("options_".$key."hour"), GETPOSTINT("options_".$key."min"), GETPOSTINT("options_".$key."sec"), GETPOSTINT("options_".$key."month"), GETPOSTINT("options_".$key."day"), GETPOSTINT("options_".$key."year"), 'gmt'); + } elseif (in_array($key_type, array('duration'))) { + $value_hours = GETPOSTINT("options_" . $key . "hour"); + $value_minutes = GETPOSTINT("options_" . $key . "minute"); + $value_key = $value_hours * 3600 + $value_minutes * 60; } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { $value_arr = GETPOST("options_".$key, 'array'); // check if an array if (!empty($value_arr)) { @@ -2658,7 +2679,7 @@ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '', $tod } } - $object->array_options["options_".$key] = $value_key; + $object->array_options["options_".$key] = $value_key; } if ($nofillrequired) { @@ -2677,10 +2698,10 @@ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '', $tod /** * return array_options array of data of extrafields value of object sent by a search form * - * @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage) + * @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage) * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) - * @return array|int array_options set or 0 if no value + * @return array|int<0,0> array_options set or 0 if no value */ public function getOptionalsFromPost($extrafieldsobjectkey, $keysuffix = '', $keyprefix = '') { @@ -2846,9 +2867,9 @@ public static function getListOfTypesLabels() /** * Return if a value is "empty" for a mandatory vision. * - * @param mixed $v Value to test + * @param null|int|float|string|array $v Value to test * @param string $type Type of extrafield 'sellist', 'link', 'select', ... - * @return boolean True is value is an empty value, not allowed for a mandatory field. + * @return bool True is value is an empty value, not allowed for a mandatory field. */ public static function isEmptyValue($v, string $type) { @@ -2864,6 +2885,6 @@ public static function isEmptyValue($v, string $type) if ($type == 'sellist') { return ($v == '0'); } - return (empty($v) && $v != '0'); + return empty($v); // Note empty('0') is also true, tested 7.0 up to 8.3.12 } } diff --git a/htdocs/core/class/extralanguages.class.php b/htdocs/core/class/extralanguages.class.php index 541a1c2a6e006..63c1ec50b0582 100644 --- a/htdocs/core/class/extralanguages.class.php +++ b/htdocs/core/class/extralanguages.class.php @@ -34,7 +34,7 @@ class ExtraLanguages public $db; /** - * @var array New array to store extralanguages definition + * @var array> New array to store extralanguages definition */ public $attributes; @@ -77,7 +77,7 @@ public function __construct($db) * * @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). * @param boolean $forceload Force load of extra fields whatever is status of cache. - * @return array Array of attributes keys+label for all extra fields. + * @return array> Array of attributes keys+label for all extra fields. */ public function fetch_name_extralanguages($elementtype, $forceload = false) { diff --git a/htdocs/core/class/fediverseparser.class.php b/htdocs/core/class/fediverseparser.class.php index 1be47f0eab710..9956c03d41c3d 100644 --- a/htdocs/core/class/fediverseparser.class.php +++ b/htdocs/core/class/fediverseparser.class.php @@ -1,5 +1,6 @@ + * 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 @@ -84,7 +85,7 @@ public function parser($urlAPI, $maxNb = 5, $cacheDelay = 60, $cacheDir = '') /** * Get the list of retrieved posts. * - * @return array List of posts. + * @return array Posts fetched from the API */ public function getPosts() { @@ -94,7 +95,7 @@ public function getPosts() /** * Get the last fetch date. * - * @return int|String Timestamp of the last successful fetch. + * @return int|string Timestamp of the last successful fetch. */ public function getLastFetchDate() { diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index ca504ec621a81..675a22ae0fed8 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2011-2022 Regis Houssin * Copyright (C) 2011-2023 Laurent Destailleur * 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 @@ -33,7 +34,13 @@ */ class FileUpload { + /** + * @var array{script_url:string,upload_dir:string,upload_url:string,param_name:string,delete_type:string,max_file_size:?int,min_file_size:int,accept_file_types:string,max_number_of_files:?int,max_width:?int,max_height:?int,min_width:int,min_height:int,discard_aborted_uploads:bool,image_versions:array} + */ public $options; + /** + * @var int + */ protected $fk_element; /** @@ -45,7 +52,7 @@ class FileUpload * Constructor. * This set ->$options * - * @param array $options Options array + * @param ?array{script_url?:string,upload_dir?:string,upload_url?:string,param_name?:string,delete_type?:string,max_file_size?:?int,min_file_size?:int,accept_file_types?:string,max_number_of_files?:?int,max_width?:?int,max_height?:?int,min_width?:int,min_height?:int,discard_aborted_uploads?:bool,image_versions?:array} $options Options array * @param int $fk_element ID of element * @param string $element Code of element */ @@ -73,6 +80,7 @@ public function __construct($options = null, $fk_element = null, $element = null throw new Exception('The element '.$element.' is not supported for uploading file. dir_output is unknown.'); } + $object_ref = 'UndefinedReference'; // If pathname and filename are null then we can still upload files if we have specified upload_dir on $options if ($pathname !== null && $filename !== null) { // Get object from its id and type @@ -196,7 +204,7 @@ protected function getFullUrl() /** * Set delete url * - * @param object $file Filename + * @param stdClass $file File object (see getFileObject) * @return void */ protected function setFileDeleteUrl($file) @@ -212,7 +220,7 @@ protected function setFileDeleteUrl($file) * getFileObject * * @param string $file_name Filename - * @return stdClass|null + * @return ?stdClass */ protected function getFileObject($file_name) { @@ -243,7 +251,7 @@ protected function getFileObject($file_name) /** * getFileObjects * - * @return array Array of objects + * @return array Array of objects */ protected function getFileObjects() { @@ -253,9 +261,9 @@ protected function getFileObjects() /** * Create thumbs of a file uploaded. * - * @param string $file_name Filename - * @param string $options is array('max_width', 'max_height') - * @return boolean + * @param string $file_name Filename + * @param array{upload_dir:string} $options is array('max_width', 'max_height') + * @return bool */ protected function createScaledImage($file_name, $options) { diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 6c378869f5e5d..0edc34a55a353 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -460,7 +460,7 @@ public function info($id) * * @param int|string $datestart Date start to scan * @param int|string $dateend Date end to scan - * @return string Number of entries + * @return int Number of entries */ public function getAccountancyEntriesByFiscalYear($datestart = '', $dateend = '') { @@ -478,10 +478,11 @@ public function getAccountancyEntriesByFiscalYear($datestart = '', $dateend = '' $sql .= " WHERE entity IN (".getEntity('bookkeeping', 0).")"; $sql .= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'"; + $nb = 0; $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - $nb = $obj->nb; + $nb = (int) $obj->nb; } else { dol_print_error($this->db); } @@ -494,7 +495,7 @@ public function getAccountancyEntriesByFiscalYear($datestart = '', $dateend = '' * * @param int|string $datestart Date start to scan * @param int|string $dateend Date end to scan - * @return string Number of movements + * @return int Number of movements */ public function getAccountancyMovementsByFiscalYear($datestart = '', $dateend = '') { @@ -512,10 +513,11 @@ public function getAccountancyMovementsByFiscalYear($datestart = '', $dateend = $sql .= " WHERE entity IN (".getEntity('bookkeeping', 0).")"; $sql .= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'"; + $nb = 0; $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - $nb = $obj->nb; + $nb = (int) $obj->nb; } else { dol_print_error($this->db); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 59308c3ca6d8d..519460b888dde 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -318,7 +318,7 @@ public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofda } elseif (preg_match('/^ckeditor/', $typeofdata)) { $tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; - $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? 100 : (int) $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? 0 : $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? 20 : (int) $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7])); + $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? 100 : (int) $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? false : (bool) $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? 20 : (int) $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7])); $ret .= $doleditor->Create(1); } elseif ($typeofdata == 'asis') { $ret .= ($editvalue ? $editvalue : $value); @@ -1360,7 +1360,7 @@ public function select_company($selected = '', $htmlname = 'socid', $filter = '' if (empty($hidelabel)) { $out .= $langs->trans("RefOrLabel") . ' : '; } elseif ($hidelabel == 1 && !is_numeric($showempty)) { - $placeholder = $showempty; + $placeholder = $langs->trans($showempty); } elseif ($hidelabel > 1) { $placeholder = $langs->trans("RefOrLabel"); if ($hidelabel == 2) { @@ -1731,15 +1731,15 @@ public function select_thirdparty_list($selected = '', $htmlname = 'socid', $fil * Note: you must use the select_contact() to get the component to select a contact. This function must only be called by select_contact. * * @param int $socid Id of third party or 0 for all or -1 for empty list - * @param array|int|string $selected Array of ID of preselected contact id + * @param string[]|int|string $selected Array of ID of preselected contact id * @param string $htmlname Name of HTML field ('none' for a not editable field) * @param int<0,3>|string $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list - * @param integer $showfunction Add function into label + * @param int<0,1> $showfunction Add function into label * @param string $morecss Add more class to class style * @param int $options_only 1=Return options only (for ajax treatment), 2=Return array - * @param integer $showsoc Add company into label + * @param int<0,1> $showsoc Add company into label * @param int $forcecombo Force to use combo box (so no ajax beautify effect) * @param array}> $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container @@ -2881,21 +2881,21 @@ public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $st * @param int $limit Limit on number of returned lines * @param int $price_level Level of price to show * @param string $filterkey Filter on product - * @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell + * @param int<-1,1> $status -1=Return all products, 0=Products not on sell, 1=Products on sell * @param int $finished Filter on finished field: 2=No filter * @param int $outputmode 0=HTML select string, 1=Array * @param int $socid Thirdparty Id (to get also price dedicated to this customer) * @param string|int<0,1> $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select - * @param int $hidepriceinlabel 1=Hide prices in label - * @param string $warehouseStatus Warehouse status filter to group/count stock. Following comma separated filter options can be used. - * 'warehouseopen' = count products from open warehouses, - * 'warehouseclosed' = count products from closed warehouses, - * 'warehouseinternal' = count products from warehouses for internal correct/transfer only - * @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase + * @param int<0,1> $hidepriceinlabel 1=Hide prices in label + * @param ''|'warehouseopen'|'warehouseclosed'|'warehouseinternal' $warehouseStatus Warehouse status filter to group/count stock. Following comma separated filter options can be used. + * 'warehouseopen' = count products from open warehouses, + * 'warehouseclosed' = count products from closed warehouses, + * 'warehouseinternal' = count products from warehouses for internal correct/transfer only + * @param int<-1,1> $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase * @param int $warehouseId Filter by Warehouses Id where there is real stock - * @return array|string Array of keys for json + * @return string|array Array of keys for json */ public function select_produits_list($selected = 0, $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = 'maxwidth500', $hidepriceinlabel = 0, $warehouseStatus = '', $status_purchase = -1, $warehouseId = 0) { @@ -3201,7 +3201,7 @@ public function select_produits_list($selected = 0, $htmlname = 'productid', $fi //$objp->default_vat_code is not overwritten by $objp2 value $this->constructProductListOption($objp, $opt, $optJson, 0, $selected, $hidepriceinlabel, $filterkey); - + '@phan-var-force array{key:string,value:string,label:string,label2:string,desc:string,type:string,price_ht:string,price_ttc:string,price_ht_locale:string,price_ttc_locale:string,pricebasetype:string,tva_tx:string,default_vat_code:string,qty:string,discount:string,duration_value:string,duration_unit:string,pbq:string,labeltrans:string,desctrans:string,ref_customer:string} $optJson'; $j++; // Add new entry @@ -3264,7 +3264,7 @@ public function select_produits_list($selected = 0, $htmlname = 'productid', $fi * * @param stdClass $objp Resultset of fetch * @param string $opt Option (var used for returned value in string option format) - * @param array{key:string,value:string,label:string,label2:string,desc:string,type:string,price_ht:string,price_ttc:string,price_ht_locale:string,price_ttc_locale:string,pricebasetype:string,tva_tx:string,default_vat_code:string,qty:string,discount:string,duration_value:string,duration_unit:string,pbq:string,labeltrans:string,desctrans:string,ref_customer:string} $optJson Option (var used for returned value in json format) + * @param array{key?:string,value?:string,label?:string,label2?:string,desc?:string,type?:string,price_ht?:string,price_ttc?:string,price_ht_locale?:string,price_ttc_locale?:string,pricebasetype?:string,tva_tx?:string,default_vat_code?:string,qty?:string,discount?:string,duration_value?:string,duration_unit?:string,pbq?:string,labeltrans?:string,desctrans?:string,ref_customer?:string} $optJson Option (var used for returned value in json format) * @param int $price_level Price level * @param int $selected Preselected value * @param int<0,1> $hidepriceinlabel Hide price in label @@ -3696,7 +3696,7 @@ public function select_produits_fournisseurs($socid, $selected = '', $htmlname = * @param string $morecss Add more CSS * @param int $showstockinlist Show stock information (slower). * @param string $placeholder Placeholder - * @return array|string Array of keys for json or HTML component + * @return array>|string Array of keys for json or HTML component */ public function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '', $showstockinlist = 0, $placeholder = '') { @@ -4845,17 +4845,17 @@ public function load_cache_transport_mode() } /** - * Return list of transport mode for intracomm report + * Return list of transport mode for intracomm report * - * @param string $selected Id of the transport mode preselected - * @param string $htmlname Name of the select field - * @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code - * @param int $empty 1=can be empty, 0 else - * @param int $noadmininfo 0=Add admin info, 1=Disable admin info - * @param int $maxlength Max length of label - * @param int $active Active or not, -1 = all - * @param string $morecss Add more CSS on select tag - * @return void + * @param string $selected Id of the transport mode preselected + * @param string $htmlname Name of the select field + * @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code + * @param int $empty 1=can be empty, 0 else + * @param int $noadmininfo 0=Add admin info, 1=Disable admin info + * @param int $maxlength Max length of label + * @param int $active Active or not, -1 = all + * @param string $morecss Add more CSS on select tag + * @return void */ public function selectTransportMode($selected = '', $htmlname = 'transportmode', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '') { @@ -4910,6 +4910,9 @@ public function selectTransportMode($selected = '', $htmlname = 'transportmode', print ''; } print ''; + + print ajax_combobox("select".$htmlname); + if ($user->admin && !$noadmininfo) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } @@ -7022,12 +7025,12 @@ public function selectDateToDate($set_time = '', $set_time_end = '', $prefix = ' * @param int<0,1> $disabled Disable input fields * @param int|string $fullday When a checkbox with id #fullday is checked, hours are set with 00:00 (if value if 'fulldaystart') or 23:59 (if value is 'fulldayend') * @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field. - * @param int|string|array $adddateof Add a link "Date of ..." using the following date. Must be array(array('adddateof' => ..., 'labeladddateof' => ...)) + * @param int|string|array $adddateof Add a link "Date of ..." using the following date. Must be array(array('adddateof' => ..., 'labeladddateof' => ...)) * @param string $openinghours Specify hour start and hour end for the select ex 8,20 * @param int $stepminutes Specify step for minutes between 1 and 30 * @param string $labeladddateof Label to use for the $adddateof parameter. Deprecated. Used only when $adddateof is not an array. * @param string $placeholder Placeholder - * @param mixed $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel' + * @param 'auto'|'gmt'|'tzserver'|'tzuserrel' $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel' * @return string Html for selectDate * @see form_date(), select_month(), select_year(), select_dayofweek() */ @@ -7679,7 +7682,7 @@ public function selectTickets($selected = '', $htmlname = 'ticketid', $filtertyp * @param string|int<0,1> $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select - * @return array|string Array of keys for json or HTML component + * @return array|string Array of keys for json or HTML component */ public function selectTicketsList($selected = '', $htmlname = 'ticketid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '') { @@ -7764,6 +7767,7 @@ public function selectTicketsList($selected = '', $htmlname = 'ticketid', $filte $objp = $this->db->fetch_object($result); $this->constructTicketListOption($objp, $opt, $optJson, $selected, $filterkey); + '@phan-var-force array{key:string,value:mixed,type:int} $optJson'; // Add new entry // "key" value of json key array is used by jQuery automatically as selected value // "label" value of json key array is used by jQuery automatically as text for combo box @@ -7794,7 +7798,7 @@ public function selectTicketsList($selected = '', $htmlname = 'ticketid', $filte * * @param object $objp Result set of fetch * @param string $opt Option (var used for returned value in string option format) - * @param mixed[] $optJson Option (var used for returned value in json format) + * @param array{key?:string,value?:mixed,type?:int} $optJson Option (var used for returned value in json format) * @param string $selected Preselected value * @param string $filterkey Filter key to highlight * @return void @@ -7903,7 +7907,7 @@ public function selectProjects($selected = '', $htmlname = 'projectid', $filtert * @param string|int<0,1> $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select - * @return array|string Array of keys for json or HTML component + * @return mixed[]|string Array of keys for json or HTML component */ public function selectProjectsList($selected = '', $htmlname = 'projectid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '') { @@ -8135,7 +8139,7 @@ public function selectMembers($selected = '', $htmlname = 'adherentid', $filtert * @param string|int<0,1> $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select - * @return array|string Array of keys for json or HTML string component + * @return mixed[]|string Array of keys for json or HTML string component */ public function selectMembersList($selected = '', $htmlname = 'adherentid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '') { @@ -8253,7 +8257,7 @@ public function selectMembersList($selected = '', $htmlname = 'adherentid', $fil * * @param object $objp Result set of fetch * @param string $opt Option (var used for returned value in string option format) - * @param mixed[] $optJson Option (var used for returned value in json format) + * @param array{key?:string,value?:mixed,type?:int} $optJson Option (var used for returned value in json format) * @param string $selected Preselected value * @param string $filterkey Filter key to highlight * @return void @@ -8482,7 +8486,7 @@ public function selectForForms($objectdesc, $htmlname, $preSelectedValue, $showe * @param int $disabled 1=Html component is disabled * @param string $sortfield Sort field * @param string $filter Add more filter (Universal Search Filter) - * @return string|array Return HTML string + * @return string|array Return HTML string * @see selectForForms() */ public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0, $sortfield = '', $filter = '') @@ -8516,7 +8520,16 @@ public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $sh } if (empty($fieldstoshow)) { - if (isset($objecttmp->fields['ref'])) { + if (!empty($objecttmp->parent_element)) { + $fieldstoshow = 'o.ref'; + if (empty($sortfield)) { + $sortfield = 'o.ref'; + } + if (in_array($objecttmp->element, ['commandedet', 'propaldet', 'facturedet', 'expeditiondet'])) { + $fieldstoshow .= ',p.ref AS p_ref,p.label,t.description'; + $sortfield .= ', p.ref'; + } + } elseif (isset($objecttmp->fields['ref'])) { $fieldstoshow = 't.ref'; } else { $langs->load("errors"); @@ -8532,14 +8545,21 @@ public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $sh $num = 0; // Search data - $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t"; + $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . " as t"; if (!empty($objecttmp->isextrafieldmanaged)) { - $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object"; + $sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . "_extrafields as e ON t.rowid = e.fk_object"; + } + if (!empty($objecttmp->parent_element)) { + $parent_properties = getElementProperties($objecttmp->parent_element); + $sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($parent_properties['table_element']) . " as o ON o.rowid = t.".$objecttmp->fk_parent_attribute; + } + if (in_array($objecttmp->parent_element, ['commande', 'propal', 'facture', 'expedition'])) { + $sql .= " LEFT JOIN " . $this->db->prefix() . "product as p ON p.rowid = t.fk_product"; } if (isset($objecttmp->ismultientitymanaged)) { if (!is_numeric($objecttmp->ismultientitymanaged)) { $tmparray = explode('@', $objecttmp->ismultientitymanaged); - $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0]; + $sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($tmparray[1]) . " as parenttable ON parenttable.rowid = t." . $this->db->sanitize($tmparray[0]); } if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { if (!$user->hasRight('societe', 'client', 'voir')) { @@ -8566,7 +8586,7 @@ public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $sh $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; } if (!is_numeric($objecttmp->ismultientitymanaged)) { - $sql .= " AND parenttable.entity = t." . $tmparray[0]; + $sql .= " AND parenttable.entity = t." . $this->db->sanitize($tmparray[0]); } if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { if ($objecttmp->element == 'societe') { @@ -8581,8 +8601,14 @@ public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $sh } } } + $splittedfieldstoshow = explode(',', $fieldstoshow); + foreach ($splittedfieldstoshow as &$field2) { + if (is_numeric($pos=strpos($field2, ' '))) { + $field2 = substr($field2, 0, $pos); + } + } if ($searchkey != '') { - $sql .= natural_search(explode(',', $fieldstoshow), $searchkey); + $sql .= natural_search($splittedfieldstoshow, $searchkey); } if ($filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" @@ -8628,7 +8654,7 @@ public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $sh $tmparray = explode(',', $fieldstoshow); $oldvalueforshowoncombobox = 0; foreach ($tmparray as $key => $val) { - $val = preg_replace('/t\./', '', $val); + $val = preg_replace('/(t|p|o)\./', '', $val); $label .= (($label && $obj->$val) ? ($oldvalueforshowoncombobox != $objecttmp->fields[$val]['showoncombobox'] ? ' - ' : ' ') : ''); $labelhtml .= (($label && $obj->$val) ? ($oldvalueforshowoncombobox != $objecttmp->fields[$val]['showoncombobox'] ? ' - ' : ' ') : ''); $label .= $obj->$val; @@ -9686,16 +9712,16 @@ public function showLinkToObjectBlock($object, $restrictlinksto = array(), $excl $htmltoenteralink .= '
'."\n"; $htmltoenteralink .= ''."\n"; $htmltoenteralink .= '
'; - $htmltoenteralink .= ''; - $htmltoenteralink .= ''; $htmltoenteralink .= ''; + $htmltoenteralink .= ''; + $htmltoenteralink .= ''; $htmltoenteralink .= ''; $htmltoenteralink .= '
'; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); // Private note @@ -1138,7 +1138,7 @@ print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'); print ''; - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); // print ' print '
'; @@ -1450,21 +1421,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - // Note public - print '
'; - print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'), 'note_public', $object->note_public, $object, $user->hasRight('facture', 'creer')); - print ''; - print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->hasRight('facture', 'creer'), 'textarea:'.ROWS_4.':90%', '', null, null, '', 1); - print '
'; - print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'), 'note_private', $object->note_private, $object, $user->hasRight('facture', 'creer')); - print ''; - print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->hasRight('facture', 'creer'), 'textarea:'.ROWS_4.':90%', '', null, null, '', 1); - print '
'; @@ -1747,7 +1704,10 @@ // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('invoice'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c8e3480d6e936..e1bcd26095c3d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -138,7 +138,7 @@ } $ret = $object->fetch($id, $ref, '', 0, $fetch_situation); if ($ret > 0 && isset($object->fk_project)) { - $ret = $object->fetch_project(); + $ret = $object->fetchProject(); } } } @@ -4121,7 +4121,7 @@ function setRadioForTypeOfInvoice() { print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); print ''; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); // Private note @@ -4131,7 +4131,7 @@ function setRadioForTypeOfInvoice() { print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); print ''; - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); // print ' print '
'; - $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print '
'; - $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print '
'.$langs->trans("NotePublic").''; - $doleditor = new DolEditor('note_public', $note_public, '', 100, 'dolibarr_notes', 'In', 1, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $note_public, '', 100, 'dolibarr_notes', 'In', true, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print '
'.$langs->trans("NotePrivate").''; - $doleditor = new DolEditor('note_private', $note_private, '', 100, 'dolibarr_notes', 'In', 1, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', $note_private, '', 100, 'dolibarr_notes', 'In', true, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print '
'; - $htmltoenteralink .= ''; + $htmltoenteralink .= ''; //print ''; $htmltoenteralink .= ''; + $htmltoenteralink .= ' '; + $htmltoenteralink .= ''; $htmltoenteralink .= ''; $htmltoenteralink .= '
' . $langs->trans("Ref") . ' '; - $htmltoenteralink .= ' '; - $htmltoenteralink .= '
'; $htmltoenteralink .= ''; @@ -9710,11 +9736,13 @@ public function showLinkToObjectBlock($object, $restrictlinksto = array(), $excl if ($num > 0) { // Section for free predefined list - $htmltoenteralink .= '
'; + if (getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { + $htmltoenteralink .= '
'; + } $htmltoenteralink .= ''."\n"; $htmltoenteralink .= '
'; - $htmltoenteralink .= ''; $htmltoenteralink .= ''; + $htmltoenteralink .= ''; $htmltoenteralink .= ''; $htmltoenteralink .= ''; $htmltoenteralink .= ''; @@ -9747,12 +9775,12 @@ public function showLinkToObjectBlock($object, $restrictlinksto = array(), $excl $htmltoenteralink .= '
'; $htmltoenteralink .= '
'; if ($num) { - $htmltoenteralink .= ''; + $htmltoenteralink .= ''; } if (empty($conf->use_javascript_ajax)) { - $htmltoenteralink .= '
'; + $htmltoenteralink .= '
'; } else { - $htmltoenteralink .= ''; + $htmltoenteralink .= ''; } $htmltoenteralink .= ''; } diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 60630b9c86056..fae07b24a6b91 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -376,6 +376,7 @@ public function select_account($selectid, $htmlname = 'account', $showempty = 0, require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; $out = ''; + $selected = ''; $options = array(); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 9a213d994a67c..c8238d4770c35 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010-2018 Juanjo Menent * 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 @@ -357,13 +358,13 @@ public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = /** * Output html select list of type of event * - * @param array|string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'). Can be an array too. + * @param string[]|string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'). Can be an array too. * @param string $htmlname Name of select field * @param string $excludetype A type to exclude ('systemauto', 'system', '') - * @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual", -2=Combined line is disabled (not implemented yet) - * @param int $hideinfohelp 1=Do not show info help, 0=Show, -1=Show+Add info to tell how to set default value - * @param int $multiselect 1=Allow multiselect of action type - * @param int $nooutput 1=No output + * @param int<-2,1> $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual", -2=Combined line is disabled (not implemented yet) + * @param int<-1,1> $hideinfohelp 1=Do not show info help, 0=Show, -1=Show+Add info to tell how to set default value + * @param int<0,1> $multiselect 1=Allow multiselect of action type + * @param int<0,1> $nooutput 1=No output * @param string $morecss More css to add to SELECT component. * @param int<0,1>|string $showempty 0 or 1 or 'Placeholder string' * @return string @@ -391,7 +392,7 @@ public function select_type_actions($selected = '', $htmlname = 'actioncode', $e $selected = 'AC_OTH_AUTO'; } - if (getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO')) { + if (array_key_exists('AC_OTH_AUTO', $arraylist) && getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO')) { unset($arraylist['AC_OTH_AUTO']); } diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index f0a7b099c4a18..57f86f121cf39 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -525,7 +525,6 @@ public function selectTypeOfFields($htmlname, $type, $typewecanchangeinto = arra // Set $valhtml with the picto for the type $valhtml = ($key ? getPictoForType($key) : '').$val; - // @phpstan-ignore-next-line if (empty($typewecanchangeinto) || in_array($key, $typewecanchangeinto[$type])) { $out .= ''; } else { diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 992e676b89e34..d113aa44d6cbe 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2008-2012 Laurent Destailleur * Copyright (C) 2018-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 @@ -55,7 +56,7 @@ public function __construct($db) * Return HTML select with list of bar code generators * * @param int $selected Id code pre-selected - * @param array $barcodelist Array of barcodes generators + * @param array $barcodelist Array of barcodes generators * @param int $code_id Id du code barre * @param string $idForm Id of html form, ex id="idform" * @return string HTML select string diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php index 731559ed119de..4a91fbc99f7e3 100644 --- a/htdocs/core/class/html.formcategory.class.php +++ b/htdocs/core/class/html.formcategory.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,12 +36,12 @@ class FormCategory extends Form * Return a HTML filter box for a list filter view * * @param string $type The categorie type (e.g Categorie::TYPE_WAREHOUSE) - * @param array $preSelected A list with the elements that should pre-selected + * @param array $preSelected A list with the elements that should pre-selected * @param string $morecss More CSS - * @param int $searchCategoryProductOperator Used only if $multiselect is 1. Set to 0 or 1 to enable the checkbox to search with a or (0=not preseleted, 1=preselected), -1=Checkbox never shown. - * @param int $multiselect 0 or 1 - * @param int $nocateg 1=Add an entry '- No Category -' - * @param string $showempty 1 or 'string' to add an empty entry + * @param int<-1,1> $searchCategoryProductOperator Used only if $multiselect is 1. Set to 0 or 1 to enable the checkbox to search with a or (0=not preselected, 1=preselected), -1=Checkbox never shown. + * @param int<0,1> $multiselect 0 or 1 + * @param int<0,1> $nocateg 1=Add an entry '- No Category -' + * @param int<1,1>|string $showempty 1 or 'string' to add an empty entry * @return string A HTML filter box (Note: selected results can get with GETPOST("search_category_".$type."_list")) */ public function getFilterBox($type, array $preSelected, $morecss = "minwidth300imp widthcentpercentminusx", $searchCategoryProductOperator = -1, $multiselect = 1, $nocateg = 1, $showempty = '') diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 59001843f2dde..87cc659819fc7 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -91,7 +91,7 @@ public function __construct($db) * @param int<0,1> $capture 1=Add tag capture="capture" to force use of micro or video recording to generate file. When setting this to 1, you must also provide a value for $accept. * @param int<0,1> $disablemulti 0=Default, 1=Disable multiple file upload * @param int<0,1> $nooutput 0=Output result with print, 1=Return result - * @return int|string Return integer <0 if KO, >0 if OK, or string if $noouput=1 + * @return int|string|array{formToUploadAFile:string,formToAddALink:string} Return integer <0 if KO, >0 if OK, or string if $nooutput=1 or array if $nooutput=2 */ public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = null, $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '', $usewithoutform = 0, $capture = 0, $disablemulti = 0, $nooutput = 0) { @@ -108,183 +108,193 @@ public function form_attach_new_file($url, $title = '', $addcancel = 0, $section $useajax = 0; } - if ((getDolGlobalString('MAIN_USE_JQUERY_FILEUPLOAD') && $useajax) || ($useajax == 2)) { - // TODO: Check this works with 2 forms on same page - // TODO: Check this works with GED module, otherwise, force useajax to 0 - // TODO: This does not support option savingdocmask - // TODO: This break feature to upload links too - // TODO: Thisdoes not work when param nooutput=1 - //return $this->_formAjaxFileUpload($object); - return 'Feature too bugged so removed'; - } else { - //If there is no permission and the option to hide unauthorized actions is enabled, then nothing is printed - if (!$perm && getDolGlobalString('MAIN_BUTTON_HIDE_UNAUTHORIZED')) { - if ($nooutput) { - return ''; - } else { - return 1; - } + //If there is no permission and the option to hide unauthorized actions is enabled, then nothing is printed + if (!$perm && getDolGlobalString('MAIN_BUTTON_HIDE_UNAUTHORIZED')) { + if ($nooutput) { + return ''; + } else { + return 1; } + } - $out = "\n\n".'
'."\n"; + // Section to generate the form to upload a new file + $out = "\n".'
'."\n"; + if ($nooutput != 2) { if (empty($title)) { $title = $langs->trans("AttachANewFile"); } if ($title != 'none') { $out .= load_fiche_titre($title, '', ''); } + } - if (empty($usewithoutform)) { // Try to avoid this and set instead the form by the caller. - // Add a param as GET parameter to detect when POST were cleaned by PHP because a file larger than post_max_size - $url .= (strpos($url, '?') === false ? '?' : '&').'uploadform=1'; + if (empty($usewithoutform)) { // Try to avoid this and set instead the form by the caller. + // Add a param as GET parameter to detect when POST were cleaned by PHP because a file larger than post_max_size + $url .= (strpos($url, '?') === false ? '?' : '&').'uploadform=1'; - $out .= '
'."\n"; - } - if (empty($usewithoutform) || $usewithoutform == 2) { - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; + $out .= ''."\n"; + } + if (empty($usewithoutform) || $usewithoutform == 2) { + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + } + + $out .= ''; + $out .= ''; + + if (!empty($options)) { + $out .= ''; + } + + $out .= '"; - $out .= '
'.$options.''; + + $maxfilesizearray = getMaxFileSizeArray(); + $max = $maxfilesizearray['max']; + $maxmin = $maxfilesizearray['maxmin']; + $maxphptoshow = $maxfilesizearray['maxphptoshow']; + $maxphptoshowparam = $maxfilesizearray['maxphptoshowparam']; + if ($maxmin > 0) { + $out .= ''; // MAX_FILE_SIZE must precede the field type=file + } + $out .= 'load('link'); + $out .= ''; + $out .= ''; + $out .= ''; + } + $out .= 'trans("Cancel").'">'; + } + + if (getDolGlobalString('MAIN_UPLOAD_DOC')) { + if ($perm) { + $menudolibarrsetupmax = $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Security"); + $langs->load('other'); + $out .= ' '; + $out .= info_admin($langs->trans("ThisLimitIsDefinedInSetupAt", $menudolibarrsetupmax, $max, $maxphptoshowparam, $maxphptoshow), 1, 0, '1', 'classfortooltip'); } + } else { + $out .= ' ('.$langs->trans("UploadDisabled").')'; + } + $out .= "
'; - $out .= ''; + if ($savingdocmask) { + //add a global variable for disable the auto renaming on upload + $rename = (!getDolGlobalString('MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT') ? 'checked' : ''); + $out .= ''; if (!empty($options)) { $out .= ''; } + $out .= ''; + $out .= ''; + } - $out .= '
'.$options.''; + $out .= ' '; + $out .= ''; + $out .= '
'; + $out .= "
"; - $maxfilesizearray = getMaxFileSizeArray(); - $max = $maxfilesizearray['max']; - $maxmin = $maxfilesizearray['maxmin']; - $maxphptoshow = $maxfilesizearray['maxphptoshow']; - $maxphptoshowparam = $maxfilesizearray['maxphptoshowparam']; - if ($maxmin > 0) { - $out .= ''; // MAX_FILE_SIZE must precede the field type=file - } - $out .= 'load('link'); - $out .= ''; - $out .= ''; - $out .= ''; + if (empty($usewithoutform)) { + $out .= '
'; + if (empty($sectionid)) { + $out .= '
'; } - $out .= 'trans("Cancel").'">'; - } + $parameters = array('socid' => (isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id' => (isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url' => $url, 'perm' => $perm, 'options' => $options); + $res = $hookmanager->executeHooks('formattachOptionsUpload', $parameters, $object); + if (empty($res)) { + $out = '
'.$out.'
'; + } + $out .= $hookmanager->resPrint; - if (getDolGlobalString('MAIN_UPLOAD_DOC')) { - if ($perm) { - $menudolibarrsetupmax = $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Security"); - $langs->load('other'); - $out .= ' '; - $out .= info_admin($langs->trans("ThisLimitIsDefinedInSetupAt", $menudolibarrsetupmax, $max, $maxphptoshowparam, $maxphptoshow), 1, 0, '1', 'classfortooltip'); - } - } else { - $out .= ' ('.$langs->trans("UploadDisabled").')'; - } - $out .= "
'.$options.''; - $out .= ' '; - $out .= ''; - $out .= '
"; - if (empty($usewithoutform)) { - $out .= ''; - if (empty($sectionid)) { - $out .= '
'; - } - } + $out2 = ""; - $out .= "\n\n"; + // Section to generate the form to upload a new file + if ($linkfiles) { + $out2 .= "\n".'
'."\n"; + $langs->load('link'); - if ($linkfiles) { - $out .= "\n".'
'."\n"; - $langs->load('link'); + if ($nooutput != 2) { $title = $langs->trans("LinkANewFile"); - $out .= load_fiche_titre($title, '', ''); + $out2 .= load_fiche_titre($title, '', ''); + } - if (empty($usewithoutform)) { - $out .= '
'; @@ -2175,11 +2213,10 @@ public function listOfLinks($object, $permissiontodelete = 1, $action = null, $s if ($nboflinks > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; } - foreach ($links as $link) { print ''; //edit mode - if ($action == 'update' && $selected === $link->id) { + if ($action == 'update' && $selected === (int) $link->id && $permissiontoedit) { print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } // invoice ref - print ''; + print ''; // company name - print ''; + print ''; // customer code - print ''; + print ''; // invoice date - print ''; // selling price - print ''; + print ''; // buying price - print ''; + print ''; // qty - print ''; + print ''; // margin - print ''; + print ''; // margin rate if (getDolGlobalString('DISPLAY_MARGIN_RATES')) { - print ''; + print ''; } // mark rate if (getDolGlobalString('DISPLAY_MARK_RATES')) { - print ''; + print ''; } // status - print ''; + print ''; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } print ''."\n"; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 89f3571cbe9bf..42a004d288a29 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -154,9 +154,7 @@ $object = new Societe($db); $object->fetch($socid); - /* - * Affichage onglets - */ + // Show tabs $head = societe_prepare_head($object); @@ -169,7 +167,7 @@ print '
'; print '
'; - print '
'; print ''; print ''; @@ -2232,7 +2269,7 @@ public function listOfLinks($object, $permissiontodelete = 1, $action = null, $s /** * Show detail icon with link for preview * - * @param array $file Array with data of file. Example: array('name'=>...) + * @param array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string} $file Array with data of file. Example: array('name'=>...) * @param string $modulepart propal, facture, facture_fourn, ... * @param string $relativepath Relative path of docs * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file). Use a negative value to show a generic picto even if preview not available. diff --git a/htdocs/core/class/html.formldap.class.php b/htdocs/core/class/html.formldap.class.php index 04c204edfd2df..d96cbcca56850 100644 --- a/htdocs/core/class/html.formldap.class.php +++ b/htdocs/core/class/html.formldap.class.php @@ -1,5 +1,6 @@ + * 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 @@ -108,8 +109,8 @@ public function selectLdapPasswordHashType($selected = 'md5', $htmlname = 'ldaph * * @param int $selected Preselected type * @param string $htmlname Name of field in form - * @param array $exclude Exclude values from the list - * @param int $scriptonly Add warning if synchro only work with a script (0 = disable, 1 = Dolibarr2ldap, 2 = ldap2dolibarr, 3 = all) + * @param string[] $exclude Exclude values from the list + * @param int<0,3> $scriptonly Add warning if synchro only work with a script (0 = disable, 1 = Dolibarr2ldap, 2 = ldap2dolibarr, 3 = all) * @param int $showempty Add an empty field * @return string HTML select string */ diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 1993ee8156c31..ccf22410156a1 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} */ @@ -1504,6 +1506,10 @@ public function getSectionForAIPrompt($function = 'textgeneration', $format = '' $out .= ''.$langs->trans("AIProcessingPleaseWait", getDolGlobalString('AI_API_SERVICE', 'chatgpt')); $out .= ''; + if ($function == 'imagegeneration') { + $out .= '
'; // Div for displaying the generated image + } + $out .= "\n"; $out .= "'."\n"; } - // Wrapper to add log when clicking on download or preview + // JS wrapper to add log when clicking on download or preview if (isModEnabled('blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0) { if (in_array($object->element, array('facture')) && $object->statut > 0) { // Restrict for the moment to element 'facture' print "\n\n"; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index ad2e76bdcf7ba..3f7159c11c5cb 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -287,75 +287,75 @@ // Fields title search // -------------------------------------------------------------------- - print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; + print ''; print '
'; print $form->selectDate($search_invoice_date_start ?: -1, 'search_invoice_date_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; print $form->selectDate($search_invoice_date_end ?: -1, 'search_invoice_date_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; - print ''; + print '
'; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; - print ''; + print '
'; + print '
'; // Type Prospect/Customer/Supplier print '
'.$langs->trans('NatureOfThirdParty').''; @@ -298,67 +296,67 @@ $i = 0; print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table - print ""; + print '
'; // Fields title search // -------------------------------------------------------------------- - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } // invoice ref - print ''; + print ''; // invoice date - print ''; // selling price - print ''; + print ''; // buying price - print ''; + print ''; // margin - print ''; + print ''; // margin rate if (getDolGlobalString('DISPLAY_MARGIN_RATES')) { - print ''; + print ''; } // mark rate if (getDolGlobalString('DISPLAY_MARK_RATES')) { - print ''; + print ''; } // status - print ''; + print ''; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } print ''."\n"; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index de5fcac6cd1bd..9440b466b5877 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -423,7 +423,7 @@ function getLicenceHeader($user, $langs, $now) } if (!$error) { - setEventMessages('ModuleInitialized', null); + setEventMessages($langs->trans('ModuleInitialized', $destdir), null); $module = $modulename; clearstatcache(true); @@ -3423,8 +3423,8 @@ function getLicenceHeader($user, $langs, $now) print '
'; print ''.$langs->trans("Picto").''; print '
'; - print ''; - print $form->textwithpicto('', $langs->trans("Example").': fa-file-o, fa-globe, ... any font awesome code.
Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]'); + print ''; + print $form->textwithpicto('', $langs->trans("Example").': fa-file, fa-globe, ... any font awesome code.
Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]'); print '
'; print '
'; @@ -3593,7 +3593,7 @@ function getLicenceHeader($user, $langs, $now) print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; - print ''; + print ''; - print ''; + print ''; + print ''; print '
'; print $form->selectDate($search_invoice_date_start ?: -1, 'search_invoice_date_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; print $form->selectDate($search_invoice_date_end ?: -1, 'search_invoice_date_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; - print ''; + print '
'; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; - print ''; + print '
'; print ''; @@ -3602,17 +3602,17 @@ function getLicenceHeader($user, $langs, $now) foreach ($listofsetuppages as $setuppage) { //var_dump($setuppage); print ''; } - print ''; - print ''; @@ -3874,7 +3874,7 @@ function getLicenceHeader($user, $langs, $now) if (!preg_match('/custom/', $dirread)) { // If this is not a module into custom $pathtofile = 'langs/'.$langfile['relativename']; } - print ''; @@ -3995,8 +3995,8 @@ function getLicenceHeader($user, $langs, $now) print '
'; print ''.$langs->trans("Picto").'   '; print '
'; - print ''; - print $form->textwithpicto('', $langs->trans("Example").': fa-file-o, fa-globe, ... any font awesome code.
Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]'); + print ''; + print $form->textwithpicto('', $langs->trans("Example").': fa-file, fa-globe, ... any font awesome code.
Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]'); print '
'; print '
'; @@ -4306,7 +4306,7 @@ function cleanString( stringtoclean ) print ''; print '
'; // Main DAO class file - print ' '.$langs->trans("ClassFile").' : '.(dol_is_file($realpathtoclass) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).(dol_is_file($realpathtoclass) ? '' : '').''; + print ' '.$langs->trans("ClassFile").' : '.(dol_is_file($realpathtoclass) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).(dol_is_file($realpathtoclass) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; // Image @@ -4321,7 +4321,7 @@ function cleanString( stringtoclean ) // API file print '
'; - print ' '.$langs->trans("ApiClassFile").' : '.(dol_is_file($realpathtoapi) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi) ? '' : '').''; + print ' '.$langs->trans("ApiClassFile").' : '.(dol_is_file($realpathtoapi) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi) ? '' : '').''; if (dol_is_file($realpathtoapi)) { $file = file_get_contents($realpathtoapi); if (preg_match('/var '.$tabobj.'\s+([^\s]*)\s/ims', $file, $objs)) { @@ -4344,7 +4344,7 @@ function cleanString( stringtoclean ) } // PHPUnit print '
'; - print ' '.$langs->trans("TestClassFile").' : '.(dol_is_file($realpathtophpunit) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit) ? '' : '').''; + print ' '.$langs->trans("TestClassFile").' : '.(dol_is_file($realpathtophpunit) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit) ? '' : '').''; if (dol_is_file($realpathtophpunit)) { print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; @@ -4356,24 +4356,24 @@ function cleanString( stringtoclean ) print '
'; - print ' '.$langs->trans("PageForLib").' : '.(dol_is_file($realpathtolib) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolib).(dol_is_file($realpathtolib) ? '' : '').''; + print ' '.$langs->trans("PageForLib").' : '.(dol_is_file($realpathtolib) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolib).(dol_is_file($realpathtolib) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("PageForObjLib").' : '.(dol_is_file($realpathtoobjlib) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoobjlib).(dol_is_file($realpathtoobjlib) ? '' : '').''; + print ' '.$langs->trans("PageForObjLib").' : '.(dol_is_file($realpathtoobjlib) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoobjlib).(dol_is_file($realpathtoobjlib) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print '
'; - print ' '.$langs->trans("SqlFile").' : '.(dol_is_file($realpathtosql) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosql).(dol_is_file($realpathtosql) ? '' : '').''; + print ' '.$langs->trans("SqlFile").' : '.(dol_is_file($realpathtosql) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosql).(dol_is_file($realpathtosql) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '   '.$langs->trans("DropTableIfEmpty").''; //print '   '.$langs->trans("RunSql").''; print '
'; - print ' '.$langs->trans("SqlFileKey").' : '.(dol_is_file($realpathtosqlkey) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlkey).(dol_is_file($realpathtosqlkey) ? '' : '').''; + print ' '.$langs->trans("SqlFileKey").' : '.(dol_is_file($realpathtosqlkey) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlkey).(dol_is_file($realpathtosqlkey) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; //print '   '.$langs->trans("RunSql").''; print '
'; - print ' '.$langs->trans("SqlFileExtraFields").' : '.(dol_is_file($realpathtosqlextra) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextra).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '').''; + print ' '.$langs->trans("SqlFileExtraFields").' : '.(dol_is_file($realpathtosqlextra) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextra).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '').''; if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) { print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; @@ -4385,7 +4385,7 @@ function cleanString( stringtoclean ) } //print '   '.$langs->trans("RunSql").''; print '
'; - print ' '.$langs->trans("SqlFileKeyExtraFields").' : '.(dol_is_file($realpathtosqlextrakey) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextrakey).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '').''; + print ' '.$langs->trans("SqlFileKeyExtraFields").' : '.(dol_is_file($realpathtosqlextrakey) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextrakey).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '').''; if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) { print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; @@ -4397,14 +4397,14 @@ function cleanString( stringtoclean ) print '
'; print '
'; - print ' '.$langs->trans("PageForList").' : '.(dol_is_file($realpathtolist) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolist).(dol_is_file($realpathtolist) ? '' : '').''; + print ' '.$langs->trans("PageForList").' : '.(dol_is_file($realpathtolist) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolist).(dol_is_file($realpathtolist) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("PageForCreateEditView").' : '.(dol_is_file($realpathtocard) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocard).(dol_is_file($realpathtocard) ? '' : '').'?action=create'; + print ' '.$langs->trans("PageForCreateEditView").' : '.(dol_is_file($realpathtocard) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocard).(dol_is_file($realpathtocard) ? '' : '').'?action=create'; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; // Page contact - print ' '.$langs->trans("PageForContactTab").' : '.(dol_is_file($realpathtocontact) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocontact).(dol_is_file($realpathtocontact) ? '' : '').''; + print ' '.$langs->trans("PageForContactTab").' : '.(dol_is_file($realpathtocontact) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocontact).(dol_is_file($realpathtocontact) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; if (dol_is_file($realpathtocontact)) { print ' '; @@ -4414,7 +4414,7 @@ function cleanString( stringtoclean ) } print '
'; // Page document - print ' '.$langs->trans("PageForDocumentTab").' : '.(dol_is_file($realpathtodocument) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtodocument).(dol_is_file($realpathtodocument) ? '' : '').''; + print ' '.$langs->trans("PageForDocumentTab").' : '.(dol_is_file($realpathtodocument) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtodocument).(dol_is_file($realpathtodocument) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; if (dol_is_file($realpathtodocument)) { print ' '; @@ -4424,7 +4424,7 @@ function cleanString( stringtoclean ) } print '
'; // Page notes - print ' '.$langs->trans("PageForNoteTab").' : '.(dol_is_file($realpathtonote) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtonote).(dol_is_file($realpathtonote) ? '' : '').''; + print ' '.$langs->trans("PageForNoteTab").' : '.(dol_is_file($realpathtonote) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtonote).(dol_is_file($realpathtonote) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; if (dol_is_file($realpathtonote)) { print ' '; @@ -4434,7 +4434,7 @@ function cleanString( stringtoclean ) } print '
'; // Page agenda - print ' '.$langs->trans("PageForAgendaTab").' : '.(dol_is_file($realpathtoagenda) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoagenda).(dol_is_file($realpathtoagenda) ? '' : '').''; + print ' '.$langs->trans("PageForAgendaTab").' : '.(dol_is_file($realpathtoagenda) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoagenda).(dol_is_file($realpathtoagenda) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; if (dol_is_file($realpathtoagenda)) { print ' '; @@ -4751,7 +4751,7 @@ function cleanString( stringtoclean ) if (preg_match('/\.md$/i', $spec['name'])) { $format = 'markdown'; } - print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; + print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; } @@ -4859,14 +4859,15 @@ function cleanString( stringtoclean ) print ''; print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; if (is_array($dicts) && !empty($dicts)) { - print ' '.$langs->trans("LanguageFile").' : '; + print ' '.$langs->trans("LanguageFile").' : '; print ''.$dicts['langs'].''; print '
'; } + print '
'; $head3 = array(); $h = 0; @@ -5227,7 +5228,7 @@ function cleanString( stringtoclean ) print ''; print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; @@ -5662,7 +5663,7 @@ function cleanString( stringtoclean ) print ''; print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; @@ -5877,14 +5878,14 @@ function updateInputField() { $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; print '
'; print ''; @@ -5892,7 +5893,7 @@ function updateInputField() { print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { print ''.$langs->trans("FileNotYetGenerated").''; - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; print ''; } print ''; @@ -5938,7 +5939,7 @@ function updateInputField() { $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; print ''; @@ -5948,16 +5949,16 @@ function updateInputField() { $pathtofile = $trigger['relpath']; print ''; print ''; print ''; } } else { print ''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; print ''; print ''; } @@ -6000,14 +6001,14 @@ function updateInputField() { print ''; print ''; } else { print ''.$langs->trans("FileNotYetGenerated").''; - print ''; + print ''; } print ''; } else { @@ -6046,7 +6047,7 @@ function updateInputField() { print ''; @@ -6097,13 +6098,13 @@ function updateInputField() { foreach ($widgets as $widget) { $pathtofile = $widget['relpath']; - print ''; print ''; } } else { - print ''; } @@ -6149,13 +6150,13 @@ function updateInputField() { foreach ($emailingselectors as $emailingselector) { $pathtofile = $emailingselector['relpath']; - print ''; print ''; } } else { - print ''; } @@ -6197,10 +6198,10 @@ function updateInputField() { print ''.$langs->transnoentities('ImportExportProfiles').'
'; print '
'; - print ' '.$langs->trans("DescriptorFile").' ('.$langs->trans("ExportsArea").') : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' ('.$langs->trans("ExportsArea").') : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("DescriptorFile").' ('.$langs->trans("ImportArea").') : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' ('.$langs->trans("ImportArea").') : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; } else { @@ -6273,13 +6274,13 @@ function updateInputField() { foreach ($clifiles as $clifile) { $pathtofile = $clifile['relpath']; - print ''; print ''; print ''; } } else { - print ''; } @@ -6320,7 +6321,7 @@ function updateInputField() { print ''.str_replace('{s1}', ''.$langs->transnoentities('CronList').'', $langs->trans("CronJobDefDesc", '{s1}')).'
'; print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; @@ -6451,14 +6452,14 @@ function updateInputField() { $format = 'markdown'; } print ''; print ''; print ''; } } else { print ''; print ''; } @@ -6504,7 +6505,7 @@ function updateInputField() { $outputfiledocrelpdf = $modulelowercase.'/doc/'.$FILENAMEDOCPDF; // HTML - print ' '.$langs->trans("PathToModuleDocumentation", "HTML").' : '; + print ' '.$langs->trans("PathToModuleDocumentation", "HTML").' : '; if (!dol_is_file($outputfiledoc)) { print ''.$langs->trans("FileNotYetGenerated").''; } else { @@ -6519,7 +6520,7 @@ function updateInputField() { print '
'; // PDF - print ' '.$langs->trans("PathToModuleDocumentation", "PDF").' : '; + print ' '.$langs->trans("PathToModuleDocumentation", "PDF").' : '; if (!dol_is_file($outputfiledocpdf)) { print ''.$langs->trans("FileNotYetGenerated").''; } else { @@ -6591,7 +6592,7 @@ function updateInputField() { print '
'; - print ' '.$langs->trans("PathToModulePackage").' : '; + print ' '.$langs->trans("PathToModulePackage").' : '; if (!dol_is_file($outputfilezip)) { print ''.$langs->trans("FileNotYetGenerated").''; } else { @@ -6628,7 +6629,7 @@ function updateInputField() { print ''; print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index b245895a586c1..4f27dc700cb77 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -104,7 +104,7 @@ // Setup conf for selection of an URL $item = $formSetup->newItem('MYMODULE_MYPARAM1'); -$item->fieldOverride = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST']; +$item->fieldAttr['placeholder'] = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST']; $item->cssClass = 'minwidth500'; // Setup conf for selection of a simple string input @@ -116,20 +116,20 @@ $item = $formSetup->newItem('MYMODULE_MYPARAM3'); $item->nameText = $item->getNameText().' more html text '; -// Setup conf for a selection of a thirdparty +// Setup conf for a selection of a Thirdparty $item = $formSetup->newItem('MYMODULE_MYPARAM4'); $item->setAsThirdpartyType(); // Setup conf for a selection of a boolean $formSetup->newItem('MYMODULE_MYPARAM5')->setAsYesNo(); -// Setup conf for a selection of an email template of type thirdparty +// Setup conf for a selection of an Email template of type thirdparty $formSetup->newItem('MYMODULE_MYPARAM6')->setAsEmailTemplate('thirdparty'); // Setup conf for a selection of a secured key //$formSetup->newItem('MYMODULE_MYPARAM7')->setAsSecureKey(); -// Setup conf for a selection of a product +// Setup conf for a selection of a Product $formSetup->newItem('MYMODULE_MYPARAM8')->setAsProduct(); // Add a title for a new section @@ -159,15 +159,26 @@ $item = $formSetup->newItem('MYMODULE_MYPARAM10'); $item->setAsColor(); $item->defaultFieldValue = '#FF0000'; -$item->nameText = $item->getNameText().' more html text '; -$item->fieldInputOverride = ''; -$item->helpText = $langs->transnoentities('AnHelpMessage'); //$item->fieldValue = ''; //$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text //$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too //$item->fieldInputOverride = false; // set this var to override field input //$item->fieldOutputOverride = false; // set this var to override field output +$item = $formSetup->newItem('MYMODULE_MYPARAM11')->setAsHtml(); +$item->nameText = $item->getNameText().' more html text '; +$item->fieldInputOverride = ''; +$item->helpText = $langs->transnoentities('HelpMessage'); +$item->cssClass = 'minwidth500'; + +$item = $formSetup->newItem('MYMODULE_MYPARAM12'); +$item->fieldOverride = "Value forced, can't be modified"; +$item->cssClass = 'minwidth500'; + +//$item = $formSetup->newItem('MYMODULE_MYPARAM13')->setAsDate(); // Not yet implemented + +// End of definition of parameters + $setupnotempty += count($formSetup->items); diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index ab99b57ec2ced..b29a2ccf8999a 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -317,7 +317,7 @@ public function __construct($db) // Add here entries to declare new menus /* BEGIN MODULEBUILDER TOPMENU */ $this->menu[$r++] = array( - 'fk_menu' => '', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'fk_menu' => '', // Will be stored into mainmenu + leftmenu. Use '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type' => 'top', // This is a Top menu entry 'titre' => 'ModuleMyModuleName', 'prefix' => img_picto('', $this->picto, 'class="pictofixedwidth valignmiddle"'), diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index c24804b89ce0e..aa2406f6cc888 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -10,6 +10,7 @@ * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW + * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) ---Replace with your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -182,10 +183,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } // Load translation files required by the page - $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); + $langfiles = array("main", "bills", "products", "dict", "companies", "compta"); + $outputlangs->loadLangs($langfiles); // Show Draft Watermark - if (getDolGlobalString('MYOBJECT_DRAFT_WATERMARK') && $object->statut == $object::STATUS_DRAFT) { + if (getDolGlobalString('MYOBJECT_DRAFT_WATERMARK') && $object->status == $object::STATUS_DRAFT) { $this->watermark = getDolGlobalString('MYOBJECT_DRAFT_WATERMARK'); } @@ -194,7 +196,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')); - $outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies")); + $outputlangsbis->loadLangs($langfiles); } $nblines = (is_array($object->lines) ? count($object->lines) : 0); @@ -937,7 +939,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if (getDolGlobalString('MYMODULE_DRAFT_WATERMARK') && $object->statut == $object::STATUS_DRAFT) { + if (getDolGlobalString('MYMODULE_DRAFT_WATERMARK') && $object->status == $object::STATUS_DRAFT) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', dol_escape_htmltag(getDolGlobalString('MYMODULE_DRAFT_WATERMARK'))); } @@ -994,7 +996,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref); - if ($object->statut == $object::STATUS_DRAFT) { + if ($object->status == $object::STATUS_DRAFT) { $pdf->SetTextColor(128, 0, 0); $textref .= ' - '.$outputlangs->transnoentities("NotValidated"); } @@ -1013,7 +1015,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output } if (getDolGlobalInt('PDF_SHOW_PROJECT_TITLE')) { - $object->fetch_projet(); + $object->fetchProject(); if (!empty($object->project->ref)) { $posy += 3; $pdf->SetXY($posx, $posy); @@ -1023,7 +1025,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output } if (getDolGlobalInt('PDF_SHOW_PROJECT')) { - $object->fetch_projet(); + $object->fetchProject(); if (!empty($object->project->ref)) { $outputlangs->load("projects"); $posy += 3; @@ -1050,6 +1052,13 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } + if (!getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE') && !empty($object->thirdparty->code_compta_client)) { + $posy += 3; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerAccountancyCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_compta_client), '', 'R'); + } + // Get contact if (getDolGlobalInt('DOC_SHOW_FIRST_SALES_REP')) { $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 9ec0e0d765235..04a43ece6ddd7 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -618,7 +618,11 @@ } // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, array(), array('myobject')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('myobject'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 06c4e452fc572..2a4b5ae6b350d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -595,7 +595,7 @@ $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("SetupFile").' : '; + print ' '.$langs->trans("SetupFile").' : '; print ''.$modulelowercase.'/admin/'.$setuppage['relativename'].''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; + print '
'.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; + print '
'.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; + print '
'.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''.img_picto($langs->trans("Delete"), 'delete').''; print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'; $pathtohook = strtolower($module).'/class/actions_'.strtolower($module).'.class.php'; - print ' '.$langs->trans("HooksFile").' : '; + print ' '.$langs->trans("HooksFile").' : '; if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.''; + print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.''; print ''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
'; - print ' '.$langs->trans("TriggersFile"); + print ' '.$langs->trans("TriggersFile"); print ' : '.$langs->trans("FileNotYetGenerated").''; - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').'
'; $pathtohook = strtolower($module).'/css/'.strtolower($module).'.css.php'; - print ' '.$langs->trans("CSSFile").' : '; + print ' '.$langs->trans("CSSFile").' : '; if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; print ''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').''.img_picto('Generate', 'generate', 'class="paddingleft"').''.img_picto('Generate', 'generate', 'class="paddingleft"').'
'; $pathtohook = strtolower($module).'/js/'.strtolower($module).'.js.php'; - print ' '.$langs->trans("JSFile").' : '; + print ' '.$langs->trans("JSFile").' : '; if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; print ''.img_picto($langs->trans("Edit"), 'edit').'
'.$langs->trans("WidgetFile").' : '.$pathtofile.''; + print '
'.$langs->trans("WidgetFile").' : '.$pathtofile.''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''.img_picto($langs->trans("Delete"), 'delete').'
'.$langs->trans("WidgetFile").' : '.$langs->trans("NoWidget").''; + print '
'.$langs->trans("WidgetFile").' : '.$langs->trans("NoWidget").''; print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; print '
'.$langs->trans("EmailingSelectorFile").' : '.$pathtofile.''; + print '
'.$langs->trans("EmailingSelectorFile").' : '.$pathtofile.''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''.img_picto($langs->trans("Delete"), 'delete').'
'.$langs->trans("EmailingSelectorFile").' : '.$langs->trans("NoEmailingSelector").''; + print '
'.$langs->trans("EmailingSelectorFile").' : '.$langs->trans("NoEmailingSelector").''; print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; print '
'.$langs->trans("CLIFile").' : '.$pathtofile.''; + print '
'.$langs->trans("CLIFile").' : '.$pathtofile.''; print ''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
'.$langs->trans("CLIFile").' : '.$langs->trans("FileNotYetGenerated").''; + print '
'.$langs->trans("CLIFile").' : '.$langs->trans("FileNotYetGenerated").''; print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; print '
'; - print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; + print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; print ''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
'; - print ' '.$langs->trans("SpecificationFile").' : '.$langs->trans("FileNotYetGenerated").''; + print ' '.$langs->trans("SpecificationFile").' : '.$langs->trans("FileNotYetGenerated").''; print ''.img_picto('Generate', 'generate', 'class="paddingleft"').'
'."\n"; +print '
'."\n"; // Fields title search // -------------------------------------------------------------------- diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 28317996858a9..7b3e68b72981c 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1124,8 +1124,8 @@ public function validate($user, $notrigger = 0) $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql .= " SET ref = '".$this->db->escape($num)."',"; $sql .= " status = ".self::STATUS_VALIDATED.","; - $sql .= " date_valid='".$this->db->idate($now)."',"; - $sql .= " fk_user_valid = ".$user->id; + $sql .= " date_valid = '".$this->db->idate($now)."',"; + $sql .= " fk_user_valid = ".((int) $user->id); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::validate()", LOG_DEBUG); diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 42efc3ef0f43d..1e4cfed293715 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -45,6 +45,7 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'moagenda'; // To manage different context of search if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index b2bb5860eb5a7..a3925f8597054 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -858,7 +858,11 @@ print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang); // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('mo')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('mo'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, false); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 95b670ec03079..a3844a3b0e7b8 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -915,31 +915,30 @@ print ''; // Product print ''; // Qty - print ''; + print ''; // Unit print ''; // Cost price if ($permissiontoupdatecost && getDolGlobalString('MRP_SHOW_COST_FOR_CONSUMPTION')) { print ''; } - // Qty already consumed + Warehouse - print ''; + + $colspan="3"; if (isModEnabled('stock')) { - print ''; + $colspan++;; } - // Lot - serial if (isModEnabled('productbatch')) { - print ''; + $colspan++; } - // Split - print ''; - // SplitAll + // Qty already consumed + Warehouse + print ''; + // Split All print ''; // Edit Line if ($object->status == Mo::STATUS_DRAFT) { @@ -1003,7 +1002,7 @@ $reg = []; $qtyhourservice = 0; if (preg_match('/^(\d+)([a-z]+)$/', $tmpproduct->duration, $reg)) { - $qtyhourservice = convertDurationtoHour((int) $reg[1], (string) $reg[2]); + $qtyhourservice = convertDurationtoHour((float) $reg[1], (string) $reg[2]); } $qtyhourforline = 0; if ($line->fk_unit) { @@ -1389,7 +1388,7 @@ if ($tmpproduct->type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { if (empty($line->disable_stock_change)) { $preselected = (GETPOSTISSET('idwarehouse-'.$line->id.'-'.$i) ? GETPOST('idwarehouse-'.$line->id.'-'.$i) : ($tmpproduct->fk_default_warehouse > 0 ? $tmpproduct->fk_default_warehouse : 'ifone')); - print $formproduct->selectWarehouses($preselected, 'idwarehouse-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'maxwidth200 csswarehouse_'.$line->id.'_'.$i); + print $formproduct->selectWarehouses($preselected, 'idwarehouse-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, array(), 'maxwidth200 csswarehouse_'.$line->id.'_'.$i); } else { print ''.$langs->trans("DisableStockChange").''; } @@ -1409,7 +1408,7 @@ if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); print ''; - print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', ''); + print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, 0, array()); } print ''; } @@ -1808,7 +1807,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 0a5ba9ba95ffc..50ab5ce7bc3c8 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -804,12 +804,6 @@ public function approve($user, $notrigger = 0) $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql .= " SET ref = '".$this->db->escape($num)."',"; $sql .= " status = ".self::STATUS_APPROVED; - // if (!empty($this->fields['date_validation'])) { - // $sql .= ", date_validation = '".$this->db->idate($now)."'"; - // } - // if (!empty($this->fields['fk_user_valid'])) { - // $sql .= ", fk_user_valid = ".$user->id; - // } $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::accept()", LOG_DEBUG); diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index b4b75732c66d7..641a0ecc116f5 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -654,7 +654,11 @@ } // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('partnership')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('partnership'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 9e0d1f0c9b677..058882792e975 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -513,7 +513,7 @@ $units = GETPOSTINT('units'); $object->entity = $conf->entity; - $object->ref = $ref; + $object->ref = (string) $ref; $object->label = GETPOST('label', $label_security_check); $object->price_base_type = GETPOST('price_base_type', 'aZ09'); $object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0; @@ -753,7 +753,7 @@ $object->oldcopy = dol_clone($object, 1); if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) { - $object->ref = $ref; + $object->ref = (string) $ref; } $object->label = GETPOST('label', $label_security_check); @@ -772,7 +772,7 @@ $object->qc_frequency = GETPOSTINT('qc_frequency'); $object->status = GETPOSTINT('statut'); $object->status_buy = GETPOSTINT('statut_buy'); - $object->status_batch = GETPOST('status_batch', 'aZ09'); + $object->status_batch = GETPOSTINT('status_batch'); $object->sell_or_eat_by_mandatory = GETPOSTINT('sell_or_eat_by_mandatory'); $object->batch_mask = GETPOST('batch_mask', 'alpha'); $object->fk_default_warehouse = GETPOSTINT('fk_default_warehouse'); @@ -1462,10 +1462,10 @@ if (isModEnabled('productbatch')) { print ''; // Product specific batch number management - $status_batch = GETPOST('status_batch'); + $status_batch = GETPOSTINT('status_batch'); if ($status_batch !== '0') { $langs->load("admin"); $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Batch"), $langs->transnoentities("Batch")); @@ -2029,7 +2029,7 @@ print ''; } foreach ($filearray as $filetoadd) { - if ($ext = pathinfo($filetoadd['name'], PATHINFO_EXTENSION) == 'pdf') { + $ext = pathinfo($filetoadd['name'], PATHINFO_EXTENSION); + if ($ext == 'pdf') { $checked = ''; $filename = $filetoadd['name']; diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index b6404b0b60844..c303e2806c357 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -576,7 +576,7 @@ public function update_next_update($next_update, $user = null, $notrigger = 0) // Update request $sql = "UPDATE ".$this->db->prefix().$this->table_element." SET"; - $sql .= " next_update = ".$this->next_update; + $sql .= " next_update = ".((int) $this->next_update); $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 50b78c18ae6de..6a98d84eedcfc 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -7,6 +7,7 @@ * Copyright (C) 2019 Pierre Ardoin * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2019 Nicolas ZABOURI + * 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 @@ -332,7 +333,7 @@ $sql .= $db->plimit($max, 0); //print $sql; - $lastmodified=""; + $lastmodified = ""; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index a56f734d006fe..bc71bc8828edf 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -473,7 +473,11 @@ } // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('inventory')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('inventory'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index d8a18e9c67f54..a7d0a4351ac60 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1986,7 +1986,7 @@ foreach ($arraypricelevel as $key => $value) { if (!empty($arrayfields['p.sellprice'.$key]['checked'])) { print ''; print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); -print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'p.fk_product_type', '', $param, '', $sortfield, $sortorder); +print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'p.fk_product_type', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); print_liste_field_titre($textforqty, $_SERVER["PHP_SELF"], 'c', '', $param, '', $sortfield, $sortorder, 'right '); print "\n"; @@ -245,10 +245,14 @@ $tmpproduct->barcode = $vals['barcode']; print ""; + + // Product ref print ''; - print '
'; - print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth300'); + print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth150'); print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if ($tmpproduct->type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { $preselected = (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i) ? GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) : ($object->fk_warehouse > 0 ? $object->fk_warehouse : 'ifone')); - print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'maxwidth200 csswarehouse_'.$line->id.'_'.$i); + print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, array(), 'maxwidth200 csswarehouse_'.$line->id.'_'.$i); } else { print ''.$langs->trans("NoStockChangeOnServices").''; } diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index d574ac6c5a83e..ebfbe3e433df2 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -183,7 +183,7 @@ public function create(User $user, $notrigger = 0) * Load object in memory from the database * * @param int $id Id object - * @param string $code code + * @param ?string $code code * @return int Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $code = null) @@ -519,12 +519,12 @@ public static function getIdFromCode($dbs, $code) /** * Get id and rate of currency from code * - * @param DoliDB $dbs Object db - * @param string $code Code value search - * @param integer|string $date_document Date from document (propal, order, invoice, ...) + * @param DoliDB $dbs Object db + * @param string $code Code value search + * @param int|string $date_document Date from document (propal, order, invoice, ...) * - * @return array [0] => id currency - * [1] => rate + * @return array{0:int,1:float} [0] => id currency + * [1] => rate */ public static function getIdAndTxFromCode($dbs, $code, $date_document = '') { diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index ade0538bf3e64..08945a7a1f701 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -256,7 +256,7 @@ // Description print '
'.$langs->trans("Description").''; if ($action == 'edit') { - $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); + $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', true, 1, 1, ROWS_7, '90%'); $doleditor->Create(0, ''); } else { print(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 4d9986338e78e..13327925dcc4c 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -126,20 +126,49 @@ class Opensurveysondage extends CommonObject * @var string Id sondage not an int */ public $id_sondage; + /** * @var string Description * @deprecated Use $description instead */ public $commentaires; + + /** + * @var string admin mail + */ public $mail_admin; + + /** + * @var string admin name + */ public $nom_admin; + + /** + * @var int ID of user + */ public $fk_user_creat; + + /** + * @var string title of survey + */ public $title; + + /** + * @var int|'' end date of survey + */ public $date_fin = ''; public $status; + + /** + * @var string format 'A' = Text choice (choices are saved into sujet field), 'D' = Date choice (choices are saved into sujet field), 'F' = Form survey + */ public $format; + + /** + * @var int to allow send mail + */ public $mailsonde; - public $entity; + /** * @var int Allow comments on this poll */ @@ -274,7 +303,7 @@ public function create(User $user, $notrigger = 0) /** * Load object in memory from the database * - * @param int $id Id object + * @param string $id Id object * @param string $numsurvey Ref of survey (admin or not) * @return int Return integer <0 if KO, >0 if OK */ diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 0b5b2f24927b3..122b836b421f9 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -485,7 +485,7 @@ // Description print '
'.$langs->trans("Description").''; if ($action == 'edit') { - $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); + $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', true, 1, 1, ROWS_7, '90%'); $doleditor->Create(0, ''); } else { print(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)); diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 084d768ce050d..77d2ca9e163ce 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -1,8 +1,8 @@ - * Copyright (C) 2014 Marcos García - * Copyright (C) 2015-2016 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France +/* Copyright (C) 2013-2014 Laurent Destailleur + * Copyright (C) 2014 Marcos García + * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 2018-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 @@ -144,7 +144,7 @@ print '
'.$langs->trans("Description").''; -$doleditor = new DolEditor('description', $_SESSION["description"], '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); +$doleditor = new DolEditor('description', $_SESSION["description"], '', 120, 'dolibarr_notes', 'In', true, 1, 1, ROWS_7, '90%'); $doleditor->Create(0, ''); print '
'.$langs->trans("ManageLotSerial").''; $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); - print $form->selectarray('status_batch', $statutarray, GETPOST('status_batch')); + print $form->selectarray('status_batch', $statutarray, GETPOSTINT('status_batch')); print '
'.$langs->trans("ManageLotSerial").''; $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); - print $form->selectarray('status_batch', $statutarray, GETPOSTISSET('status_batch') ? GETPOST('status_batch') : $object->status_batch); + print $form->selectarray('status_batch', $statutarray, GETPOSTISSET('status_batch') ? GETPOSTINT('status_batch') : $object->status_batch); print ''; @@ -2755,14 +2755,22 @@ if ($object->isService()) { // Duration - print '
'.$langs->trans("Duration").''; - print $object->duration_value; + require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; + $measuringUnits = new CUnits($db); + $durations = []; + $plural = ''; 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")); + $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(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : ''); + print '
'.$langs->trans("Duration").''; + print $object->duration_value; + print (!empty($object->duration_unit) && isset($durations[$object->duration_unit]) ? " ".$langs->trans($durations[$object->duration_unit])." " : ''); // Mandatory period if ($object->duration_value > 0) { diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 98051f76b423a..8176e2296628f 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 @@ -42,8 +42,17 @@ class FormProduct public $error = ''; // Cache arrays + /** + * @var array + */ public $cache_warehouses = array(); + /** + * @var array> + */ public $cache_lot = array(); + /** + * @var array + */ public $cache_workstations = array(); @@ -69,7 +78,7 @@ public function __construct($db) * 'warehouseclosed' = select products from closed warehouses, * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @param boolean $sumStock sum total stock of a warehouse, default true - * @param array $exclude warehouses ids to exclude + * @param int[] $exclude warehouses ids to exclude * @param bool|int $stockMin [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock * @param string $orderBy [='e.ref'] Order by * @return int Nb of loaded lines, 0 if already loaded, <0 if KO @@ -180,7 +189,7 @@ public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumS * If fk_product is not 0, we do not use cache * * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. - * @param array $exclude warehouses ids to exclude + * @param int[] $exclude warehouses ids to exclude * @param string $orderBy [='e.ref'] Order by * @return int Nb of loaded lines, 0 if already loaded, <0 if KO * @throws Exception @@ -239,7 +248,7 @@ public function loadWorkstations($fk_product = 0, $exclude = array(), $orderBy = * 0 : Default behavior, display parents of warehouse * 1 : Display only current warehouse label only * 2 : Display last parent warehouse label - * @param array $tab warehouse data in $this->cache_warehouses line + * @param array{id:int,label:string,parent_id:int,description:string,stock:string,full_label:string} $tab warehouse data in $this->cache_warehouses line * @param string $final_label full label with all parents, separated by ' >> ' (completed on each call) * @return string full label with all parents, separated by ' >> ' */ @@ -268,25 +277,25 @@ private function get_parent_path($tab, $final_label = '') /** * Return list of warehouses * - * @param string|int|array $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup) + * @param ''|'-1'|'ifone'|'ifonenodefault'|'-2'|string|int|int[] $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup) * @param string $htmlname Name of html select html * @param string $filterstatus warehouse status filter, following comma separated filter options can be used * 'warehouseopen' = select products from open warehouses, * 'warehouseclosed' = select products from closed warehouses, * 'warehouseinternal' = select products from warehouses for internal correct/transfer only - * @param int $empty 1=Can be empty, 0 if not - * @param int $disabled 1=Select is disabled + * @param int<0,1> $empty 1=Can be empty, 0 if not + * @param int<0,1> $disabled 1=Select is disabled * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. * @param string $empty_label Empty label if needed (only if $empty=1) - * @param int $showstock 1=Show stock count - * @param int $forcecombo 1=Force combo iso ajax select2 - * @param array $events Events to add to select2 + * @param int<0,1> $showstock 1=Show stock count + * @param int<0,1> $forcecombo 1=Force combo iso ajax select2 + * @param array}> $events Events to add to select2 * @param string $morecss Add more css classes to HTML select - * @param array $exclude Warehouses ids to exclude + * @param int[] $exclude Warehouses ids to exclude * @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse * @param bool|int $stockMin [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock * @param string $orderBy [='e.ref'] Order by - * @param int $multiselect 1=Allow multiselect + * @param int<0,1> $multiselect 1=Allow multiselect * @return string HTML select * * @throws Exception @@ -401,15 +410,15 @@ public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $fil * * @param string|int $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup) * @param string $htmlname Name of html select html - * @param int $empty 1=Can be empty, 0 if not - * @param int $disabled 1=Select is disabled + * @param int<0,1> $empty 1=Can be empty, 0 if not + * @param int<0,1> $disabled 1=Select is disabled * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. * @param string $empty_label Empty label if needed (only if $empty=1) - * @param int $forcecombo 1=Force combo iso ajax select2 - * @param array $events Events to add to select2 - * @param string $morecss Add more css classes to HTML select - * @param array $exclude Warehouses ids to exclude - * @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse + * @param int<0,1> $forcecombo 1=Force combo iso ajax select2 + * @param array}> $events Events to add to select2 + * @param string $morecss Add more css classes to HTML select + * @param int[] $exclude Warehouses ids to exclude + * @param int<0,1> $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse * @param string $orderBy [='e.ref'] Order by * @return string HTML select * @@ -501,7 +510,7 @@ public function selectWorkstations($selected = '', $htmlname = 'idworkstations', * @param string $page Page * @param string|int $selected Id of warehouse * @param string $htmlname Name of select html field - * @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. + * @param int<0,2> $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @return void */ public function formSelectWarehouses($page, $selected = '', $htmlname = 'warehouse_id', $addempty = 0) @@ -556,9 +565,9 @@ public function select_measuring_units($name = 'measuring_units', $measuring_sty * @param string $measuring_style Unit to show: weight, size, surface, volume, time * @param string $selected Preselected value * @param int|string $adddefault 1=Add empty unit called "Default", ''=Add empty value - * @param int $mode 1=Use short label as value, 0=Use rowid, 2=Use scale (power) + * @param int<0,2> $mode 1=Use short label as value, 0=Use rowid, 2=Use scale (power) * @param string $morecss More CSS - * @return string|-1 + * @return string|int<-1,-1> */ public function selectMeasuringUnits($name = 'measuring_units', $measuring_style = '', $selected = '0', $adddefault = 0, $mode = 0, $morecss = 'minwidth75 maxwidth125') { @@ -580,7 +589,7 @@ public function selectMeasuringUnits($name = 'measuring_units', $measuring_style $result = $measuringUnits->fetchAll( '', - '', + 'scale', 0, 0, $filter @@ -706,10 +715,10 @@ public function selectProductNature($name = 'finished', $selected = '', $mode = * @param int $disabled 1=Select is disabled * @param int $fk_product show lot numbers of product with id fk_product. All from objectLines if 0. * @param int $fk_entrepot filter lot numbers for warehouse with id fk_entrepot. All if 0. - * @param array $objectLines Only cache lot numbers for products in lines of object. If no lines only for fk_product. If no fk_product, all. + * @param CommonObjectLine[] $objectLines Only cache lot numbers for products in lines of object. If no lines only for fk_product. If no fk_product, all. * @param string $empty_label Empty label if needed (only if $empty=1) * @param int $forcecombo 1=Force combo iso ajax select2 - * @param array $events Events to add to select2 + * @param array}> $events Events to add to select2 * @param string $morecss Add more css classes to HTML select * * @return string HTML select @@ -794,7 +803,7 @@ public function selectLotStock($selected = '', $htmlname = 'batch_id', $filterst * @param int $empty 1=Can be empty, 0 if not * @param int $fk_product show lot numbers of product with id fk_product. All from objectLines if 0. * @param int $fk_entrepot filter lot numbers for warehouse with id fk_entrepot. All if 0. - * @param array $objectLines Only cache lot numbers for products in lines of object. If no lines only for fk_product. If no fk_product, all. + * @param CommonObjectLine[] $objectLines Only cache lot numbers for products in lines of object. If no lines only for fk_product. If no fk_product, all. * @return string HTML datalist */ public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array()) @@ -864,7 +873,7 @@ public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_produc /** * Load in cache array list of lot available in stock from a given list of products * - * @param array $productIdArray array of product id's from who to get lot numbers. A + * @param int[] $productIdArray array of product id's from who to get lot numbers. A * * @return int Nb of loaded lines, 0 if nothing loaded, <0 if KO */ diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9feaf9a16ee2b..f60226709c1d8 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -610,17 +610,49 @@ class Product extends CommonObject */ public $barcode_type_code; + /** + * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats propales + */ public $stats_propale = array(); + + /** + * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats orders + */ public $stats_commande = array(); + + /** + * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats contracts + */ public $stats_contrat = array(); + + /** + * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats invoices + */ public $stats_facture = array(); + + /** + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:int} stats supplier propales + */ public $stats_proposal_supplier = array(); + + /** + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:int|float} stats supplier orders + */ public $stats_commande_fournisseur = array(); + + /** + * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats shipping + */ public $stats_expedition = array(); + /** - * @var array{}|array{suppliers:int,nb:int,rows:int,qty:int|float} + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:int|float} stats receptions */ public $stats_reception = array(); + + /** + * @var array{}|array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:int,customers_consumed:int,nb_consumed:int,qty_consumed:int,customers_toproduce:int,nb_toproduce:int,qty_toproduce:int,customers_produced:int,nb_produced:int,qty_produced:int} stats by role toconsume, consumed, toproduce, produced + */ public $stats_mo = array(); public $stats_bom = array(); public $stats_mrptoconsume = array(); @@ -693,7 +725,7 @@ class Product extends CommonObject /** * @var string - * @deprecated + * @deprecated Use $ref_supplier * @see $ref_supplier */ public $ref_fourn; @@ -2843,8 +2875,8 @@ public function fetch($id = 0, $ref = '', $ref_ext = '', $barcode = '', $ignore_ $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 +3001,10 @@ public function fetch($id = 0, $ref = '', $ref_ext = '', $barcode = '', $ignore_ $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 bf0ddcda9752b..681cac1ed8bf9 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/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 8e9a7d13da3c6..559a30f5bac41 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -64,6 +64,9 @@ class ProductCustomerPrice extends CommonObject */ public $entity; + /** + * @var string + */ public $datec = ''; /** @@ -81,18 +84,57 @@ class ProductCustomerPrice extends CommonObject */ public $ref_customer; + /** + * @var float|'' + */ public $price; + /** + * @var float|'' + */ public $price_ttc; + /** + * @var float|string|'' + */ public $price_min; + /** + * @var float|string|'' + */ public $price_min_ttc; + /** + * @var string + */ public $price_base_type; + /** + * @var string + */ public $default_vat_code; + /** + * @var string + */ public $tva_tx; + /** + * @var int|string + */ public $recuperableonly; + /** + * @var string + */ public $localtax1_type; + /** + * @var float|'' + */ public $localtax1_tx; + /** + * @var string + */ public $localtax2_type; + /** + * @var float|'' + */ public $localtax2_tx; + /** + * @var string + */ public $price_label; /** @@ -159,7 +201,7 @@ public function create($user, $notrigger = 0, $forceupdateaffiliate = 0) $this->price_base_type = trim($this->price_base_type); } if (isset($this->tva_tx)) { - $this->tva_tx = (float) $this->tva_tx; + $this->tva_tx = trim($this->tva_tx); } if (isset($this->recuperableonly)) { $this->recuperableonly = trim($this->recuperableonly); @@ -184,14 +226,15 @@ public function create($user, $notrigger = 0, $forceupdateaffiliate = 0) // Put here code to add control on parameters values if ($this->price != '' || $this->price == 0) { + $vatRate = (float) $this->tva_tx; if ($this->price_base_type == 'TTC') { $this->price_ttc = price2num($this->price, 'MU'); - $this->price = (float) price2num($this->price) / (1 + ($this->tva_tx / 100)); + $this->price = (float) price2num($this->price) / (1 + ($vatRate / 100)); $this->price = price2num($this->price, 'MU'); if ($this->price_min != '' || $this->price_min == 0) { $this->price_min_ttc = price2num($this->price_min, 'MU'); - $this->price_min = (float) price2num($this->price_min) / (1 + ($this->tva_tx / 100)); + $this->price_min = (float) price2num($this->price_min) / (1 + ($vatRate / 100)); $this->price_min = price2num($this->price_min, 'MU'); } else { $this->price_min = 0; @@ -199,12 +242,12 @@ public function create($user, $notrigger = 0, $forceupdateaffiliate = 0) } } else { $this->price = price2num($this->price, 'MU'); - $this->price_ttc = ($this->recuperableonly != 1) ? (float) price2num($this->price) * (1 + ($this->tva_tx / 100)) : $this->price; + $this->price_ttc = ($this->recuperableonly != 1) ? (float) price2num($this->price) * (1 + ($vatRate / 100)) : $this->price; $this->price_ttc = price2num($this->price_ttc, 'MU'); if ($this->price_min != '' || $this->price_min == 0) { $this->price_min = price2num($this->price_min, 'MU'); - $this->price_min_ttc = (float) price2num($this->price_min) * (1 + ($this->tva_tx / 100)); + $this->price_min_ttc = (float) price2num($this->price_min) * (1 + ($vatRate / 100)); $this->price_min_ttc = price2num($this->price_min_ttc, 'MU'); // print 'X'.$newminprice.'-'.$price_min; } else { @@ -383,7 +426,7 @@ public function fetch($id) * @param string $sortfield Sort field * @param int $limit Limit page * @param int $offset offset - * @param string|array $filter Filter USF. + * @param string|array $filter Filter USF. * @return int Return integer <0 if KO, >0 if OK * @since dolibarr v17 */ @@ -513,12 +556,12 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = /** * Load all objects in memory from database * - * @param string $sortorder order - * @param string $sortfield field - * @param int $limit page - * @param int $offset offset - * @param array $filter Filter for sql request - * @return int Return integer <0 if KO, >0 if OK + * @param string $sortorder order + * @param string $sortfield field + * @param int $limit page + * @param int $offset offset + * @param array $filter Filter for sql request + * @return int Return integer <0 if KO, >0 if OK */ public function fetchAllLog($sortorder, $sortfield, $limit, $offset, $filter = array()) { @@ -622,10 +665,10 @@ public function fetchAllLog($sortorder, $sortfield, $limit, $offset, $filter = a /** * Update object into database * - * @param User $user that modifies - * @param int $notrigger triggers after, 1=disable triggers - * @param int $forceupdateaffiliate update price on each soc child - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User making modification + * @param int<0,1> $notrigger Triggers after, 1=disable triggers + * @param int<0,1> $forceupdateaffiliate Update price on each soc child + * @return int Return integer <0 if KO, >0 if OK */ public function update(User $user, $notrigger = 0, $forceupdateaffiliate = 0) { @@ -647,31 +690,31 @@ public function update(User $user, $notrigger = 0, $forceupdateaffiliate = 0) $this->ref_customer = trim($this->ref_customer); } if (isset($this->price)) { - $this->price = trim($this->price); + $this->price = trim((string) $this->price); } if (isset($this->price_ttc)) { - $this->price_ttc = trim($this->price_ttc); + $this->price_ttc = trim((string) $this->price_ttc); } if (isset($this->price_min)) { - $this->price_min = trim($this->price_min); + $this->price_min = trim((string) $this->price_min); } if (isset($this->price_min_ttc)) { - $this->price_min_ttc = trim($this->price_min_ttc); + $this->price_min_ttc = trim((string) $this->price_min_ttc); } if (isset($this->price_base_type)) { $this->price_base_type = trim($this->price_base_type); } if (isset($this->tva_tx)) { - $this->tva_tx = (float) $this->tva_tx; + $this->tva_tx = trim($this->tva_tx); } if (isset($this->recuperableonly)) { - $this->recuperableonly = trim($this->recuperableonly); + $this->recuperableonly = trim((string) $this->recuperableonly); } if (isset($this->localtax1_tx)) { - $this->localtax1_tx = trim($this->localtax1_tx); + $this->localtax1_tx = trim((string) $this->localtax1_tx); } if (isset($this->localtax2_tx)) { - $this->localtax2_tx = trim($this->localtax2_tx); + $this->localtax2_tx = trim((string) $this->localtax2_tx); } if (isset($this->fk_user)) { $this->fk_user = (int) $this->fk_user; @@ -687,14 +730,15 @@ public function update(User $user, $notrigger = 0, $forceupdateaffiliate = 0) // Put here code to add a control on parameters values if ($this->price != '' || $this->price == 0) { + $vatRate = (float) $this->tva_tx; if ($this->price_base_type == 'TTC') { $this->price_ttc = price2num($this->price, 'MU'); - $this->price = (float) price2num($this->price) / (1 + ($this->tva_tx / 100)); + $this->price = (float) price2num($this->price) / (1 + ($vatRate / 100)); $this->price = price2num($this->price, 'MU'); if ($this->price_min != '' || $this->price_min == 0) { $this->price_min_ttc = price2num($this->price_min, 'MU'); - $this->price_min = (float) price2num($this->price_min) / (1 + ($this->tva_tx / 100)); + $this->price_min = (float) price2num($this->price_min) / (1 + ($vatRate / 100)); $this->price_min = price2num($this->price_min, 'MU'); } else { $this->price_min = 0; @@ -702,12 +746,12 @@ public function update(User $user, $notrigger = 0, $forceupdateaffiliate = 0) } } else { $this->price = price2num($this->price, 'MU'); - $this->price_ttc = ($this->recuperableonly != 1) ? (float) price2num($this->price) * (1 + ($this->tva_tx / 100)) : $this->price; + $this->price_ttc = ($this->recuperableonly != 1) ? (float) price2num($this->price) * (1 + ($vatRate / 100)) : $this->price; $this->price_ttc = price2num($this->price_ttc, 'MU'); if ($this->price_min != '' || $this->price_min == 0) { $this->price_min = price2num($this->price_min, 'MU'); - $this->price_min_ttc = (float) price2num($this->price_min) * (1 + ($this->tva_tx / 100)); + $this->price_min_ttc = (float) price2num($this->price_min) * (1 + ($vatRate / 100)); $this->price_min_ttc = price2num($this->price_min_ttc, 'MU'); // print 'X'.$newminprice.'-'.$price_min; } else { @@ -780,7 +824,7 @@ public function update(User $user, $notrigger = 0, $forceupdateaffiliate = 0) // Update request $sql = "UPDATE ".$this->db->prefix()."product_customer_price SET"; - $sql .= " entity=".$conf->entity.","; + $sql .= " entity=".((int) $conf->entity).","; $sql .= " datec='".$this->db->idate(dol_now())."',"; $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").","; @@ -798,7 +842,7 @@ public function update(User $user, $notrigger = 0, $forceupdateaffiliate = 0) $sql .= " localtax2_tx=".(isset($this->localtax2_tx) ? (empty($this->localtax2_tx) ? 0 : $this->localtax2_tx) : "null").","; $sql .= " localtax1_type=".(!empty($this->localtax1_type) ? "'".$this->db->escape($this->localtax1_type)."'" : "'0'").","; $sql .= " localtax2_type=".(!empty($this->localtax2_type) ? "'".$this->db->escape($this->localtax2_type)."'" : "'0'").","; - $sql .= " fk_user=".$user->id.","; + $sql .= " fk_user=".((int) $user->id).","; $sql .= " price_label=".(isset($this->price_label) ? "'".$this->db->escape($this->price_label)."'" : "null").","; $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); @@ -850,8 +894,6 @@ public function update(User $user, $notrigger = 0, $forceupdateaffiliate = 0) */ public function setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate) { - global $conf; - if (getDolGlobalString('PRODUCT_DISABLE_PROPAGATE_CUSTOMER_PRICES_ON_CHILD_COMPANIES')) { return 0; } @@ -1083,6 +1125,9 @@ class PriceByCustomerLine extends CommonObjectLine */ public $entity; + /** + * @var string|int + */ public $datec = ''; /** @@ -1100,24 +1145,66 @@ class PriceByCustomerLine extends CommonObjectLine */ public $fk_soc; + /** + * @var float + */ public $price; + /** + * @var float + */ public $price_ttc; + /** + * @var float + */ public $price_min; + /** + * @var float + */ public $price_min_ttc; + /** + * @var string + */ public $price_base_type; + /** + * @var string + */ public $default_vat_code; + /** + * @var string + */ public $tva_tx; + /** + * @var int|string + */ public $recuperableonly; + /** + * @var float + */ public $localtax1_tx; + /** + * @var float + */ public $localtax2_tx; /** * @var int User ID */ public $fk_user; + /** + * @var string + */ public $price_label; + /** + * @var string + */ public $import_key; + /** + * @var string + */ public $socname; + /** + * @var string + */ public $prodref; } diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index b0f9850423fd5..bf57ac8f7d4ff 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -566,7 +566,7 @@ public function validate($user, $notrigger = 0) $sql .= ", date_validation = '".$this->db->idate($now)."'"; } if (!empty($this->fields['fk_user_valid'])) { - $sql .= ", fk_user_valid = ".$user->id; + $sql .= ", fk_user_valid = ".((int) $user->id); } $sql .= " WHERE rowid = ".((int) $this->id); diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 4819a0df0b893..44a0e5eaf14c8 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -329,15 +329,15 @@ public function update(User $user, $notrigger = 0) // Update request $sql = "UPDATE ".$this->db->prefix()."propal_merge_pdf_product SET"; - $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").","; - $sql .= " file_name=".(isset($this->file_name) ? "'".$this->db->escape($this->file_name)."'" : "null").","; + $sql .= " fk_product = ".(isset($this->fk_product) ? $this->fk_product : "null").","; + $sql .= " file_name = ".(isset($this->file_name) ? "'".$this->db->escape($this->file_name)."'" : "null").","; if (getDolGlobalInt('MAIN_MULTILANGS')) { - $sql .= " lang=".(isset($this->lang) ? "'".$this->db->escape($this->lang)."'" : "null").","; + $sql .= " lang = ".(isset($this->lang) ? "'".$this->db->escape($this->lang)."'" : "null").","; } - $sql .= " fk_user_mod=".$user->id; + $sql .= " fk_user_mod = ".((int) $user->id); - $sql .= " WHERE rowid=".((int) $this->id); + $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index ca919daa86ed6..a1b8307f90903 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -330,11 +330,11 @@ print load_fiche_titre($langs->trans("ProductParentList"), '', ''); - print ''; + print '
'; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; if (count($prodsfather) > 0) { foreach ($prodsfather as $value) { @@ -374,33 +374,33 @@ print ''; print ''; - print '
'.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').''.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').'
'; + print '
'; print ''; // Rank - print ''; + print ''; // Product ref - print ''; + print ''; // Product label - print ''; + print ''; // Min supplier price - print ''; + print ''; // Min customer price - print ''; + print ''; // Stock if (isModEnabled('stock')) { - print ''; + print ''; } // Hook fields $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Qty in kit - print ''; + print ''; // Stoc inc/dev - print ''; + print ''; // Move - print ''; + print ''; print ''."\n"; $totalsell = 0; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 3caedef6f8f55..d9d06afbe2ebe 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -25,7 +25,7 @@ /** * \file htdocs/product/document.php * \ingroup product - * \brief Page des documents joints sur les produits + * \brief Page of documents attached to products/services */ @@ -211,7 +211,7 @@ llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'mod-product page-card_document'); -if ($object->id) { +if ($object->id > 0) { $head = product_prepare_head($object); $titre = $langs->trans("CardProduct".$object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); @@ -263,6 +263,29 @@ print dol_get_fiche_end(); + /* To move into tpl + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + + $formmail = new FormMail($db); + $formmail->withaiprompt = 'text'; + $out = ''; + + $showlinktoai = ($formmail->withaiprompt && isModEnabled('ai')) ? 'textgenerationemail' : ''; + $showlinktoailabel = $langs->trans("GenerateImage"); + + $formatforouput = 'image'; + $htmlname = 'bodyemail'; + + print load_fiche_titre($langs->trans('GenerateWithAI'), '', ''); + print '
'.$langs->trans('Position').''.$langs->trans('Position').''.$langs->trans('ComposedProduct').''.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('Stock').''.$langs->trans('Stock').''.$langs->trans('Qty').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').''.$langs->trans('ComposedProductIncDecStock').'
'; + + // Fill $out + require DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php'; + + print $out; + print '
'; + */ + $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; @@ -317,14 +340,15 @@ print Form::selectarray('lang_id', $langs_available, $default_lang, 0, 0, 0, '', 0, 0, 0, 'ASC'); if (getDolGlobalInt('MAIN_MULTILANGS')) { - print ''; + print ''; } print '
'; - if (!empty($productpricescache[$obj->rowid])) { + if (!empty($productpricescache[$obj->rowid]) && isset($productpricescache[$obj->rowid][$key]['price_base_type'])) { if ($productpricescache[$obj->rowid][$key]['price_base_type'] == 'TTC') { print ''.price($productpricescache[$obj->rowid][$key]['price_ttc']).' '.$langs->trans("TTC").''; } else { diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 601703943da5a..5990151509c7b 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -211,7 +211,7 @@ print '
'; print $tmpproduct->getNomUrl(1); print ''; + + // Type + print ''; $s = ''; if ($vals['type'] == 1) { $s .= img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"'); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 6317d870845ec..a31ed63e28374 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2779,36 +2779,36 @@ function on_change() { print ''."\n"; print '
'."\n"; - print ''."\n"; + print '
'."\n"; print ''; - print ''; + print ''; + print ''; } if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { - print ''; + print ''; } - print ''; + print ''; if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { - print ''; + print ''; } - print ''; - print ''; + print ''; + print ''; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { - print ''; + print ''; } if (isModEnabled('dynamicprices')) { - print ''; + print ''; } - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; if ($user->hasRight('produit', 'supprimer')) { - print ''; + print ''; } print ''; diff --git a/htdocs/product/price_suppliers.php b/htdocs/product/price_suppliers.php index eb84ed7554718..a8a0b0da05563 100644 --- a/htdocs/product/price_suppliers.php +++ b/htdocs/product/price_suppliers.php @@ -507,7 +507,7 @@ $events = array(); $events[] = array('method' => 'getVatRates', 'url' => dol_buildpath('/core/ajax/vatrates.php', 1), 'htmlname' => 'tva_tx', 'params' => array()); $filter = '(fournisseur:=:1) AND (status:=:1)'; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(GETPOST("id_fourn", 'alpha'), 'id_fourn', $filter, 'SelectThirdParty', 0, 0, $events); + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(GETPOST("id_fourn", 'alpha'), 'id_fourn', $filter, $langs->transnoentitiesnoconv('SelectThirdParty'), 0, 0, $events); $parameters = array('filter'=>$filter, 'html_name'=>'id_fourn', 'selected'=>GETPOST("id_fourn"), 'showempty'=>1, 'prod_id'=>$object->id); $reshook = $hookmanager->executeHooks('formCreateThirdpartyOptions', $parameters, $object, $action); @@ -987,7 +987,7 @@ function edit_price_from_multicurrency() { include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields print ''; print ''; @@ -997,14 +997,21 @@ function edit_price_from_multicurrency() { print ''; // Suppliers list title + print ''."\n"; print '
'; - print '
'.$langs->trans("AppliedPricesFrom").''.$langs->trans("AppliedPricesFrom").''; if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { - print ''.$langs->trans("PriceLevel").''.$langs->trans("PriceLevel").''.$langs->trans("Type").''.$langs->trans("Type").''.$langs->trans("PriceBase").''.$langs->trans("PriceBase").''.$langs->trans("DefaultTaxRate").''.$langs->trans("DefaultTaxRate").''.$langs->trans("HT").''.$langs->trans("TTC").''.$langs->trans("HT").''.$langs->trans("TTC").''.$langs->trans("INCT").''.$langs->trans("INCT").''.$langs->trans("PriceExpressionSelected").''.$langs->trans("PriceExpressionSelected").''.$langs->trans("MinPrice").' '.$langs->trans("HT").''.$langs->trans("MinPrice").' '.$langs->trans("TTC").''.$langs->trans("Label").''.$langs->trans("ChangedBy").''.$langs->trans("MinPrice").' '.$langs->trans("HT").''.$langs->trans("MinPrice").' '.$langs->trans("TTC").''.$langs->trans("Label").''.$langs->trans("ChangedBy").'  
'; + print '
'; $param = "&id=".$object->id; $nbfields = 0; print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); + $nbfields++; + } if (!empty($arrayfields['pfp.datec']['checked'])) { print_liste_field_titre("AppliedPricesFrom", $_SERVER["PHP_SELF"], "pfp.datec", "", $param, "", $sortfield, $sortorder, '', '', 1); $nbfields++; @@ -1110,14 +1117,28 @@ function edit_price_from_multicurrency() { $parameters = array('id_fourn'=>(!empty($id_fourn) ? $id_fourn : ''), 'prod_id'=>$object->id, 'nbfields'=>$nbfields); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); } - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); - $nbfields++; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + $nbfields++; + } print "\n"; if (is_array($product_fourn_list)) { foreach ($product_fourn_list as $productfourn) { print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // Date from if (!empty($arrayfields['pfp.datec']['checked'])) { print ''; @@ -1297,16 +1318,17 @@ function edit_price_from_multicurrency() { } // Modify-Remove - print ''; } - print ''; - print ''; } diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index f46feb5b2cc01..4d95ca988e6d3 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -266,9 +266,9 @@ } if ($mode != 'byunit') { - print ''; + print ''; } else { - print ''; + print ''; } if ($type == '0') { print $langs->trans("StatsByNumberOfUnitsProducts"); diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index ab5ee0c1017e4..56c1cdbe9ebbc 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -52,27 +52,49 @@ class Productlot extends CommonObject */ public $picto = 'lot'; + /** + * @var array{customers:int,nb:int,rows:int,qty:int} stats propales + */ public $stats_propale; + + /** + * @var array{customers:int,nb:int,rows:int,qty:int} stats orders + */ public $stats_commande; + + /** + * @var array{customers:int,nb:int,rows:int,qty:int} stats contracts + */ public $stats_contrat; + + /** + * @var array{customers:int,nb:int,rows:int,qty:int} stats invoices + */ public $stats_facture; + + /** + * @var array{suppliers:int,nb:int,rows:int,qty:int} stats supplier propales + */ public $stats_commande_fournisseur; /** - * @var array{customers:int,nb:int,rows:int,qty:int} stats_expedition + * @var array{customers:int,nb:int,rows:int,qty:int} stats shipping */ public $stats_expedition; /** - * @var array{customers:int,nb:int,rows:int,qty:int} stats_expedition + * @var array{customers:int,nb:int,rows:int,qty:int} stats receptions */ public $stats_reception; /** - * @var array{customers:int,nb:int,rows:int,qty:int} stats_expedition + * @var array{customers:int,nb:int,rows:int,qty:int} stats supplier orders */ public $stats_supplier_order; + /** + * @var array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:int,customers_consumed:int,nb_consumed:int,qty_consumed:int,customers_toproduce:int,nb_toproduce:int,qty_toproduce:int,customers_produced:int,nb_produced:int,qty_produced:int} stats by role toconsume, consumed, toproduce, produced + */ public $stats_mo; public $stats_bom; public $stats_mrptoconsume; diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 463b39d5723ad..33c832e5bc52f 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -567,7 +567,7 @@ //print '
'; // Form to upload a file -print ''; +print ''; print ''; print ''; if (!empty($conf->dol_optimize_smallscreen)) { @@ -660,7 +660,7 @@ print '
'; -print '
'; + if ($usercancreate) { + print ''.img_edit().""; + print '   '; + print ''.img_picto($langs->trans("Remove"), 'delete').''; + } + + print ''.dol_print_date(($productfourn->fourn_date_creation ? $productfourn->fourn_date_creation : $productfourn->date_creation), 'dayhour', 'tzuserrel').''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($usercancreate) { + print ''.img_edit().""; + print '   '; + print ''.img_picto($langs->trans("Remove"), 'delete').''; + } - if ($usercancreate) { - print ''.img_edit().""; - print '   '; - print ''.img_picto($langs->trans("Remove"), 'delete').''; + print '
'; +print '
'; $param = ''; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 4b9367c8d2e01..40cfb94546a71 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -837,7 +837,7 @@ if (!empty($arrayfields['e.ref']['checked'])) { print ''; } if (!empty($arrayfields['m.fk_user_author']['checked'])) { diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 312ff77436719..c876eab1a5695 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -325,7 +325,8 @@ } if ($action == 'update_extras' && $permissiontoadd) { - $tmpwarehouse->oldcopy = dol_clone($tmpwarehouse, 2); + $whClass = get_class($whClass); + $whClass::$oldcopy = dol_clone($tmpwarehouse, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $tmpwarehouse, GETPOST('attribute', 'restricthtml')); @@ -344,6 +345,13 @@ } } +$batch = ''; +$eatby = null; +$sellby = 0; +$qty = 0; +$price = '0'; +$entrepot = 0; + // Correct stock if ($action == "correct_stock" && $permissiontoadd) { $product = new Product($db); @@ -505,6 +513,8 @@ $sellby = $d_sellby; } + $result1 = -1; + $result2 = -1; if (!$error) { // Remove stock $result1 = $product->correct_stock_batch( @@ -608,6 +618,8 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; + $hasSuccess = false; + $hasError = false; while ($i < $num) { $obj = $db->fetch_object($resql); $object->fetch($obj->rowid); @@ -638,6 +650,8 @@ $formproduct = new FormProduct($db); if (isModEnabled('project')) { $formproject = new FormProjets($db); +} else { + $formproject = null; } $productlot = new Productlot($db); $productstatic = new Product($db); @@ -838,7 +852,7 @@ $morehtmlref .= $langs->trans("LocationSummary").' : '.$warehouse->lieu; // Project - if (isModEnabled('project')) { + if (isModEnabled('project') && $formproject !== null) { $langs->load("projects"); $morehtmlref .= '
'.img_picto('', 'project').' '.$langs->trans('Project').' '; if ($usercancreate && 1 == 2) { @@ -922,6 +936,8 @@ $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; $sql .= " WHERE m.fk_entrepot = ".((int) $warehouse->id); $resqlbis = $db->query($sql); + + $lastmovementdate = 0; if ($resqlbis) { $objbis = $db->fetch_object($resqlbis); $lastmovementdate = $db->jdate($objbis->datem); @@ -1209,7 +1225,7 @@ if (!empty($arrayfields['e.ref']['checked'])) { print '
'; } if (!empty($arrayfields['m.fk_user_author']['checked'])) { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index f8ad4f06ce301..ebad79a6d09e6 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -86,6 +86,10 @@ if ($count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) && getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) { $fk_entrepot = $lastWarehouseID; } +//If the warehouse is set to the default selected user +if (!GETPOSTISSET('fk_warehouse') && (empty($fk_entrepot) || $fk_entrepot <= 0) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE_USER')) { + $fk_entrepot = $user->fk_warehouse; +} $texte = ''; diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 900b1d475c2f4..b5510929e51e4 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -49,7 +49,7 @@ $type = GETPOSTINT('type'); $mode = GETPOST('mode', 'alpha'); -$ext=(GETPOSTISSET('output') && in_array(GETPOST('output'), array('csv'))) ? GETPOST('output') : ''; +$ext = (GETPOSTISSET('output') && in_array(GETPOST('output'), array('csv'))) ? GETPOST('output') : ''; $date = ''; $dateendofday = ''; @@ -250,8 +250,8 @@ $movements_prod_warehouse_nb[$fk_product][$fk_entrepot] = $nbofmovement; // Pour llx_product.stock - $movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod)?$movements_prod[$fk_product]:0); - $movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb)?$movements_prod_nb[$fk_product]:0); + $movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod) ? $movements_prod[$fk_product] : 0); + $movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb) ? $movements_prod_nb[$fk_product] : 0); $i++; } @@ -371,11 +371,11 @@ if ($ext == 'csv') { top_httphead("text/csv"); //header("Content-Type: text/csv"); - header("Content-Disposition: attachment; filename=stock".($date?'-'.date("Y-m-d", $date):'').".csv"); + header("Content-Disposition: attachment; filename=stock".($date ? '-'.date("Y-m-d", $date) : '').".csv"); // Lines of title print implode(";", ($mode == 'future') ? - array('"Product Reference"', '"Label"', '"Current Stock"', '"'.$stocklabel.'"', '"Virtual Stock"'): + array('"Product Reference"', '"Label"', '"Current Stock"', '"'.$stocklabel.'"', '"Virtual Stock"') : array('"Product Reference"', '"Label"', '"'.$stocklabel.'"', '"Estimated Stock Value"', '"Estimate Sell Value"', '"Movements"', '"Current Stock"'))."\r\n"; } else { llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'mod-product page-stock_stockatdate'); @@ -421,7 +421,7 @@ print img_picto('', 'stock', 'class="pictofixedwidth"').$langs->trans("Warehouse").' :'; print ' '; $selected = ((GETPOSTISSET('search_fk_warehouse') || GETPOSTISSET('fk_warehouse')) ? $search_fk_warehouse : 'ifonenodefault'); - print $formproduct->selectWarehouses($selected, 'search_fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, 'minwidth200', null, 1, false, 'e.ref', 1); + print $formproduct->selectWarehouses($selected, 'search_fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, array(), 'minwidth200', array(), 1, false, 'e.ref', 1); } print ''; @@ -473,13 +473,13 @@ if ($num) { print '

'; print ''; print img_picto('', 'download', 'class="pictofixedwidth"'); print 'Download CSV'; @@ -508,7 +508,7 @@ print '

'; } // Fields from hook - $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -545,7 +545,7 @@ } // Hook fields - $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -638,8 +638,8 @@ '"'.$objp->ref.'"', '"'.$objp->label.'"', '"'.price(price2num($stock, 'MS')).'"', - price2num($stock * $objp->pmp, 'MT')?'"'.price2num($stock * $objp->pmp, 'MT').'"':'', - !getDolGlobalString('PRODUIT_MULTIPRICES')?'"'.price2num($stock * $objp->price, 'MT').'"':'"'.$langs->trans("Variable").'('.$langs->trans("OptionMULTIPRICESIsOn").')"', + price2num($stock * $objp->pmp, 'MT') ? '"'.price2num($stock * $objp->pmp, 'MT').'"' : '', + !getDolGlobalString('PRODUIT_MULTIPRICES') ? '"'.price2num($stock * $objp->price, 'MT').'"' : '"'.$langs->trans("Variable").'('.$langs->trans("OptionMULTIPRICESIsOn").')"', "$nbofmovement", '"'.price2num($currentstock, 'MS').'"'))."\r\n"; $totalbuyingprice += $stock * $objp->pmp; @@ -737,7 +737,7 @@ $totalcurrentstock += $currentstock; // Fields from hook - $parameters = array('objp'=>$objp); + $parameters = array('objp' => $objp); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -750,9 +750,9 @@ $i++; } -$parameters = array('sql'=>$sql); +$parameters = array('sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook -if ($ext!='csv') { +if ($ext != 'csv') { print $hookmanager->resPrint; } @@ -761,22 +761,24 @@ $colspan++; } -if ($ext=='csv') { - print implode(";", - ($mode == 'future')?array( +if ($ext == 'csv') { + print implode( + ";", + ($mode == 'future') ? array( '"'.$langs->trans("Totalforthispage").'"', '', $productid > 0 ? price2num($totalcurrentstock, 'MS') : '', '', - price(price2num($totalvirtualstock, 'MS'))): + price(price2num($totalvirtualstock, 'MS'))) : array( '"'.$langs->trans("Totalforthispage").'"', '', '', '"'.price2num($totalbuyingprice, 'MT').'"', - !getDolGlobalString('PRODUIT_MULTIPRICES')?'"'.price2num($totalsellingprice, 'MT').'"':'', + !getDolGlobalString('PRODUIT_MULTIPRICES') ? '"'.price2num($totalsellingprice, 'MT').'"' : '', '', - $productid > 0 ? price2num($totalcurrentstock, 'MS') : '')); + $productid > 0 ? price2num($totalcurrentstock, 'MS') : '') + ); } else { if (empty($date) || !$dateIsValid) { print ''; diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index b5dcf35939897..c684e2b0e333a 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -66,7 +66,7 @@ class StockTransfer extends CommonObject /** * @var string Customer ref - * @deprecated + * @deprecated Use $ref_customer * @see $ref_customer */ public $ref_client; diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 5190982928568..3ad11aee2df70 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -1112,7 +1112,11 @@ } // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('stocktransfer')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('stocktransfer'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index b368d21aab82e..0ddd6bb246f20 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -747,6 +747,51 @@ print ''; } + + $THolidays = array(); + $totaldayholiday = 0; + foreach ($TWeek as $weekNb) { + $weekstart = dol_stringtotime($year.$month.($TFirstDays[$weekNb])); + $weekend = dol_stringtotime($year.$month.$TLastDays[$weekNb]); + $filter = " AND cp.statut = ".((int) Holiday::STATUS_APPROVED); + $filter .= " AND ('".$db->idate($weekstart)."' BETWEEN cp.date_debut AND cp.date_fin"; + $filter .= " OR '".$db->idate($weekend)."' BETWEEN cp.date_debut AND cp.date_fin)"; + $holiday->fetchByUser($usertoprocess->id, '', $filter); + $THolidays[$weekNb] = array(); + $THolidays[$weekNb]["ids"] = array(); + $THolidays[$weekNb]["days"] = 0; + foreach ($holiday->holiday as $key => $h) { + if (!empty($THolidays[$weekNb]["ids"]) && in_array($h->rowid, $THolidays[$weekNb]["ids"])) { + continue; + } + $startweekholiday =(int) (($h["date_debut"] <= $weekstart) ? $weekstart : $h["date_debut"] ); + $endweekholiday =(int) (($h["date_fin"] >= $weekend) ? $weekend : $h["date_fin"]); + $halfdays = (int) $h["halfday"]; + $nbdays = num_open_day($startweekholiday, $endweekholiday, 0, 1, $halfdays); + + $THolidays[$weekNb]["ids"][] = $h->rowid; + $THolidays[$weekNb]["days"] += $nbdays; + $totaldayholiday += $nbdays; + } + } + + //Calculate nb holiday + print ''; + print ''; + if (!empty($arrayfields['timeconsumed']['checked'])) { + print ''; + print ''; + } + $j = 0; + foreach ($TWeek as $weekNb) { + $j++; + print ''; + } + print ' + '; } else { print ''; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 375e75df425f1..062b4975f8761 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -649,7 +649,7 @@ public function update($user, $notrigger = 0) $sql .= ", fk_user_close = ".($this->fk_user_close > 0 ? $this->fk_user_close : "null"); $sql .= ", opp_amount = ".(strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : "null"); $sql .= ", budget_amount = ".(strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : "null"); - $sql .= ", fk_user_modif = ".$user->id; + $sql .= ", fk_user_modif = ".((int) $user->id); $sql .= ", usage_opportunity = ".($this->usage_opportunity ? 1 : 0); $sql .= ", usage_task = ".($this->usage_task ? 1 : 0); $sql .= ", usage_bill_time = ".($this->usage_bill_time ? 1 : 0); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index dd89d8023d532..f34c39cbb1999 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -83,12 +83,12 @@ class Task extends CommonObjectLine public $description; /** - * @var float|'' total of time spent on this task + * @var int|'' total of time spent on this task (in seconds) */ public $duration_effective; /** - * @var float|'' planned workload + * @var int|'' planned workload (in seconds) */ public $planned_workload; @@ -240,7 +240,7 @@ class Task extends CommonObjectLine /** * @var int ID of thirdparty - * @deprecated + * @deprecated Use $thirdparty_id * @see $thirdparty_id */ public $socid; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index fb8ab16804370..cf11682a4a2d8 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -760,7 +760,10 @@ print $formfile->showdocuments('project_task', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf); // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('project_task')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('project_task'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; $compatibleImportElementsList = false; $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index f86e08adf6cde..1c04d6287c204 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -231,7 +231,7 @@ } if (!$error) { - $object->fetch_projet(); + $object->fetchProject(); if (empty($object->project->status)) { setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); diff --git a/htdocs/public/demo/demo.css b/htdocs/public/demo/demo.css index 5ab2f453b6186..ebca41400f017 100644 --- a/htdocs/public/demo/demo.css +++ b/htdocs/public/demo/demo.css @@ -127,6 +127,11 @@ img.demothumb { width: 200px; } +div#tr1profdemoall { + margin-left: 30px; + margin-right: 30px; +} + @media only screen and (max-width: 767px) { .CTable { @@ -149,7 +154,7 @@ img.demothumb { font-size: 100%; } div#tr1profdemoall { - margin-left: 0px; - margin-right: 0px; + margin-left: 15px; + margin-right: 15px; } } diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 9e113d9125d8d..cbe3cb0c0f3ce 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -359,9 +359,9 @@ print ''; - // Modules (a profile you must choose modules) + // Modules (a profile to customize by selecting modules) if (empty($profilearray['url'])) { - print ''; print '"; @@ -906,7 +906,7 @@ if ($objectsrc->note_private && !$user->socid) { print ''; print '"; } @@ -2243,7 +2243,7 @@ print $formfile->showdocuments('reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); + //$tmparray = $form->showLinkToObjectBlock($object, null, array('order'), 1); $somethingshown = $form->showLinkedObjectBlock($object, ''); print '
'; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index a4fa06b44acf6..8bb29ddb0f6cd 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -596,7 +596,7 @@ public function valid($user, $notrigger = 0) $sql .= " ref='".$this->db->escape($numref)."'"; $sql .= ", fk_statut = 1"; $sql .= ", date_valid = '".$this->db->idate($now)."'"; - $sql .= ", fk_user_valid = ".$user->id; + $sql .= ", fk_user_valid = ".((int) $user->id); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::valid update reception", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1144,6 +1144,11 @@ public function delete(User $user) $mouvS->origin = null; $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed + if ($result < 0) { + $error++; + $this->error = $mouvS->error; + $this->errors = $mouvS->errors; + } } } else { $error++; diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php index e53b525be5584..e57bed8ba8d4d 100644 --- a/htdocs/reception/dispatch.php +++ b/htdocs/reception/dispatch.php @@ -7,7 +7,7 @@ * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry * Copyright (C) 2017-2022 Ferran Marcet - * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019-2020 Christophe Battarel * Copyright (C) 2024 MDW * @@ -280,7 +280,7 @@ } if ($error > 0) { $db->rollback(); - setEventMessages($error, $errors, 'errors'); + setEventMessages($langs->trans("Error"), $errors, 'errors'); } else { $db->commit(); setEventMessages($langs->trans("ReceptionUpdated"), null); @@ -840,9 +840,9 @@ // Warehouse print '
'; //print ''; - print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); + print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'maxwidth200'); print ''; //print ''; - print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); + print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'maxwidth200'); print '
'.$langs->trans("EnterADateCriteria").'
 
'; + print $langs->trans("Total"); + print ' - '.$langs->trans("NbUseDaysCP").': '.price($totaldayholiday, 1, $langs, 0, 0).''; + print ' 0 ? "onholidayallday" : "").' hide'.$weekNb.' center'.($j <= 1 ? ' borderleft' : '').'">
'.$THolidays[$weekNb]["days"].'
 
'.$langs->trans("NoAssignedTasks").'
'.$langs->trans("NotePublic").''; - $doleditor = new DolEditor('note_public', $objectsrc->note_public, '', 60, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $objectsrc->note_public, '', 60, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print "
'.$langs->trans("NotePrivate").''; - $doleditor = new DolEditor('note_private', $objectsrc->note_private, '', 60, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', $objectsrc->note_private, '', 60, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print "
'; if (count($listwarehouses) > 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix) ? GETPOST("entrepot".$suffix) : $objd->fk_entrepot, "entrepot".$suffix, '', 1, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); + print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix) ? GETPOST("entrepot".$suffix) : $objd->fk_entrepot, "entrepot".$suffix, '', 1, 0, $objp->fk_product, '', 1, 0, array(), 'csswarehouse'.$suffix); } elseif (count($listwarehouses) == 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix) ? GETPOST("entrepot".$suffix) : $objd->fk_entrepot, "entrepot".$suffix, '', 0, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); + print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix) ? GETPOST("entrepot".$suffix) : $objd->fk_entrepot, "entrepot".$suffix, '', 0, 0, $objp->fk_product, '', 1, 0, array(), 'csswarehouse'.$suffix); } else { $langs->load("errors"); print $langs->trans("ErrorNoWarehouseDefined"); @@ -1013,9 +1013,9 @@ // Warehouse print ''; if (count($listwarehouses) > 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix) ? GETPOST("entrepot".$suffix) : ($objp->fk_default_warehouse ? $objp->fk_default_warehouse : ''), "entrepot".$suffix, '', 1, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); + print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix) ? GETPOST("entrepot".$suffix) : ($objp->fk_default_warehouse ? $objp->fk_default_warehouse : ''), "entrepot".$suffix, '', 1, 0, $objp->fk_product, '', 1, 0, array(), 'csswarehouse'.$suffix); } elseif (count($listwarehouses) == 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix) ? GETPOST("entrepot".$suffix) : ($objp->fk_default_warehouse ? $objp->fk_default_warehouse : ''), "entrepot".$suffix, '', 0, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); + print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix) ? GETPOST("entrepot".$suffix) : ($objp->fk_default_warehouse ? $objp->fk_default_warehouse : ''), "entrepot".$suffix, '', 0, 0, $objp->fk_product, '', 1, 0, array(), 'csswarehouse'.$suffix); } else { $langs->load("errors"); print $langs->trans("ErrorNoWarehouseDefined"); diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 2657468598b75..f5ef655468904 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -573,7 +573,7 @@ public function validate($user, $notrigger = 0) $sql .= ", date_validation = '".$this->db->idate($now)."',"; } if (!empty($this->fields['fk_user_valid'])) { // @phan-suppress-current-line PhanTypeMismatchProperty - $sql .= ", fk_user_valid = ".$user->id; + $sql .= ", fk_user_valid = ".((int) $user->id); } $sql .= " WHERE rowid = ".((int) $this->id); diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 1d7d604aa4c01..6eab8b522d537 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -581,7 +581,7 @@ public function validate($user, $notrigger = 0) $sql .= ", date_validation = '".$this->db->idate($now)."',"; } if (!empty($this->fields['fk_user_valid'])) { // @phan-suppress-current-line PhanTypeMismatchProperty - $sql .= ", fk_user_valid = ".$user->id; + $sql .= ", fk_user_valid = ".((int) $user->id); } $sql .= " WHERE rowid = ".((int) $this->id); diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index eaa4e0720ade4..475cb21f216b3 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -805,7 +805,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output } if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) { - $object->fetch_projet(); + $object->fetchProject(); if (!empty($object->project->ref)) { $posy += 3; $pdf->SetXY($posx, $posy); @@ -815,7 +815,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output } if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) { - $object->fetch_projet(); + $object->fetchProject(); if (!empty($object->project->ref)) { $posy += 3; $pdf->SetXY($posx, $posy); @@ -825,7 +825,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output } if (getDolGlobalString('PDF_SHOW_PROJECT')) { - $object->fetch_projet(); + $object->fetchProject(); if (!empty($object->project->ref)) { $outputlangs->load("projects"); $posy += 3; diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 7025b1758dddc..9be8841e04424 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -636,7 +636,11 @@ } // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('recruitmentcandidature')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('recruitmentcanidature'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index f9788aa911eb7..a66447f2e63be 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -612,7 +612,7 @@ $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print ''."\n"; +print '
'."\n"; // Fields title search diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index b7030f3aad12a..1290641d2ff89 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -481,7 +481,11 @@ } // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('recruitmentjobposition')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('recruitmentjobposition'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); // Show link to public job page diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index c7dbe68269d22..1a5f0bce6ed05 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -451,12 +451,12 @@ $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print '
'."\n"; +print '
'."\n"; // Fields title search // -------------------------------------------------------------------- -print ''; +print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; if (!$i) { diff --git a/htdocs/support/background.png b/htdocs/support/background.png deleted file mode 100644 index 4d20deebd7bd0..0000000000000 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 7233060aafda9..0000000000000 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 85a2595d1cd3b..0000000000000 --- 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 7956389ef6af4..0000000000000 --- 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 '
'; diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index 3ccacf0a3714f..c774dd312a918 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -6,8 +6,8 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Marcos García - * Copyright (C) 2018 Florain Henry + * Copyright (C) 2018 Florian Henry * * 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/resource/element_resource.php b/htdocs/resource/element_resource.php index f10db26836689..e001bbf16ffc9 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -506,6 +506,7 @@ $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/salaries/card.php b/htdocs/salaries/card.php index 8357653f038d0..9fd577354dac0 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1180,7 +1180,11 @@ function( data ) { // Show links to link elements /* - $linktoelem = $form->showLinkToObjectBlock($object, null, array('salaries')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('salaries'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); */ diff --git a/htdocs/salaries/class/salariesstats.class.php b/htdocs/salaries/class/salariesstats.class.php index 11c250fcab465..00837a1701c17 100644 --- a/htdocs/salaries/class/salariesstats.class.php +++ b/htdocs/salaries/class/salariesstats.class.php @@ -1,8 +1,9 @@ - * Copyright (c) 2018 Fidesio - * Copyright (C) 2021 Gauthier VERDOL +/* Copyright (C) 2018 Alexandre Spangaro + * Copyright (c) 2018 Fidesio + * Copyright (C) 2021 Gauthier VERDOL * 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 @@ -36,12 +37,15 @@ class SalariesStats extends Stats */ public $table_element; + /** + * @var int thirdparty ID + */ public $socid; - public $userid; - public $from; - public $field; - public $where; + /** + * @var int user ID + */ + public $userid; /** * Constructor diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 5e8f090149418..a70fce80e077f 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW +/* Copyright (C) 2011-2022 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2021 Gauthier VERDOL + * 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 @@ -732,7 +732,7 @@ public function info($id) /** * Tag social contribution as paid completely * - * @deprecated + * @deprecated Use setPaid() * @see setPaid() * @param User $user Object user making change * @return int Return integer <0 if KO, >0 if OK diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 2362599a432d1..91195e6010ef3 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1429,7 +1429,11 @@ public function getCompanyBankAccount($id) $object = array(); foreach ($account as $key => $value) { if (in_array($key, $fields)) { - $object[$key] = $value; + if ($key == 'iban') { + $object[$key] = dolDecrypt($value); + } else { + $object[$key] = $value; + } } } $returnAccounts[] = $object; diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 6bc7a0bcdcbde..090392efd7058 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/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index acca367fb615a..a27f7c3504a8c 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -362,7 +362,7 @@ public function __construct(DoliDB $db) /** * Create bank information record. * - * @param ?User $user User + * @param ?User $user User * @param int<0,1> $notrigger 1=Disable triggers * @return int Return integer <0 if KO, > 0 if OK (ID of newly created company bank account information) */ @@ -385,7 +385,8 @@ public function create($user = null, $notrigger = 0) // Correct ->default_rib to not set the new account as default, if there is already 1. We want to be sure to have always 1 default for type = 'ban'. // If we really want the new bank account to be the default, we must set it by calling setDefault() after creation. - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".((int) $this->socid)." AND default_rib = 1 AND type = 'ban'"; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib"; + $sql .= " WHERE fk_soc = ".((int) $this->socid)." AND default_rib = 1 AND type = 'ban'"; $result = $this->db->query($sql); if ($result) { $numrows = $this->db->num_rows($result); @@ -450,9 +451,6 @@ public function update($user = null, $notrigger = 0) return -1; } - if (!empty($this->domiciliation) && dol_strlen($this->domiciliation) > 255) { - $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1); - } if (!empty($this->address) && dol_strlen($this->address) > 255) { $this->address = dol_trunc($this->address, 254, 'right', 'UTF-8', 1); } @@ -473,9 +471,9 @@ public function update($user = null, $notrigger = 0) $sql .= ",number='".$this->db->escape($this->number)."'"; $sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'"; $sql .= ",bic='".$this->db->escape($this->bic)."'"; - $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'"; - $sql .= ",domiciliation = '".$this->db->escape($this->address ? $this->address : $this->domiciliation)."'"; - $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; + $sql .= ",iban_prefix = '".$this->db->escape(dolEncrypt($this->iban))."'"; + $sql .= ",domiciliation = '".$this->db->escape($this->address)."'"; + $sql .= ",proprio = '".$this->db->escape($this->owner_name)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; $sql .= ",default_rib = ".((int) $this->default_rib); if (isModEnabled('prelevement')) { @@ -575,13 +573,12 @@ public function fetch($id, $ref = '', $socid = 0, $default = 1, $type = 'ban') $this->number = $obj->number; $this->cle_rib = $obj->cle_rib; $this->bic = $obj->bic; - $this->iban = $obj->iban; + $this->iban = dolDecrypt($obj->iban); - $this->domiciliation = $obj->address; $this->address = $obj->address; + $this->owner_name = $obj->owner_name; $this->proprio = $obj->owner_name; - $this->owner_name = $obj->owner_name; $this->owner_address = $obj->owner_address; $this->label = $obj->label; $this->default_rib = $obj->default_rib; @@ -679,7 +676,7 @@ public function getRibLabel($displayriblabel = true) public function setAsDefault($rib = 0, $resetolddefaultfor = 'ban') { $sql1 = "SELECT rowid as id, fk_soc as socid FROM ".MAIN_DB_PREFIX."societe_rib"; - $sql1 .= " WHERE rowid = ".($rib ? $rib : $this->id); + $sql1 .= " WHERE rowid = ".((int) ($rib ? $rib : $this->id)); dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG); $result1 = $this->db->query($sql1); @@ -743,8 +740,7 @@ public function initAsSpecimen() $this->address = 'Rue de Paris'; $this->country_id = 1; - $this->proprio = 'Owner'; - $this->owner_name = 'Owner'; + $this->owner_name = 'Owner'; $this->owner_address = 'Owner address'; $this->owner_country_id = 1; diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 86d39b2d4a9f4..6c3a910f1e506 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -158,7 +158,7 @@ class CompanyPaymentMode extends CommonObject /** * @var string iban - * @deprecated Use $iban_prefix + * @deprecated Use $iban_prefix, or wait the field in database is renamed into iban. * @see $iban_prefix */ public $iban; @@ -167,18 +167,34 @@ class CompanyPaymentMode extends CommonObject * @var string IBAN prefix */ public $iban_prefix; + /** * @var string + * @deprecated Use address */ public $domiciliation; + + /** + * @var string + */ + public $address; + /** * @var string + * @deprecated Use owner_name */ public $proprio; + + /** + * @var string + */ + public $owner_name; + /** * @var string */ public $owner_address; + /** * @var int */ @@ -516,7 +532,7 @@ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss public function setAsDefault($id = 0, $alltypes = 0) { $sql1 = "SELECT rowid as id, fk_soc, type FROM ".MAIN_DB_PREFIX."societe_rib"; - $sql1 .= " WHERE rowid = ".($id ? $id : $this->id); + $sql1 .= " WHERE rowid = ".((int) ($id ? $id : $this->id)); dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG); $result1 = $this->db->query($sql1); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8bfd1a6f37241..958cf25f7e60e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1594,7 +1594,7 @@ public function update($id, User $user, $call_trigger = 1, $allowmodcodeclient = dol_syslog(get_class($this)."::update verify ok or not done"); $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET "; - $sql .= "entity = ".$this->db->escape($this->entity); + $sql .= "entity = ".((int) $this->entity); $sql .= ",nom = '".$this->db->escape($this->name)."'"; // Required $sql .= ",name_alias = '".$this->db->escape($this->name_alias)."'"; $sql .= ",ref_ext = ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null"); @@ -2165,7 +2165,7 @@ public function fetch($rowid, $ref = '', $ref_ext = '', $barcode = '', $idprof1 $this->model_pdf = $obj->model_pdf; $this->last_main_doc = $obj->last_main_doc; - $result = 1; + $result = $this->id; // fetch optionals attributes and labels $this->fetch_optionals(); @@ -3498,7 +3498,7 @@ public function get_all_rib() { // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type='ban' AND fk_soc = ".((int) $this->id); + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND fk_soc = ".((int) $this->id); $result = $this->db->query($sql); if (!$result) { $this->error = $this->db->lasterror(); diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 4d5f68aff2154..31a64843623f8 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -480,34 +480,34 @@ print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, '', 0, '', '', $limit); print '
'; - print ''."\n"; + print '
'."\n"; // Filters print ''; - print ''; // delivery planned date if ($type_element == 'order' || $type_element == 'supplier_order' || $type_element == 'shipment') { print ''; } - print ''; - print ''; + print ''; - print ''; - print ''; + print ''; + print ''; print ''; // Titles with sort buttons @@ -749,7 +749,7 @@ } elseif (empty($type_element) || $type_element == -1) { print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', (!empty($num) ? $num : 0), '', ''); - print '
'; + print ''; print ''; - print ''; - print ''; // date + print ''; + print ''; // date print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle'); print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 1, 0, 0, '', 'valignmiddle maxwidth75imp marginleftonly'); - print ''; + print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; $searchpicto = $form->showFilterAndCheckAddButtons(0); print $searchpicto; - print ''; + print '
'."\n"; + print '
'."\n"; // Titles with sort buttons print ''; print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, '', $sortfield, $sortorder, 'left '); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index dfecc621994c9..41d5b95f20513 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -187,7 +187,6 @@ $companybankaccount->iban = GETPOST('iban', 'alpha'); $companybankaccount->address = GETPOST('address', 'alpha'); - $companybankaccount->domiciliation = $companybankaccount->address; $companybankaccount->owner_name = GETPOST('proprio', 'alpha'); $companybankaccount->proprio = $companybankaccount->owner_name; @@ -258,7 +257,8 @@ $companypaymentmode->label = GETPOST('label', 'alpha'); $companypaymentmode->number = GETPOST('cardnumber', 'alpha'); $companypaymentmode->last_four = substr(GETPOST('cardnumber', 'alpha'), -4); - $companypaymentmode->proprio = GETPOST('proprio', 'alpha'); + $companypaymentmode->owner_name = GETPOST('proprio', 'alpha'); + $companypaymentmode->proprio = $companypaymentmode->owner_name; $companypaymentmode->exp_date_month = GETPOSTINT('exp_date_month'); $companypaymentmode->exp_date_year = GETPOSTINT('exp_date_year'); $companypaymentmode->cvn = GETPOST('cvn', 'alpha'); @@ -319,10 +319,10 @@ $companybankaccount->bic = GETPOST('bic', 'alpha'); $companybankaccount->iban = GETPOST('iban', 'alpha'); - $companybankaccount->domiciliation = GETPOST('address', 'alpha'); $companybankaccount->address = GETPOST('address', 'alpha'); - $companybankaccount->proprio = GETPOST('proprio', 'alpha'); + $companybankaccount->owner_name = GETPOST('proprio', 'alpha'); + $companybankaccount->proprio = $companybankaccount->owner_name; $companybankaccount->owner_address = GETPOST('owner_address', 'alpha'); $companybankaccount->frstrecur = GETPOST('frstrecur', 'alpha'); $companybankaccount->rum = GETPOST('rum', 'alpha'); @@ -820,6 +820,7 @@ $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib as sr "; $sql .= " SET stripe_card_ref = null"; $sql .= " WHERE sr.stripe_card_ref = '".$db->escape($source)."'"; + $resql = $db->query($sql); } else { $card->delete($user); @@ -1281,8 +1282,8 @@ print ''; // Information (Owner, ...) print ''; // Account number - print ''; // IBAN - print ''; // BIC - print ''; if (isModEnabled('prelevement')) { // RUM - print ''; // Date - print ''; // Mode mandate - print ''; } @@ -1894,6 +1895,9 @@ if (isModEnabled('prelevement')) { $colspan += 3; } + if (!getDolGlobalInt('SOCIETE_DISABLE_BANKACCOUNT') && getDolGlobalInt("SOCIETE_RIB_ALLOW_ONLINESIGN")) { + $colspan++; + } print ''; } @@ -2120,7 +2124,7 @@ print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -2163,10 +2167,10 @@ print '
'; - if ($companypaymentmodetemp->proprio) { - print ''.$companypaymentmodetemp->proprio.'
'; + if ($companypaymentmodetemp->owner_name) { + print ''.$companypaymentmodetemp->owner_name.'
'; } if ($companypaymentmodetemp->last_four) { print '....'.$companypaymentmodetemp->last_four; @@ -1824,28 +1825,28 @@ print '
'; print''; + print ''; print ''; + print ''; //var_dump($src); print ''; + print ''; //var_dump($src); print ''; + print ''; //var_dump($src); print ''; + print ''; //var_dump($src); print ''; + print ''; //var_dump($src); print '
'.$langs->trans("NoBANRecord").'
'.$langs->trans("NameOnCard").'
'.$langs->trans("CardNumber").'
'; print ''; - print ''; + print ''; print ''; - print ''; + print ''; // Show fields of bank account foreach ($companybankaccount->getFieldsToShow(1) as $val) { diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index c828c929bc777..8ccb9a4d40f39 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -845,7 +845,7 @@ public function cardStripe($cu, CompanyPaymentMode $object, $stripeacc = '', $st $card = null; - $sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.exp_date_month, sa.exp_date_year, sa.number, sa.cvn"; // stripe_card_ref is card_.... + $sql = "SELECT sa.stripe_card_ref, sa.proprio as owner_name, sa.exp_date_month, sa.exp_date_year, sa.number, sa.cvn"; // stripe_card_ref is card_.... $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as sa"; $sql .= " WHERE sa.rowid = ".((int) $object->id); // We get record from ID, no need for filter on entity $sql .= " AND sa.type = 'card'"; @@ -885,7 +885,7 @@ public function cardStripe($cu, CompanyPaymentMode $object, $stripeacc = '', $st $exp_date_year = $obj->exp_date_year; $number = $obj->number; $cvc = $obj->cvn; // cvn in database, cvc for stripe - $cardholdername = $obj->proprio; + $cardholdername = $obj->owner_name; $ipaddress = getUserRemoteIP(); @@ -1034,7 +1034,7 @@ public function sepaStripe($cu, CompanyPaymentMode $object, $stripeacc = '', $st dol_syslog($this->error, LOG_WARNING); } } elseif ($createifnotlinkedtostripe) { - $iban = $obj->iban; + $iban = dolDecrypt($obj->iban); $ipaddress = getUserRemoteIP(); $metadata = array('dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress); if (is_object($object)) { diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index d9c95188353bb..5e430279c20a9 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -106,7 +106,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); print '
'; - print '
'.$langs->trans("Label").'
name).'">
'.$langs->trans("Bank").'
'."\n"; + print '
'."\n"; print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index aa7f2274c782f..32de1c098f7dd 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -294,9 +294,11 @@ $object->fk_project = GETPOSTINT('projectid'); $object->model_pdf = GETPOST('model'); $object->author = $user->id; // deprecated + $object->user_creation_id = $user->id; $object->note = GETPOST('note', 'restricthtml'); $object->note_private = GETPOST('note', 'restricthtml'); $object->statut = SupplierProposal::STATUS_DRAFT; + $object->status = SupplierProposal::STATUS_DRAFT; } else { setEventMessages($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_supplier_proposal')), null, 'errors'); } @@ -311,6 +313,7 @@ $object->fk_project = GETPOSTINT('projectid'); $object->model_pdf = GETPOST('model'); $object->author = $user->id; // deprecated + $object->user_creation_id = $user->id; $object->note = GETPOST('note', 'restricthtml'); $object->note_private = GETPOST('note', 'restricthtml'); @@ -1206,6 +1209,7 @@ // Load objectsrc if (!empty($origin) && !empty($originid)) { $element = $subelement = GETPOST('origin'); + $regs = array(); if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin'), $regs)) { $element = $regs[1]; $subelement = $regs[2]; @@ -1709,7 +1713,7 @@ print '
'; - if ($action != 'editdate_livraison' && $object->statut == SupplierProposal::STATUS_VALIDATED) { + if ($action != 'editdate_livraison' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { print ''; } print '
'; print $langs->trans('DeliveryDate'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).'
'; @@ -2043,8 +2047,13 @@ // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, array(), array('supplier_proposal')); + $tmparray = $form->showLinkToObjectBlock($object, array(), array('supplier_proposal'), 1); + $linktoelem = $tmparray['linktoelem']; + $htmltoenteralink = $tmparray['htmltoenteralink']; + print $htmltoenteralink; + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + $MAXEVENT = 10; print '
'; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 1424f305489e5..767c31d57b604 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -372,16 +372,16 @@ public function insert_discount($idremise) $supplier_proposalligne->fk_remise_except = $remise->id; $supplier_proposalligne->desc = $remise->description; // Description ligne $supplier_proposalligne->tva_tx = $remise->tva_tx; - $supplier_proposalligne->subprice = -$remise->amount_ht; + $supplier_proposalligne->subprice = -(float) $remise->amount_ht; $supplier_proposalligne->fk_product = 0; // Id produit predefini $supplier_proposalligne->qty = 1; $supplier_proposalligne->remise_percent = 0; $supplier_proposalligne->rang = -1; $supplier_proposalligne->info_bits = 2; - $supplier_proposalligne->total_ht = -$remise->amount_ht; - $supplier_proposalligne->total_tva = -$remise->amount_tva; - $supplier_proposalligne->total_ttc = -$remise->amount_ttc; + $supplier_proposalligne->total_ht = -(float) $remise->amount_ht; + $supplier_proposalligne->total_tva = -(float) $remise->amount_tva; + $supplier_proposalligne->total_ttc = -(float) $remise->amount_ttc; $result = $supplier_proposalligne->insert(); if ($result > 0) { diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 1baab53f9a680..0ce1066e27249 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -108,10 +108,11 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -1083,7 +1084,7 @@ // Thirdparty if (!empty($arrayfields['s.nom']['checked'])) { - print '
'; + print ''; print $companystatic->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); 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 9f923811baf5c..0000000000000 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 95f3a5a050aae..0000000000000 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 f9e6b2b1ea368..0000000000000 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 b1fa6a0a8ed8f..0000000000000 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 4d319e9e3b366..0000000000000 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 34c6b87ff94d9..0000000000000 Binary files a/htdocs/support/who.png and /dev/null differ diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index e667a8b2215a3..cbce49031aba5 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -68,7 +68,7 @@ * View */ -top_httphead('text/html', 1); +top_htmlhead('', '', 1); if ($place > 0) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; @@ -81,6 +81,25 @@ $object = new Facture($db); $object->fetch($facid); + +// Record entry in blocked logs +// DOL_DOCUMENT_ROOT.'/blockedlog/ajax/block-add.php?id='.$object->id.'&element='.$object->element.'&action=DOC_PREVIEW&token='.newToken(); +print " +"; + + // Call to external receipt modules if exist $parameters = array(); $hookmanager->initHooks(array('takeposfrontend')); @@ -103,6 +122,16 @@ .left { text-align: left; } +.centpercent { + width: 100%; +} +@media only screen and (min-width: 1024px) +{ + body { + margin-left: 50px; + margin-right: 50px; + } +}
@@ -132,7 +161,7 @@ if (getDolGlobalString('TAKEPOS_RECEIPT_NAME')) { print getDolGlobalString('TAKEPOS_RECEIPT_NAME') . " "; } -if ($object->statut == Facture::STATUS_DRAFT) { +if ($object->status == Facture::STATUS_DRAFT) { print str_replace(")", "", str_replace("-", " ".$langs->trans('Place')." ", str_replace("(PROV-POS", $langs->trans("Terminal")." ", $object->ref))); } else { print $object->ref; @@ -155,7 +184,7 @@


- +
@@ -194,7 +223,7 @@ product_label)) { echo $line->product_label; } else { - echo $line->description; + echo $line->desc; } ?> @@ -219,7 +248,7 @@
trans("Label"); ?> qty; ?>

- +
trans("TotalHT"); diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index a4a68577a95a6..89f81fed44219 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -164,6 +164,19 @@ box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); } +/* +.butActionDelete#action-delete::before { + content: "\f1f8"; + font-family: ""; + font-weight: 600; + width: 20px; + visibility: visible; +} +.butActionDelete#action-delete span.textbutton { + display: none; +} +*/ + .butActionRefused { text-decoration: none !important; text-transform: uppercase; diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index ac13bea9645e3..d12b99266bc38 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -59,7 +59,7 @@ CKEDITOR.editorConfig = function( config ) [ ['Maximize','Preview'], ['SpellChecker', 'Scayt'], - ['Undo','Redo','-','Find','Replace'], + ['Find','Replace'], ['CreateDiv','ShowBlocks'], ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], @@ -74,8 +74,8 @@ CKEDITOR.editorConfig = function( config ) [ ['Maximize'], ['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Find','Replace'], + ['Format','FontSize'], ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index bf291bc538edc..03eb1aed0add0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -89,6 +89,8 @@ @phan-var-force array{h:int,l:int,s:int,a:int} $colortextlinkHsla '; +$borderradius = getDolGlobalString('THEME_ELDY_USEBORDERONTABLE') ? getDolGlobalInt('THEME_ELDY_BORDER_RADIUS', 6) : 0; + ?> /*