diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index ccd276f8a97..26d49f0b1f4 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -131,7 +131,7 @@ jobs: ls -l ~/.cache/pre-commit/ - name: Convert Raw Log to Annotations - uses: mdeweerd/logToCheckStyle@v2024.3.5 + uses: mdeweerd/logToCheckStyle@v2025.1.1 if: ${{ failure() }} with: in: ${{ env.RAW_LOG }} diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index c15d2747125..2c34622bb70 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -165,7 +165,7 @@ jobs: for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A - name: Convert Raw Log to Annotations - uses: mdeweerd/logToCheckStyle@v2024.3.5 + uses: mdeweerd/logToCheckStyle@v2025.1.1 if: ${{ failure() }} with: in: ${{ env.PHPUNIT_LOG }} diff --git a/.travis.yml b/.travis.yml index d3f1a32c067..80826abe00e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -511,6 +511,9 @@ script: php upgrade.php 20.0.0 21.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade20002100.log || cat $TRAVIS_BUILD_DIR/upgrade20002100.log php upgrade2.php 20.0.0 21.0.0 > $TRAVIS_BUILD_DIR/upgrade20002100-2.log || cat $TRAVIS_BUILD_DIR/upgrade20002100-2.log php step5.php 20.0.0 21.0.0 > $TRAVIS_BUILD_DIR/upgrade20002100-3.log || cat $TRAVIS_BUILD_DIR/upgrade20002100-3.log + php upgrade.php 21.0.0 22.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade21002200.log || cat $TRAVIS_BUILD_DIR/upgrade21002200.log + php upgrade2.php 21.0.0 22.0.0 > $TRAVIS_BUILD_DIR/upgrade21002200-2.log || cat $TRAVIS_BUILD_DIR/upgrade21002200-2.log + php step5.php 21.0.0 22.0.0 > $TRAVIS_BUILD_DIR/upgrade21002200-3.log || cat $TRAVIS_BUILD_DIR/upgrade21002200-3.log set +e echo diff --git a/ChangeLog b/ChangeLog index a150b81dd15..c8f9e8bb857 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1216,8 +1216,13 @@ NEW: updating for display Help title when try to delete Don (issue #25314) NEW: Upgrade in module builder in menu section NEW: use account address in sepa mandate (#23642) NEW: VAT rate - Add entity -NEW: Website: Support of js into the Dolibarr server preview NEW: When an user unset the batch management of products, transformation of each batch stock movement in global stock movement +NEW: PDF Generation for each Human Resource Evaluations. + +SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520) +SEC: Add action confirm_... as sensitive to need a CSRF token +SEC: Disable not used PHP streams +SEC: Add option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY For developers or integrators: @@ -1311,7 +1316,7 @@ The following changes may create regressions for some external modules, but were * The delete() method of AdherentType, Contact, Delivery, MultiCurrency, CurrencyRate now need $user as first parameter. * A very high number of class properties (with old name in french) are now deprecated in favor of the property name in english. * The load of hook context productdao has been removed before calling loadvirtualstock. Modules must use the context of main parent page or 'all' for all cases. - +* booking.class.php was removed, please have a look at calendar.class.php ***** ChangeLog for 18.0.6 compared to 18.0.5 ***** FIX: 16.0 - parent company gets emptied when updating a third party from the card in edit mode (#28269) diff --git a/README.md b/README.md index 136f946a257..607ab21f166 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,12 @@ There is a lot of different solutions to install Dolibarr. ### Using packages -If you have low technical skills and you're looking to install Dolibarr ERP/CRM with just a few clicks, you can use one of the packaged versions: +If you have low technical skills and you're looking to install Dolibarr ERP/CRM with just few clicks, you can use one of the packaged versions (see next chapter if you have IT knowledge) : - [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp)) -- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian) +- [DoliDeb for Debian, Ubuntu](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian) - DoliRpm for Red Hat, Fedora, OpenSuse, Mandriva or Mageia -- The Docker image (see next chapter) +- The Docker image (see chapter "Using Docker") Releases can be downloaded from [official website](https://www.dolibarr.org/). diff --git a/dev/build/docker-dev/Dockerfile b/dev/build/docker-dev/Dockerfile index 5cd4c60673b..f98726d4f8c 100644 --- a/dev/build/docker-dev/Dockerfile +++ b/dev/build/docker-dev/Dockerfile @@ -23,11 +23,12 @@ RUN apt-get update -y \ msmtp \ msmtp-mta \ mailutils \ + libpq-dev \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ - && docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \ - && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ + && docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql pgsql gd soap zip \ + && docker-php-ext-configure ldap \ && docker-php-ext-install -j$(nproc) ldap && \ mv ${PHP_INI_DIR}/php.ini-development ${PHP_INI_DIR}/php.ini diff --git a/dev/build/docker-dev/README.md b/dev/build/docker-dev/README.md index bb5c82391f1..22a1a671121 100644 --- a/dev/build/docker-dev/README.md +++ b/dev/build/docker-dev/README.md @@ -1,8 +1,9 @@ # How to use it ? -The docker-compose.yml file is a sample of a config file to use to build and run Dolibarr in the current workspace with Docker. -This docker image is intended for development usage. -For production usage you should consider other contributor reference like https://hub.docker.com/r/dolibarr/dolibarr +The docker-compose.yml file is a sample of a config file to use to build and run +Dolibarr in the current workspace with Docker. This docker image is intended for +**development usage**. For production usage you should consider other +contributor reference like https://hub.docker.com/r/dolibarr/dolibarr. Before build/run, define the variable HOST_USER_ID as following: @@ -12,11 +13,18 @@ Go in repository build/docker : cd dev/build/docker -And then, you can run : +And then, depending on whether you want to run with a MariaDB database or +PostgreSQL database, you can run: - docker-compose up + docker compose -f docker-compose.yml -f mariadb.yml up + +or + + docker compose -f docker-compose.yml -f postgres.yml up This will run 4 containers Docker : Dolibarr, MariaDB, PhpMyAdmin and MailDev. +In the case of PostgreSQL, only Dolibarr, MailDev and the PostgreSQL database +will be running. The URL to go to the Dolibarr is : @@ -26,9 +34,35 @@ The URL to go to PhpMyAdmin is (login/password is root/root) : http://0.0.0.0:8080 -In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev +In Dolibarr configuration Email let PHP mail function, To see all mail send by +Dolibarr go to maildev http://0.0.0.0:8081 -Setup the database connection during the installation process, please use mariadb (name of the database container) as database host. -Setup documents folder, during the installation process, to /var/documents +Setup the database connection during the installation process, please use +mariadb or postgres (name of the database container) as database host. + +## Setup your custom modules + +You can setup your own modules from your development folder by using volume +mounts and docker compose override. For instance for your module "yourmodule" +located in `/path/to/your/module_folder`, you can edit `yourmodule.yml` and +write: + + --- + services: + web: + volumes: + - /path/to/your/module_folder:/var/www/html/custom/yourmodule/ + +This will add your module at runtime inside the dolibarr custom plugins and it +will automatically be synced with your development environment. + +Then, you can start by extending one of the commands above, for instance for +mariadb: + + docker compose \ + -f docker-compose.yml \ + -f postgres.yml \ + -f yourmodule.yml \ + up diff --git a/dev/build/docker-dev/docker-compose.yml b/dev/build/docker-dev/docker-compose.yml index cc2988a67d1..84a48d00f48 100644 --- a/dev/build/docker-dev/docker-compose.yml +++ b/dev/build/docker-dev/docker-compose.yml @@ -1,5 +1,4 @@ -version: '3' - +--- networks: internal-pod: internal: true @@ -17,19 +16,6 @@ services: networks: - internal-pod - external-pod - - phpmyadmin: - image: phpmyadmin/phpmyadmin - environment: - PMA_HOST: mariadb - depends_on: - - mariadb - ports: - - "8080:80" - networks: - - internal-pod - - external-pod - web: build: . environment: @@ -37,13 +23,12 @@ services: PHP_INI_DATE_TIMEZONE: $PHP_INI_DATE_TIMEZONE PHP_INI_MEMORY_LIMIT: $PHP_INI_MEMORY_LIMIT volumes: - - ../../htdocs:/var/www/html/ - - ../../documents:/var/documents + - ../../../htdocs:/var/www/html/ + - ../../../documents:/var/www/documents ports: - "80:80" - "9000:9000" depends_on: - - mariadb - mail networks: - internal-pod diff --git a/dev/build/docker-dev/docker-run.sh b/dev/build/docker-dev/docker-run.sh index 07bc35947cf..a3a1123c1f2 100755 --- a/dev/build/docker-dev/docker-run.sh +++ b/dev/build/docker-dev/docker-run.sh @@ -1,24 +1,21 @@ #!/bin/bash # Script used by the Dockerfile. # See README.md to know how to create a Dolibarr env with docker +set -ex + +if [ "${HOST_USER_ID}" == "" ]; then + echo "Define HOST_USER_ID to your user ID before starting" + exit 1 +fi usermod -u "${HOST_USER_ID}" www-data groupmod -g "${HOST_USER_ID}" www-data -chgrp -hR www-data /var/www/html -chmod g+rwx /var/www/html/conf - -if [ ! -d /var/documents ]; then - echo "[docker-run] => create volume directory /var/documents ..." - mkdir -p /var/documents -fi -echo "[docker-run] => Set Permission to www-data for /var/documents" -chown -R www-data:www-data /var/documents - echo "[docker-run] => update '${PHP_INI_DIR}/conf.d/dolibarr-php.ini'" cat < "${PHP_INI_DIR}/conf.d/dolibarr-php.ini" date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC} memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M} +display_errors = Off EOF exec apache2-foreground diff --git a/dev/build/docker-dev/mariadb.yml b/dev/build/docker-dev/mariadb.yml new file mode 100644 index 00000000000..c9b2e78ac18 --- /dev/null +++ b/dev/build/docker-dev/mariadb.yml @@ -0,0 +1,34 @@ +--- +networks: + internal-pod: + internal: true + external-pod: + internal: false + +services: + mariadb: + image: mariadb:latest + environment: + MYSQL_ROOT_PASSWORD: rootpassfordev + MYSQL_DATABASE: dolibarr + ports: + - "3306:3306" + networks: + - internal-pod + - external-pod + web: + depends_on: + - mariadb + phpmyadmin: + image: phpmyadmin/phpmyadmin + environment: + PMA_HOST: mariadb + depends_on: + - mariadb + ports: + - "8080:80" + networks: + - internal-pod + - external-pod + + diff --git a/dev/build/docker-dev/postgres.yml b/dev/build/docker-dev/postgres.yml new file mode 100644 index 00000000000..ab740658894 --- /dev/null +++ b/dev/build/docker-dev/postgres.yml @@ -0,0 +1,18 @@ +--- +networks: + internal-pod: + internal: true + external-pod: + internal: false + +services: + postgres: + image: postgres:latest + environment: + POSTGRES_PASSWORD: rootpassfordev + networks: + - internal-pod + - external-pod + web: + depends_on: + - postgres diff --git a/dev/build/makepack-howto.txt b/dev/build/makepack-howto.txt index 61a6006f0ae..b23b21e1bd7 100644 --- a/dev/build/makepack-howto.txt +++ b/dev/build/makepack-howto.txt @@ -1,14 +1,14 @@ ----- Dolibarr Makepack How To ----- -This documentation describe steps to build a BETA or RELEASE versions -of Dolibarr. There is a chapter for BETA version and a chapter for RELEASE version. +This documentation describe steps to build a BETA or RELEASE versions of Dolibarr. +There is a chapter for BETA version and a chapter for RELEASE version. -***** Prerequisites For Linux ***** +***** Prerequisites on Linux ***** -Prerequisites to build tgz, debian and rpm packages: +Prerequisites to build the tgz, debian and rpm packages: > apt-get install perl tar dpkg dpatch p7zip-full rpm zip php-cli -Prerequisites to build autoexe DoliWamp package from Linux (solution seems broken since Ubuntu 20.04): +Prerequisites to build autoexe DoliWamp package from Linux (solution seems broken since Ubuntu 20.04+): > apt-get install wine q4wine > Launch "wine cmd" to check a drive Z: pointing to / exists. > Install InnoSetup @@ -23,7 +23,7 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke The .exe file will be build into directory build. -***** Prerequisites For Windows ***** +***** Prerequisites on Windows ***** Prerequisites to build autoexe DoliWamp package from Windows: @@ -49,9 +49,9 @@ This files describe steps made by Dolibarr packaging team to make a beta version - Check all files are committed. - Update version/info in ChangeLog, for this you can: -To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a major new version x.y.0 (from a repo on branch x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" +To generate a changelog of a major new version x.y.0 (from a repo on branch x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" +To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" Recopy the content of the output file into the file ChangeLog. - Note: To know number of lines changes: git diff --shortstat A B - Update version number with x.y.z-w in file htdocs/filefunc.inc.php @@ -67,15 +67,15 @@ Recopy the content of the output file into the file ChangeLog. ***** Actions to do a RELEASE ***** This files describe steps made by Dolibarr packaging team to make a complete release of Dolibarr, step by step. -We suppose the branch x.y has already been created during the beta (see previous step). +We suppose the branch x.y has already been created during the beta (see previous step) and we want to release a version x.y.z (with z >= 0) - Check all files are committed. -- Update version/info in ChangeLog, for this you can: -To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a major new version x.y.0 (from a repo pn branch x.y), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +- Update version/info in ChangeLog, for this: +To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" +To generate a changelog of a major new version x.y.0 (from a repo pn branch x.y), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" +To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" Recopy the content of the output file into the file ChangeLog. -- Note: To know the number of lines changes: git diff --shortstat A B +- Note: To know the number of lines changes: git diff --shortstat vA vB - Update version number with x.y.z in file htdocs/filefunc.inc.php - Commit all changes. @@ -84,6 +84,6 @@ Recopy the content of the output file into the file ChangeLog. - Check content of built packages. - Run makepack-dolibarr.pl again with option to publish files on dolibarr foundation server (Dir /home/dolibarr/wwwroot/files/stable on www.dolibarr.org). -- Run makepack-dolibarr.pl again with option to publish files on sourceforge. This will also add official tag. +- Run makepack-dolibarr.pl again with option to publish files on sourceforge. This will also add the official tag x.y.z. -- Post a news on dolibarr.org/dolibarr.fr + social networks +- Post a news in english dolibarr.org/dolibarr.fr web site by cloning a past news (the news will be propagated on social networks) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 02bff396fb4..8e8123cefb0 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -942,12 +942,6 @@ parameters: count: 5 path: ../../../htdocs/adherents/class/adherent.class.php - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/adherents/class/adherent.class.php - - message: '#^Property Adherent\:\:\$last_subscription_amount \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -1884,12 +1878,6 @@ parameters: count: 1 path: ../../../htdocs/admin/workstation.php - - - message: '#^Variable \$arrayofparameters might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/admin/workstation.php - - message: '#^Variable \$label might not be defined\.$#' identifier: variable.undefined @@ -1986,12 +1974,6 @@ parameters: count: 1 path: ../../../htdocs/api/class/api_documents.class.php - - - message: '#^Variable \$relativefile might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/api/class/api_documents.class.php - - message: '#^Method Login\:\:index\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -2568,12 +2550,6 @@ parameters: count: 1 path: ../../../htdocs/blockedlog/ajax/block-add.php - - - message: '#^Call to function is_object\(\) with Don\|Facture\|FactureFournisseur\|PaymentVarious will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/blockedlog/class/blockedlog.class.php - - message: '#^Dead catch \- Exception is never thrown in the try block\.$#' identifier: catch.neverThrown @@ -3720,12 +3696,6 @@ parameters: count: 2 path: ../../../htdocs/comm/action/pertype.php - - - message: '#^Parameter \#3 \$status of function print_actions_filter expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/comm/action/pertype.php - - message: '#^Result of && is always false\.$#' identifier: booleanAnd.alwaysFalse @@ -3756,18 +3726,6 @@ parameters: count: 1 path: ../../../htdocs/comm/action/pertype.php - - - message: '#^Call to function is_array\(\) with array\{\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/comm/action/peruser.php - - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 1 - path: ../../../htdocs/comm/action/peruser.php - - message: '#^Loose comparison using \!\= between ''show_peruser'' and ''show_day'' will always evaluate to true\.$#' identifier: notEqual.alwaysTrue @@ -3786,34 +3744,16 @@ parameters: count: 1 path: ../../../htdocs/comm/action/peruser.php - - - message: '#^Loose comparison using \=\= between ''show_peruser'' and ''list'' will always evaluate to false\.$#' - identifier: equal.alwaysFalse - count: 1 - path: ../../../htdocs/comm/action/peruser.php - - message: '#^Loose comparison using \=\= between ''show_peruser'' and ''show_day'' will always evaluate to false\.$#' identifier: equal.alwaysFalse count: 2 path: ../../../htdocs/comm/action/peruser.php - - - message: '#^Loose comparison using \=\= between ''show_peruser'' and ''show_month'' will always evaluate to false\.$#' - identifier: equal.alwaysFalse - count: 1 - path: ../../../htdocs/comm/action/peruser.php - - - - message: '#^Loose comparison using \=\= between ''show_peruser'' and ''show_peruser'' will always evaluate to true\.$#' - identifier: equal.alwaysTrue - count: 2 - path: ../../../htdocs/comm/action/peruser.php - - message: '#^Loose comparison using \=\= between ''show_peruser'' and ''show_week'' will always evaluate to false\.$#' identifier: equal.alwaysFalse - count: 2 + count: 1 path: ../../../htdocs/comm/action/peruser.php - @@ -3831,7 +3771,7 @@ parameters: - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue - count: 10 + count: 6 path: ../../../htdocs/comm/action/peruser.php - @@ -3843,12 +3783,6 @@ parameters: - message: '#^Variable \$mode in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable - count: 2 - path: ../../../htdocs/comm/action/peruser.php - - - - message: '#^Variable \$s might not be defined\.$#' - identifier: variable.undefined count: 1 path: ../../../htdocs/comm/action/peruser.php @@ -5622,24 +5556,12 @@ parameters: count: 3 path: ../../../htdocs/compta/facture/class/facture.class.php - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/compta/facture/class/facture.class.php - - message: '#^Parameter \#12 \$localtaxes_array of function calcul_price_total expects array\{string, int\|string, string, int\|string, string, string\}\|array\{string, int\|string, string, string\}, array\{\} given\.$#' identifier: argument.type count: 2 path: ../../../htdocs/compta/facture/class/facture.class.php - - - message: '#^Parameter \#2 \$alreadypaid of method CommonInvoice\:\:getLibStatut\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/compta/facture/class/facture.class.php - - message: '#^Parameter \#4 \$txtva of method Facture\:\:addline\(\) expects float, string given\.$#' identifier: argument.type @@ -7680,12 +7602,6 @@ parameters: count: 1 path: ../../../htdocs/contrat/list.php - - - message: '#^Parameter \#2 \$array of static method Form\:\:multiselectarray\(\) expects array\, non\-empty\-array\\|non\-empty\-string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/contrat/list.php - - message: '#^Unable to resolve the template type T in call to function dol_sort_array$#' identifier: argument.templateType @@ -7962,12 +7878,6 @@ parameters: count: 3 path: ../../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$obj might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$permissiontoadd might not be defined\.$#' identifier: variable.undefined @@ -8094,12 +8004,6 @@ parameters: count: 1 path: ../../../htdocs/core/ajax/ajaxdirpreview.php - - - message: '#^Variable \$module might not be defined\.$#' - identifier: variable.undefined - count: 34 - path: ../../../htdocs/core/ajax/ajaxdirpreview.php - - message: '#^Variable \$section might not be defined\.$#' identifier: variable.undefined @@ -8604,24 +8508,12 @@ parameters: count: 1 path: ../../../htdocs/core/boxes/box_produits.php - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: bool, module\: ''product\|service''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/boxes/box_produits.php - - message: '#^Constructor of class box_produits_alerte_stock has an unused parameter \$param\.$#' identifier: constructor.unusedParameter count: 1 path: ../../../htdocs/core/boxes/box_produits_alerte_stock.php - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: mixed, module\: ''product\|service…''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/boxes/box_produits_alerte_stock.php - - message: '#^Constructor of class box_project has an unused parameter \$param\.$#' identifier: constructor.unusedParameter @@ -8922,18 +8814,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/comment.class.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, CommonObject given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/class/commondocgenerator.class.php - - - - message: '#^Parameter \#2 \$array_to_fill of method CommonDocGenerator\:\:fill_substitutionarray_with_extrafields\(\) expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/class/commondocgenerator.class.php - - message: '#^Property CommonObject\:\:\$element \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -9342,18 +9222,6 @@ parameters: count: 2 path: ../../../htdocs/core/class/conf.class.php - - - message: '#^Property Conf\:\:\$delivery_note has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$expedition_bon has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - message: '#^Property Conf\:\:\$expensereport \(stdClass\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -9366,66 +9234,6 @@ parameters: count: 2 path: ../../../htdocs/core/class/conf.class.php - - - message: '#^Property Conf\:\:\$format_date_hour_sec_short has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$format_date_hour_short has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$format_date_hour_text has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$format_date_hour_text_short has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$format_date_short has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$format_date_short_java has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$format_date_text has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$format_date_text_short has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$format_hour_short has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$format_hour_short_duration has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - message: '#^Property Conf\:\:\$main_checkbox_left_column \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -9444,30 +9252,12 @@ parameters: count: 1 path: ../../../htdocs/core/class/conf.class.php - - - message: '#^Property Conf\:\:\$mycompany has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - message: '#^Property Conf\:\:\$product \(stdClass\) in isset\(\) is not nullable\.$#' identifier: isset.property count: 1 path: ../../../htdocs/core/class/conf.class.php - - - message: '#^Property Conf\:\:\$project \(stdClass\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Property Conf\:\:\$projet has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/class/conf.class.php - - message: '#^Property Conf\:\:\$propal \(stdClass\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -9477,12 +9267,6 @@ parameters: - message: '#^Result of && is always false\.$#' identifier: booleanAnd.alwaysFalse - count: 2 - path: ../../../htdocs/core/class/conf.class.php - - - - message: '#^Variable \$mc might not be defined\.$#' - identifier: variable.undefined count: 1 path: ../../../htdocs/core/class/conf.class.php @@ -9696,12 +9480,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/dolgraph.class.php - - - message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#' - identifier: greater.alwaysFalse - count: 3 - path: ../../../htdocs/core/class/dolgraph.class.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -9720,24 +9498,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/dolgraph.class.php - - - message: '#^Loose comparison using \=\= between 0 and 0 will always evaluate to true\.$#' - identifier: equal.alwaysTrue - count: 2 - path: ../../../htdocs/core/class/dolgraph.class.php - - - - message: '#^Loose comparison using \=\= between 1 and 3 will always evaluate to false\.$#' - identifier: equal.alwaysFalse - count: 1 - path: ../../../htdocs/core/class/dolgraph.class.php - - - - message: '#^Offset 0 on array\{array\{stacknum\: int, legend\: mixed, legendwithgroup\: non\-falsy\-string\}\} in empty\(\) always exists and is not falsy\.$#' - identifier: empty.offset - count: 1 - path: ../../../htdocs/core/class/dolgraph.class.php - - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue @@ -9870,24 +9630,12 @@ parameters: count: 4 path: ../../../htdocs/core/class/html.form.class.php - - - message: '#^Parameter \#1 \$selected of method Form\:\:getSelectConditionsPaiements\(\) expects int, string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/class/html.form.class.php - - message: '#^Parameter \#15 \$excludeids of method Form\:\:select_company\(\) expects array\, array\ given\.$#' identifier: argument.type count: 1 path: ../../../htdocs/core/class/html.form.class.php - - - message: '#^Parameter \#2 \$array of method Form\:\:multiselectarray\(\) expects array\, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/class/html.form.class.php - - message: '#^Parameter \#3 \$optJson of method Form\:\:constructProjectListOption\(\) expects array\{key\: string, value\: string, type\: string\}, array\{\} given\.$#' identifier: argument.type @@ -10008,12 +9756,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/html.formcategory.class.php - - - message: '#^Parameter \#2 \$array of static method Form\:\:multiselectarray\(\) expects array\, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/class/html.formcategory.class.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -10116,24 +9858,12 @@ parameters: count: 1 path: ../../../htdocs/core/class/html.formmail.class.php - - - message: '#^Parameter \#2 \$array of static method Form\:\:multiselectarray\(\) expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/class/html.formmail.class.php - - message: '#^Property FormMail\:\:\$ckeditortoolbar \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property count: 1 path: ../../../htdocs/core/class/html.formmail.class.php - - - message: '#^Parameter \#2 \$array of static method Form\:\:multiselectarray\(\) expects array\, non\-empty\-array\<\-1\|0\|1\|2\|3, string\> given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/class/html.formorder.class.php - - message: '#^Parameter \#3 \$zone of static method InfoBox\:\:listBoxes\(\) expects int, string given\.$#' identifier: argument.type @@ -10158,12 +9888,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/html.formprojet.class.php - - - message: '#^Parameter \#2 \$array of static method Form\:\:multiselectarray\(\) expects array\, non\-empty\-array\<0\|1\|2, string\> given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/class/html.formprojet.class.php - - message: '#^Variable \$labeltoshow might not be defined\.$#' identifier: variable.undefined @@ -10734,36 +10458,12 @@ parameters: count: 1 path: ../../../htdocs/core/customreports.php - - - message: '#^Variable \$gval might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/customreports.php - - message: '#^Variable \$page might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/core/customreports.php - - - message: '#^Variable \$search_graph might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/core/customreports.php - - - - message: '#^Variable \$search_groupby might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/customreports.php - - - - message: '#^Variable \$search_xaxis might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../../htdocs/core/customreports.php - - message: '#^Variable \$search_yaxis might not be defined\.$#' identifier: variable.undefined @@ -10782,12 +10482,6 @@ parameters: count: 1 path: ../../../htdocs/core/customreports.php - - - message: '#^Variable \$tabfamily might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/core/customreports.php - - message: '#^Constructor of class DoliDBMysqli has an unused parameter \$type\.$#' identifier: constructor.unusedParameter @@ -10866,12 +10560,6 @@ parameters: count: 1 path: ../../../htdocs/core/db/sqlite3.class.php - - - message: '#^Method DoliDBSqlite3\:\:getListOfCollation\(\) should return array\\|null but returns array\{array\{charset\: ''UTF\-8'', description\: ''UTF\-8''\}\}\.$#' - identifier: return.type - count: 1 - path: ../../../htdocs/core/db/sqlite3.class.php - - message: '#^Cannot access property \$db on mixed\.$#' identifier: property.nonObject @@ -11424,12 +11112,6 @@ parameters: count: 3 path: ../../../htdocs/core/lib/images.lib.php - - - message: '#^Variable \$extImg might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/lib/images.lib.php - - message: '#^Loose comparison using \=\= between ''suppliers'' and ''fourn'' will always evaluate to false\.$#' identifier: equal.alwaysFalse @@ -11820,84 +11502,6 @@ parameters: count: 2 path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: 0\|1, perms\: 0\|1, module\: ''projet''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: 0\|1, perms\: bool, module\: ''facture\|supplier…''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: 0\|1, perms\: bool, module\: ''propal\|commande…''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: 1, perms\: 1, module\: ''''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: bool, module\: ''banque\|prelevement…''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: bool, module\: ''bom\|mrp''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: bool, module\: ''comptabilite…''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: bool, module\: ''hrm\|holiday…''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: bool, module\: ''product\|service''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: bool, module\: ''societe\|fournisseur''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: bool, module\: ''ticket…''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: bool, perms\: mixed, module\: ''adherent''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - - - message: '#^Parameter \#2 \$menuentry of function isVisibleToUserType expects array\{enabled\: int\<0, 1\>, module\: string, perms\: string\}, array\{enabled\: true, perms\: mixed, module\: ''projet''\} given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/menus/standard/eldy.lib.php - - message: '#^Parameter \#8 \$menuval of function print_text_menu_entry expects array\{\}\|array\{rowid\: string, fk_menu\: string, langs\: string, enabled\: int\<0, 2\>, type\: string, fk_mainmenu\: string, fk_leftmenu\: string, url\: string, \.\.\.\}, array\{url\: string, titre\: string, enabled\: int\<0, 2\>, target\: string, mainmenu\: string, leftmenu\: string, position\: int, level\?\: int, \.\.\.\} given\.$#' identifier: argument.type @@ -12036,30 +11640,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/action/doc/pdf_standard_actions.class.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Asset given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -12150,12 +11730,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php - - - message: '#^Variable \$carac_client_name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -12168,12 +11742,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/bank/doc/pdf_ban.modules.php - - - message: '#^Parameter \#3 \$tab_height of method pdf_ban\:\:_tableau\(\) expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/bank/doc/pdf_ban.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -12186,24 +11754,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php - - - message: '#^Parameter \#3 \$posy of method pdf_sepamandate\:\:_tableau_info\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php - - - - message: '#^Parameter \#3 \$tab_height of method pdf_sepamandate\:\:_tableau\(\) expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php - - - - message: '#^Variable \$result might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/barcode/doc/phpbarcode.modules.php - - message: '#^Property modTcpdfbarcode\:\:\$is2d has no type specified\.$#' identifier: missingType.property @@ -12216,48 +11766,12 @@ parameters: count: 1 path: ../../../htdocs/core/modules/barcode/mod_barcode_product_standard.php - - - message: '#^Property mod_barcode_product_standard\:\:\$numbitcounter has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/barcode/mod_barcode_product_standard.php - - - - message: '#^Property mod_barcode_product_standard\:\:\$searchcode has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/barcode/mod_barcode_product_standard.php - - message: '#^Parameter \#2 \$type of method mod_barcode_thirdparty_standard\:\:literalBarcodeType\(\) expects int, string given\.$#' identifier: argument.type count: 1 path: ../../../htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, BOM given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -12270,48 +11784,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/cheque/doc/pdf_blochet.class.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Commande given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php - - - - message: '#^Parameter \#3 \$posy of method pdf_einstein\:\:_tableau_info\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php - - - - message: '#^Parameter \#4 \$posy of method pdf_einstein\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php - - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php - - message: '#^Property Commande\:\:\$availability \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -12336,12 +11808,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php - - - message: '#^Left side of && is always true\.$#' - identifier: booleanAnd.leftAlwaysTrue - count: 1 - path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php - - message: '#^Property Commande\:\:\$availability \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -12450,42 +11916,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php - - - message: '#^Variable \$carac_client_name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php - - - - message: '#^Variable \$realpath might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Contrat given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php - - - - message: '#^Parameter \#3 \$tab_height of method pdf_strato\:\:tabSignature\(\) expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/contract/doc/pdf_strato.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -12498,30 +11928,12 @@ parameters: count: 1 path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php - - - message: '#^Left side of && is always true\.$#' - identifier: booleanAnd.leftAlwaysTrue - count: 1 - path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php - - - - message: '#^Parameter \#3 \$posy of method pdf_storm\:\:_tableau_info\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php - - message: '#^Parameter \#4 \$columnText of method CommonDocGenerator\:\:printStdColumnContent\(\) expects string, float given\.$#' identifier: argument.type count: 2 path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php - - message: '#^Property CommonDocGenerator\:\:\$cols \(array\\) does not accept non\-empty\-array\\.$#' identifier: assign.propertyType @@ -12558,48 +11970,12 @@ parameters: count: 1 path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php - - - message: '#^Variable \$realpath might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType count: 1 path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php - - - message: '#^Parameter \#3 \$posy of method pdf_typhon\:\:_tableau_info\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php - - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php - - - - message: '#^Property pdf_typhon\:\:\$posxcomm has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php - - - - message: '#^Property pdf_typhon\:\:\$posxremainingqty has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php - - - - message: '#^Property pdf_typhon\:\:\$posxweightvol has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -12624,12 +12000,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php - - message: '#^Parameter \#4 \$columnText of method CommonDocGenerator\:\:printStdColumnContent\(\) expects string, float given\.$#' identifier: argument.type @@ -12642,12 +12012,6 @@ parameters: count: 2 path: ../../../htdocs/core/modules/expedition/doc/pdf_espadon.modules.php - - - message: '#^Parameter \#4 \$posy of method pdf_espadon\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/expedition/doc/pdf_espadon.modules.php - - message: '#^Property CommonDocGenerator\:\:\$cols \(array\\) does not accept non\-empty\-array\\.$#' identifier: assign.propertyType @@ -12720,84 +12084,12 @@ parameters: count: 1 path: ../../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php - - - message: '#^Property pdf_merou\:\:\$destinataire has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php - - - - message: '#^Property pdf_merou\:\:\$expediteur has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php - - - - message: '#^Property pdf_merou\:\:\$livreur has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php - - - - message: '#^Parameter \#4 \$posy of method pdf_rouget\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/expedition/doc/pdf_rouget.modules.php - - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/expedition/doc/pdf_rouget.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse count: 1 path: ../../../htdocs/core/modules/expedition/doc/pdf_rouget.modules.php - - - message: '#^Parameter \#3 \$posy of method pdf_standard_expensereport\:\:tablePayments\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php - - - - message: '#^Parameter \#3 \$tab_height of method pdf_standard_expensereport\:\:_tableau\(\) expects int, float given\.$#' - identifier: argument.type - count: 6 - path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php - - - - message: '#^Property pdf_standard_expensereport\:\:\$postotalttc has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php - - - - message: '#^Property pdf_standard_expensereport\:\:\$posxcomment has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php - - - - message: '#^Property pdf_standard_expensereport\:\:\$posxpiece has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php - - - - message: '#^Property pdf_standard_expensereport\:\:\$posxprojet has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php - - - - message: '#^Property pdf_standard_expensereport\:\:\$posxtype has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -12810,30 +12102,6 @@ parameters: count: 6 path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Facture given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php - - message: '#^Variable \$array_propal_object in isset\(\) always exists and is not nullable\.$#' identifier: isset.variable @@ -12852,30 +12120,6 @@ parameters: count: 6 path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php - - - message: '#^Parameter \#3 \$posy of method pdf_crabe\:\:_tableau_info\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php - - - - message: '#^Parameter \#4 \$posy of method pdf_crabe\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php - - - - message: '#^Parameter \#5 \$heightforfooter of method pdf_crabe\:\:_tableau_versements\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php - - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php - - message: '#^Property CommonInvoice\:\:\$type \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -12900,12 +12144,6 @@ parameters: count: 13 path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - - message: '#^Left side of && is always true\.$#' - identifier: booleanAnd.leftAlwaysTrue - count: 1 - path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - message: '#^Parameter \#1 \$a of method pdf_octopus\:\:sumSituation\(\) expects array\\|float\|int\>, array\ given\.$#' identifier: argument.type @@ -12918,18 +12156,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - - message: '#^Parameter \#3 \$tab_height of method pdf_octopus\:\:_tableFirstPage\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - - - message: '#^Parameter \#3 \$tab_height of method pdf_octopus\:\:_tableau\(\) expects int, float given\.$#' - identifier: argument.type - count: 3 - path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - message: '#^Property CommonInvoice\:\:\$type \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -13068,12 +12294,6 @@ parameters: count: 3 path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - - message: '#^Variable \$realpath might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -13086,12 +12306,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php - - - message: '#^Left side of && is always true\.$#' - identifier: booleanAnd.leftAlwaysTrue - count: 1 - path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php - - message: '#^Property CommonInvoice\:\:\$type \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -13212,12 +12426,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php - - - message: '#^Variable \$realpath might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php - - message: '#^Property mod_facture_mars\:\:\$prefixcreditnote has no type specified\.$#' identifier: missingType.property @@ -13296,12 +12504,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php - - - message: '#^Variable \$max might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/fichinter/mod_pacific.php - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14088,66 +13290,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php - - - - message: '#^Property pdf_standard_movementstock\:\:\$posxdatemouv has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php - - - - message: '#^Property pdf_standard_movementstock\:\:\$posxidref has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php - - - - message: '#^Property pdf_standard_movementstock\:\:\$wref has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php - - - - message: '#^Variable \$lastmovementdate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php - - - - message: '#^Variable \$result might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Mo given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php - - message: '#^Property Mo\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14160,18 +13302,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/mrp/doc/pdf_vinci.modules.php - - - message: '#^Parameter \#3 \$posy of method pdf_vinci\:\:_tableau_info\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/mrp/doc/pdf_vinci.modules.php - - - - message: '#^Parameter \#4 \$columnText of method CommonDocGenerator\:\:printStdColumnContent\(\) expects string, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/mrp/doc/pdf_vinci.modules.php - - message: '#^Property CommonDocGenerator\:\:\$cols \(array\\) does not accept non\-empty\-array\\.$#' identifier: assign.propertyType @@ -14280,66 +13410,6 @@ parameters: count: 2 path: ../../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php - - - message: '#^Parameter \#5 \$x of method pdf_tcpdflabel\:\:writeBarcode\(\) expects int, float given\.$#' - identifier: argument.type - count: 3 - path: ../../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php - - - - message: '#^Parameter \#7 \$w of method pdf_tcpdflabel\:\:writeBarcode\(\) expects int, float given\.$#' - identifier: argument.type - count: 6 - path: ../../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php - - - - message: '#^Parameter \#8 \$h of method pdf_tcpdflabel\:\:writeBarcode\(\) expects int, float given\.$#' - identifier: argument.type - count: 6 - path: ../../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php - - - - message: '#^Property pdf_tcpdflabel\:\:\$_align2d has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php - - - - message: '#^Property pdf_tcpdflabel\:\:\$_style1d has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php - - - - message: '#^Property pdf_tcpdflabel\:\:\$_style2d has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php - - - - message: '#^Property pdf_tcpdflabel\:\:\$_xres has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Product given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php - - message: '#^Property Product\:\:\$weight_units \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14358,30 +13428,6 @@ parameters: count: 2 path: ../../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Project given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method doc_generic_project_odt\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - - - message: '#^Parameter \#2 \$array_to_fill of method CommonDocGenerator\:\:fill_substitutionarray_with_extrafields\(\) expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - - message: '#^Variable \$objectdetail might not be defined\.$#' identifier: variable.undefined @@ -14430,90 +13476,12 @@ parameters: count: 2 path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Project\|Task given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - - message: '#^Parameter \#1 \$task of method doc_generic_task_odt\:\:get_substitutionarray_tasks\(\) expects Task, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - - message: '#^Parameter \#2 \$array_to_fill of method CommonDocGenerator\:\:fill_substitutionarray_with_extrafields\(\) expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - message: '#^Variable \$listlines might not be defined\.$#' identifier: variable.undefined count: 3 path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - message: '#^Variable \$objectdetail might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Propal given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php - - - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - - - message: '#^Parameter \#3 \$posy of method pdf_azur\:\:_tableau_info\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - - - message: '#^Parameter \#4 \$posy of method pdf_azur\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14526,18 +13494,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - - message: '#^Variable \$filetomerge_dir might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/core/modules/propale/doc/pdf_cyan.modules.php - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14646,54 +13602,12 @@ parameters: count: 1 path: ../../../htdocs/core/modules/propale/doc/pdf_cyan.modules.php - - - message: '#^Variable \$filetomerge_dir might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/modules/propale/doc/pdf_cyan.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType count: 1 path: ../../../htdocs/core/modules/rapport/pdf_paiement.class.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Reception given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php - - - - message: '#^Parameter \#4 \$posy of method pdf_squille\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/reception/doc/pdf_squille.modules.php - - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/reception/doc/pdf_squille.modules.php - - message: '#^Property Reception\:\:\$trueWeight \(float\|int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14718,138 +13632,6 @@ parameters: count: 3 path: ../../../htdocs/core/modules/societe/doc/doc_generic_odt.modules.php - - - message: '#^Property mod_codeclient_monkey\:\:\$prefixcustomer has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codeclient_monkey.php - - - - message: '#^Property mod_codeclient_monkey\:\:\$prefixsupplier has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codeclient_monkey.php - - - - message: '#^Property mod_codecompta_aquarium\:\:\$position has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codecompta_aquarium.php - - - - message: '#^Property mod_codecompta_aquarium\:\:\$prefixcustomeraccountancycode has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codecompta_aquarium.php - - - - message: '#^Property mod_codecompta_aquarium\:\:\$prefixsupplieraccountancycode has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codecompta_aquarium.php - - - - message: '#^Comparison operation "\<\=" between int\<100, 999\> and 999 is always true\.$#' - identifier: smallerOrEqual.alwaysTrue - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codecompta_digitaria.php - - - - message: '#^Property mod_codecompta_digitaria\:\:\$customeraccountancycodecharacternumber has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codecompta_digitaria.php - - - - message: '#^Property mod_codecompta_digitaria\:\:\$position has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codecompta_digitaria.php - - - - message: '#^Property mod_codecompta_digitaria\:\:\$supplieraccountancycodecharacternumber has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codecompta_digitaria.php - - - - message: '#^Variable \$a might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/modules/societe/mod_codecompta_digitaria.php - - - - message: '#^Variable \$thirdpartylabelexample might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/modules/societe/mod_codecompta_digitaria.php - - - - message: '#^Property mod_codecompta_panicum\:\:\$position has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/societe/mod_codecompta_panicum.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, Entrepot given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php - - - - message: '#^Property pdf_standard_stock\:\:\$wref has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php - - - - message: '#^Variable \$lastmovementdate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php - - - - message: '#^Variable \$pricemin might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php - - - - message: '#^Parameter \#4 \$posy of method pdf_eagle\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php - - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php - - - - message: '#^Variable \$carac_emetteur_name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php - - - - message: '#^Left side of && is always true\.$#' - identifier: booleanAnd.leftAlwaysTrue - count: 1 - path: ../../../htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php - - message: '#^Property CommonDocGenerator\:\:\$cols \(array\\) does not accept non\-empty\-array\\.$#' identifier: assign.propertyType @@ -14922,72 +13704,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php - - - message: '#^Variable \$carac_emetteur_name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php - - - - message: '#^Variable \$pmp might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php - - - - message: '#^Variable \$realpath might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, FactureFournisseur given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php - - - - message: '#^Variable \$objectref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php - - - - message: '#^Parameter \#4 \$posy of method pdf_canelle\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php - - - - message: '#^Parameter \#5 \$heightforfooter of method pdf_canelle\:\:_tableau_versements\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php - - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15006,54 +13722,12 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, CommandeFournisseur given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php - - - - message: '#^Variable \$objectref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php - - message: '#^Left side of \|\| is always false\.$#' identifier: booleanOr.leftAlwaysFalse count: 1 path: ../../../htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php - - - message: '#^Parameter \#3 \$posy of method pdf_cornas\:\:_tableau_info\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php - - - - message: '#^Parameter \#4 \$posy of method pdf_cornas\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php - - message: '#^Property CommandeFournisseur\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15168,24 +13842,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php - - - message: '#^Parameter \#3 \$posy of method pdf_muscadet\:\:_tableau_info\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php - - - - message: '#^Parameter \#4 \$posy of method pdf_muscadet\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php - - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php - - message: '#^Property CommandeFournisseur\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15204,78 +13860,12 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php - - - message: '#^Variable \$max might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php - - - - message: '#^Parameter \#3 \$posy of method pdf_standard_supplierpayment\:\:_tableau_cheque\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php - - - - message: '#^Parameter \#3 \$tab_height of method pdf_standard_supplierpayment\:\:_tableau\(\) expects int, float given\.$#' - identifier: argument.type - count: 6 - path: ../../../htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php - - - - message: '#^Property pdf_standard_supplierpayment\:\:\$posxdate has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php - - - - message: '#^Property pdf_standard_supplierpayment\:\:\$posxreffacture has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php - - - - message: '#^Property pdf_standard_supplierpayment\:\:\$posxreffacturefourn has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php - - - - message: '#^Property pdf_standard_supplierpayment\:\:\$posxtotalttc has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php - - - - message: '#^Property pdf_standard_supplierpayment\:\:\$posxtype has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php - - - - message: '#^Parameter \#1 \$line of method CommonDocGenerator\:\:get_substitutionarray_lines\(\) expects CommonObjectLine, CommonObject\|stdClass given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php - - message: '#^Left side of && is always true\.$#' identifier: booleanAnd.leftAlwaysTrue count: 1 path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php - - - message: '#^Parameter \#5 \$w of function pdf_writelinedesc expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php - - message: '#^Property SupplierProposal\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15294,12 +13884,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php - - - message: '#^Parameter \#4 \$posy of method pdf_zenith\:\:_tableau_tot\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php - - message: '#^Property CommonDocGenerator\:\:\$cols \(array\\) does not accept non\-empty\-array\\.$#' identifier: assign.propertyType @@ -15402,42 +13986,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php - - - message: '#^Variable \$contactobject might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php - - - - message: '#^Variable \$contactobject might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php - - - - message: '#^Call to function is_array\(\) with string will always evaluate to false\.$#' - identifier: function.impossibleType - count: 1 - path: ../../../htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, UserGroup given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php - - message: '#^Variable \$contactobject might not be defined\.$#' identifier: variable.undefined @@ -15546,102 +14094,24 @@ parameters: count: 1 path: ../../../htdocs/core/tpl/bloc_showhide.tpl.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 12 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$defaulttopic might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$diroutput might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$file might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$hidedesc might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - message: '#^Variable \$hidedetails might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - message: '#^Variable \$hideref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - - message: '#^Variable \$modelmail might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable count: 1 path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 36 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - message: '#^Variable \$user might not be defined\.$#' identifier: variable.undefined count: 2 path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/commonfields_edit.tpl.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/commonfields_view.tpl.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -15654,30 +14124,12 @@ parameters: count: 1 path: ../../../htdocs/core/tpl/contacts.tpl.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/contacts.tpl.php - - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/core/tpl/contacts.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/core/tpl/contacts.tpl.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/contacts.tpl.php - - message: '#^Variable \$action might not be defined\.$#' identifier: variable.undefined @@ -15762,12 +14214,6 @@ parameters: count: 2 path: ../../../htdocs/core/tpl/extrafields_list_print_fields.tpl.php - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/extrafields_list_search_input.tpl.php - - message: '#^Variable \$extrafields might not be defined\.$#' identifier: variable.undefined @@ -15780,12 +14226,6 @@ parameters: count: 2 path: ../../../htdocs/core/tpl/extrafields_list_search_param.tpl.php - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/extrafields_list_search_param.tpl.php - - message: '#^Variable \$param might not be defined\.$#' identifier: variable.undefined @@ -15804,48 +14244,18 @@ parameters: count: 1 path: ../../../htdocs/core/tpl/extrafields_list_search_sql.tpl.php - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/extrafields_list_search_sql.tpl.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined count: 7 path: ../../../htdocs/core/tpl/extrafields_list_search_sql.tpl.php - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/extrafields_list_search_title.tpl.php - - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/extrafields_list_search_title.tpl.php - - message: '#^Variable \$param might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/core/tpl/extrafields_list_search_title.tpl.php - - - message: '#^Variable \$sortfield might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/extrafields_list_search_title.tpl.php - - - - message: '#^Variable \$sortorder might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/extrafields_list_search_title.tpl.php - - message: '#^Left side of && is always true\.$#' identifier: booleanAnd.leftAlwaysTrue @@ -15918,12 +14328,6 @@ parameters: count: 2 path: ../../../htdocs/core/tpl/formlayoutai.tpl.php - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/list_print_subtotal.tpl.php - - message: '#^Variable \$limit might not be defined\.$#' identifier: variable.undefined @@ -16011,19 +14415,7 @@ parameters: - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined - count: 5 - path: ../../../htdocs/core/tpl/objectline_create.tpl.php - - - - message: '#^Variable \$date_end_prefill might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/objectline_create.tpl.php - - - - message: '#^Variable \$date_start_prefill might not be defined\.$#' - identifier: variable.undefined - count: 1 + count: 4 path: ../../../htdocs/core/tpl/objectline_create.tpl.php - @@ -16032,12 +14424,6 @@ parameters: count: 4 path: ../../../htdocs/core/tpl/objectline_create.tpl.php - - - message: '#^Variable \$type_tva might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/objectline_create.tpl.php - - message: '#^Variable \$usehm might not be defined\.$#' identifier: variable.undefined @@ -16128,12 +14514,6 @@ parameters: count: 1 path: ../../../htdocs/core/tpl/originproductline.tpl.php - - - message: '#^Variable \$shippingline might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php - - message: '#^Property CommonObject\:\:\$fk_project \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -16380,12 +14760,6 @@ parameters: count: 1 path: ../../../htdocs/cron/list.php - - - message: '#^Variable \$texttoshow might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/cron/list.php - - message: '#^Offset ''css'' on array\{css\: ''minwidth200'', picto\: mixed\} in empty\(\) always exists and is not falsy\.$#' identifier: empty.offset @@ -16446,12 +14820,6 @@ parameters: count: 1 path: ../../../htdocs/delivery/card.php - - - message: '#^Variable \$arrayoptions might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/delivery/card.php - - message: '#^Variable \$hidedesc might not be defined\.$#' identifier: variable.undefined @@ -16722,42 +15090,12 @@ parameters: count: 1 path: ../../../htdocs/don/paiement/list.php - - - message: '#^Variable \$morecss might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/paiement/list.php - - - - message: '#^Variable \$morejs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/paiement/list.php - - - - message: '#^Variable \$outputlangs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/payment/card.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue count: 1 path: ../../../htdocs/don/payment/payment.php - - - message: '#^Variable \$sumpaid might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/don/payment/payment.php - - - - message: '#^Variable \$objectlink might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/tpl/linkedobjectblock.tpl.php - - message: '#^Property EcmFiles\:\:\$acl \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -16896,12 +15234,6 @@ parameters: count: 1 path: ../../../htdocs/ecm/dir_card.php - - - message: '#^Variable \$oldlabel might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/ecm/dir_card.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -16938,12 +15270,6 @@ parameters: count: 2 path: ../../../htdocs/ecm/file_card.php - - - message: '#^Variable \$relativepath might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/ecm/index.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -17274,12 +15600,6 @@ parameters: count: 1 path: ../../../htdocs/eventorganization/conferenceorboothattendee_card.php - - - message: '#^Variable \$confOrBooth might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/eventorganization/conferenceorboothattendee_card.php - - message: '#^Variable \$text might not be defined\.$#' identifier: variable.undefined @@ -17640,12 +15960,6 @@ parameters: count: 1 path: ../../../htdocs/expedition/class/expedition.class.php - - - message: '#^Variable \$line might not be defined\.$#' - identifier: variable.undefined - count: 77 - path: ../../../htdocs/expedition/class/expedition.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -17700,48 +16014,18 @@ parameters: count: 8 path: ../../../htdocs/expedition/contact.php - - - message: '#^Variable \$typeobject might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/expedition/contact.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse count: 1 path: ../../../htdocs/expedition/dispatch.php - - - message: '#^Variable \$modebatch might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/expedition/dispatch.php - - - - message: '#^Variable \$nbproduct might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/expedition/dispatch.php - - message: '#^Variable \$objectsrc might not be defined\.$#' identifier: variable.undefined count: 3 path: ../../../htdocs/expedition/dispatch.php - - - message: '#^Variable \$objsearchdet might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/expedition/dispatch.php - - - - message: '#^Variable \$typeobject might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/expedition/dispatch.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -17754,12 +16038,6 @@ parameters: count: 2 path: ../../../htdocs/expedition/document.php - - - message: '#^Variable \$typeobject might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/expedition/document.php - - message: '#^Call to function method_exists\(\) with Expedition and ''fetch_lines'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -17802,12 +16080,6 @@ parameters: count: 1 path: ../../../htdocs/expedition/list.php - - - message: '#^Variable \$search_shipping_method_id might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/expedition/list.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -17820,12 +16092,6 @@ parameters: count: 2 path: ../../../htdocs/expedition/note.php - - - message: '#^Variable \$typeobject might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/expedition/note.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -17862,12 +16128,6 @@ parameters: count: 6 path: ../../../htdocs/expedition/shipment.php - - - message: '#^Variable \$toBeShippedTotal might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/expedition/shipment.php - - message: '#^Variable \$socid might not be defined\.$#' identifier: variable.undefined @@ -17928,18 +16188,6 @@ parameters: count: 10 path: ../../../htdocs/expensereport/card.php - - - message: '#^Variable \$remaintopay might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/expensereport/card.php - - - - message: '#^Variable \$userauthor might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/expensereport/card.php - - message: '#^Method ExpenseReports\:\:_validate\(\) has parameter \$data with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -18168,12 +16416,6 @@ parameters: count: 1 path: ../../../htdocs/expensereport/payment/card.php - - - message: '#^Variable \$title_button might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/expensereport/payment/card.php - - message: '#^Variable \$linkback might not be defined\.$#' identifier: variable.undefined @@ -18204,30 +16446,12 @@ parameters: count: 1 path: ../../../htdocs/expensereport/payment/payment.php - - - message: '#^Variable \$sumpaid might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../../htdocs/expensereport/payment/payment.php - - - - message: '#^Variable \$fileurl_avg might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/expensereport/stats/index.php - - message: '#^Variable \$action might not be defined\.$#' identifier: variable.undefined count: 2 path: ../../../htdocs/expensereport/tpl/expensereport_addfile.tpl.php - - - message: '#^Variable \$colspan might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/expensereport/tpl/expensereport_addfile.tpl.php - - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined @@ -18258,12 +16482,6 @@ parameters: count: 2 path: ../../../htdocs/expensereport/tpl/expensereport_linktofile.tpl.php - - - message: '#^Variable \$colspan might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/expensereport/tpl/expensereport_linktofile.tpl.php - - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined @@ -18282,12 +16500,6 @@ parameters: count: 1 path: ../../../htdocs/expensereport/tpl/expensereport_linktofile.tpl.php - - - message: '#^Variable \$minifile might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/expensereport/tpl/expensereport_linktofile.tpl.php - - message: '#^Variable \$object might not be defined\.$#' identifier: variable.undefined @@ -18378,12 +16590,6 @@ parameters: count: 1 path: ../../../htdocs/fichinter/card.php - - - message: '#^Variable \$extrafields in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 2 - path: ../../../htdocs/fichinter/card.php - - message: '#^Variable \$line might not be defined\.$#' identifier: variable.undefined @@ -18396,66 +16602,6 @@ parameters: count: 11 path: ../../../htdocs/fichinter/card.php - - - message: '#^Method Interventions\:\:_validate\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - - - message: '#^Method Interventions\:\:_validate\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - - - message: '#^Method Interventions\:\:_validateLine\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - - - message: '#^Method Interventions\:\:_validateLine\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - - - message: '#^Method Interventions\:\:delete\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - - - message: '#^Method Interventions\:\:index\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - - - message: '#^Method Interventions\:\:post\(\) has parameter \$request_data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - - - message: '#^Method Interventions\:\:postLine\(\) has parameter \$request_data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - - - message: '#^Property Interventions\:\:\$FIELDS type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - - - message: '#^Property Interventions\:\:\$FIELDSLINE has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/fichinter/class/api_interventions.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Fichinter\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -18504,24 +16650,6 @@ parameters: count: 2 path: ../../../htdocs/fichinter/class/fichinterligne.class.php - - - message: '#^Parameter \#17 \$fk_unit of method FichinterRec\:\:addLineRec\(\) expects string\|null, int\|null given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/fichinter/class/fichinterrec.class.php - - - - message: '#^Parameter \#2 \$pu of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/fichinter/class/fichinterrec.class.php - - - - message: '#^Parameter \#3 \$remise_percent_ligne of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/fichinter/class/fichinterrec.class.php - - message: '#^Right side of && is always false\.$#' identifier: booleanAnd.rightAlwaysFalse @@ -18564,18 +16692,6 @@ parameters: count: 2 path: ../../../htdocs/fichinter/list.php - - - message: '#^Variable \$contratstatic might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../../htdocs/fichinter/list.php - - - - message: '#^Variable \$projetstatic might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../../htdocs/fichinter/list.php - - message: '#^Right side of && is always false\.$#' identifier: booleanAnd.rightAlwaysFalse @@ -19002,12 +17118,6 @@ parameters: count: 2 path: ../../../htdocs/fourn/class/fournisseur.facture-rec.class.php - - - message: '#^Parameter \#8 \$remise_percent of method FactureFournisseurRec\:\:addline\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/fourn/class/fournisseur.facture-rec.class.php - - message: '#^Property CommonInvoice\:\:\$subtype \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -19068,24 +17178,12 @@ parameters: count: 2 path: ../../../htdocs/fourn/class/fournisseur.facture.class.php - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/fourn/class/fournisseur.facture.class.php - - message: '#^Parameter \#15 \$pu_devise of function calcul_price_total expects float, string given\.$#' identifier: argument.type count: 1 path: ../../../htdocs/fourn/class/fournisseur.facture.class.php - - - message: '#^Parameter \#2 \$alreadypaid of method CommonInvoice\:\:getLibStatut\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/fourn/class/fournisseur.facture.class.php - - message: '#^Parameter \#2 \$pu of function calcul_price_total expects float, string given\.$#' identifier: argument.type @@ -19404,24 +17502,12 @@ parameters: count: 2 path: ../../../htdocs/fourn/commande/card.php - - - message: '#^Variable \$array_option might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/commande/card.php - - message: '#^Variable \$classname might not be defined\.$#' identifier: variable.undefined count: 2 path: ../../../htdocs/fourn/commande/card.php - - - message: '#^Variable \$fk_account might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/commande/card.php - - message: '#^Variable \$line might not be defined\.$#' identifier: variable.undefined @@ -19446,36 +17532,12 @@ parameters: count: 1 path: ../../../htdocs/fourn/commande/contact.php - - - message: '#^Variable \$caneditproject might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/commande/contact.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse count: 1 path: ../../../htdocs/fourn/commande/dispatch.php - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/fourn/commande/dispatch.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/fourn/commande/dispatch.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/fourn/commande/dispatch.php - - message: '#^Right side of && is always false\.$#' identifier: booleanAnd.rightAlwaysFalse @@ -19506,24 +17568,12 @@ parameters: count: 1 path: ../../../htdocs/fourn/commande/document.php - - - message: '#^Variable \$caneditproject might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/commande/document.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse count: 1 path: ../../../htdocs/fourn/commande/info.php - - - message: '#^Variable \$caneditproject might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/commande/info.php - - message: '#^Call to function method_exists\(\) with CommandeFournisseur and ''fetch_lines'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -19542,12 +17592,6 @@ parameters: count: 1 path: ../../../htdocs/fourn/commande/list.php - - - message: '#^Variable \$billed might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/commande/list.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -19566,24 +17610,12 @@ parameters: count: 1 path: ../../../htdocs/fourn/commande/note.php - - - message: '#^Variable \$caneditproject might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/commande/note.php - - message: '#^Variable \$object might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php - - - message: '#^Variable \$begin might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/fourn/contact.php - - message: '#^Variable \$socid might not be defined\.$#' identifier: variable.undefined @@ -19596,48 +17628,6 @@ parameters: count: 1 path: ../../../htdocs/fourn/facture/agenda.php - - - message: '#^Parameter \#1 \$hour of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 3 - path: ../../../htdocs/fourn/facture/card-rec.php - - - - message: '#^Parameter \#2 \$minute of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 3 - path: ../../../htdocs/fourn/facture/card-rec.php - - - - message: '#^Parameter \#3 \$second of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/fourn/facture/card-rec.php - - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/fourn/facture/card-rec.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/fourn/facture/card-rec.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/fourn/facture/card-rec.php - - - - message: '#^Variable \$formproject might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/facture/card-rec.php - - message: '#^Variable \$label might not be defined\.$#' identifier: variable.undefined @@ -19656,24 +17646,6 @@ parameters: count: 2 path: ../../../htdocs/fourn/facture/card-rec.php - - - message: '#^Variable \$predef might not be defined\.$#' - identifier: variable.undefined - count: 20 - path: ../../../htdocs/fourn/facture/card-rec.php - - - - message: '#^Variable \$price_min might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/facture/card-rec.php - - - - message: '#^Variable \$ref_fournisseur might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/facture/card-rec.php - - message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#' identifier: greater.alwaysFalse @@ -19686,60 +17658,12 @@ parameters: count: 2 path: ../../../htdocs/fourn/facture/card.php - - - message: '#^Parameter \#1 \$hour of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 6 - path: ../../../htdocs/fourn/facture/card.php - - - - message: '#^Parameter \#2 \$minute of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 6 - path: ../../../htdocs/fourn/facture/card.php - - - - message: '#^Parameter \#3 \$second of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/fourn/facture/card.php - - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 6 - path: ../../../htdocs/fourn/facture/card.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 6 - path: ../../../htdocs/fourn/facture/card.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 6 - path: ../../../htdocs/fourn/facture/card.php - - - - message: '#^Property CommonObject\:\:\$cond_reglement_id \(int\) does not accept array\\|string\.$#' - identifier: assign.propertyType - count: 2 - path: ../../../htdocs/fourn/facture/card.php - - message: '#^Property CommonObject\:\:\$fk_project \(int\) does not accept null\.$#' identifier: assign.propertyType count: 1 path: ../../../htdocs/fourn/facture/card.php - - - message: '#^Property CommonObject\:\:\$mode_reglement_id \(int\) does not accept array\\|string\.$#' - identifier: assign.propertyType - count: 2 - path: ../../../htdocs/fourn/facture/card.php - - message: '#^Variable \$backtopageforcancel in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable @@ -19764,12 +17688,6 @@ parameters: count: 2 path: ../../../htdocs/fourn/facture/card.php - - - message: '#^Variable \$vat_reverse_charge might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/facture/card.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -19842,18 +17760,6 @@ parameters: count: 1 path: ../../../htdocs/fourn/facture/list.php - - - message: '#^Variable \$numprlv might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/facture/list.php - - - - message: '#^Variable \$soc might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/facture/list.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -19908,12 +17814,6 @@ parameters: count: 1 path: ../../../htdocs/fourn/paiement/card.php - - - message: '#^Variable \$title_button might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/paiement/card.php - - message: '#^Variable \$object might not be defined\.$#' identifier: variable.undefined @@ -19944,36 +17844,6 @@ parameters: count: 1 path: ../../../htdocs/fourn/product/list.php - - - message: '#^Variable \$result2 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/ftp/admin/ftpclient.php - - - - message: '#^Variable \$result3 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/ftp/admin/ftpclient.php - - - - message: '#^Variable \$result4 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/ftp/admin/ftpclient.php - - - - message: '#^Variable \$result5 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/ftp/admin/ftpclient.php - - - - message: '#^Variable \$result6 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/ftp/admin/ftpclient.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -20004,12 +17874,6 @@ parameters: count: 3 path: ../../../htdocs/ftp/index.php - - - message: '#^Variable \$newsectioniso might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/ftp/index.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -20022,42 +17886,12 @@ parameters: count: 1 path: ../../../htdocs/holiday/card_group.php - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/holiday/card_group.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/holiday/card_group.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/holiday/card_group.php - - - - message: '#^Variable \$endhalfdaykey might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/holiday/card_group.php - - message: '#^Variable \$errors might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/holiday/card_group.php - - - message: '#^Variable \$starthalfdaykey might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/holiday/card_group.php - - message: '#^Call to function method_exists\(\) with \$this\(Holiday\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -20094,12 +17928,6 @@ parameters: count: 3 path: ../../../htdocs/holiday/class/holiday.class.php - - - message: '#^Parameter \#4 \$new_solde of method Holiday\:\:addLogCP\(\) expects int, float given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/holiday/class/holiday.class.php - - message: '#^Property Holiday\:\:\$events has no type specified\.$#' identifier: missingType.property @@ -20148,12 +17976,6 @@ parameters: count: 1 path: ../../../htdocs/holiday/define_holiday.php - - - message: '#^Variable \$arraydata might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/holiday/list.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -20721,7 +18543,7 @@ parameters: - message: '#^Variable \$line might not be defined\.$#' identifier: variable.undefined - count: 13 + count: 12 path: ../../../htdocs/hrm/core/tpl/objectline_view.tpl.php - @@ -20808,12 +18630,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/index.php - - - message: '#^Variable \$newcardbutton might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/hrm/job_agenda.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -21294,18 +19110,6 @@ parameters: count: 8 path: ../../../htdocs/install/fileconf.php - - - message: '#^Variable \$testclass might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/install/fileconf.php - - - - message: '#^Variable \$testfunction might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/install/fileconf.php - - message: '#^Instanceof between mod_syslog_file and LogHandler will always evaluate to true\.$#' identifier: instanceof.alwaysTrue @@ -21396,18 +19200,6 @@ parameters: count: 4 path: ../../../htdocs/install/repair.php - - - message: '#^Variable \$methodtofix might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/install/repair.php - - - - message: '#^Variable \$object_instance might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/install/repair.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -21540,12 +19332,6 @@ parameters: count: 1 path: ../../../htdocs/install/step2.php - - - message: '#^Variable \$buffer might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/install/step2.php - - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined @@ -21564,12 +19350,6 @@ parameters: count: 1 path: ../../../htdocs/install/step2.php - - - message: '#^Variable \$dir might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/install/step2.php - - message: '#^Variable \$dolibarr_main_db_prefix might not be defined\.$#' identifier: variable.undefined @@ -21588,12 +19368,6 @@ parameters: count: 3 path: ../../../htdocs/install/step2.php - - - message: '#^Variable \$versionarray might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/install/step2.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -21828,12 +19602,6 @@ parameters: count: 2 path: ../../../htdocs/install/upgrade.php - - - message: '#^Variable \$versionarray might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/install/upgrade.php - - message: '#^Call to function is_array\(\) with array\, array\{mixed, mixed, mixed\}\> will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -21984,12 +19752,6 @@ parameters: count: 1 path: ../../../htdocs/intracommreport/class/intracommreport.class.php - - - message: '#^Parameter \#3 \$period_reference of method IntracommReport\:\:addItemsFact\(\) expects int, string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/intracommreport/class/intracommreport.class.php - - message: '#^Variable \$url in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -22332,36 +20094,6 @@ parameters: count: 1 path: ../../../htdocs/loan/payment/payment.php - - - message: '#^Variable \$amount_capital might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/loan/payment/payment.php - - - - message: '#^Variable \$amount_insurance might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/loan/payment/payment.php - - - - message: '#^Variable \$amount_interest might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/loan/payment/payment.php - - - - message: '#^Variable \$line_id might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/loan/payment/payment.php - - - - message: '#^Variable \$sumpaid might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/loan/payment/payment.php - - message: '#^Variable \$result might not be defined\.$#' identifier: variable.undefined @@ -22422,18 +20154,6 @@ parameters: count: 1 path: ../../../htdocs/main.inc.php - - - message: '#^Parameter \#1 \$var of function analyseVarsForSqlAndScriptsInjection expects array\\|string, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/main.inc.php - - - - message: '#^Parameter \#1 \$var of function analyseVarsForSqlAndScriptsInjection expects array\\|string, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/main.inc.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -22488,24 +20208,12 @@ parameters: count: 2 path: ../../../htdocs/margin/customerMargins.php - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/margin/customerMargins.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse count: 1 path: ../../../htdocs/margin/customerMargins.php - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/margin/productMargins.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -22590,12 +20298,6 @@ parameters: count: 1 path: ../../../htdocs/modulebuilder/index.php - - - message: '#^If condition is always true\.$#' - identifier: if.alwaysTrue - count: 1 - path: ../../../htdocs/modulebuilder/index.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -22638,12 +20340,6 @@ parameters: count: 1 path: ../../../htdocs/modulebuilder/index.php - - - message: '#^Variable \$content might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/modulebuilder/index.php - - message: '#^Variable \$field might not be defined\.$#' identifier: variable.undefined @@ -22677,7 +20373,7 @@ parameters: - message: '#^Variable \$outputfilezip might not be defined\.$#' identifier: variable.undefined - count: 3 + count: 1 path: ../../../htdocs/modulebuilder/index.php - @@ -22776,12 +20472,6 @@ parameters: count: 3 path: ../../../htdocs/modulebuilder/template/class/api_mymodule.class.php - - - message: '#^Parameter \#1 \$data of method MyModuleApi\:\:_validateMyObject\(\) expects array\, list\\|null given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/modulebuilder/template/class/api_mymodule.class.php - - message: '#^Result of && is always false\.$#' identifier: booleanAnd.alwaysFalse @@ -22884,12 +20574,6 @@ parameters: count: 1 path: ../../../htdocs/modulebuilder/template/class/myobject.class.php - - - message: '#^Parameter \#1 \$params of method MyObject\:\:getTooltipContentArray\(\) expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/modulebuilder/template/class/myobject.class.php - - message: '#^Property CommonObject\:\:\$isextrafieldmanaged \(int\<0, 1\>\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -22920,30 +20604,6 @@ parameters: count: 1 path: ../../../htdocs/modulebuilder/template/core/modules/modMyModule.class.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, MyObject given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php - - message: '#^Property MyObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -23232,54 +20892,6 @@ parameters: count: 3 path: ../../../htdocs/mrp/class/api_mos.class.php - - - message: '#^Method Mos\:\:_validate\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/mrp/class/api_mos.class.php - - - - message: '#^Method Mos\:\:_validate\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/mrp/class/api_mos.class.php - - - - message: '#^Method Mos\:\:delete\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/mrp/class/api_mos.class.php - - - - message: '#^Method Mos\:\:index\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/mrp/class/api_mos.class.php - - - - message: '#^Method Mos\:\:post\(\) has parameter \$request_data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/mrp/class/api_mos.class.php - - - - message: '#^Method Mos\:\:produceAndConsume\(\) has parameter \$request_data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/mrp/class/api_mos.class.php - - - - message: '#^Method Mos\:\:produceAndConsumeAll\(\) has parameter \$request_data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/mrp/class/api_mos.class.php - - - - message: '#^Method Mos\:\:put\(\) has parameter \$request_data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/mrp/class/api_mos.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -23454,12 +21066,6 @@ parameters: count: 1 path: ../../../htdocs/mrp/mo_card.php - - - message: '#^Variable \$titlelist might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/mrp/mo_card.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -23490,12 +21096,6 @@ parameters: count: 1 path: ../../../htdocs/mrp/mo_movements.php - - - message: '#^Variable \$movement might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/mrp/mo_movements.php - - message: '#^Variable \$text might not be defined\.$#' identifier: variable.undefined @@ -23628,36 +21228,12 @@ parameters: count: 1 path: ../../../htdocs/opcachepreload.php - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/opensurvey/card.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/opensurvey/card.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/opensurvey/card.php - - message: '#^Variable \$id might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/opensurvey/card.php - - - message: '#^Variable \$userstatic might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/opensurvey/card.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -23671,14 +21247,14 @@ parameters: path: ../../../htdocs/opensurvey/class/opensurveysondage.class.php - - message: '#^Method Opensurveysondage\:\:fetchAll\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue + message: '#^Negated boolean expression is always true\.$#' + identifier: booleanNot.alwaysTrue count: 1 path: ../../../htdocs/opensurvey/class/opensurveysondage.class.php - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue + message: '#^PHPDoc type array\\> of property Opensurveysondage\:\:\$lines is not covariant with PHPDoc type array\ of overridden property CommonObject\:\:\$lines\.$#' + identifier: property.phpDocType count: 1 path: ../../../htdocs/opensurvey/class/opensurveysondage.class.php @@ -23742,12 +21318,6 @@ parameters: count: 1 path: ../../../htdocs/opensurvey/results.php - - - message: '#^Variable \$cleinsertion might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/opensurvey/results.php - - message: '#^Variable \$erreur_ajout_date in isset\(\) always exists and is not nullable\.$#' identifier: isset.variable @@ -23760,42 +21330,6 @@ parameters: count: 1 path: ../../../htdocs/opensurvey/results.php - - - message: '#^Variable \$meilleurecolonne might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/opensurvey/results.php - - - - message: '#^Variable \$modifier might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/opensurvey/results.php - - - - message: '#^Variable \$userstatic might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/opensurvey/results.php - - - - message: '#^Variable \$allow_comments might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/opensurvey/wizard/create_survey.php - - - - message: '#^Variable \$allow_spy might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/opensurvey/wizard/create_survey.php - - - - message: '#^Variable \$champdatefin might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/opensurvey/wizard/create_survey.php - - message: '#^Left side of && is always false\.$#' identifier: booleanAnd.leftAlwaysFalse @@ -24798,12 +22332,6 @@ parameters: count: 1 path: ../../../htdocs/product/inventory/inventory.php - - - message: '#^Offset ''help'' on array\{label\: string, checked\: string, enabled\?\: string, type\?\: string, langfile\?\: string\} in empty\(\) does not exist\.$#' - identifier: empty.offset - count: 1 - path: ../../../htdocs/product/list.php - - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue @@ -25236,12 +22764,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/class/mouvementstock.class.php - - - message: '#^Variable \$fk_product_stock might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/product/stock/class/mouvementstock.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -25392,12 +22914,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/list.php - - - message: '#^Variable \$totalnboflines might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/product/stock/list.php - - message: '#^Comparison operation "\<" between 0 and 0 is always false\.$#' identifier: smaller.alwaysFalse @@ -25914,24 +23430,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/tpl/extrafields_add.tpl.php - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/product/stock/tpl/stockcorrection.tpl.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/product/stock/tpl/stockcorrection.tpl.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/product/stock/tpl/stockcorrection.tpl.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -25974,12 +23472,6 @@ parameters: count: 1 path: ../../../htdocs/projet/activity/perday.php - - - message: '#^Parameter \#13 \$arrayfields of function projectLinesPerDay expects array\, array\\> given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/projet/activity/perday.php - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' identifier: argument.type @@ -26046,12 +23538,6 @@ parameters: count: 1 path: ../../../htdocs/projet/activity/permonth.php - - - message: '#^Parameter \#14 \$arrayfields of function projectLinesPerMonth expects array\, array\\> given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/projet/activity/permonth.php - - message: '#^Parameter \#7 \$projectsrole of function projectLinesPerMonth expects string, array\\|int given\.$#' identifier: argument.type @@ -26106,12 +23592,6 @@ parameters: count: 1 path: ../../../htdocs/projet/activity/perweek.php - - - message: '#^Parameter \#13 \$arrayfields of function projectLinesPerWeek expects array\, array\\> given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/projet/activity/perweek.php - - message: '#^Parameter \#7 \$projectsrole of function projectLinesPerWeek expects string, array\\|int given\.$#' identifier: argument.type @@ -26478,30 +23958,6 @@ parameters: count: 1 path: ../../../htdocs/projet/element.php - - - message: '#^PHPDoc tag @var has invalid value \(\$loanSchedule LoanSchedule\)\: Unexpected token "\$loanSchedule", expected type at offset 20 on line 2$#' - identifier: phpDoc.parseError - count: 1 - path: ../../../htdocs/projet/element.php - - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/projet/element.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/projet/element.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/projet/element.php - - message: '#^Variable \$margin in isset\(\) always exists and is not nullable\.$#' identifier: isset.variable @@ -26724,12 +24180,6 @@ parameters: count: 1 path: ../../../htdocs/projet/tasks.php - - - message: '#^Parameter \#13 \$arrayfields of function projectLinesa expects array\, array\\> given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/projet/tasks.php - - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue @@ -28482,24 +25932,6 @@ parameters: count: 1 path: ../../../htdocs/reception/dispatch.php - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/reception/dispatch.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/reception/dispatch.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 4 - path: ../../../htdocs/reception/dispatch.php - - message: '#^Variable \$modebatch might not be defined\.$#' identifier: variable.undefined @@ -28848,30 +26280,6 @@ parameters: count: 1 path: ../../../htdocs/recruitment/class/recruitmentjobposition.class.php - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, RecruitmentJobPosition given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php - - - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_object\(\) expects CommonObject, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php - - - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php - - - - message: '#^Parameter \#3 \$object of function complete_substitutions_array expects CommonObject\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: ../../../htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php - - message: '#^Property RecruitmentJobPosition\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -28950,12 +26358,6 @@ parameters: count: 1 path: ../../../htdocs/recruitment/recruitmentcandidature_card.php - - - message: '#^Variable \$formquestion might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/recruitment/recruitmentcandidature_card.php - - message: '#^Variable \$text might not be defined\.$#' identifier: variable.undefined @@ -29556,18 +26958,6 @@ parameters: count: 1 path: ../../../htdocs/salaries/virement_request.php - - - message: '#^Variable \$resteapayer might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/salaries/virement_request.php - - - - message: '#^Variable \$result might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/salaries/virement_request.php - - message: '#^Variable \$mc might not be defined\.$#' identifier: variable.undefined @@ -29685,7 +27075,7 @@ parameters: - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue - count: 4 + count: 3 path: ../../../htdocs/societe/card.php - @@ -30222,12 +27612,6 @@ parameters: count: 1 path: ../../../htdocs/stripe/class/stripe.class.php - - - message: '#^Variable \$invoice might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/stripe/class/stripe.class.php - - message: '#^Variable \$setupintent in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable @@ -30816,12 +28200,6 @@ parameters: count: 1 path: ../../../htdocs/theme/eldy/dropdown.inc.php - - - message: '#^Parameter \#2 \$steps of function colorAdjustBrightness expects int, string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/theme/eldy/global.inc.php - - message: '#^Variable \$theme might not be defined\.$#' identifier: variable.undefined @@ -31020,12 +28398,6 @@ parameters: count: 1 path: ../../../htdocs/ticket/card.php - - - message: '#^Variable \$limit might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/ticket/card.php - - message: '#^Variable \$mine might not be defined\.$#' identifier: variable.undefined @@ -31116,12 +28488,6 @@ parameters: count: 1 path: ../../../htdocs/ticket/class/api_tickets.class.php - - - message: '#^Variable \$user_action might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/ticket/class/api_tickets.class.php - - message: '#^Call to function property_exists\(\) with CTicketCategory and ''date_creation'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -31440,36 +28806,12 @@ parameters: count: 1 path: ../../../htdocs/user/bank.php - - - message: '#^Variable \$content might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/user/bank.php - - message: '#^Variable \$countrynotdefined might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/user/bank.php - - - message: '#^Variable \$moreparam might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/user/bank.php - - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/user/bank.php - - - - message: '#^Variable \$size might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/user/bank.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -31488,18 +28830,6 @@ parameters: count: 7 path: ../../../htdocs/user/card.php - - - message: '#^Variable \$dolibarr_main_authentication might not be defined\.$#' - identifier: variable.undefined - count: 12 - path: ../../../htdocs/user/card.php - - - - message: '#^Variable \$formproduct might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/user/card.php - - message: '#^Variable \$mc might not be defined\.$#' identifier: variable.undefined @@ -32436,36 +29766,6 @@ parameters: count: 1 path: ../../../htdocs/website/class/website.class.php - - - message: '#^Variable \$aliasesarray might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/website/class/website.class.php - - - - message: '#^Variable \$destdir might not be defined\.$#' - identifier: variable.undefined - count: 13 - path: ../../../htdocs/website/class/website.class.php - - - - message: '#^Variable \$destdirrel might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/website/class/website.class.php - - - - message: '#^Variable \$maxrowid might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/website/class/website.class.php - - - - message: '#^Variable \$newidforhome might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/website/class/website.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -32736,12 +30036,6 @@ parameters: count: 2 path: ../../../htdocs/workstation/workstation_card.php - - - message: '#^Variable \$formquestion might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/workstation/workstation_card.php - - message: '#^Variable \$upload_dir might not be defined\.$#' identifier: variable.undefined diff --git a/dev/initdemo/mysqldump_dolibarr_21.0.0.sql b/dev/initdemo/mysqldump_dolibarr_21.0.0.sql index 8beb53eac6f..9b6c75e5123 100644 --- a/dev/initdemo/mysqldump_dolibarr_21.0.0.sql +++ b/dev/initdemo/mysqldump_dolibarr_21.0.0.sql @@ -60051,15 +60051,6 @@ INSERT INTO `llx_const` VALUES (12776,'MAIN_VERSION_LAST_UPGRADE',0,'21.0.0','chaine',0,'Dolibarr version for last upgrade','2025-01-06 15:48:34'), (12777,'MAIN_FIRST_PING_OK_DATE',2,'20250106154835','chaine',0,'','2025-01-06 15:48:35'), (12778,'MAIN_FIRST_PING_OK_ID',2,'disabled','chaine',0,'','2025-01-06 15:48:35'), -(12781,'MAIN_MODULE_MULTICOMPANY',0,'1','string',0,'{\"authorid\":\"12\",\"ip\":\"127.0.0.1\",\"lastactivationversion\":\"18.0.1\"}','2025-01-06 15:50:14'), -(12782,'MAIN_MODULE_MULTICOMPANY_LOGIN',0,'1','chaine',0,NULL,'2025-01-06 15:50:14'), -(12783,'MAIN_MODULE_MULTICOMPANY_TRIGGERS',0,'1','chaine',0,NULL,'2025-01-06 15:50:14'), -(12784,'MAIN_MODULE_MULTICOMPANY_HOOKS',0,'[\"login\",\"main\",\"mainloginpage\",\"upgrade\",\"upgrade2\",\"cashdeskloginpage\",\"passwordforgottenpage\",\"toprightmenu\",\"adminmodules\",\"admincompany\",\"commonobject\",\"thirdpartiesindex\",\"commercialindex\",\"globalcard\",\"thirdpartycard\",\"thirdpartycontact\",\"thirdpartylist\",\"customerlist\",\"prospectlist\",\"supplierlist\",\"usercard\",\"userperms\",\"groupcard\",\"groupperms\",\"userlist\",\"userhome\",\"userdao\",\"contactlist\",\"contactprospectlist\",\"contactcustomerlist\",\"contactsupplierlist\",\"contactotherlist\",\"productindex\",\"productcard\",\"productservicelist\",\"pricesuppliercard\",\"productreassortlist\",\"propalcard\",\"propallist\",\"ordercard\",\"orderlist\",\"invoicecard\",\"invoicelist\",\"warehousecard\",\"stocklist\",\"memberlist\",\"membercard\",\"projectlist\",\"projectcard\",\"accountancyadminaccount\"]','chaine',0,NULL,'2025-01-06 15:50:14'), -(12785,'MAIN_MODULE_MULTICOMPANY_CSS',0,'/multicompany/css/multicompany.css.php','chaine',0,NULL,'2025-01-06 15:50:14'), -(12786,'MAIN_MODULE_MULTICOMPANY_SUBSTITUTIONS',0,'/multicompany/core/substitutions/','chaine',0,NULL,'2025-01-06 15:50:14'), -(12787,'MULTICOMPANY_MAIN_VERSION',0,'18.0.1','chaine',0,NULL,'2025-01-06 15:50:14'), -(12788,'MULTICOMPANY_EXTERNAL_MODULES_SHARING',0,'','chaine',0,NULL,'2025-01-06 15:50:14'), -(12789,'MULTICOMPANY_PMP_PER_ENTITY_ENABLED',0,'1','chaine',0,NULL,'2025-01-06 15:50:14'), (12790,'MAIN_IHM_PARAMS_REV',2,'1','chaine',0,'','2025-01-06 15:50:15'), (12791,'MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT',2,'commonkanban','chaine',0,'','2025-01-06 15:50:15'), (12792,'MAIN_FIRST_PING_OK_DATE',1,'20250106155034','chaine',0,'','2025-01-06 15:50:34'), diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index 687afec36f4..9eee54b90d6 100644 --- a/dev/tools/codespell/codespell-lines-ignore.txt +++ b/dev/tools/codespell/codespell-lines-ignore.txt @@ -1,13 +1,10 @@ $objMod->dictionaries = $objMod->{"dictionnaries"}; // For backward compatibility if (empty($objMod->dictionaries) && !empty($objMod->{"dictionnaries"})) { print 'id.'&token='.newToken().'">'; - $object->date_ech = $object->periode; $reponsesadd = str_split($obj->reponses); $sql .= " SET reponses = '".$db->escape($reponsesadd)."'"; $sql .= " SET reponses = '0".$db->escape($obj->reponses)."'"; $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0); - //$pice = ''; - //$typea = ($objp->typea == 'birth') ? $picb : $pice; print ''; $dateemail = dol_stringtotime((string) $overview[0]->udate, 'gmt'); $pice = ''; @@ -33,7 +30,6 @@ print ''.$langs->trans("TransferStock").''; $action = 'transfert'; $date_com = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); - $date_next_execution = (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear); $datesubscription = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $ensemblereponses = $obj->reponses; @@ -55,7 +51,6 @@ preg_match('/:([!<>=\s]+|in|notin|like|notlike):/', $tmpcrit, $reg); print ''.$langs->trans("TransferStock").''; print ''.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).''; - print ''.dol_print_date($db->jdate($obj->period), 'day').''; "sme", $action = 'transfert'; $cle_rib = strtolower(checkES($rib, $CCC)); @@ -71,7 +66,6 @@ $reday = GETPOSTINT('reday'); $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; - $sql .= ", '".$this->db->idate($this->period)."'"; $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode as period, cs.import_key"; $sql .= ", periode = '".$this->db->idate($this->period ? $this->period : $this->periode)."'"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)"; @@ -82,14 +76,11 @@ $this->periode = $this->date_creation + 3600 * 24 * 30; $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Referers'); $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Referers'); - $title = $langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime"); if (!empty($arrayfields['cs.periode']['checked'])) { if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) { if ($user->hasRight('stock', 'mouvement', 'creer')) { if (GETPOSTISSET("reday") && GETPOSTISSET("remonth") && GETPOSTISSET("reyear")) { - if (empty($reyear) || empty($remonth) || empty($reday)) { * @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing. - $datepaid = dol_mktime(12, 0, 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); $datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $datepaye = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $datepaye = dol_mktime(GETPOSTINT("rehour"), GETPOSTINT("remin"), GETPOSTINT("resec"), GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); @@ -100,7 +91,6 @@ $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', $val); $opensurveysondage->mail_admin = $_SESSION['adresse']; $pdf->SetXY($savx, $savy); - $reday = GETPOST('reday'); $savy = $pdf->getY(); $somethingshown = $formactions->showactions($object, 'mouvement', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; @@ -125,7 +115,6 @@ print ''; print ''; print ''."\n"; print ''."\n"; + print ''; + print ''; print ''."\n"; print dol_get_fiche_head(); @@ -519,7 +527,7 @@ if ($action == 'create') { $head = array(); $h = 0; - $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.((int) $object->piece_num).($mode ? '&mode='.$mode : ''); + $head[$h][0] = DOL_URL_ROOT."/accountancy/bookkeeping/card.php".'?piece_num='.((int) $object->piece_num).($mode ? '&mode='.$mode : '').($type ? '&type='.$type : '').'&backtopage='.urlencode($backtopage); $head[$h][1] = $langs->trans("Transaction"); $head[$h][2] = 'transaction'; $h++; @@ -571,6 +579,8 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -602,6 +612,8 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; + print ''; print $form->selectDate($object->doc_date ? $object->doc_date : -1, 'doc_date', 0, 0, 0, "setdate"); print ''; print ''; @@ -613,7 +625,7 @@ if ($action == 'create') { // Journal print ''; - print '
'; + print ''; if ($action != 'editjournal') { @@ -633,6 +645,8 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; + print ''; print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, 0, 1, 1); print ''; print ''; @@ -808,6 +822,8 @@ if ($action == 'create') { print ''."\n"; print ''."\n"; print ''."\n"; + print ''; + print ''; if (count($object->linesmvt) > 0) { print '
'; @@ -964,13 +980,13 @@ if ($action == 'create') { if (empty($total_debit) && empty($total_credit)) { print ''; } elseif ($total_debit == $total_credit) { - print ''.$langs->trans("ValidTransaction").''; + print ''.$langs->trans("ValidTransaction").''; } else { print ''; } print '   '; - print ''.$langs->trans("Cancel").''; + print ''.$langs->trans("Cancel").''; print "
"; } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 60409e47f0f..4b4f57cc3b1 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -843,12 +843,12 @@ if (empty($reshook)) { $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub'.$param, '', 1, array('morecss' => 'marginleftonly')); - $url = './card.php?action=create'; + $url = './card.php?action=create'.(!empty($type)?'&type=sub':'').'&backtopage='.urlencode($_SERVER['PHP_SELF']); if (!empty($socid)) { $url .= '&socid='.$socid; } $newcardbutton .= dolGetButtonTitleSeparator(); - $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->hasRight('accounting', 'mouvements', 'creer')); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $permissiontoadd); } print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 8f9d300d893..ba17782a8b0 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -796,7 +796,7 @@ if (empty($reshook)) { } $newcardbutton .= dolGetButtonTitleSeparator(); } - $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'.(!empty($type)?'&type=sub':'').'&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 379e2b802e1..fbbdb35e7a8 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -439,7 +439,7 @@ class AccountancyCategory // extends CommonObject { global $conf; $sql = "SELECT t.rowid, t.account_number, t.label"; - $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; + $sql .= " FROM ".$this->db->prefix()."accounting_account as t"; $sql .= " WHERE t.fk_accounting_category = ".((int) $id); $sql .= " AND t.entity = ".$conf->entity; diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index a35235e0218..4394a0eac2a 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2017-2024 Frédéric France * Copyright (C) 2017 André Schild * Copyright (C) 2020 Guillaume Alexandre - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -109,7 +109,7 @@ class AccountancyImport $amount = (float) price2num($arrayrecord[$credit_index]['val']); } - return "'" . $this->db->escape(abs($amount)) . "'"; + return "'" . $this->db->escape((string) abs($amount)) . "'"; } return "''"; @@ -117,12 +117,12 @@ class AccountancyImport /** - * Compute direction + * Compute direction * * @param array}> $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]... * @param array $listfields Fields list to add * @param int $record_key Record key - * @return string Value + * @return string Value D or C or "" */ public function computeDirection(&$arrayrecord, $listfields, $record_key) { @@ -139,7 +139,7 @@ class AccountancyImport return $sens; } - return "''"; + return ""; } /** diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index e1934a31b0e..d2217e62654 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -5,6 +5,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -429,10 +430,10 @@ if ($resql) { $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); - print ''; // Preview diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 3e9335a30d1..82cf1ba1d43 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -8,7 +8,7 @@ * Copyright (C) 2015-2024 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Waël Almoman - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1563,14 +1563,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $fullname = $object->getFullName($langs); if ($object->morphy == 'mor') { - $companyname = $object->company; + $companyname = (string) $object->company; if (!empty($fullname)) { - $companyalias = $fullname; + $companyalias = (string) $fullname; } } else { $companyname = $fullname; if (!empty($object->company)) { - $companyalias = $object->company; + $companyalias = (string) $object->company; } } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index ddc70d21c85..bcd8753aa95 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -15,7 +15,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021 Waël Almoman * Copyright (C) 2021 Philippe Grand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -317,38 +317,76 @@ class Adherent extends CommonObject /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * 'type' field format: + * 'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', + * 'select' (list of values are in 'options'. for integer list of values are in 'arrayofkeyval'), + * 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:CategoryIdType[:CategoryIdList[:SortField]]]]]]', + * 'chkbxlst:...', + * 'varchar(x)', + * 'text', 'text:none', 'html', + * 'double(24,8)', 'real', 'price', 'stock', + * 'date', 'datetime', 'timestamp', 'duration', + * 'boolean', 'checkbox', 'radio', 'array', + * 'mail', 'phone', 'url', 'password', 'ip' + * Note: Filter must be a Dolibarr Universal Filter syntax string. Example: "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.status:!=:0) or (t.nature:is:NULL)" + * 'length' the length of field. Example: 255, '24,8' + * 'label' the translation key. + * 'alias' the alias used into some old hard coded SQL requests + * 'picto' is code of a picto to show before value in forms + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalInt("MY_SETUP_PARAM")' or 'isModEnabled("multicurrency")' ...) + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'alwayseditable' says if field can be modified also when status is not draft ('1' or '0') + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommended to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage) + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' + * 'placeholder' to set the placeholder of a varchar field. + * 'help' and 'helplist' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code like the constructor of the class. + * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'validate' is 1 if you need to validate the field with $this->validateField(). Need MAIN_ACTIVATE_VALIDATION_RESULT. + * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value) + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'default' => '1', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 12, 'index' => 1), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => 3, 'notnull' => 1, 'position' => 15, 'index' => 1), 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'RefExt', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25), 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'showoncombobox' => 1), 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 1, 'position' => 35, 'showoncombobox' => 1), 'login' => array('type' => 'varchar(50)', 'label' => 'Login', 'enabled' => 1, 'visible' => 1, 'position' => 40), - 'pass' => array('type' => 'varchar(50)', 'label' => 'Pass', 'enabled' => 1, 'visible' => -1, 'position' => 45), - 'pass_crypted' => array('type' => 'varchar(128)', 'label' => 'Pass crypted', 'enabled' => 1, 'visible' => -1, 'position' => 50), + 'pass' => array('type' => 'varchar(50)', 'label' => 'Pass', 'enabled' => 1, 'visible' => 3, 'position' => 45), + 'pass_crypted' => array('type' => 'varchar(128)', 'label' => 'Pass crypted', 'enabled' => 1, 'visible' => 3, 'position' => 50), 'morphy' => array('type' => 'varchar(3)', 'label' => 'MemberNature', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 55), - 'fk_adherent_type' => array('type' => 'integer', 'label' => 'Fk adherent type', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 60), + 'fk_adherent_type' => array('type' => 'integer', 'label' => 'MemberType', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 60), 'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => 1, 'position' => 65, 'showoncombobox' => 2), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => 1, 'position' => 70), 'address' => array('type' => 'text', 'label' => 'Address', 'enabled' => 1, 'visible' => -1, 'position' => 75), 'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80), 'town' => array('type' => 'varchar(50)', 'label' => 'Town', 'enabled' => 1, 'visible' => -1, 'position' => 85), - 'state_id' => array('type' => 'integer', 'label' => 'State id', 'enabled' => 1, 'visible' => -1, 'position' => 90), + 'state_id' => array('type' => 'integer', 'label' => 'State', 'enabled' => 1, 'visible' => -1, 'position' => 90), 'country' => array('type' => 'integer:Ccountry:core/class/ccountry.class.php', 'label' => 'Country', 'enabled' => 1, 'visible' => 1, 'position' => 95), 'phone' => array('type' => 'varchar(30)', 'label' => 'Phone', 'enabled' => 1, 'visible' => -1, 'position' => 115), 'phone_perso' => array('type' => 'varchar(30)', 'label' => 'Phone perso', 'enabled' => 1, 'visible' => -1, 'position' => 120), 'phone_mobile' => array('type' => 'varchar(30)', 'label' => 'Phone mobile', 'enabled' => 1, 'visible' => -1, 'position' => 125), 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => 1, 'position' => 126), 'url' => array('type' => 'varchar(255)', 'label' => 'Url', 'enabled' => 1, 'visible' => -1, 'position' => 127), - 'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 128), + 'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => 3, 'position' => 128), 'birth' => array('type' => 'date', 'label' => 'DateOfBirth', 'enabled' => 1, 'visible' => -1, 'position' => 130), 'gender' => array('type' => 'varchar(10)', 'label' => 'Gender', 'enabled' => 1, 'visible' => -1, 'position' => 132), 'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135), - 'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145), + 'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => 3, 'notnull' => 1, 'position' => 145), 'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => 1, 'position' => 150), 'default_lang' => array('type' => 'varchar(6)', 'label' => 'Default lang', 'enabled' => 1, 'visible' => -1, 'position' => 153), 'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155), @@ -356,13 +394,13 @@ class Adherent extends CommonObject 'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 175), - 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fk user author', 'enabled' => 1, 'visible' => -1, 'position' => 180), - 'fk_user_mod' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fk user mod', 'enabled' => 1, 'visible' => -1, 'position' => 185), - 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 190), - 'canvas' => array('type' => 'varchar(32)', 'label' => 'Canvas', 'enabled' => 1, 'visible' => -1, 'position' => 195), - 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 500, 'arrayofkeyval' => array(-1 => 'Draft', 1 => 'Validated', 0 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')), + 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserCreation', 'enabled' => 1, 'visible' => 3, 'position' => 180), + 'fk_user_mod' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModification', 'enabled' => 1, 'visible' => 3, 'position' => 185), + 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => 3, 'position' => 190), + 'canvas' => array('type' => 'varchar(32)', 'label' => 'Canvas', 'enabled' => 1, 'visible' => 0, 'position' => 195), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 800), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805) + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805), + 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 1000, 'arrayofkeyval' => array(-1 => 'Draft', 1 => 'Validated', 0 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')) ); /** @@ -1660,7 +1698,7 @@ class Adherent extends CommonObject */ public function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0, $fk_type = null) { - global $conf, $langs, $user; + global $user; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; @@ -1691,6 +1729,10 @@ class Adherent extends CommonObject $subscription->note_public = $label; $subscription->fk_type = $fk_type; + if (empty($subscription->user_creation_id)) { + $subscription->user_creation_id = $user->id; + } + $rowid = $subscription->create($user); if ($rowid > 0) { // Update denormalized subscription end date (read database subscription to find values) @@ -3302,7 +3344,7 @@ class Adherent extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 1af9ebd608d..7c431a82063 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2018-2019 Thibault Foucart * Copyright (C) 2021 Waël Almoman * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -299,12 +299,12 @@ class AdherentType extends CommonObject } /** - * Delete a language for this member type - * - * @param string $langtodelete Language code to delete - * @param User $user Object user making delete - * @return int Return integer <0 if KO, >0 if OK - */ + * Delete a language for this member type + * + * @param string $langtodelete Language code to delete + * @param User $user Object user making delete + * @return int Return integer <0 if KO, >0 if OK + */ public function delMultiLangs($langtodelete, $user) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type_lang"; @@ -1001,7 +1001,7 @@ class AdherentType extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index db18500629c..0261be16cb6 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -355,7 +355,7 @@ class Members extends DolibarrApi /** * Create member object * - * @param array $request_data Request data + * @param array $request_data Request data * @phan-param ?array $request_data * @phpstan-param ?array $request_data * @return int ID of member diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 36c10eb7429..68d24732235 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -1,6 +1,7 @@ - * Copyright (C) 2025 MDW + * Copyright (C) 2025 MDW + * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index f31f75ea7b1..c021e335604 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2006-2015 Laurent Destailleur - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -98,7 +98,7 @@ class Subscription extends CommonObject public $fk_bank; /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -155,8 +155,6 @@ class Subscription extends CommonObject $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)"; - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $member = new Adherent($this->db); $result = $member->fetch($this->fk_adherent); @@ -166,11 +164,15 @@ class Subscription extends CommonObject } else { $type = $this->fk_type; } - $sql .= " VALUES (".((int) $this->fk_adherent).", '".$this->db->escape($type)."', '".$this->db->idate($now)."',"; + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note, fk_user_creat)"; + $sql .= " VALUES (".((int) $this->fk_adherent).", '".$this->db->escape((string) $type)."', '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->dateh)."',"; $sql .= " '".$this->db->idate($this->datef)."',"; $sql .= " ".((float) $this->amount).","; - $sql .= " '".$this->db->escape($this->note_public ? $this->note_public : $this->note)."')"; + $sql .= " '".$this->db->escape($this->note_public ? $this->note_public : $this->note)."',"; + $sql .= " ".((int) ($this->user_creation_id > 0 ? $this->user_creation_id : $user->id)); + $sql .= ")"; $resql = $this->db->query($sql); if (!$resql) { @@ -516,8 +518,7 @@ class Subscription extends CommonObject */ public function info($id) { - $sql = 'SELECT c.rowid, c.datec,'; - $sql .= ' c.tms as datem'; + $sql = 'SELECT c.rowid, c.datec, c.tms as datem, c.fk_user_creat'; $sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c'; $sql .= ' WHERE c.rowid = '.((int) $id); @@ -529,6 +530,8 @@ class Subscription extends CommonObject $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->datem); + + $this->user_creation_id = $obj->fk_user_creat; } $this->db->free($resql); @@ -540,9 +543,9 @@ class Subscription extends CommonObject /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{selected:?int,member:?Adherent,bank:?Account} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array{selected?:int|bool,adherent_type?:AdherentType,member?:Adherent,bank?:Account} $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 21f24487c24..5c18a3688d1 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -174,7 +174,7 @@ $arrayfields = array( 'd.company' => array('label' => "Company", 'checked' => 1, 'position' => 70), 'd.login' => array('label' => "Login", 'checked' => 1), 'd.morphy' => array('label' => "MemberNature", 'checked' => 1), - 't.libelle' => array('label' => "Type", 'checked' => 1, 'position' => 55), + 't.libelle' => array('label' => "MemberType", 'checked' => 1, 'position' => 55), 'd.address' => array('label' => "Address", 'checked' => 0), 'd.zip' => array('label' => "Zip", 'checked' => 0), 'd.town' => array('label' => "Town", 'checked' => 0), @@ -199,6 +199,10 @@ $tableprefix = 'd'; foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { + // Special case already added + if (in_array($key, array('fk_adherent_type', 'state_id', 'country'))) { // Already managed by another field key in arrayfields + continue; + } $visible = (int) dol_eval((string) $val['visible'], 1); $arrayfields[$tableprefix.'.'.$key] = array( 'label' => $val['label'], @@ -222,7 +226,6 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); // Security check $result = restrictedArea($user, 'adherent'); - /* * Actions */ diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 5a60b07c223..55cde8bd728 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -559,12 +559,12 @@ if ($object->datefin) { print $langs->trans("SubscriptionNotNeeded"); } elseif (!$adht->subscription) { print $langs->trans("SubscriptionNotRecorded"); - if (Adherent::STATUS_VALIDATED == $object->statut) { + if (Adherent::STATUS_VALIDATED == $object->status) { print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } else { print $langs->trans("SubscriptionNotReceived"); - if (Adherent::STATUS_VALIDATED == $object->statut) { + if (Adherent::STATUS_VALIDATED == $object->status) { print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } @@ -967,8 +967,8 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h $paymentdate = dol_mktime(0, 0, 0, GETPOSTINT('paymentmonth'), GETPOSTINT('paymentday'), GETPOSTINT('paymentyear')); } - print ''; // Date start subscription + print ''; $currentyear = dol_print_date($now, "%Y"); $currentmonth = dol_print_date($now, "%m"); print ''; + print ''; + print ''; // Label print ''; diff --git a/htdocs/adherents/subscription/info.php b/htdocs/adherents/subscription/info.php index 96bed86d3a2..e8046dc3f41 100644 --- a/htdocs/adherents/subscription/info.php +++ b/htdocs/adherents/subscription/info.php @@ -80,7 +80,7 @@ print '
'; $object->info($rowid); -print '
'; print $langs->trans('Codejournal'); print ''; - print price($row[2*$i - 2]); + print ''; + print price($row[2 * $i - 2]); // Add link to make binding - if (!empty(price2num($row[2*$i - 2])) || !empty($row[2*$i - 1])) { + if (!empty(price2num($row[2 * $i - 2])) || !empty($row[2 * $i - 1])) { print ''; print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad((string) $cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); print ''; @@ -672,7 +673,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent ! " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))" ).")", - 0 + '0' ).") AS month".str_pad((string) $j, 2, '0', STR_PAD_LEFT).","; } $sql .= " SUM(".$db->ifsql( @@ -694,7 +695,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))", " (fd.total_ht - (fd.buy_price_ht * fd.qty))" ).")", - 0 + '0' ).") AS month".str_pad((string) $j, 2, '0', STR_PAD_LEFT).","; } $sql .= " SUM(".$db->ifsql( diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 8bd3a2013ea..31a1597eeed 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -10,7 +10,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2020-2024 Frédéric France * Copyright (C) 2023 Waël Almoman - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -461,7 +461,7 @@ foreach ($dirmodels as $reldir) { print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'.$langs->trans("DateSubscription").''; @@ -977,7 +977,10 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h } if (!$datefrom) { // Guess the subscription start date - $datefrom = $object->datevalid; // By default, the subscription start date is the payment date + // By default, the subscription start date is the end date of previous membership ($object->datefin) + 1 day, or the date of + // the validation of the member if no previous date exists. + $datefrom = ($object->datefin ? dol_time_plus_duree($object->datefin, 1, 'd') : $object->datevalid); + if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) { $datefrom = dol_time_plus_duree($now, (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)); } elseif ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > $now) { @@ -1015,7 +1018,8 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h if ($adht->subscription) { // Amount - print '
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency) .'
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency) .'
'.$langs->trans("Label").'
'; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.rowid']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.libelle']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.morphy']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.duration']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.subscription']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.amount']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.caneditamount']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.vote']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.statut']['checked'])) { + print ''; + $totalarray['nbfield']++; } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + $totalarray['nbfield']++; } print "\n"; @@ -397,47 +438,55 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; } } - - print ''; - - print ''; - - print ''; } - print ''; - - print ''; + } + if (!empty($arrayfields['t.morphy']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.duration']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.subscription']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.amount']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.caneditamount']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.vote']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.statut']['checked'])) { + print ''; } - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if ($user->hasRight('adherent', 'configurer')) { print ''; diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 0dbe9d5dc4c..174e71a7516 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -127,7 +127,7 @@ print ''; print ''; print '
'; +print '
'; dol_print_object_info($object); print '
'; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index c34a84824cc..a038e3b11f8 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2023 Laurent Destailleur * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -102,20 +102,20 @@ $fieldstosearchall = array( 'c.note' => "Label", ); $arrayfields = array( - 'd.ref' => array('label' => "Ref", 'checked' => 1), - 'd.fk_type' => array('label' => "Type", 'checked' => 1), - 'd.lastname' => array('label' => "Lastname", 'checked' => 1), - 'd.firstname' => array('label' => "Firstname", 'checked' => 1), - 'd.login' => array('label' => "Login", 'checked' => 1), - 'c.note' => array('label' => "Label", 'checked' => 1), - 'd.bank' => array('label' => "BankAccount", 'checked' => 1, 'enabled' => (isModEnabled('bank'))), + 'd.ref' => array('label' => "Ref", 'checked' => '1'), + 'd.fk_type' => array('label' => "Type", 'checked' => '1'), + 'd.lastname' => array('label' => "Lastname", 'checked' => '1'), + 'd.firstname' => array('label' => "Firstname", 'checked' => '1'), + 'd.login' => array('label' => "Login", 'checked' => '1'), + 'c.note' => array('label' => "Label", 'checked' => '1'), + 'd.bank' => array('label' => "BankAccount", 'checked' => '1', 'enabled' => (string) (int) (isModEnabled('bank'))), /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0), 'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/ - 'c.dateadh' => array('label' => "DateSubscription", 'checked' => 1, 'position' => 100), - 'c.datef' => array('label' => "EndSubscription", 'checked' => 1, 'position' => 101), - 'd.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 102), - 'c.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500), - 'c.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500), + 'c.dateadh' => array('label' => "DateSubscription", 'checked' => '1', 'position' => 100), + 'c.datef' => array('label' => "EndSubscription", 'checked' => '1', 'position' => 101), + 'd.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 102), + 'c.datec' => array('label' => "DateCreation", 'checked' => '0', 'position' => 500), + 'c.tms' => array('label' => "DateModificationShort", 'checked' => '0', 'position' => 500), // 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); @@ -223,7 +223,7 @@ if ($search_ref) { } } if ($search_type > 0) { - $sql .= natural_search(array('c.fk_type'), $search_type); + $sql .= natural_search(array('c.fk_type'), (string) $search_type); } if ($search_lastname) { $sql .= natural_search(array('d.lastname', 'd.societe'), $search_lastname); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 91f105c48b8..7db9917b1d2 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -9,7 +9,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021 Waël Almoman * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -136,6 +136,9 @@ $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); */ $error = 0; +// Selection of new fields +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ""; $search_lastname = ""; @@ -283,6 +286,9 @@ $help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_M llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-type'); $arrayofselected = is_array($toselect) ? $toselect : array(); +$totalarray = [ + 'nbfield' => 0, +]; // List of members type if (!$rowid && $action != 'create' && $action != 'edit') { @@ -329,8 +335,14 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; print ''; + print ''; + print ''; print ''; + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; + $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup + $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); + // $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -341,19 +353,48 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print '
 '.$langs->trans("Ref").''.$langs->trans($arrayfields['t.libelle']['label']).''.$langs->trans("MembersNature").''.$langs->trans("MembershipDuration").''.$langs->trans("SubscriptionRequired").''.$langs->trans("Amount").''.$langs->trans("CanEditAmountShort").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").''.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("MembersNature").''.$langs->trans("MembershipDuration").''.$langs->trans("SubscriptionRequired").''.$langs->trans("Amount").''.$langs->trans("CanEditAmountShort").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").' 
rowid.'">'.img_edit().''; - print $membertype->getNomUrl(1); - //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' - print ''.dol_escape_htmltag($objp->label).''; - if ($objp->morphy == 'phy') { - print $langs->trans("Physical"); - } elseif ($objp->morphy == 'mor') { - print $langs->trans("Moral"); - } else { - print $langs->trans("MorAndPhy"); + if (!empty($arrayfields['t.rowid']['checked'])) { + print ''; + print $membertype->getNomUrl(1); + //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' + print ''; - if ($objp->duration) { - $duration_value = intval($objp->duration); - if ($duration_value > 1) { - $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); + if (!empty($arrayfields['t.libelle']['checked'])) { + print ''.dol_escape_htmltag($objp->label).''; + if ($objp->morphy == 'phy') { + print $langs->trans("Physical"); + } elseif ($objp->morphy == 'mor') { + print $langs->trans("Moral"); } else { - $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); + print $langs->trans("MorAndPhy"); } - $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); - print max(1, $duration_value).' '.$dur[$unit]; + print ''; + if ($objp->duration) { + $duration_value = intval($objp->duration); + if ($duration_value > 1) { + $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); + } else { + $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")); + } + $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); + print max(1, $duration_value).' '.$dur[$unit]; + } + print ''.yn($objp->subscription).''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''.yn($objp->caneditamount).''.yn($objp->vote).''.$membertype->getLibStatut(5).''.yn($objp->subscription).''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''.yn($objp->caneditamount).''.yn($objp->vote).''.$membertype->getLibStatut(5).'rowid.'">'.img_edit().'
'; -print ''."\n"; +print ''."\n"; // Name of Accountant Company print ''; print ''; // Preview @@ -444,8 +444,8 @@ print load_fiche_titre($langs->trans("BankColorizeMovement"), '', ''); print '
'; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyInfo").'
'; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 5f50050e53c..fddb1cf8566 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Charlie Benke * Copyright (C) 2017 Open-DSI - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -320,7 +320,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; print ''.img_object($langs->trans("Preview"), 'pdf').''; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 18b5dff4645..a01086727f0 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -3,7 +3,7 @@ * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -413,7 +413,7 @@ foreach ($dirmodels as $reldir) { //$htmltooltip .= '
' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'."\n"; print ''."\n"; -print ''; -print ''."\n"; +print ''; +print ''."\n"; print "\n"; print ''; print "\n"; @@ -427,7 +427,7 @@ foreach ($dirmodels as $reldir) { $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); print ''; // Preview diff --git a/htdocs/admin/fediverse.php b/htdocs/admin/fediverse.php index e10baa10207..d2848b905ec 100644 --- a/htdocs/admin/fediverse.php +++ b/htdocs/admin/fediverse.php @@ -25,9 +25,9 @@ */ /** - * \file htdocs/admin/faitdivers.php - * \ingroup faitdivers - * \brief Page to setupe module Socialnetworks + * \file htdocs/admin/fediverse.php + * \ingroup fedivers + * \brief Page to setup fedivers in module Socialnetworks */ //load Dolibarr environment diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 9e04a9894da..18c72b62051 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -7,7 +7,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -364,7 +364,7 @@ foreach ($dirmodels as $reldir) { } } print ''; print ''; @@ -503,7 +503,7 @@ foreach ($dirmodels as $reldir) { $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); print ''; // Preview @@ -538,7 +538,7 @@ print '
'; print '
'.$langs->trans("Name").''.$langs->trans("Value").''.$langs->trans("Parameter").'
'; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index a2d261159e0..f425524f3cc 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -450,7 +450,7 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 1c28ed4c482..de147fc81d3 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -283,7 +283,7 @@ foreach ($dirmodels as $reldir) { } print ''; print "\n"; @@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir) { print ''; // Preview @@ -456,7 +456,7 @@ print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print ''; -print ''; +print ''; print "\n"; print "\n"; diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 07f6779fd90..11955d4ae4f 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2022 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -471,7 +471,7 @@ print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; print '
'; -print $form->buttonsSaveCancel("Save", '', array(), 0, 'reposition'); +print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition'); print ''; print "\n".''."\n"; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index a26f0f33af2..75b0e216b27 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -3,7 +3,7 @@ * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -226,7 +226,7 @@ foreach ($dirmodels as $reldir) { } print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); if (getDolGlobalString('CHEQUERECEIPTS_ADDON').'.php' == $file) { // If module is the one used, we show existing errors if (!empty($module->error)) { diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 49cb87e885c..ba4836f815c 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -92,8 +92,8 @@ print ''; print '
'; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index e3d08bb29cb..68856768f08 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -899,7 +899,7 @@ if ($mysoc->country_code == 'GR') { print '
'.$langs->trans("Name").''.$langs->trans("Value").''.$langs->trans("Parameter").'
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index cf91b5fb5cb..d9bd0289527 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -1,7 +1,7 @@ * Copyright (C) 2011-2018 Philippe Grand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -316,7 +316,7 @@ foreach ($dirmodels as $reldir) { } print ''; print ''; @@ -456,7 +456,7 @@ foreach ($dirmodels as $reldir) { print ''; // Preview @@ -497,7 +497,7 @@ print '
'; print '
'.$langs->trans("AccountParameter").''.$langs->trans("Value").'
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print ''; -print ''; +print ''; print "\n"; $substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index 76bfbd63b8f..6099d183348 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -102,7 +102,7 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - print ''; + print ''; foreach ($arrayofparameters as $key => $val) { if (isset($val['enabled']) && empty($val['enabled'])) { @@ -138,7 +138,7 @@ if ($action == 'edit') { print '
'; } else { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print ''; + print ''; foreach ($arrayofparameters as $key => $val) { if (isset($val['enabled']) && empty($val['enabled'])) { diff --git a/htdocs/admin/debugbar.php b/htdocs/admin/debugbar.php index 9d1356362ba..6f77e1ef4e9 100644 --- a/htdocs/admin/debugbar.php +++ b/htdocs/admin/debugbar.php @@ -97,7 +97,7 @@ print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index df90a2a2d62..43f4dffe6d9 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -311,7 +311,7 @@ if ($mode != 'focus' && $mode != 'mandatory') { foreach ($substitutionarray as $key => $val) { $texthelp .= $key.' -> '.$val.'
'; } - $textvalue = $form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip'); + $textvalue = $form->textwithpicto($langs->trans("Value"), $langs->trans("DefaultValuesHelpText")); } else { $texthelp = 'ASC or DESC'; $textvalue = $form->textwithpicto($langs->trans("SortOrder"), $texthelp); @@ -345,6 +345,9 @@ print ''; if ($mode != 'focus' && $mode != 'mandatory') { print ''; } // Limit to superadmin diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index fe17368d821..092ec5bc5fc 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -249,11 +249,11 @@ if ($action == 'edit') { // Show if meteo is enabled print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Parameter").'
'; print ''; + if ($mode != 'sortorder') { + print $form->textwithpicto('', $texthelp, 1, 'list-alt', 'paddingleftimp cursorpointer', 0, 2, 'subsitutiontooltip'); + } print '
'; - print ''; + print ''; print ''; print ''; print '
'.$langs->trans("Option").''.$langs->trans("Value").'
'.$langs->trans("Option").'
'.$langs->trans("MAIN_DISABLE_METEO").''; - print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (!getDolGlobalString('MAIN_DISABLE_METEO') ? 0 : $conf->global->MAIN_DISABLE_METEO)); + print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, getDolGlobalInt('MAIN_DISABLE_METEO')); print '
'; @@ -263,7 +263,7 @@ if ($action == 'edit') { */ print ''; - print ''; + print ''; foreach ($modules as $module => $delays) { if (isModEnabled($module)) { @@ -283,7 +283,7 @@ if ($action == 'edit') { // Show if meteo is enabled print '
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
'.$langs->trans("DelaysOfToleranceBeforeWarning").'
'; - print ''; + print ''; print ''; print ''; print ''; @@ -456,7 +456,7 @@ if (getDolGlobalString('MAIN_SUBMODULE_DELIVERY')) { $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); print ''; // Preview @@ -490,7 +490,7 @@ if (getDolGlobalString('MAIN_SUBMODULE_DELIVERY')) { print '
'.$langs->trans("Option").''.$langs->trans("Value").'
'.$langs->trans("Option").'
'.$langs->trans("MAIN_DISABLE_METEO").''; diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index f8d6c1730ad..95ef16efbad 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -8,7 +8,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -328,7 +328,7 @@ if (getDolGlobalString('MAIN_SUBMODULE_DELIVERY')) { } print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c201ca97b73..cd052b7dde0 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -11,7 +11,7 @@ * Copyright (C) 2011-2024 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2025 Frédéric France * Copyright (C) 2020-2022 Open-Dsi * Copyright (C) 2024 Charlene Benke * Copyright (C) 2024 MDW @@ -716,6 +716,7 @@ if ($id == DICT_TYPE_CONTACT) { 'project_task' => img_picto('', 'projecttask', 'class="pictofixedwidth"').$langs->trans('Task'), 'propal' => img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans('Proposal'), 'commande' => img_picto('', 'order', 'class="pictofixedwidth"').$langs->trans('Order'), + 'shipping' => img_picto('', 'dolly', 'class="pictofixedwidth"') . $langs->trans('Shipment'), 'facture' => img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans('Bill'), 'fichinter' => img_picto('', 'intervention', 'class="pictofixedwidth"').$langs->trans('InterventionCard'), 'contrat' => img_picto('', 'contract', 'class="pictofixedwidth"').$langs->trans('Contract'), @@ -2539,7 +2540,7 @@ if ($id > 0) { } elseif ($value == 'block_if_negative') { $valuetoshow = yn($obj->{$value}); } elseif ($value == 'icon') { - $valuetoshow = $obj->{$value}." ".img_picto("", $obj->{$value}); + $valuetoshow = $obj->{$value}." ".img_picto("", preg_replace('/^fa-/', '', $obj->{$value})); } elseif ($value == 'type_duration') { $TDurationTypes = array('y' => $langs->trans('Years'), 'm' => $langs->trans('Month'), 'w' => $langs->trans('Weeks'), 'd' => $langs->trans('Days'), 'h' => $langs->trans('Hours'), 'i' => $langs->trans('Minutes')); if (!empty($obj->{$value}) && array_key_exists($obj->{$value}, $TDurationTypes)) { @@ -2560,7 +2561,7 @@ if ($id > 0) { if (in_array($value, array('nbjour', 'decalage', 'pos', 'position', 'deposit_percent'))) { $class .= ' right'; } - if (in_array($value, array('type_vat', 'localtax1_type', 'localtax2_type'))) { + if (in_array($value, array('icon', 'type_vat', 'localtax1_type', 'localtax2_type'))) { $class .= ' nowraponall'; } if (in_array($value, array('use_default', 'fk_parent', 'sortorder'))) { diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index b881d6d6a1a..cfc02d93efa 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -96,7 +96,7 @@ print dol_get_fiche_head($head, 'ecm', '', -1, ''); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; print ''; print ''; -print ''."\n"; +print ''."\n"; print ''; // Mail required for members diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index a92affd82cd..51eaededfb0 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -186,7 +186,7 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Description").''.$langs->trans("Value").'
'; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled'] == 1) { @@ -269,7 +269,7 @@ if ($action == 'edit') { } else { if (!empty($arrayofparameters)) { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled'] == 1) { diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 3fcfa7c7b36..1f03a708917 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -272,7 +272,7 @@ foreach ($dirmodels as $reldir) { } print ''; print ''; @@ -408,7 +408,7 @@ foreach ($dirmodels as $reldir) { $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); print ''; // Preview @@ -490,6 +490,14 @@ print ''; +// Pre fill shipment qty option +print ''; +print ''; +print ''; + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; print ajax_constantonoff('EXPEDITION_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, $langs->trans("WarningOnlineSignature")); print '
'.$langs->trans("DontPrefillShipmentQty"); +print ''; +print ajax_constantonoff('SHIPMENT_DONT_PREFILL_QTY', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, ''); +print '
'; print $form->buttonsSaveCancel("Modify", ''); diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 31087976ffc..e9d5c01acd8 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -7,7 +7,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2022 Philippe Grand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -298,7 +298,7 @@ foreach ($dirmodels as $reldir) { } print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, -1, 0); + print $form->textwithpicto('', $htmltooltip, -1, 'info'); print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, -1, 0); + print $form->textwithpicto('', $htmltooltip, -1, 'info'); print '
'; print ''; print ''; -print ''; +print ''; print "\n"; print "\n"; diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index 64bc975d3da..20716b351cf 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -110,7 +110,7 @@ print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 18b7ac33f6d..4eb9e2f5dbd 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -3,7 +3,7 @@ * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2018 Charlene Benke * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -274,7 +274,7 @@ foreach ($dirmodels as $reldir) { } print ''; print ''; @@ -419,7 +419,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { print ''; // Preview @@ -461,27 +461,9 @@ print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Parameter").'
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print ''; -print ''; +print ''; print "\n"; -//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY); -//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY); -//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY); -//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY); - -if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) { - $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1; -} -if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) { - $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1; -} - -//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY); -//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY); -//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY); -//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY); - - // Set working days print ''; print ""; diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 6671a5b68ad..de8dfabaa18 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -4,7 +4,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify @@ -331,7 +331,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print ''; print "\n"; @@ -471,7 +471,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); print ''; // Preview @@ -510,7 +510,7 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Monday"))."'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled'] == 1) { @@ -595,7 +595,7 @@ if ($action == 'edit') { } else { if (!empty($arrayofparameters)) { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled'] == 1) { diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 1ec7c21252f..41ba080ff85 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -400,7 +400,7 @@ if ($mode == 'other') { print ''; // Default language @@ -435,7 +435,7 @@ if ($mode == 'other') { print ''; - print ''; + print ''; print ''; if (!empty($conf->use_javascript_ajax)) { diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index 736078cd4cf..1beac2929ee 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -7,7 +7,7 @@ * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2022 Anthony Berton - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Alexandre Spangaro * @@ -451,7 +451,7 @@ foreach ($dirmodels as $reldir) { } print ''; // Preview @@ -792,7 +792,7 @@ print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; print $langs->trans("Language"); - print ''; + print ''; print '
'; print $langs->trans("Miscellaneous"); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); if (getDolGlobalString('FACTURE_ADDON') . '.php' == $file) { // If module is the one used, we show existing errors if (!empty($module->error)) { @@ -608,7 +608,7 @@ foreach ($dirmodels as $reldir) { print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; @@ -879,7 +879,7 @@ print '
'; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print "\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index ffd63bb379c..953f7958bd7 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify @@ -217,7 +217,7 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Name").''.$langs->trans("Value").'
'.$langs->trans("PathDirectory").'
'; - print ''; + print ''; // @phan-suppress-next-line PhanEmptyForeach foreach ($arrayofparameters as $constname => $val) { @@ -285,7 +285,7 @@ if ($action == 'edit') { } else { if (!empty($arrayofparameters)) { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print ''; + print ''; // @phan-suppress-next-line PhanEmptyForeach foreach ($arrayofparameters as $constname => $val) { @@ -450,7 +450,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print ''; print "\n"; @@ -589,7 +589,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); print ''; // Preview diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index c7c55268b4b..2fb95d6e572 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -198,7 +198,7 @@ print $hookmanager->resPrint; print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index a3e9b993621..164a0ce525c 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -173,7 +173,7 @@ if ($action == 'edit') { clearstatcache(); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Example").'
'; - print ''; + print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").'
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); @@ -204,7 +204,7 @@ if ($action == 'edit') { } else { print '
'; print ''; - print ''; + print ''; print ''; print "\n"; @@ -509,7 +509,7 @@ foreach ($dirmodels as $reldir) { print ''; // Preview @@ -649,7 +649,7 @@ print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 36b8553156e..73a0787486b 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -144,7 +144,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/mails_ingoing.php b/htdocs/admin/mails_ingoing.php index 734d83f619c..a206f4bed29 100644 --- a/htdocs/admin/mails_ingoing.php +++ b/htdocs/admin/mails_ingoing.php @@ -118,7 +118,7 @@ print "

\n"; /* print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Example").'
'; -print ''; +print ''; print '
'; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 6f79d58551a..d710306172c 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -252,6 +252,9 @@ if (isModEnabled('eventorganization') && $user->hasRight('eventorganization', 'r if (isModEnabled('partnership') && $user->hasRight('partnership', 'read')) { $elementList['partnership_send'] = img_picto('', 'partnership', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToPartnership')); } +if (isModEnabled('product') && !empty($user->rights->produit->lire)) { + $elementList['product_send'] = img_picto('', 'product', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('Product')); +} $parameters = array('elementList' => $elementList); $reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 7ec045037ad..71e27fc5729 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1269,7 +1269,9 @@ if ($mode == 'marketplace') { print '
'; - if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) { + $conf->global->MAIN_DISABLE_DOLISTORE_SEARCH = 1; // avoid warning with the new Dolistore website + + if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // $options is array with filter criteria if (getDolGlobalInt('MAIN_ENANLE_OLD_DOLISTORE')) { diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index bf7c39d8b9a..9f75b7efa18 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -30,12 +30,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; /** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager - * @var Societe $mysoc * @var Translate $langs * @var User $user */ @@ -263,13 +263,15 @@ foreach ($dirmodels as $reldir) { $mrp = new Mo($db); $mrp->initAsSpecimen(); + $product = new Product($db); + $product->initAsSpecimen(); // Info $htmltooltip = ''; $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; $mrp->type = 0; - $nextval = $module->getNextValue($mysoc, $mrp); - if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $nextval = $module->getNextValue($product, $mrp); + if ((string) $nextval != $langs->trans("NotAvailable")) { $htmltooltip .= ''.$langs->trans("NextValue").': '; if ($nextval) { if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { @@ -282,7 +284,7 @@ foreach ($dirmodels as $reldir) { } print '
'; print "\n"; @@ -396,7 +398,7 @@ foreach ($dirmodels as $reldir) { // Default print ''; // Preview @@ -450,7 +452,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - if ($conf->global->MRP_MO_ADDON_PDF == $name) { + if (getDolGlobalString("MRP_MO_ADDON_PDF") == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; @@ -417,7 +419,7 @@ foreach ($dirmodels as $reldir) { print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print ''; -print ''; +print ''; print "\n"; print "\n"; diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index c44caecb710..1df42a44853 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -139,9 +139,9 @@ if ($action == 'add_currency') { } } elseif ($action == 'setapilayer') { if (GETPOSTISSET('modify_apilayer')) { - dolibarr_set_const($db, 'MULTICURRENCY_APP_ID', GETPOST('MULTICURRENCY_APP_ID', 'alpha')); - dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha')); - //dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha')); + dolibarr_set_const($db, 'MULTICURRENCY_APP_ID', GETPOST('MULTICURRENCY_APP_ID', 'alpha'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha'), 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha'), 'chaine', 0, '', $conf->entity); } else { $multiurrency = new MultiCurrency($db); $result = $multiurrency->syncRates(getDolGlobalString('MULTICURRENCY_APP_ID')); diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index d9a9ae5bbfc..7bf96c88081 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -202,7 +202,7 @@ print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; print ''; print ''; -print ''; +print ''; print "\n"; diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index 67289748f37..f79b92a7949 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -107,37 +107,37 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit') { print ''."\n"; + print ''."\n"; print ''."\n"; + print ''."\n"; print ''."\n"; + print ''."\n"; print ''."\n"; + print ''."\n"; print ''."\n"; + print ''."\n"; print ''."\n"; + print ''."\n"; print ''."\n"; + print ''."\n"; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print '
'; print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print '
'; print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print '
'; print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print '
'; print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print '
'; print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print '
'; print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print '
'; diff --git a/htdocs/admin/order.php b/htdocs/admin/order.php index d915eda1693..27e6f623a62 100644 --- a/htdocs/admin/order.php +++ b/htdocs/admin/order.php @@ -10,7 +10,7 @@ * Copyright (C) 2011-2016 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -368,7 +368,7 @@ foreach ($dirmodels as $reldir) { } print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print ''; -print ''; +print ''; print "\n"; print "\n"; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index c37c008ad9c..f40c357e13e 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Maxime DEMAREST - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -230,7 +230,7 @@ foreach ($dirmodels as $reldir) { } print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); if (getDolGlobalString('PAYMENT_ADDON') . '.php' == $file) { // If module is the one used, we show existing errors if (!empty($module->error)) { @@ -265,7 +265,7 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index a4771a9013b..3d5fb00b6ac 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -162,7 +162,7 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; print ''; print ''; -print ''; +print ''; print ""; // Bank account (from Banks module) @@ -445,7 +445,7 @@ if (isModEnabled('notification')) print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 6101cdcc7bf..02521e57b9e 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -306,7 +306,7 @@ print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); print '
'; print '
'.$langs->trans("User").''.$langs->trans("Value").''.$langs->trans("Action").'
'; -print ''; +print ''; $selected = getDolGlobalString('MAIN_PDF_FORMAT'); if (empty($selected)) { @@ -515,7 +515,7 @@ print load_fiche_titre($langs->trans("Other"), '', ''); print '
'; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").'
'; -print ''; +print ''; // Use 2 languages into PDF diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 73fea915995..73b4d52596c 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -214,7 +214,7 @@ if (isModEnabled('propal')) { print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print ''; + print ''; /* This feature seems not yet used into Dolibarr. So option is kept hidden and enabled by default print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; @@ -256,11 +256,12 @@ if (isModEnabled('propal')) { } if (isModEnabled('order')) { - print load_fiche_titre($langs->trans("Orders"), '', 'bill'); + $langs->load("orders"); + print load_fiche_titre($langs->trans('CustomersOrders'), '', 'order'); print '
'; print ''; - print ''; + print ''; print ''; - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").'
'; print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_ORDER"), $langs->trans("PdfAddTermOfSaleHelp")); print ''; @@ -271,19 +272,8 @@ if (isModEnabled('order')) { print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_ORDER", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_ORDER); } print '
'; - print '
'; -} -if (isModEnabled('order')) { - $langs->load("orders"); - print load_fiche_titre($langs->trans('CustomersOrders'), '', 'order'); - - print '
'; - print ''; - print ''; - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print '
'; print $form->textwithpicto($langs->trans("SALES_ORDER_SHOW_SHIPPING_ADDRESS"), $langs->trans("SALES_ORDER_SHOW_SHIPPING_ADDRESSMore")); print ''; if ($conf->use_javascript_ajax) { @@ -305,7 +295,7 @@ if (isModEnabled('supplier_proposal')) { print '
'; print ''; - print ''; + print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE"), ''); @@ -340,7 +330,7 @@ if (isModEnabled('supplier_order')) { print '
'; print ''; - print ''; + print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE"), ''); @@ -373,7 +363,7 @@ if (isModEnabled('invoice')) { print '
'; print ''; - print ''; + print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").'
'; print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_INVOICE"), $langs->trans("PdfAddTermOfSaleHelp")); @@ -489,7 +479,7 @@ if (isModEnabled('shipping')) { print '
'; print ''; - print ''; + print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").'
'; print $langs->trans("BARCODE_ON_SHIPPING_PDF"); @@ -511,7 +501,7 @@ if (isModEnabled('reception')) { print '
'; print ''; - print ''; + print ''; print ''; print "\n"; @@ -382,7 +382,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { } print ''; print "\n"; @@ -511,7 +511,7 @@ foreach ($dirmodels as $reldir) { print ''; // Preview diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 7787a852f1c..caa131fd708 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -2,6 +2,7 @@ /* Copyright (C) 2012 Regis Houssin * Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -150,7 +151,7 @@ if ($action == 'convert') { $newlevel = $level; //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $retm = $objectstatic->updatePrice($newprice, $price_base_type, $user, $newvatrateclean, $newminprice, $newlevel, $newnpr, 0, 0, $localtaxes_type, $newdefaultvatcode); + $retm = $objectstatic->updatePrice((float) $newprice, $price_base_type, $user, (float) $newvatrateclean, $newminprice, $newlevel, $newnpr, 0, 0, $localtaxes_type, $newdefaultvatcode); if ($retm < 0) { $error++; break; @@ -180,7 +181,7 @@ if ($action == 'convert') { $newlevel = 0; if (!empty($price_base_type) && !$updatelevel1) { //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $ret = $objectstatic->updatePrice($newprice, $price_base_type, $user, $newvatrateclean, $newminprice, $newlevel, $newnpr, 0, 0, $localtaxes_type, $newdefaultvatcode); + $ret = $objectstatic->updatePrice((float) $newprice, $price_base_type, $user, (float) $newvatrateclean, $newminprice, $newlevel, $newnpr, 0, 0, $localtaxes_type, $newdefaultvatcode); } if ($ret < 0 || $retm < 0) { @@ -236,8 +237,8 @@ if ($action == 'convert') { //} //else //{ - $newprice = price2num($obj->price, 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - //$newminprice=$objectstatic2->fourn_price_min; + $newprice = price2num($obj->price, 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + //$newminprice=$objectstatic2->fourn_price_min; //} //if ($newminprice > $newprice) $newminprice=$newprice; $newvat = str_replace('*', '', $newvatrate); @@ -254,7 +255,7 @@ if ($action == 'convert') { if (!empty($price_base_type) && !$updatelevel1) { //print "$objectstatic2->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; $fourn->id = $obj->fk_soc; - $ret = $objectstatic2->update_buyprice($obj->qty, $newprice, $user, $price_base_type, $fourn, $obj->fk_availability, $obj->ref_fourn, $newvat, '', $newpercent, 0, $newnpr, $newdeliverydelay, $newsupplierreputation, $localtaxes_type, $newdefaultvatcode); + $ret = $objectstatic2->update_buyprice($obj->qty, (float) $newprice, $user, $price_base_type, $fourn, $obj->fk_availability, $obj->ref_fourn, (float) $newvat, '', $newpercent, 0, $newnpr, $newdeliverydelay, $newsupplierreputation, $localtaxes_type, $newdefaultvatcode); } if ($ret < 0 || $retm < 0) { diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 00032c9acbc..254999a5269 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -170,7 +170,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter +$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")"; $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index a0337a75a49..274de7cce07 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -4,6 +4,7 @@ * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,7 +69,7 @@ $finished = GETPOSTINT('finished'); $alsoproductwithnosupplierprice = GETPOSTINT('alsoproductwithnosupplierprice'); $warehouseStatus = GETPOST('warehousestatus', 'alpha'); $hidepriceinlabel = GETPOSTINT('hidepriceinlabel'); -$warehouseId = GETPOST('warehouseid', 'int'); +$warehouseId = GETPOSTINT('warehouseid'); // Security check restrictedArea($user, 'produit|service|commande|propal|facture', 0, 'product&product'); @@ -214,7 +215,7 @@ if ($action == 'fetch' && !empty($id)) { $prodcustprice = new ProductCustomerPrice($db); - $filter = array('t.fk_product' => $object->id, 't.fk_soc' => $socid); + $filter = array('t.fk_product' => (string) $object->id, 't.fk_soc' => (string) $socid); $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); if ($result) { @@ -252,7 +253,7 @@ if ($action == 'fetch' && !empty($id)) { $tmpvatwithcode = get_default_tva($mysoc, $thirdparty_buyer, $id, 0); if (!is_numeric($tmpvatwithcode) || $tmpvatwithcode != -1) { - $reg =array(); + $reg = array(); if (preg_match('/(.+)\s\((.+)\)/', $tmpvatwithcode, $reg)) { $outtva_tx = price2num($reg[1]); $outtva_tx_formated = price($outtva_tx); @@ -286,7 +287,7 @@ if ($action == 'fetch' && !empty($id)) { 'qty' => $outqty, 'discount' => $outdiscount, 'mandatory_period' => $mandatory_period, - 'array_options'=>$object->array_options + 'array_options' => $object->array_options ); } @@ -325,7 +326,7 @@ if ($action == 'fetch' && !empty($id)) { $arrayresult = []; if (empty($mode) || $mode == 1) { // mode=1: customer - $arrayresult = $form->select_produits_list("", $htmlname, $type, getDolGlobalInt('PRODUIT_LIMIT_SIZE', 1000), $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus, $status_purchase, $warehouseId); + $arrayresult = $form->select_produits_list(0, $htmlname, $type, getDolGlobalInt('PRODUIT_LIMIT_SIZE', 1000), $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus, $status_purchase, $warehouseId); } elseif ($mode == 2) { // mode=2: supplier $arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, getDolGlobalInt('PRODUIT_LIMIT_SIZE', 1000), $alsoproductwithnosupplierprice); } diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 4ed003ed06f..4f0b4cbe4bd 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -245,23 +245,23 @@ class ActionsCardProduct // Finished $statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - $this->tpl['finished'] = $form->selectarray('finished', $statutarray, $this->object->finished); + $this->tpl['finished'] = $form->selectarray('finished', $statutarray, (int) $this->object->finished); // Weight $this->tpl['weight'] = $this->object->weight; - $this->tpl['weight_units'] = $formproduct->selectMeasuringUnits("weight_units", "weight", $this->object->weight_units, 0, 2); + $this->tpl['weight_units'] = $formproduct->selectMeasuringUnits("weight_units", "weight", (string) $this->object->weight_units, 0, 2); // Length $this->tpl['length'] = $this->object->length; - $this->tpl['length_units'] = $formproduct->selectMeasuringUnits("length_units", "size", $this->object->length_units, 0, 2); + $this->tpl['length_units'] = $formproduct->selectMeasuringUnits("length_units", "size", (string) $this->object->length_units, 0, 2); // Surface $this->tpl['surface'] = $this->object->surface; - $this->tpl['surface_units'] = $formproduct->selectMeasuringUnits("surface_units", "surface", $this->object->surface_units, 0, 2); + $this->tpl['surface_units'] = $formproduct->selectMeasuringUnits("surface_units", "surface", (string) $this->object->surface_units, 0, 2); // Volume $this->tpl['volume'] = $this->object->volume; - $this->tpl['volume_units'] = $formproduct->selectMeasuringUnits("volume_units", "volume", $this->object->volume_units, 0, 2); + $this->tpl['volume_units'] = $formproduct->selectMeasuringUnits("volume_units", "volume", (string) $this->object->volume_units, 0, 2); } if ($action == 'view') { diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php index e7b26f58762..4dac736d8b1 100644 --- a/htdocs/product/canvas/product/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + /** * @var Conf $conf * @var Translate $langs @@ -39,7 +40,7 @@ $titre = $langs->trans("CardProduct".$object->type); print dol_get_fiche_head($head, 'card', $titre, -1, 'product'); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter +$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")"; $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/canvas/service/tpl/card_view.tpl.php b/htdocs/product/canvas/service/tpl/card_view.tpl.php index b5fd7372b39..8e6379125d3 100644 --- a/htdocs/product/canvas/service/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_view.tpl.php @@ -39,7 +39,7 @@ $titre = $langs->trans("CardProduct".$object->type); print dol_get_fiche_head($head, 'card', $titre, -1, 'service'); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = " fk_product_type:=:".((int) $object->type); +$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")"; $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5de9cda0342..f685f012a5b 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -20,7 +20,7 @@ * Copyright (C) 2019-2020 Thibault FOUCART * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2022 Vincent de Grandpré - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -161,7 +161,7 @@ $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); if ($id > 0 || !empty($ref)) { - $result = $object->fetch($id, $ref); + $result = $object->fetch($id, (string) $ref); if ($result < 0) { dol_print_error($db, $object->error, $object->errors); } @@ -361,7 +361,7 @@ if (empty($reshook)) { 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', ); - //First, all core objects must update their tables + // First, all core objects must update their tables foreach ($objects as $object_name => $object_file) { require_once DOL_DOCUMENT_ROOT.$object_file; @@ -406,13 +406,30 @@ if (empty($reshook)) { } if (!$error) { - // We finally remove the old product - // TODO merge attached files from old product into new one before delete + // Delete the product if ($productOrigin->delete($user) < 1) { $error++; } } + if ($error) { + // Move files from the dir of the third party to delete into the dir of the third party to keep + if (!empty($conf->product->multidir_output[$productOrigin->entity])) { + $srcdir = $conf->product->multidir_output[$productOrigin->entity]."/".$productOrigin->ref; + $destdir = $conf->product->multidir_output[$object->entity]."/".$object->ref; + + if (dol_is_dir($srcdir)) { + $dirlist = dol_dir_list($srcdir, 'files', 1); + foreach ($dirlist as $filetomove) { + $destfile = $destdir.'/'.$filetomove['relativename']; + //var_dump('Move file '.$filetomove['relativename'].' into '.$destfile); + dol_move($filetomove['fullname'], $destfile, '0', 0, 0, 1); + } + //exit; + } + } + } + if (!$error) { setEventMessages($langs->trans('ProductsMergeSuccess'), null, 'mesgs'); $db->commit(); @@ -617,7 +634,7 @@ if (empty($reshook)) { $object->desiredstock = GETPOST('desiredstock') ? GETPOST('desiredstock') : 0; $object->canvas = GETPOST('canvas'); $object->net_measure = GETPOST('net_measure'); - $object->net_measure_units = GETPOST('net_measure_units'); // This is not the fk_unit but the power of unit + $object->net_measure_units = GETPOST('net_measure_units') === '' ? null : GETPOSTINT('net_measure_units'); // This is not the fk_unit but the power of unit $object->weight = GETPOST('weight'); $object->weight_units = GETPOST('weight_units'); // This is not the fk_unit but the power of unit $object->length = GETPOST('size'); @@ -795,7 +812,7 @@ if (empty($reshook)) { $object->canvas = GETPOST('canvas'); $object->net_measure = GETPOST('net_measure'); - $object->net_measure_units = GETPOST('net_measure_units'); // This is not the fk_unit but the power of unit + $object->net_measure_units = GETPOST('net_measure_units') === '' ? null : GETPOSTINT('net_measure_units'); // This is not the fk_unit but the power of unit $object->weight = GETPOST('weight'); $object->weight_units = GETPOST('weight_units'); // This is not the fk_unit but the power of unit $object->length = GETPOST('size'); @@ -1073,27 +1090,27 @@ if (empty($reshook)) { $commande = null; // Get object and test permission - if (GETPOST('propalid') > 0) { + if (GETPOSTINT('propalid') > 0) { $propal = new Propal($db); - $result = $propal->fetch(GETPOST('propalid')); + $result = $propal->fetch(GETPOSTINT('propalid')); if ($result <= 0) { dol_print_error($db, $propal->error); exit; } $thirdpartyid = $propal->socid; $permissiontoaddline = $user->hasRight('propal', 'creer'); - } elseif (GETPOST('commandeid') > 0) { + } elseif (GETPOSTINT('commandeid') > 0) { $commande = new Commande($db); - $result = $commande->fetch(GETPOST('commandeid')); + $result = $commande->fetch(GETPOSTINT('commandeid')); if ($result <= 0) { dol_print_error($db, $commande->error); exit; } $thirdpartyid = $commande->socid; $permissiontoaddline = $user->hasRight('commande', 'creer'); - } elseif (GETPOST('factureid') > 0) { + } elseif (GETPOSTINT('factureid') > 0) { $facture = new Facture($db); - $result = $facture->fetch(GETPOST('factureid')); + $result = $facture->fetch(GETPOSTINT('factureid')); if ($result <= 0) { dol_print_error($db, $facture->error); exit; @@ -1134,7 +1151,7 @@ if (empty($reshook)) { $prodcustprice = new ProductCustomerPrice($db); - $filter = array('t.fk_product' => $object->id, 't.fk_soc' => $soc->id); + $filter = array('t.fk_product' => (string) $object->id, 't.fk_soc' => (string) $soc->id); $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); if ($result) { @@ -1148,7 +1165,7 @@ if (empty($reshook)) { } $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $object->tva_tx)); // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par default (par example si pays different entre vendeur et acheteur). @@ -1160,10 +1177,10 @@ if (empty($reshook)) { } } - if (GETPOST('propalid') > 0 && $permissiontoaddline && is_object($propal)) { + if (GETPOSTINT('propalid') > 0 && $permissiontoaddline && is_object($propal)) { // Define cost price for margin calculation $buyprice = 0; - if (($result = $propal->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) { + if (($result = $propal->defineBuyPrice($pu_ht, (float) price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } else { @@ -1173,12 +1190,12 @@ if (empty($reshook)) { $result = $propal->addline( $desc, $pu_ht, - price2num(GETPOST('qty'), 'MS'), + (float) price2num(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, // localtax1 $localtax2_tx, // localtax2 $object->id, - price2num(GETPOST('remise_percent'), '', 2), + (float) price2num(GETPOST('remise_percent'), '', 2), $price_base_type, $pu_ttc, 0, @@ -1203,7 +1220,7 @@ if (empty($reshook)) { } elseif (GETPOST('commandeid') > 0 && $permissiontoaddline && is_object($commande)) { // Define cost price for margin calculation $buyprice = 0; - if (($result = $commande->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) { + if (($result = $commande->defineBuyPrice($pu_ht, (float) price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } else { @@ -1212,13 +1229,13 @@ if (empty($reshook)) { $result = $commande->addline( $desc, - $pu_ht, - price2num(GETPOST('qty'), 'MS'), + (float) $pu_ht, + (float) price2num(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, // localtax1 $localtax2_tx, // localtax2 $object->id, - price2num(GETPOST('remise_percent'), '', 2), + (float) price2num(GETPOST('remise_percent'), '', 2), 0, 0, $price_base_type, @@ -1245,7 +1262,7 @@ if (empty($reshook)) { } elseif (GETPOST('factureid') > 0 && $permissiontoaddline && is_object($facture)) { // Define cost price for margin calculation $buyprice = 0; - if (($result = $facture->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) { + if (($result = $facture->defineBuyPrice($pu_ht, (float) price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } else { @@ -1254,13 +1271,13 @@ if (empty($reshook)) { $result = $facture->addline( $desc, - $pu_ht, - price2num(GETPOST('qty'), 'MS'), + (float) $pu_ht, + (float) price2num(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, $localtax2_tx, $object->id, - price2num(GETPOST('remise_percent'), '', 2), + (float) price2num(GETPOST('remise_percent'), '', 2), '', '', 0, @@ -1295,6 +1312,13 @@ if (empty($reshook)) { setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings'); } } + + // Actions to send emails + $triggersendname = 'PRODUCT_SENTBYMAIL'; + $paramname = 'id'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_PRODUCT_TO'; + $trackid = 'prod'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -1489,7 +1513,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $inherited_mask_lot = getDolGlobalString('LOT_ADVANCED_MASK'); $inherited_mask_sn = getDolGlobalString('SN_ADVANCED_MASK'); print '
'; if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; } @@ -929,13 +929,13 @@ if ($id > 0 || !empty($ref)) { print ''; if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; } diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index e50ffb1e687..ac7f9eec351 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -1,10 +1,11 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2023-2024 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Benjamin Falière * Copyright (C) 2024 Frédéric France * @@ -642,6 +643,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_s $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target"; // Add table from hooks $parameters = array(); +// @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " WHERE e.entity IN (".getEntity('reception').")"; diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index cdf35793f84..b80897a2635 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify @@ -343,7 +343,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print ''; print "\n"; @@ -482,7 +482,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); print ''; // Preview diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index b113a9a5b32..5fdbfa43419 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify @@ -337,7 +337,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print ''; print "\n"; @@ -476,7 +476,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); print ''; // Preview diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 45a3c3a827b..3db699c6d45 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,7 +97,7 @@ class RecruitmentCandidature extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), @@ -1112,9 +1112,9 @@ class RecruitmentCandidature extends CommonObject /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 67b04b6c05b..6beb6c590bf 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2020 Laurent Destailleur /* Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,7 +102,7 @@ class RecruitmentJobPosition extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), @@ -1151,9 +1151,9 @@ class RecruitmentJobPosition extends CommonObject /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index e8462bd4ef4..637ba4f0cba 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -238,7 +238,12 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi } // Add odtgeneration hook + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } $hookmanager->initHooks(array('odtgeneration')); + global $action; if (!is_object($outputlangs)) { $outputlangs = $langs; @@ -432,6 +437,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi if ($foundtagforlines) { $linenumber = 0; foreach ($object->lines as $line) { + /** @var CommonObjectLine $line */ $linenumber++; $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); 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 64983e640de..d7859da8565 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 @@ -1,4 +1,5 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand @@ -9,7 +10,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -256,7 +257,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio // Create pdf instance $pdf = pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - $pdf->SetAutoPageBreak(1, 0); + $pdf->setAutoPageBreak(true, 0); $heightforinfotot = 50; // Height reserved to output the info and total part and payment part $heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page @@ -377,12 +378,12 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio // $this->_pagefoot($pdf,$object,$outputlangs,1); $pdf->setTopMargin($tab_top_newpage); // The only function to edit the bottom margin of current page to set it. - $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext); + $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext); } // back to start $pdf->setPage($pageposbeforenote); - $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext); + $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext); $pdf->SetFont('', '', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); $pageposafternote = $pdf->getPage(); @@ -396,7 +397,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio $pdf->setPage($pageposafternote); $pdf->setTopMargin($tab_top_newpage); // The only function to edit the bottom margin of current page to set it. - $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext); + $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext); //$posyafter = $tab_top_newpage; } @@ -418,7 +419,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio } // Add footer - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it. $this->_pagefoot($pdf, $object, $outputlangs, 1); $i++; @@ -482,7 +483,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio $pdf->SetTextColor(0, 0, 0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore = $pdf->getPage(); $showpricebeforepagebreak = 1; @@ -496,7 +497,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio if ($pageposafter > $pageposbefore) { // There is a pagebreak $pdf->rollbackTransaction(true); - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', true, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); @@ -529,7 +530,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { @@ -561,7 +562,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it. if (!getDolGlobalString('MAIN_PDF_DONOTREPEAT_HEAD')) { $this->_pagehead($pdf, $object, 0, $outputlangs); } @@ -696,7 +697,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio if (empty($hidetop)) { //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } @@ -886,7 +887,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); - $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1); + $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', true); $pdf->SetTextColor(0, 0, 60); // Show sender name diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index b47557d5f45..e71616a8879 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -419,7 +419,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'close') { $langs->load("propal"); - + $formquestion = array(); //Form to close proposal (signed or not) $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ConfirmClose'), $langs->trans('ConfirmCloseAsk'), 'confirm_close', $formquestion, '', 1, 250); } diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 1097eb06f6d..b83a5331aa3 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,7 +155,7 @@ class PaymentSalary extends CommonObject public $datev = ''; /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), @@ -989,9 +989,9 @@ class PaymentSalary extends CommonObject /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index da4fed65b02..c0fcd932e7c 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -856,9 +856,9 @@ class Salary extends CommonObject /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index de001535e3f..ed686d356ca 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -1,9 +1,10 @@ * Copyright (C) 2015 Charlie BENKE * Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -367,6 +368,7 @@ $sql .= " AND p.fk_salary = s.rowid"; $sql .= " AND s.entity IN (".getEntity('tax').")"; $sql .= " ORDER BY dp DESC"; +$resteapayer = 0; //print $sql; $resql = $db->query($sql); if ($resql) { @@ -560,7 +562,7 @@ if ($resql) { $tmpuser = new User($db); - $num = $db->num_rows($result); + $num = $db->num_rows($resql); if ($num > 0) { while ($i < $num) { $obj = $db->fetch_object($resql); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 29b48fb1e7b..e36905642e7 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -659,7 +659,7 @@ foreach ($dirsociete as $dirroot) { $htmltooltip .= '
'.$langs->trans("WatermarkOnDraft").': '.yn((isset($module->option_draft_watermark) ? $module->option_draft_watermark : ''), 1, 1); print '
'; // Preview diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index a06a442568f..ef113ba10da 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2011-2012 Laurent Destailleur - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -318,7 +318,7 @@ abstract class ActionsCardCommon $img = picto_from_langcode($this->object->country_code); if ($this->object->isInEEC()) { - $this->tpl['country'] = $form->textwithpicto(($img ? $img.' ' : '').$this->object->country, $langs->trans("CountryIsInEEC"), 1, 0); + $this->tpl['country'] = $form->textwithpicto(($img ? $img.' ' : '').$this->object->country, $langs->trans("CountryIsInEEC"), 1, 'info'); } $this->tpl['country'] = ($img ? $img.' ' : '').$this->object->country; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index fd29d86a584..97ce9aebbc1 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1551,7 +1551,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''; print ''; - print ''; + print ''; - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) { + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire')) + || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) { if ($conf->browser->layout == 'phone') { print ''; print ''; } - print ''; - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").'
'; print $langs->trans("RECEPTION_PDF_HIDE_ORDERED"); @@ -554,7 +544,7 @@ if (isModEnabled('stocktransfer')) { print '
'; print ''; - print ''; + print ''; print ' diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index d49f3a3304c..7ad305e9365 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -177,7 +177,7 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel print '\n"; // Multicompany if (isModEnabled('multicompany')) { - print ''; if (!$i) { diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index d9c860a050f..c7c6b2ec789 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -1,5 +1,28 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * @var Conf $conf + * @var DoliDB $db + * @var CommonObject $object + */ + print ''."\n"; // Protection to avoid direct call of template @@ -27,9 +50,11 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') { continue; } - $cssclass = $extrafields->getAlignFlag($key, $extrafieldsobjectkey); + + $cssclasstd = $extrafields->getCSSClass($key, $extrafieldsobjectkey, 'csslist'); + $typeofextrafield = $extrafields->attributes[$extrafieldsobjectkey]['type'][$key]; - print ' - @@ -499,7 +506,7 @@ if ($nolinesbefore) { if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $coldisplay++; print ''; } $remise_percent = $buyer->remise_percent; @@ -526,21 +533,21 @@ if ($nolinesbefore) { $coldisplay++; ?> - %'; - $coldisplay++; - } - if (getDolGlobalString('DISPLAY_MARK_RATES')) { - echo ''; - $coldisplay++; - } + %'; + $coldisplay++; + } + if (getDolGlobalString('DISPLAY_MARK_RATES')) { + echo ''; + $coldisplay++; + } } } $coldisplay += $colspan; @@ -561,6 +568,8 @@ if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelecto $date_end = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); $prefillDates = false; + $date_start_prefill = 0; + $date_end_prefill = 0; if (getDolGlobalString('MAIN_FILL_SERVICE_DATES_FROM_LAST_SERVICE_LINE') && !empty($object->lines)) { for ($i = count($object->lines) - 1; $i >= 0; $i--) { @@ -815,7 +824,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { } } }); - /* When changing predefined product, we reload list of supplier prices required for margin combo */ @@ -932,7 +941,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) { if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { ?> var proddesc = data.desc_trans; - var proddesc = data.desc; hasRight('margins', 'creer')) { editor.setData(proddesc); } } - jQuery('#dp_desc').text(proddesc); hasRight('margins', 'creer')) { jQuery.each(data.array_options, function( key, value ) { jQuery('div[class*="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value); }); - }, 'json' ); } - hasRight('margins', 'creer')) { diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 58ccc4e50ff..b34c3e3a33f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Juanjo Menent * Copyright (C) 2022 OpenDSI - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France * @@ -75,6 +75,7 @@ if (empty($object) || !is_object($object)) { @phan-var-force ?Product $product_static @phan-var-force string $text @phan-var-force string $description +@phan-var-force Object $objp '; global $mysoc; @@ -128,7 +129,7 @@ $coldisplay = 0; $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay]; +$parameters = ['line' => $line, 'i' => & $i, 'coldisplay' => & $coldisplay]; $reshook = $hookmanager->executeHooks('objectLineView_BeforeProduct', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -274,7 +275,7 @@ if (($line->info_bits & 2) == 2) { } - $parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay]; + $parameters = ['line' => $line, 'i' => & $i, 'coldisplay' => & $coldisplay]; $reshook = $hookmanager->executeHooks('objectLineView_BeforeProductExtrafield', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Line extrafield @@ -288,7 +289,7 @@ if (($line->info_bits & 2) == 2) { } } -$parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay]; +$parameters = ['line' => $line, 'i' => & $i, 'coldisplay' => & $coldisplay]; $reshook = $hookmanager->executeHooks('objectLineView_ProductSupplier', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index 3964d67232d..aae89f8a135 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +20,9 @@ * @var Translate $langs * @var string $servicename */ +' +@phan-var-force string $servicename +'; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index d01fb3a5f99..edfaae9154c 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -2,7 +2,7 @@ /* Copyright (C) 2009-2010 Regis Houssin * Copyright (C) 2011-2024 Laurent Destailleur * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,13 +34,25 @@ if (!defined('NOBROWSERNOTIF')) { * @var string $disabled * @var string $dol_url_root * @var string $focus_element - * @var string $mode + * @var string $mode Contains (list of) authentication methods - example "http","dolibarr","openid,dolibarr" * @var string $message * @var string $title * @var string $urllogo - * @var string $user + * @var User $user * @var string $username */ +' +@phan-var-force string $captcha +@phan-var-force string $disabled +@phan-var-force string $dol_url_root +@phan-var-force string $focus_element +@phan-var-force string $mode +@phan-var-force string $message +@phan-var-force string $title +@phan-var-force string $urllogo +@phan-var-force User $user +@phan-var-force string $username +'; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; @@ -130,10 +142,10 @@ $(document).ready(function () { '; print ''; print ''; - print ''; + print ''; print ''; print ''."\n"; $i++; @@ -327,7 +338,7 @@ if ($object->nbterm > 0 && count($echeances->lines) == 0) { print ''; print ''; if (empty($line->fk_bank)) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d6e652922d9..0b07dd0b80a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -12,12 +12,12 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2020 Demarest Maxime - * Copyright (C) 2020-2024 Charlene Benke + * Copyright (C) 2020-2024 Charlene Benke * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2021 Alexandre Spangaro * Copyright (C) 2023 Joachim Küter * Copyright (C) 2023 Eric Seigne - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -255,7 +255,7 @@ function testSqlAndScriptInject($val, $type) /** * Return true if security check on parameters are OK, false otherwise. * - * @param string|array $var Variable name + * @param string|array $var Variable name * @param int<0,2> $type 1=GET, 0=POST, 2=PHP_SELF * @param int<0,1> $stopcode 0=No stop code, 1=Stop code (default) if injection found * @return boolean True if there is no injection. @@ -822,7 +822,7 @@ if (!defined('NOLOGIN')) { // If in demo mode, we check we go to home page through the public/demo/index.php page if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_URL_ROOT.'/index.php') { // We ask index page if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/public/', $_SERVER['HTTP_REFERER'])) { - dol_syslog("Call index page from another url than demo page (call is done from page ".(empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFER']).")"); + dol_syslog("Call index page from another url than demo page (call is done from page ".(empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']).")"); $url = ''; $url .= ($url ? '&' : '').($dol_hide_topmenu ? 'dol_hide_topmenu='.$dol_hide_topmenu : ''); $url .= ($url ? '&' : '').($dol_hide_leftmenu ? 'dol_hide_leftmenu='.$dol_hide_leftmenu : ''); @@ -2012,14 +2012,16 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) { print ''."\n"; - $jquerytheme = 'base'; - if (getDolGlobalString('MAIN_USE_JQUERY_THEME')) { - $jquerytheme = getDolGlobalString('MAIN_USE_JQUERY_THEME'); - } - if (constant('JS_JQUERY_UI')) { - print ''."\n"; // Forced JQuery - } else { - print ''."\n"; // JQuery + if (!defined('DISABLE_JQUERY_UI')) { + $jquerytheme = 'base'; + if (getDolGlobalString('MAIN_USE_JQUERY_THEME')) { + $jquerytheme = getDolGlobalString('MAIN_USE_JQUERY_THEME'); + } + if (constant('JS_JQUERY_UI')) { + print '' . "\n"; // Forced JQuery + } else { + print '' . "\n"; // JQuery + } } if (!defined('DISABLE_JQUERY_JNOTIFY')) { print ''."\n"; // JNotify @@ -2036,7 +2038,6 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; } - print ''."\n"; // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php' $themepath = dol_buildpath($conf->css, 1); $themesubdir = ''; @@ -2050,8 +2051,11 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } } - //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; - print ''."\n"; + if (!defined('DISABLE_CSS_DEFAULT_THEME')) { + print ''."\n"; + print '' . "\n"; + } + if (getDolGlobalString('MAIN_FIX_FLASH_ON_CHROME')) { print ''."\n".''."\n"; } @@ -2118,10 +2122,12 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } else { print ''."\n"; } - if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) { - print ''."\n"; - } else { - print ''."\n"; + if (!defined('DISABLE_JQUERY_UI')) { + if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) { + print '' . "\n"; + } else { + print '' . "\n"; + } } // jQuery jnotify if (!getDolGlobalString('MAIN_DISABLE_JQUERY_JNOTIFY') && !defined('DISABLE_JQUERY_JNOTIFY')) { @@ -2591,7 +2597,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $langs->load('companies'); $userImage = $userDropDownImage = ''; - if (!empty($user->photo)) { + if (!empty($user->photo) || isModEnabled('gravatar')) { $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); } else { @@ -3133,7 +3139,7 @@ function printDropdownQuickadd($mode = 0) // Allow the $items of the menu to be manipulated by modules $parameters = array(); $hook_items = $items; - $reshook = $hookmanager->executeHooks('menuDropdownQuickaddItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('menuDropdownQuickaddItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks @phan-suppress-current-line PhanTypeMismatchArgument if (is_numeric($reshook) && !empty($hookmanager->resArray) && is_array($hookmanager->resArray)) { if ($reshook == 0) { $items['items'] = array_merge($items['items'], $hookmanager->resArray); // add @@ -3498,7 +3504,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ //$textsearch = $langs->trans("Search"); $textsearch = ''.$langs->trans("Search"); - $searchform .= $form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, 'accesskey="s"', 1, 0, (getDolGlobalString('MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY') ? 0 : 1), 'vmenusearchselectcombo', 1, $textsearch, 1, $stringforfirstkey.' s'); + $searchform .= $form->selectArrayFilter('searchselectcombo', $arrayresult, (string) $selected, 'accesskey="s"', 1, 0, (getDolGlobalString('MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY') ? 0 : 1), 'vmenusearchselectcombo', 1, $textsearch, 1, $stringforfirstkey.' s'); } else { if (is_array($arrayresult)) { // @phan-suppress-next-line PhanEmptyForeach // array is really empty in else case. diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 95c4ba1ad06..9bf8f5c3a0d 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -2,7 +2,7 @@ /* Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2015 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -134,7 +134,7 @@ print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").'
'; print $langs->trans("BARCODE_ON_STOCKTRANSFER_PDF"); @@ -574,7 +564,7 @@ if (isModEnabled('stocktransfer')) { print load_fiche_titre($langs->trans("Files"), '', 'file'); print '
'; print ''; -print ''; +print ''; // Terms of sale $tooltiptermsofsale = $langs->trans('AvailableFormats').' : pdf'; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 90a150ba6bc..50a5430df3e 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -164,7 +164,7 @@ print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").'
'; print ''; print ''; -print ''; +print ''; print ""; @@ -460,7 +460,7 @@ if (isModEnabled('notification') ) print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 49ca75ee0a1..f9c26ab8616 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -346,7 +346,7 @@ foreach ($dirmodels as $reldir) { } print ''; print "\n"; @@ -486,7 +486,7 @@ foreach ($dirmodels as $reldir) { print ''; // Preview diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 7c1c855dc0a..b783d9e07df 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -279,7 +279,7 @@ foreach ($dirmodels as $reldir) { } print ''; print ''; @@ -421,7 +421,7 @@ foreach ($dirmodels as $reldir) { $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); print ''; // Preview diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php index aac4c03bfb4..7b16c42eb81 100644 --- a/htdocs/admin/resource.php +++ b/htdocs/admin/resource.php @@ -88,7 +88,7 @@ print '
'; print '
'.$langs->trans("User").''.$langs->trans("Value").''.$langs->trans("Action").'
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''; diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index ad815dc5bc8..15bbe9a6691 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -181,7 +181,7 @@ if ($action == 'edit') { clearstatcache(); print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; - print ''; + print ''; // Disable print ''; } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 4c5ee381d51..7e45aaa7faf 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1,4 +1,5 @@ * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin @@ -8,7 +9,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2024 Frédéric France * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -147,7 +148,7 @@ class FactureRec extends CommonInvoice public $user_author; /** - * @var int Frequency + * @var ?int Frequency */ public $frequency; @@ -234,7 +235,7 @@ class FactureRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -1491,6 +1492,7 @@ class FactureRec extends CommonInvoice 'facturerec' => $facturerec, // it's an object which PHP passes by "reference", so modifiable by hooks. 'this' => $this, // it's an object which PHP passes by "reference", so modifiable by hooks. ); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('afterCreationOfRecurringInvoice', $parameters, $facture); // note: $facture can be modified by hooks (warning: $facture can be null) $i++; @@ -1943,10 +1945,10 @@ class FactureRec extends CommonInvoice /** * Update frequency and unit * - * @param int $frequency value of frequency - * @param string $unit unit of frequency (d, m, y) - * @param int $notrigger Disable the trigger - * @return int Return integer <0 if KO, >0 if OK + * @param ?int $frequency value of frequency + * @param string $unit unit of frequency (d, m, y) + * @param int<0,1> $notrigger Disable the trigger + * @return int Return integer <0 if KO, >0 if OK */ public function setFrequencyAndUnit($frequency, $unit, $notrigger = 0) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 179385b1aba..d7583b42d62 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -14,13 +14,13 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Cedric Gross * Copyright (C) 2013 Florian Henry - * Copyright (C) 2016-2022 Ferran Marcet + * Copyright (C) 2016-2025 Ferran Marcet * Copyright (C) 2018-2024 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2022 Sylvain Legrand * Copyright (C) 2023 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -77,6 +77,11 @@ class Facture extends CommonInvoice */ public $table_element_line = 'facturedet'; + /** + * @var string Name of class line + */ + public $class_element_line = 'FactureLigne'; + /** * @var string Fieldname with ID of parent key if this field has a parent */ @@ -169,7 +174,6 @@ class Facture extends CommonInvoice public $resteapayer; /** - * * @var int<0,1> 1 if invoice paid COMPLETELY, 0 otherwise * @deprecated * Use statut and close_code) */ @@ -317,7 +321,7 @@ class Facture extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 1), @@ -3938,7 +3942,7 @@ class Facture extends CommonInvoice if (empty($fk_prev_id)) { $fk_prev_id = 'null'; } - if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') { + if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { $situation_percent = 100; } if (empty($ref_ext)) { @@ -3994,6 +3998,20 @@ class Facture extends CommonInvoice $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); + if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($fk_product); + if (abs($qty) < $tmpproduct->packaging) { + $qty = (float) $tmpproduct->packaging; + } else { + if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) { + $coeff = intval(abs($qty) / $tmpproduct->packaging) + 1; + $qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS'); + setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); + } + } + } + // Clean vat code $reg = array(); $vat_src_code = ''; @@ -4202,7 +4220,7 @@ class Facture extends CommonInvoice if (empty($special_code) || $special_code == 3) { $special_code = 0; } - if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') { + if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { $situation_percent = 100; } if (empty($ref_ext)) { @@ -4298,6 +4316,18 @@ class Facture extends CommonInvoice $this->line->rang = $rangmax + 1; } + if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { + if ($qty < $this->line->packaging) { + $qty = $this->line->packaging; + } else { + if (!empty($this->line->packaging) && fmod($qty, $this->line->packaging) > 0) { + $coeff = intval($qty / $this->line->packaging) + 1; + $qty = $this->line->packaging * $coeff; + setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); + } + } + } + $this->line->id = $rowid; $this->line->rowid = $rowid; $this->line->label = $label; @@ -4831,7 +4861,7 @@ class Facture extends CommonInvoice } // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } // Search on sale representative @@ -5025,7 +5055,7 @@ class Facture extends CommonInvoice $sql = "SELECT f.rowid, f.date_lim_reglement as datefin, f.fk_statut as status, f.total_ht"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".((int) $user->id); $clause = " AND"; @@ -5178,7 +5208,9 @@ class Facture extends CommonInvoice $line->remise_percent = 0; if ($xnbp == 1) { // Qty is negative (product line) $prodid = mt_rand(1, $num_prods); - $line->fk_product = $prodids[$prodid]; + if (isset($prodids[$prodid])) { + $line->fk_product = $prodids[$prodid]; + } $line->qty = -1; $line->total_ht = -100; $line->total_ttc = -119.6; @@ -5197,7 +5229,9 @@ class Facture extends CommonInvoice $line->multicurrency_total_tva = -39.2; } elseif ($xnbp == 3) { // Discount is 50% (product line) $prodid = mt_rand(1, $num_prods); - $line->fk_product = $prodids[$prodid]; + if (isset($prodids[$prodid])) { + $line->fk_product = $prodids[$prodid]; + } $line->total_ht = 50; $line->total_ttc = 59.8; $line->total_tva = 9.8; @@ -5207,7 +5241,9 @@ class Facture extends CommonInvoice $line->remise_percent = 50; } else { // (product line) $prodid = mt_rand(1, $num_prods); - $line->fk_product = $prodids[$prodid]; + if (isset($prodids[$prodid])) { + $line->fk_product = $prodids[$prodid]; + } $line->total_ht = 100; $line->total_ttc = 119.6; $line->total_tva = 19.6; @@ -5248,7 +5284,9 @@ class Facture extends CommonInvoice $line->multicurrency_total_ttc = 0; $line->multicurrency_total_tva = 0; $prodid = mt_rand(1, $num_prods); - $line->fk_product = $prodids[$prodid]; + if (isset($prodids[$prodid])) { + $line->fk_product = $prodids[$prodid]; + } $this->lines[$xnbp] = $line; $xnbp++; @@ -5273,7 +5311,7 @@ class Facture extends CommonInvoice $sql = "SELECT count(f.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".((int) $user->id); $clause = "AND"; @@ -6079,7 +6117,7 @@ class Facture extends CommonInvoice * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/compta/facture/class/factureligne.class.php b/htdocs/compta/facture/class/factureligne.class.php index e4e2b1a3ae2..da644fff225 100644 --- a/htdocs/compta/facture/class/factureligne.class.php +++ b/htdocs/compta/facture/class/factureligne.class.php @@ -180,6 +180,11 @@ class FactureLigne extends CommonInvoiceLine */ public $fk_prev_id; + /** + * @var float + */ + public $packaging; + /** * Constructor @@ -204,13 +209,15 @@ class FactureLigne extends CommonInvoiceLine $sql .= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,'; $sql .= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,'; $sql .= ' fd.fk_code_ventilation,'; + $sql .= ' fd.batch, fd.fk_warehouse,'; $sql .= ' fd.fk_unit, fd.fk_user_author, fd.fk_user_modif,'; $sql .= ' fd.situation_percent, fd.fk_prev_id,'; $sql .= ' fd.multicurrency_subprice,'; $sql .= ' fd.multicurrency_total_ht,'; $sql .= ' fd.multicurrency_total_tva,'; $sql .= ' fd.multicurrency_total_ttc,'; - $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc'; + $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,'; + $sql .= ' p.packaging'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid'; $sql .= ' WHERE fd.rowid = '.((int) $rowid); @@ -252,6 +259,8 @@ class FactureLigne extends CommonInvoiceLine $this->total_localtax2 = $objp->total_localtax2; $this->total_ttc = $objp->total_ttc; $this->fk_code_ventilation = $objp->fk_code_ventilation; + $this->batch = $objp->batch; + $this->fk_warehouse = $objp->fk_warehouse; $this->rang = $objp->rang; $this->fk_fournprice = $objp->fk_fournprice; $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht); @@ -277,6 +286,8 @@ class FactureLigne extends CommonInvoiceLine $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $this->packaging = $objp->packaging; + $this->fetch_optionals(); $this->db->free($result); diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 4d69db45350..ac09b9adeb5 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -154,7 +154,7 @@ class FactureStats extends Stats $sql = "SELECT date_format(f.datef,'%m') as dm, COUNT(*) as nb"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= $this->join; @@ -180,7 +180,7 @@ class FactureStats extends Stats $sql = "SELECT date_format(f.datef,'%Y') as dm, COUNT(*), SUM(c.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= $this->join; @@ -205,7 +205,7 @@ class FactureStats extends Stats $sql = "SELECT date_format(datef,'%m') as dm, SUM(f.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= $this->join; @@ -231,7 +231,7 @@ class FactureStats extends Stats $sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= $this->join; @@ -254,7 +254,7 @@ class FactureStats extends Stats $sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$this->field.") as avg"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= $this->join; @@ -278,7 +278,7 @@ class FactureStats extends Stats $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= $this->join; @@ -306,7 +306,7 @@ class FactureStats extends Stats $startYear = $endYear - $numberYears; $sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= $this->join; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 1c3856d360e..e2dff3c5387 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -316,7 +316,8 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan -if (!$user->hasRight('societe', 'client', 'voir')) { +// Check only if it's an internal user, external users are already filtered by $socid +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } @@ -325,6 +326,10 @@ $fieldid = (!empty($ref) ? 'ref' : 'rowid'); if (!empty($user->socid)) { $socid = $user->socid; } +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { + $search_sale = $user->id; +} + $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); diff --git a/htdocs/compta/facture/note-rec.php b/htdocs/compta/facture/note-rec.php index 61da109eb4a..42aa5138c86 100644 --- a/htdocs/compta/facture/note-rec.php +++ b/htdocs/compta/facture/note-rec.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,7 +118,7 @@ if (empty($object->id)) { } -if ($id > 0 ) { +if ($id > 0) { $object = new FactureRec($db); $object->fetch($id); @@ -129,7 +130,7 @@ if ($id > 0 ) { print dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'); - // Object card + // Object card // ------------------------------------------------------------ $linkback = ''.$langs->trans("BackToList").''; @@ -152,7 +153,7 @@ if ($id > 0 ) { 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'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); @@ -184,18 +185,18 @@ if ($id > 0 ) { $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_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $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_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $dateexample, 1, 'm'), '%m') . ')'; + $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $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_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $dateexample, 1, 'm'), '%B') . ')'; + $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $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') . ')'; + $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree((int) $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_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(($object->date_when ? (int) $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 ? (int) $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; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index fd22234a7a9..35a46efd9bc 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -1,4 +1,5 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2016 Laurent Destailleur @@ -6,7 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -931,7 +932,7 @@ if ($object->id > 0) { $tmpuser = new User($db); - $num = $db->num_rows($result); + $num = $db->num_rows($resql); while ($i < $num) { $obj = $db->fetch_object($resql); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 0d129b745a1..31c98fef78c 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -1,17 +1,17 @@ - * Copyright (C) 2004-2022 Laurent Destailleur - * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2015-2020 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2016 Marcos García - * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2020 Tobias Sekan - * Copyright (C) 2020 Josep Lluís Amador - * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2024 Rafael San José - * Copyright (C) 2024 MDW +/* Copyright (C) 2001-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2022 Laurent Destailleur + * Copyright (C) 2005-2015 Regis Houssin + * Copyright (C) 2015-2020 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016 Marcos García + * Copyright (C) 2019 Nicolas ZABOURI + * Copyright (C) 2020 Tobias Sekan + * Copyright (C) 2020 Josep Lluís Amador + * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2024 Rafael San José + * 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 @@ -161,7 +161,7 @@ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) { $sql .= " AND f.fk_soc = ".((int) $socid); } // Filter on sale representative - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $user->id).")"; } // Add where from hooks @@ -312,7 +312,7 @@ if ((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO $sql .= " AND ff.fk_soc = ".((int) $socid); } // Filter on sale representative - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = ff.fk_soc AND sc.fk_user = ".((int) $user->id).")"; } // Add where from hooks @@ -433,7 +433,7 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) { $langs->load("boxes"); $donationstatic = new Don($db); - $sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut as status"; + $sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut as status, d.fk_soc as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; $sql .= " WHERE d.entity IN (".getEntity('donation').")"; // Add where from hooks @@ -484,9 +484,18 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) { $donationstatic->statut = $obj->status; $donationstatic->status = $obj->status; - $label = $donationstatic->getFullName($langs); - if ($obj->societe) { - $label .= ($label ? ' - ' : '').$obj->societe; + $label = ''; + if (!empty($obj->socid)) { + $companystatic = new Societe($db); + $ret = $companystatic->fetch($obj->socid); + if ($ret > 0) { + $label = $companystatic->getNomUrl(1); + } + } else { + $label = $donationstatic->getFullName($langs); + if ($obj->societe) { + $label .= ($label ? ' - ' : '').$obj->societe; + } } print ''; @@ -635,7 +644,7 @@ if (isModEnabled('invoice') && isModEnabled('order') && $user->hasRight("command $sql .= " AND c.fk_statut = ".((int) Commande::STATUS_CLOSED); $sql .= " AND c.facture = 0"; // Filter on sale representative - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $user->id).")"; } diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 398c7f443cc..b7725e4f736 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -671,7 +671,7 @@ class Localtax extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index ddce090b667..33a10159f33 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2016 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1031,7 +1031,7 @@ class RemiseCheque extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/compta/paiement/document.php b/htdocs/compta/paiement/document.php index e4d761b0da3..428ea6d9d10 100644 --- a/htdocs/compta/paiement/document.php +++ b/htdocs/compta/paiement/document.php @@ -8,6 +8,7 @@ * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2021 Jesus Jerez * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,7 +52,7 @@ if (isModEnabled('project')) { // Load translation files required by the page $langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers', 'other')); -$id = GETPOST('id', 'int'); +$id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); @@ -105,7 +106,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; * View */ -$form = new Form($db); +$form = new Form($db); $title = $langs->trans('Payment')." - ".$langs->trans('Documents'); llxHeader('', $title); @@ -120,8 +121,8 @@ if ($object->id > 0) { $morehtmlref = '
'; // Date of payment - $morehtmlref .= $form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight('facture', 'creer')), 'datehourpicker', '', 0, 3).': '; - $morehtmlref .= $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight('facture', 'creer')), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded')); + $morehtmlref .= $form->editfieldkey("Date", 'datep', $object->date, $object, (int) ($object->statut == 0 && ($user->hasRight('facture', 'creer'))), 'datehourpicker', '', 0, 3).': '; + $morehtmlref .= $form->editfieldval("Date", 'datep', $object->date, $object, (int) ($object->statut == 0 && ($user->hasRight('facture', 'creer'))), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded')); // Payment mode $morehtmlref .= '
'.$langs->trans('PaymentMode').' : '; @@ -158,7 +159,7 @@ if ($object->id > 0) { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); // Build file list - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); $totalsize = 0; foreach ($filearray as $key => $file) { $totalsize += $file['size']; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 777973ca035..95f3968d84b 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2022 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -88,7 +88,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('tax', ' } /*if ($action == 'setdatep' && GETPOST('datepday') && $user->hasRight('tax', 'charges', 'creer')) { - $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int')); + $datepaye = dol_mktime(GETPOSTINT('datephour'), GETPOSTINT('datepmin'), GETPOSTINT('datepsec'), GETPOSTINT('datepmonth'), GETPOSTINT('datepday'), GETPOSTINT('datepyear')); $res = $object->update_date($datepaye); if ($res === 0) { setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs'); @@ -257,7 +257,7 @@ if (getDolGlobalString('BILL_ADD_PAYMENT_VALIDATION')) { if ($user->socid == 0 && $object->statut == 0 && $action == '') { if ($user->hasRight('facture', 'paiement')){ - print ''.$langs->trans('Valid').''; + print ''.$langs->trans('Valid').''; } } } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 376a958ee6a..861948151d6 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2014-2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 JC Prieto - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -194,7 +194,7 @@ class BonPrelevement extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 0,), @@ -252,7 +252,7 @@ class BonPrelevement extends CommonObject */ public $date_trans; /** - * @var int Current transport method, index to $methodes_trans + * @var int Current transport method, index to `$methodes_trans` */ public $method_trans; /** @@ -2912,7 +2912,7 @@ class BonPrelevement extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param ?array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 123f3c0bf4b..9c37b76e37b 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2016-2024 Frédéric France * Copyright (C) 2017-2024 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -215,6 +215,7 @@ if (empty($reshook)) { $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); $object->fk_account = GETPOSTINT('fk_account'); $object->fk_project = GETPOSTINT('fk_project'); + $object->paye = ChargeSociales::STATUS_UNPAID; $id = $object->create($user); if ($id <= 0) { @@ -430,7 +431,7 @@ if ($action == 'create') { print '
'; } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 97ac741e52e..35a1535e232 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2016-2024 Frédéric France * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,7 +62,7 @@ class ChargeSociales extends CommonObject protected $table_ref_field = 'ref'; /** - * @var int|string $date_ech + * @var int|string */ public $date_ech; @@ -820,7 +820,7 @@ class ChargeSociales extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index f2a4f3ecba0..0e7eaabe7d8 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -80,7 +80,7 @@ $search_date_limit_endyear = GETPOSTINT('search_date_limit_endyear'); $search_date_limit_start = dol_mktime(0, 0, 0, $search_date_limit_startmonth, $search_date_limit_startday, $search_date_limit_startyear); $search_date_limit_end = dol_mktime(23, 59, 59, $search_date_limit_endmonth, $search_date_limit_endday, $search_date_limit_endyear); $search_project_ref = GETPOST('search_project_ref', 'alpha'); -$search_users = GETPOST('search_users', 'intcomma'); +$search_users = GETPOST('search_users', 'array:int'); $search_type = GETPOST('search_type', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 1222d7c1472..3079b6225de 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2018 Philippe Grand * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -935,7 +935,7 @@ class Tva extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index e0ea47ccbd8..0e374c8d5da 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -185,10 +185,22 @@ if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') { $description .= '
' . $langs->trans("RulesVATInServices"); } if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { - $description .= '
' . $langs->trans("DepositsAreNotIncluded"); + if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice' && getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice') { + $description .= '
' . $langs->trans("DepositsAreNotIncluded"); + } elseif (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice') { // calculate on sale invoice for service only + $description .= '
' . $langs->trans("DepositsAreNotIncluded").' (for services)'; + } elseif (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice') { // calculate on sale invoice for service only + $description .= '
' . $langs->trans("DepositsAreNotIncluded").' (for products)'; + } } if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { - $description .= $langs->trans("SupplierDepositsAreNotIncluded"); + if (getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice' && getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice') { + $description .= '
' . $langs->trans("SupplierDepositsAreNotIncluded"); + } elseif (getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice') { // calculate on supplier invoice for service only + $description .= '
' . $langs->trans("SupplierDepositsAreNotIncluded").' (for services)'; + } elseif (getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice') { // calculate on supplier invoice for product only + $description .= '
' . $langs->trans("SupplierDepositsAreNotIncluded").' (for products)'; + } } if (isModEnabled('accounting')) { $description .= '
' . $langs->trans("ThisIsAnEstimatedValue"); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index a3db32f86cb..606ca72fecf 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -924,16 +924,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'.$langs->trans("MAIN_DISABLE_ALL_SMS").''; @@ -217,7 +217,7 @@ if ($action == 'edit') { print '
'; } else { print ''; - print ''; + print ''; // Disable print ''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 78590db9795..10df54ee44d 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -5,7 +5,7 @@ * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013 Florian Henry - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -656,7 +656,7 @@ foreach ($dirmodels as $reldir) { print ''; // Preview @@ -697,7 +697,7 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'.$langs->trans("MAIN_DISABLE_ALL_SMS").''.yn(getDolGlobalString('MAIN_DISABLE_ALL_SMS')).'
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index e1281c1bf58..8dc65bc920e 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2021 SuperAdmin - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify @@ -192,7 +192,7 @@ print ''.$langs->trans("StockTransferSetupPage").''; print '
".$langs->trans("Parameter")."'.$langs->trans("Value").'
'; - print ''; + print ''; foreach ($arrayofparameters as $key => $val) { @@ -213,7 +213,7 @@ print ''.$langs->trans("StockTransferSetupPage").''; - print ''; + print ''; foreach ($arrayofparameters as $key => $val) { @@ -337,7 +337,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print ''; print "\n"; @@ -473,7 +473,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); print ''; // Preview diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 325378332ce..b0c05b8bbea 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -303,7 +303,7 @@ foreach ($dirmodels as $reldir) { } print ''; print ''; @@ -441,7 +441,7 @@ foreach ($dirmodels as $reldir) { $htmltooltip .= '
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); print ''; print ''; print ''; } print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; print ''.img_object($langs->trans("Preview"), 'pdf').''; @@ -472,7 +472,7 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 17aa2f5f78f..c10d59f2939 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -320,7 +320,7 @@ foreach ($dirmodels as $reldir) { } print ''; print ''; @@ -446,7 +446,7 @@ foreach ($dirmodels as $reldir) { $htmltooltip .= '
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); print ''; print ''; // User print ''; // Actions code diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index c959800cef7..afe6549c03d 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 ATM Consulting * Copyright (C) 2017-2020 Laurent Destailleur * Copyright (C) 2022 charlene benke - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -102,12 +102,12 @@ class BlockedLog public $fk_user = 0; /** - * @var int|string date_creation + * @var int|string */ public $date_creation; /** - * @var int|string $date_modification; + * @var int|string */ public $date_modification; @@ -395,11 +395,11 @@ class BlockedLog /** * Populate properties of log from object data * - * @param CommonObject $object object to store - * @param string $action action - * @param float|int $amounts amounts - * @param ?User $fuser User object (forced) - * @return int<-1,-1>|int<1,1> >0 if OK, <0 if KO + * @param CommonObject|stdClass $object object to store + * @param string $action action + * @param float|int $amounts amounts + * @param ?User $fuser User object (forced) + * @return int<-1,-1>|int<1,1> >0 if OK, <0 if KO */ public function setObjectData(&$object, $action, $amounts, $fuser = null) { @@ -1115,7 +1115,7 @@ class BlockedLog if (empty($previoussignature)) { $sql = "SELECT rowid, signature FROM ".MAIN_DB_PREFIX."blockedlog"; if ($beforeid) { - $sql.= $this->db->hintindex('entity_rowid', 1); + $sql .= $this->db->hintindex('entity_rowid', 1); } $sql .= " WHERE entity = ".((int) $conf->entity); if ($beforeid) { diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 702c0f68e9b..ad8882f6ebc 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -815,7 +815,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->hasRight('bom', 'read'); // If you can read, you can build the PDF to read content $delallowed = $user->hasRight('bom', 'write'); // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); + print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang, '', $object); // Show links to link elements $tmparray = $form->showLinkToObjectBlock($object, array(), array('bom'), 1); diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index ed592c8ff91..1663a64d1bf 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -1,6 +1,7 @@ * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -135,7 +136,7 @@ $form = new Form($db); $formfile = new FormFile($db); $title = $langs->trans('BOM'); -$help_url ='EN:Module_BOM'; +$help_url = 'EN:Module_BOM'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bom page-net_needs'); @@ -330,7 +331,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($useunit) { require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; $unit = new CUnits($db); - $unit->fetch($elem['fk_unit']); + $unit->fetch((int) $elem['fk_unit']); print(isset($unit->label) ? " ".$langs->trans(ucwords($unit->label))." " : ''); } print ''; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index d779f11f4d7..49ebde095d7 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -98,7 +98,7 @@ class BOM extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/bom/class/bomline.class.php b/htdocs/bom/class/bomline.class.php index 67b879078df..a26f0c2a9f2 100644 --- a/htdocs/bom/class/bomline.class.php +++ b/htdocs/bom/class/bomline.class.php @@ -80,7 +80,7 @@ class BOMLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'LineID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index def20558866..1ce3201aa9c 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -6,7 +6,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -153,7 +153,7 @@ print ''; if ($filtertype != 1) { // Product if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // For product, unit is shown only if option PRODUCT_USE_UNITS is on print ''; $entry .= ''; $entry .= ''; $entry .= ''; @@ -517,7 +517,7 @@ $arrayofmassactions = array( ); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); -$typeid = $type; +$typeid = $type; // warning, typeid can be a string // List of products or services (type is type of category) @@ -579,7 +579,7 @@ if ($type == Categorie::TYPE_PRODUCT) { // Link to delete from category print ''; } @@ -2144,8 +2144,8 @@ if ($id > 0) { 'type' => 'user', //'transparency'=>$object->userassigned[$user->id]['transparency'], 'transparency' => $object->transparency, // Force transparency on ownerfrom event - 'answer_status' => (isset($object->userassigned[$object->userownerid]['answer_status']) ? $object->userassigned[$object->userownerid]['answer_status']: null), - 'mandatory' => (isset($object->userassigned[$object->userownerid]['mandatory']) ? $object->userassigned[$object->userownerid]['mandatory']:null) + 'answer_status' => (isset($object->userassigned[$object->userownerid]['answer_status']) ? $object->userassigned[$object->userownerid]['answer_status'] : null), + 'mandatory' => (isset($object->userassigned[$object->userownerid]['mandatory']) ? $object->userassigned[$object->userownerid]['mandatory'] : null) ); } if (!empty($object->userassigned)) { // Now concat assigned users @@ -2255,7 +2255,7 @@ if ($id > 0) { print ''; diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index a1d248df806..f7894822fb3 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -71,7 +71,7 @@ class ActionCommReminder extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index da003149657..648f96aba4d 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -4,7 +4,8 @@ * Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Vincent de Grandpré * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,7 +97,16 @@ class ICal $file_text = ''; //$tmpresult = getURLContent($file, 'GET', '', 1, [], ['http', 'https'], 2, 0); // To test with any URL - $tmpresult = getURLContent($file, 'GET'); + $localip = 0; + $sslverify = -1; + if (getDolGlobalString('AGENDA_EXT_CALENDAR_IP_MODE')) { + $localip = intval(getDolGlobalString('AGENDA_EXT_CALENDAR_IP_MODE')); + } + if (getDolGlobalString('AGENDA_EXT_CALENDAR_SSLVERIFY_MODE')) { + $sslverify = intval(getDolGlobalString('AGENDA_EXT_CALENDAR_SSLVERIFY_MODE')); + } + // See documentation of getURLContent function for $localip and $sslverify possible values + $tmpresult = getURLContent($file, 'GET', '', 1, [], ['http', 'https'], $localip, $sslverify); if ($tmpresult['http_code'] != 200) { $file_text = null; $this->error = 'Error: '.$tmpresult['http_code'].' '.$tmpresult['content']; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 93ae98884a3..a1d8b1605c9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -7,8 +7,8 @@ * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Open-DSI - * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,14 +33,13 @@ // Load Dolibarr environment require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -if (isModEnabled('project')) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -} +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; /** * @var Conf $conf @@ -50,14 +49,7 @@ if (isModEnabled('project')) { * @var User $user */ -if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) { - $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3; -} - -if (!getDolGlobalString('AGENDA_EXT_NB')) { - $conf->global->AGENDA_EXT_NB = 5; -} -$MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB'); +$MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB', 5); $DELAYFORCACHE = 300; // 300 seconds $disabledefaultvalues = GETPOSTINT('disabledefaultvalues'); @@ -122,10 +114,10 @@ $year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y"); $month = GETPOSTINT("month") ? GETPOSTINT("month") : date("m"); $week = GETPOSTINT("week") ? GETPOSTINT("week") : date("W"); $day = GETPOSTINT("day") ? GETPOSTINT("day") : date("d"); -$pid = GETPOSTINT("search_projectid", 3) ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3); +$pid = GETPOSTISSET("search_projectid") ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3); $status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo', 'na' or -1 $type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09'); -$maxprint = GETPOSTISSET("maxprint") ? GETPOSTINT("maxprint") : getDolGlobalInt('AGENDA_MAX_EVENTS_DAY_VIEW'); +$maxprint = GETPOSTISSET("maxprint") ? GETPOSTINT("maxprint") : getDolGlobalInt('AGENDA_MAX_EVENTS_DAY_VIEW', 3); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $dateselect = dol_mktime(0, 0, 0, GETPOSTINT('dateselectmonth'), GETPOSTINT('dateselectday'), GETPOSTINT('dateselectyear')); @@ -149,7 +141,7 @@ if (is_scalar($actioncode) && $actioncode == '-1') { } if ($status == '' && !GETPOSTISSET('search_status')) { - $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); + $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS')); } $defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app @@ -253,14 +245,14 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung'; -llxHeader('', $langs->trans("Agenda"), $help_url); - $form = new Form($db); $companystatic = new Societe($db); $contactstatic = new Contact($db); $userstatic = new User($db); +$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung'; +llxHeader('', $langs->trans("Agenda"), $help_url); + $now = dol_now(); $nowarray = dol_getdate($now); $nowyear = $nowarray['year']; @@ -407,9 +399,13 @@ if ($mode == 'show_day') { //print dol_print_date($firstdaytoshow,'dayhour').' '.dol_print_date($lastdaytoshow,'dayhour'); /*$title = $langs->trans("DoneAndToDoActions"); - if ($status == 'done') $title = $langs->trans("DoneActions"); - if ($status == 'todo') $title = $langs->trans("ToDoActions"); - */ +if ($status == 'done') { + $title = $langs->trans("DoneActions"); +} +if ($status == 'todo') { + $title = $langs->trans("ToDoActions"); +} +*/ $param = ''; if ($actioncode || GETPOSTISSET('search_actioncode')) { @@ -428,10 +424,10 @@ if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) { $param .= "&search_status=".urlencode($status); } if ($filter) { - $param .= "&search_filter=".urlencode($filter); + $param .= "&search_filter=".urlencode((string) $filter); } if ($filtert) { - $param .= "&search_filtert=".urlencode($filtert); + $param .= "&search_filtert=".urlencode((string) $filtert); } if ($usergroup > 0) { $param .= "&search_usergroup=".urlencode((string) ($usergroup)); @@ -481,7 +477,7 @@ if ($mode == 'show_day') { $picto = 'calendarday'; } if (empty($conf->dol_optimize_smallscreen)) { - $nav .= '   '.$langs->trans("Today").' '; + $nav .= ' '.$langs->trans("Today").' '; } $nav .= ''; @@ -585,7 +581,6 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' // Define the legend/list of calendard to show $s = ''; -$link = ''; $showextcals = $listofextcals; @@ -624,8 +619,8 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on $s .= ''."\n"; - if (!empty($conf->use_javascript_ajax)) { - $s .= '
'.$langs->trans("LocalAgenda").'  
'; - if (is_array($showextcals) && count($showextcals) > 0) { - foreach ($showextcals as $val) { - $htmlname = md5($val['name']); - $s .= ''."\n"; - $s .= '
'.$val ['name'].'  
'; - } - } - - //$s.='
'.$langs->trans("AgendaShowBirthdayEvents").'  
'; - - // Calendars from hooks - $parameters = array(); - $reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action); - if (empty($reshook)) { - $s .= $hookmanager->resPrint; - } elseif ($reshook > 1) { - $s = $hookmanager->resPrint; - } - } +if ($optioncss != '') { + print ''; } +print ''; +print ''; + $mode = 'show_peruser'; $massactionbutton = ''; @@ -444,31 +465,31 @@ $massactionbutton = ''; $viewmode = '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; print ''.img_object($langs->trans("Preview"), 'pdf').''; @@ -477,7 +477,7 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index b76fe11f1bd..20d89893d8e 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -2,7 +2,7 @@ /* Copyright (C) 2015 Juanjo Menent * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2020 Maxime DEMAREST - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -307,7 +307,7 @@ foreach ($dirmodels as $reldir) { } print ''; print ''; print "\n"; @@ -466,7 +415,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); print ''; // Preview diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 9cc2258a4df..71b42aea8a8 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -1,9 +1,11 @@ * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2016 Jean-François Ferry * Copyright (C) 2023 Romain Neil * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,7 +107,7 @@ class Documents extends DolibarrApi } $file_content = file_get_contents($original_file_osencoded); - return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'encoding'=>'base64'); + return array('filename' => $filename, 'content-type' => dol_mimetype($filename), 'filesize' => filesize($original_file), 'content' => base64_encode($file_content), 'encoding' => 'base64'); } @@ -290,7 +292,7 @@ class Documents extends DolibarrApi } $file_content = file_get_contents($original_file_osencoded); - return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'langcode'=>$outputlangs->defaultlang, 'template'=>$templateused, 'encoding'=>'base64'); + return array('filename' => $filename, 'content-type' => dol_mimetype($filename), 'filesize' => filesize($original_file), 'content' => base64_encode($file_content), 'langcode' => $outputlangs->defaultlang, 'template' => $templateused, 'encoding' => 'base64'); } /** @@ -693,6 +695,7 @@ class Documents extends DolibarrApi } $original_file = dol_sanitizeFileName($filename); + $relativefile = 'UNSET'; // Define $uploadir $object = null; diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 22e36b47bda..4930864aa71 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -1,7 +1,7 @@ * Copyright (C) 2018-2024 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify @@ -301,7 +301,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print ''; print "\n"; @@ -439,7 +439,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); print ''; // Preview diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index e90672c6d76..44eb8af5724 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018-2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Jose MARTINEZ * * This program is free software; you can redistribute it and/or modify @@ -84,23 +84,23 @@ class Asset extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'noteditable' => 0, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "Reference of object"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,), - 'fk_asset_model' => array('type' => 'integer:AssetModel:asset/class/assetmodel.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label' => 'AssetModel', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => 1,), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'noteditable' => 0, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "Reference of object", "css" => "maxwidth150"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax125', 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,), + 'fk_asset_model' => array('type' => 'integer:AssetModel:asset/class/assetmodel.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label' => 'AssetModel', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => 1, 'csslist' => 'tdoverflowmax75', 'css' => 'maxwidth300'), 'qty' => array('type' => 'real', 'label' => 'Qty', 'enabled' => 1, 'position' => 50, 'notnull' => 1, 'visible' => 0, 'default' => '1', 'isameasure' => 1, 'css' => 'maxwidth75imp', 'validate' => 1,), - 'acquisition_type' => array('type' => 'smallint', 'label' => 'AssetAcquisitionType', 'enabled' => 1, 'position' => 60, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array(0 => 'AssetAcquisitionTypeNew', 1 => 'AssetAcquisitionTypeOccasion'), 'validate' => 1,), - 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array(0 => 'AssetTypeIntangible', 1 => 'AssetTypeTangible', 2 => 'AssetTypeInProgress', 3 => 'AssetTypeFinancial'), 'validate' => 1,), - 'not_depreciated' => array('type' => 'boolean', 'label' => 'AssetNotDepreciated', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => 1,), + 'acquisition_type' => array('type' => 'smallint', 'label' => 'AssetAcquisitionType', 'enabled' => 1, 'position' => 60, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array(0 => 'AssetAcquisitionTypeNew', 1 => 'AssetAcquisitionTypeOccasion'), 'validate' => 1, 'csslist' => 'tdoverflowmax75'), + 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array(0 => 'AssetTypeIntangible', 1 => 'AssetTypeTangible', 2 => 'AssetTypeInProgress', 3 => 'AssetTypeFinancial'), 'validate' => 1, 'csslist' => 'tdoverflowmax75'), + 'not_depreciated' => array('type' => 'boolean', 'label' => 'AssetNotDepreciated', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => 1, 'csslist' => 'maxwidth50 tdoverflowmax50', 'css' => 'maxwidth50imp'), 'date_acquisition' => array('type' => 'date', 'label' => 'AssetDateAcquisition', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => 1,), 'date_start' => array('type' => 'date', 'label' => 'AssetDateStart', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => -1,), 'acquisition_value_ht' => array('type' => 'price', 'label' => 'AssetAcquisitionValueHT', 'enabled' => 1, 'position' => 110, 'notnull' => 1, 'visible' => 1, 'isameasure' => 1, 'validate' => 1,), 'recovered_vat' => array('type' => 'price', 'label' => 'AssetRecoveredVAT', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 1, 'isameasure' => 1, 'validate' => 1,), 'reversal_date' => array('type' => 'date', 'label' => 'AssetReversalDate', 'enabled' => 1, 'position' => 130, 'notnull' => 0, 'visible' => 1,), - 'reversal_amount_ht' => array('type' => 'price', 'label' => 'AssetReversalAmountHT', 'enabled' => 1, 'position' => 140, 'notnull' => 0, 'visible' => 1, 'isameasure' => 1, 'validate' => 1,), + 'reversal_amount_ht' => array('type' => 'price', 'label' => 'AssetReversalAmountHT', 'enabled' => 1, 'position' => 140, 'notnull' => 0, 'visible' => 1, 'isameasure' => 1, 'validate' => 1, 'csslist' => 'maxwidth50'), 'disposal_date' => array('type' => 'date', 'label' => 'AssetDisposalDate', 'enabled' => 1, 'position' => 200, 'notnull' => 0, 'visible' => -2,), 'disposal_amount_ht' => array('type' => 'price', 'label' => 'AssetDisposalAmount', 'enabled' => 1, 'position' => 210, 'notnull' => 0, 'visible' => -2, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), 'fk_disposal_type' => array('type' => 'sellist:c_asset_disposal_type:label:rowid::active=1', 'label' => 'AssetDisposalType', 'enabled' => 1, 'position' => 220, 'notnull' => 0, 'visible' => -2, 'index' => 1, 'validate' => 1,), @@ -713,7 +713,7 @@ class Asset extends CommonObject */ $sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht"; - $sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0) . " AS bookkeeping"; + $sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', '1', '0') . " AS bookkeeping"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad"; $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; $sql .= " WHERE ad.fk_asset = " . (int) $this->id; diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index ecd6d276726..16db99fcd02 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -66,7 +66,7 @@ class AssetDepreciationOptions extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index fcb463504e4..f985497ed4d 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -89,7 +89,7 @@ class AssetModel extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 649f436b2e0..abc15afd4af 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -53,26 +53,29 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'assetlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$mode = GETPOST('mode', 'alpha'); // mode view (kanban or common) +$mode = GETPOST('mode', 'aZ'); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...) +$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut' + $id = GETPOSTINT('id'); // Load variable for pagination $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 < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (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 or if we click on clear filters or if we select empty mass action +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -// Initialize a technical objects +// Initialize technical objects $object = new Asset($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('assetlist')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -90,7 +93,7 @@ if (!$sortorder) { } // Initialize array of search criteria -$search_all = GETPOST('search_all', 'alphanohtml'); +$search_all = trim(GETPOST('search_all', 'alphanohtml')); $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') { @@ -111,12 +114,13 @@ foreach ($object->fields as $key => $val) { } // Definition of array of fields for columns +$tableprefix = 't'; $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { $visible = (int) dol_eval((string) $val['visible'], 1); - $arrayfields['t.'.$key] = array( + $arrayfields[$tableprefix.'.'.$key] = array( 'label' => $val['label'], 'checked' => (($visible < 0) ? 0 : 1), 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), @@ -171,7 +175,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array(); +$parameters = array('arrayfields' => &$arrayfields); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -190,6 +194,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } + $search_all = ''; $toselect = array(); $search_array_options = array(); } @@ -202,6 +207,8 @@ if (empty($reshook)) { $objectclass = 'Asset'; $objectlabel = 'Asset'; $uploaddir = $conf->asset->dir_output; + + global $error; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -223,17 +230,17 @@ $morecss = array(); // Build and execute select // -------------------------------------------------------------------- -$sql = 'SELECT '; -$sql .= $object->getFieldList('t'); +$sql = "SELECT"; +$sql .= " ".$object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ""); } } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); @@ -245,10 +252,10 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array } // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if ($object->ismultientitymanaged == 1) { - $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; + $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")"; } else { $sql .= " WHERE 1 = 1"; } @@ -264,18 +271,24 @@ foreach ($search as $key => $val) { } $mode_search = 2; } - if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + if (empty($object->fields[$key]['searchmulti'])) { + if (!is_array($search[$key]) && $search[$key] != '') { + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + } + } else { + if (is_array($search[$key]) && !empty($search[$key])) { + $sql .= natural_search("t.".$db->escape($key), implode(',', $search[$key]), (($key == 'status') ? 2 : $mode_search)); + } } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; + $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'"; } } } @@ -289,13 +302,13 @@ if ($search_all) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; /* If a group by is required $sql .= " GROUP BY "; foreach($object->fields as $key => $val) { - $sql .= "t.".$key.", "; + $sql .= "t.".$db->sanitize($key).", "; } // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -303,9 +316,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); } } -// Add where from hooks +// Add groupby from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); */ @@ -313,8 +326,8 @@ $sql = preg_replace('/,\s*$/', '', $sql); // Add HAVING from hooks /* $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook -$sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrint) : ""; +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint; */ // Count total nb of records @@ -331,7 +344,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -354,10 +367,10 @@ $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { +if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/asset/card.php?id='.$id); + header("Location: ".DOL_URL_ROOT.'/asset/card.php?id='.((int) $id)); exit; } @@ -365,36 +378,46 @@ if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $s // Output page // -------------------------------------------------------------------- -llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-asset page-list'); +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-asset page-list bodyforlist'); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($groupby != '') { + $param .= '&groupby='.urlencode($groupby); +} foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { if ($skey != '') { $param .= '&search_'.$key.'[]='.urlencode($skey); } } + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month'); + $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day'); + $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year'); } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } -if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); -} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array('param' => &$param); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -404,7 +427,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) { @@ -423,6 +446,9 @@ print ''; print ''; print ''; print ''; +print ''; +print ''; + $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/asset/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); @@ -437,10 +463,14 @@ $trackid = 'asset'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; + // @phan-suppress-next-line PhanEmptyForeach foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } - print '
'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'
'; + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'
'."\n"; } $moreforfilter = ''; @@ -455,6 +485,9 @@ if (empty($reshook)) { } else { $moreforfilter = $hookmanager->resPrint; } +$parameters = array( + 'arrayfields' => &$arrayfields, +); if (!empty($moreforfilter)) { print '
'; @@ -463,7 +496,8 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); $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 @@ -472,8 +506,16 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); if (getDolGlobalString("PAYMENT_ADDON").'.php' == $file) { // If module is the one used, we show existing errors if (!empty($module->error)) { @@ -421,7 +421,7 @@ foreach ($dirmodels as $reldir) { $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; print ''.img_object($langs->trans("Preview"), 'pdf').''; @@ -454,7 +454,7 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 4c3fc9ee12c..c642ff20383 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -8,7 +8,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -336,7 +336,7 @@ foreach ($dirmodels as $reldir) { } print ''; print "\n"; @@ -475,7 +475,7 @@ foreach ($dirmodels as $reldir) { print ''; // Preview diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index fac147f09d4..2a922fbd752 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -217,7 +217,7 @@ print '
'; // You can use div-table-resp print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; @@ -309,7 +309,7 @@ print ''; print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print '
'.$langs->trans("Type").''.$langs->trans("Value").'
'; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 77ff2b03096..d70217c985e 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -180,7 +180,7 @@ if (empty($mysoc->tva_assuj)) { print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Parameter").'
'; - print ''; + print ''; print ''; // Preview diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index fbaa912385a..15939c806c2 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -236,7 +236,7 @@ foreach ($dirmodels as $reldir) { print ''; // Preview diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index 382971d9906..a4451fec911 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -182,7 +182,7 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").'
'; print ''; diff --git a/htdocs/admin/tools/ui/class/documentation.class.php b/htdocs/admin/tools/ui/class/documentation.class.php index 4de7133c9e6..642b07121da 100644 --- a/htdocs/admin/tools/ui/class/documentation.class.php +++ b/htdocs/admin/tools/ui/class/documentation.class.php @@ -127,6 +127,15 @@ class Documentation 'DocButtonSubmenu' => '#buttonsection-submenu', ), ), + 'Icons' => array( + 'url' => dol_buildpath($baseUrl.'/components/icons.php', 1), + 'icon' => 'far fa-flag pictofixedwidth', + 'submenu' => array(), + 'summary' => array( + 'DocIconsList' => '#img-picto-section-list', + 'DocIconsFontAwesomeList' => '#icon-section-list', + ), + ), 'Progress' => array( 'url' => dol_buildpath($baseUrl.'/components/progress-bars.php', 1), 'icon' => 'fas fa-battery-half pictofixedwidth', diff --git a/htdocs/admin/tools/ui/components/event-message.php b/htdocs/admin/tools/ui/components/event-message.php index 9de212b8991..beab510a877 100644 --- a/htdocs/admin/tools/ui/components/event-message.php +++ b/htdocs/admin/tools/ui/components/event-message.php @@ -110,7 +110,7 @@ $documentation->showSidebar(); ?> $lines = array( ' + * + * This program and files/directory inner it is free software: you can + * redistribute it and/or modify it under the terms of the + * GNU Affero General Public License (AGPL) 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 AGPL for more details. + * + * You should have received a copy of the GNU AGPL + * along with this program. If not, see . + */ + +// Load Dolibarr environment +require '../../../../main.inc.php'; + +/** + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + +// Protection if external user +if ($user->socid > 0) { + accessforbidden(); +} + +// Includes +require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php'; + +// Load documentation translations +$langs->load('uxdocumentation'); + +// +$documentation = new Documentation($db); + +// Output html head + body - Param is Title +$documentation->docHeader('Icons'); + +// Set view for menu and breadcrumb +// Menu must be set in constructor of documentation class +$documentation->view = array('Components','Icons'); + +// Output sidebar +$documentation->showSidebar(); ?> + +
+ + showBreadCrumb(); ?> + +
+ +

trans('DocIconsTitle'); ?>

+

trans('DocIconsMainDescription'); ?>

+ + + showSummary(); ?> + + + +
+ + + +

trans('DocIconsList'); ?>

+ trans('DocDocIconsListDescription'); ?>

*/ ?> +
+
+ + + '.$iconCode.' + +
+
'. $iconName .'
+
+
+
+
'.dol_htmlentities('img_picto(\''.$labelAlt.'\', '.$iconName.')').'
+
+
+
+
+
'; + } + ?> +
+
+
+ + + + +
+ + + +

trans('DocIconsList'); ?>

+ trans('DocDocIconsListDescription'); ?>

*/ ?> +
+ +
+ + '; + + + print '
+ + '.$iconCode.' + +
+
'. ($iconData[2]??($iconData[0]??'')) .'
+
+
+
+
'.dol_htmlentities($iconCode).'
+
+
+
+
+
'; + } + } + ?> +
+
+
+ +
+ + +docFooter(); diff --git a/htdocs/admin/tools/ui/css/documentation.css b/htdocs/admin/tools/ui/css/documentation.css index 0bee0aae2bf..3dbd1abdfb2 100644 --- a/htdocs/admin/tools/ui/css/documentation.css +++ b/htdocs/admin/tools/ui/css/documentation.css @@ -78,8 +78,12 @@ body.dolibarr-doc { .doc-wrapper .doc-content-wrapper .documentation-section h2.documentation-title {margin: 0;margin-bottom:16px;padding: 0;color: rgb(38,60,92);} .doc-wrapper .doc-content-wrapper .documentation-section .documentation-example {border:1px dashed #ccc;box-sizing: border-box;padding: 16px;margin-bottom: 16px;} .doc-wrapper .doc-content-wrapper .documentation-section .documentation-code {background: var(--colorbacklinepairchecked);border:1px dashed #ccc;box-sizing: border-box;padding: 16px;margin-bottom: 16px;overflow: auto;} +.doc-wrapper .doc-content-wrapper .documentation-section .info-box .documentation-code {padding: 3px 16px; margin-bottom: 5px;} .doc-wrapper .doc-content-wrapper .documentation-section .documentation-code pre {margin: 0;padding: 0;tab-size: 24px;} /* Documentation scroll indicator */ #documentation-scrollwrapper {height: 5px;position: fixed;bottom: 0;left: 260px;right:0;z-index: 99;} -#documentation-scroll {background: rgb(0, 123, 140);height: 5px;position: absolute;top: 0;left:0} \ No newline at end of file +#documentation-scroll {background: rgb(0, 123, 140);height: 5px;position: absolute;top: 0;left:0} + +/* component icons */ +.documentation-fontawesome-icon-list span{ color: #333; } diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 0c957617ce1..8055e5fdcde 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2020-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -317,7 +317,7 @@ foreach ($dirmodels as $reldir) { print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print ''; + print ''; // @phan-suppress-next-line PhanEmptyForeach foreach ($arrayofparameters as $constname => $val) { @@ -273,7 +273,7 @@ if ($action == 'edit') { } else { if (!empty($arrayofparameters)) { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled'] == 1) { diff --git a/htdocs/admin/website_options.php b/htdocs/admin/website_options.php index e41ccdf90c7..4cb3f9c6120 100644 --- a/htdocs/admin/website_options.php +++ b/htdocs/admin/website_options.php @@ -128,7 +128,7 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'; print ''; print ''; print ''; -print ''."\n"; +print ''."\n"; print ''; diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index f05467d68da..b93b8e0bb0c 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify @@ -185,57 +185,6 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); $head = workstationAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "workstation"); -// Setup page goes here -//echo ''.$langs->trans("WorkstationSetupPage").'

'; - - -if ($action == 'edit') { - print '
'; - print ''; - print ''; - - print '
'.$langs->trans("Parameter").' '.$langs->trans("Value").'
'; - print ''; - - // @phan-suppress-next-line PhanEmptyForeach - foreach ($arrayofparameters as $key => $val) { - print ''; - } - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); - print $form->textwithpicto($langs->trans($key), $tooltiphelp); - print '
'; - - print '
'; - print ''; - print '
'; - - print ''; - print '
'; -} else { - if (!empty($arrayofparameters)) { - print ''; - print ''; - - foreach ($arrayofparameters as $key => $val) { - $setupnotempty++; - - print ''; - } - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); - print $form->textwithpicto($langs->trans($key), $tooltiphelp); - print ''.getDolGlobalString($key).'
'; - - print '
'; - print ''.$langs->trans("Modify").''; - print '
'; - }/* else { - print '
'.$langs->trans("NothingToSetup"); - }*/ -} - foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectArray['includerefgeneration']) { @@ -332,7 +281,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
'; +print ''; +// Action column +if ($conf->main_checkbox_left_column) { + print ''; +} foreach ($object->fields as $key => $val) { + //$searchkey = empty($search[$key]) ? '' : $search[$key]; $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -481,15 +523,19 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; } @@ -512,19 +558,28 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields' => $arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; +if (!$conf->main_checkbox_left_column) { + print ''; +} print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column +if ($conf->main_checkbox_left_column) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -533,21 +588,26 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; + $totalarray['nbfield']++; } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (!$conf->main_checkbox_left_column) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} print ''."\n"; @@ -565,9 +625,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // Loop on record // -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -576,8 +638,26 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; + // Show line of result + $j = 0; + print ''; + + // Action column + if ($conf->main_checkbox_left_column) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Fields foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { @@ -587,18 +667,22 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; } - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print '$key) && !in_array($key, array('ref'))) { + print ' title="'.dol_escape_htmltag($object->$key).'"'; + } + print '>'; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { @@ -628,20 +712,22 @@ while ($i < ($limit ? min($num, $limit) : $num)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; } print ''."\n"; @@ -667,7 +753,7 @@ if ($num == 0) { $db->free($resql); $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print ''."\n"; diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 01cb2c58f1c..35f7934add0 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 ATM Consulting * Copyright (C) 2017-2018 Laurent Destailleur * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -353,7 +353,7 @@ $help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Ina llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-blockedlog page-admin_blockedlog_list'); -$blocks = $block_static->getLog('all', $search_id, $MAXLINES, $sortfield, $sortorder, $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code); +$blocks = $block_static->getLog('all', (int) $search_id, $MAXLINES, $sortfield, $sortorder, (int) $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code); if (!is_array($blocks)) { if ($blocks == -2) { setEventMessages($langs->trans("TooManyRecordToScanRestrictFilters", $MAXLINES), null, 'errors'); @@ -440,7 +440,7 @@ print ''; print '
'; print $langs->trans("RestrictYearToExport").': '; // Month -print $formother->select_month(GETPOSTINT('monthtoexport'), 'monthtoexport', 1, 0, 'minwidth50 maxwidth75imp valignmiddle', true); +print $formother->select_month((string) GETPOSTINT('monthtoexport'), 'monthtoexport', 1, 0, 'minwidth50 maxwidth75imp valignmiddle', true); print ''; print ''; print ''; @@ -491,7 +491,7 @@ print '
'; -print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth150'); +print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth150'); print ''; - $label = measuringUnitString($line->fk_unit, '', '', 1); + $label = measuringUnitString((int) $line->fk_unit, '', null, 1); if ($label !== '') { print $langs->trans($label); } @@ -359,7 +359,7 @@ if ($resql) { $total_cost += $sub_bom->total_cost * $sub_bom_line->qty * (float) $line->qty; } elseif ($sub_bom_product->type == Product::TYPE_SERVICE && isModEnabled('workstation') && !empty($sub_bom_product->fk_default_workstation)) { //Convert qty to hour - $unit = measuringUnitString($sub_bom_line->fk_unit, '', '', 1); + $unit = measuringUnitString($sub_bom_line->fk_unit, '', null, 1); $qty = convertDurationtoHour($sub_bom_line->qty, $unit); $workstation = new Workstation($this->db); $res = $workstation->fetch($sub_bom_product->fk_default_workstation); diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index 8906b147c82..ce329cc9620 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2022 Alice Adminson * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,7 +101,7 @@ class Availabilities extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), @@ -831,7 +831,7 @@ class Availabilities extends CommonObject * Return a thumb for kanban views * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index db5eff037cd..a6f76aafb1d 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2023 Alice Adminson - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,7 +101,7 @@ class Calendar extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'right', 'comment' => "Id"), @@ -816,8 +816,8 @@ class Calendar extends CommonObject /** * Return a thumb for kanban views * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 6e1b9083210..ffdfa80e1c4 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -294,10 +294,35 @@ class Categorie extends CommonObject */ public $imgHeight; + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommended to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => -1,), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'default' => '1', 'notnull' => 1, 'index' => 1, 'position' => 5), 'fk_parent' => array('type' => 'integer', 'label' => 'Fkparent', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx',), - 'label' => array('type' => 'varchar(180)', 'label' => 'Label', 'enabled' => 1, 'position' => 25, 'notnull' => 1, 'visible' => -1, 'alwayseditable' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist' => 'tdoverflowmax150',), + 'label' => array('type' => 'varchar(180)', 'label' => 'Label', 'enabled' => 1, 'position' => 25, 'notnull' => 1, 'visible' => -1, 'alwayseditable' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist' => 'tdoverflowmax150', 'showoncombobox' => 1), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => 0, 'alwayseditable' => 1,), 'type' => array('type' => 'integer', 'label' => 'Type', 'enabled' => 1, 'position' => 35, 'notnull' => 1, 'visible' => -1, 'alwayseditable' => 1,), 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,), @@ -1466,12 +1491,13 @@ class Categorie extends CommonObject // phpcs:enable $ways = array(); - $all_ways = $this->get_all_ways(); // Load array of categories - foreach ($all_ways as $way) { + $all_ways = $this->get_all_ways(); // Load array of categories to reach this->id + + foreach ($all_ways as $way) { // It seems we always have 1 entry in this array. $w = array(); $i = 0; $forced_color = ''; - foreach ($way as $cat) { + foreach ($way as $cat) { // Loop on each successive categories to reach the target of current category $i++; if (empty($nocolor)) { @@ -1511,6 +1537,7 @@ class Categorie extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns an array containing the list of parent categories + * Note: A category can only have one parent but this method return an array to work the same way the get_filles is working. * * @return int|Categorie[] Return integer <0 KO, array OK */ @@ -1541,7 +1568,7 @@ class Categorie extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Returns in a table all possible paths to get to the category + * Returns in a array all possible paths to go to the category * starting with the major categories represented by Tables of categories * * @return Categorie[][] @@ -1554,7 +1581,7 @@ class Categorie extends CommonObject $parents = $this->get_meres(); if (is_array($parents)) { foreach ($parents as $parent) { - $all_ways = $parent->get_all_ways(); + $all_ways = $parent->get_all_ways(); // recursivity. TODO Add a protection for infinite loop foreach ($all_ways as $way) { $w = $way; $w[] = $this; @@ -1646,8 +1673,8 @@ class Categorie extends CommonObject } /** - * Returns categories whose id or name match - * add wildcards in the name unless $exact = true + * Returns categories whose id or name matches. + * It add wildcards in the name unless $exact = true * * @param int $id Id * @param string $nom Name @@ -1806,9 +1833,9 @@ class Categorie extends CommonObject } // Check contrast with background and correct text color - $forced_color = 'categtextwhite'; + $forced_color = 'categtextwhite'; // We want color white because the getNomUrl of a tag is always called inside a dark background like '' to show it as a tag. TODO Add this in param to force when called outside of span. if ($this->color) { - if (colorIsLight($this->color)) { + if (colorIsLight($this->color)) { // If color is light, we force color to dark $forced_color = 'categtextblack'; } } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 725e43717cd..fcef409cc55 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -298,9 +298,9 @@ dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'la // Confirmation of deletion if ($action == 'delete') { if ($backtopage) { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&backtopage='.urlencode($backtopage), $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 2); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.urlencode($type).'&backtopage='.urlencode($backtopage), $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 2); } else { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type, $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.urlencode($type), $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 1); } } @@ -349,11 +349,11 @@ if ($reshook < 0) { if (empty($reshook)) { if ($user->hasRight('categorie', 'creer')) { $socid = ($object->socid ? "&socid=".$object->socid : ""); - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; } if ($user->hasRight('categorie', 'supprimer')) { - print 'id.'&type='.$type.'&backtolist='.urlencode($backtolist).'">'.$langs->trans("Delete").''; + print 'id.'&type='.urlencode($type).'&backtolist='.urlencode($backtolist).'">'.$langs->trans("Delete").''; } } @@ -363,8 +363,8 @@ $newcardbutton = ''; if ($user->hasRight('categorie', 'creer')) { $link = DOL_URL_ROOT.'/categories/card.php'; $link .= '?action=create'; - $link .= '&type='.$type; - $link .= '&catorigin='.$object->id; + $link .= '&type='.urlencode($type); + $link .= '&catorigin='.((int) $object->id); $link .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.'&id='.$id); $newcardbutton = '
'; @@ -462,13 +462,13 @@ if ($cats < 0) { $entry .= $counter; $entry .= '
'; - $entry .= ''.img_view().''; + $entry .= ''.img_view().''; $entry .= ''; - $entry .= ''.img_edit().''; + $entry .= ''.img_edit().''; $entry .= ''; - $entry .= ''.img_delete().''; + $entry .= ''.img_delete().''; $entry .= '
'; if ($permission) { - print 'id.'">'; + print 'id).($limit ? '&limit='.$limit : '').'">'; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -659,7 +659,7 @@ if ($type == Categorie::TYPE_CUSTOMER) { // Link to delete from category print ''; if ($permission) { - print "id."'>"; + print "id).($limit ? '&limit='.$limit : '')."'>"; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -740,7 +740,7 @@ if ($type == Categorie::TYPE_SUPPLIER) { // Link to delete from category print ''; if ($permission) { - print 'id.($limit ? '&limit='.$limit : '').'">'; + print 'id).($limit ? '&limit='.$limit : '').'">'; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -825,7 +825,7 @@ if ($type == Categorie::TYPE_MEMBER) { // Link to delete from category print ''; if ($permission) { - print "id."'>"; + print "id).($limit ? '&limit='.$limit : '')."'>"; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -911,7 +911,7 @@ if ($type == Categorie::TYPE_CONTACT) { // Link to delete from category print ''; if ($permission) { - print "id."'>"; + print "id).($limit ? '&limit='.$limit : '')."'>"; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -994,7 +994,7 @@ if ($type == Categorie::TYPE_ACCOUNT) { // Link to delete from category print ''; if ($permission) { - print "id."'>"; + print "id).($limit ? '&limit='.$limit : '')."'>"; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -1076,7 +1076,7 @@ if ($type == Categorie::TYPE_PROJECT) { // Link to delete from category print ''; if ($permission) { - print "id."'>"; + print "id).($limit ? '&limit='.$limit : '')."'>"; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -1154,7 +1154,7 @@ if ($type == Categorie::TYPE_USER) { // Link to delete from category print ''; if ($user->hasRight('user', 'user', 'creer')) { - print "id."'>"; + print "id).($limit ? '&limit='.$limit : '')."'>"; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -1225,7 +1225,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) { // Link to delete from category print ''; if ($permission) { - print "id."'>"; + print "id).($limit ? '&limit='.$limit : '')."'>"; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -1305,7 +1305,7 @@ if ($type == Categorie::TYPE_TICKET) { // Link to delete from category print ''; if ($permission) { - print "id."'>"; + print "id).($limit ? '&limit='.$limit : '')."'>"; //print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; @@ -1391,7 +1391,7 @@ if ($type == Categorie::TYPE_FICHINTER) { // Link to delete from category print ''; if ($permission) { - print "id."'>"; + print "id).($limit ? '&limit='.$limit : '')."'>"; print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); print ""; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 6af0cf4aca6..9ebc4408438 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -9,7 +9,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1682,7 +1682,7 @@ if ($action == 'create') { print '
'.$langs->trans("Project").''; print img_picto('', 'project', 'class="pictofixedwidth"'); - print $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx maxwidth500'); + print $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), (string) $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx maxwidth500'); print ' '; print ''; @@ -1708,14 +1708,14 @@ if ($action == 'create') { // Task print '
'.$langs->trans("Task").''; print img_picto('', 'projecttask', 'class="paddingrightonly"'); - $projectsListId = false; + $projectsListId = ''; if (!empty($projectid)) { $projectsListId = $projectid; } $tid = GETPOSTISSET("projecttaskid") ? GETPOSTINT("projecttaskid") : (GETPOSTISSET("taskid") ? GETPOSTINT("taskid") : ''); - $formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500 widthcentpercentminusxx', $projectsListId); + $formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500 widthcentpercentminusxx', (string) $projectsListId); print '
'.$langs->trans("Project").''; print img_picto('', 'project', 'class="pictofixedwidth"'); - $numprojet = $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth500 widthcentpercentminusxx'); + $numprojet = $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), (string) $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth500 widthcentpercentminusxx'); if ($numprojet == 0) { print '   '; } @@ -2294,7 +2294,7 @@ if ($id > 0) { })'; print ''."\n"; - $formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $object->fk_element, 'fk_element', 24, 0, 0, 1, 0, 0, 'maxwidth500', $object->fk_project); + $formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $object->fk_element, 'fk_element', 24, 0, '', 1, 0, 0, 'maxwidth500', (string) $object->fk_project); print ''; print '
'; + echo '
'; echo ''; echo ''; @@ -1695,11 +2423,11 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($style2 == 'peruser_notbusy') { print 'style="border: 1px solid #'.($color2 ? $color2 : "888").' !important" '; } elseif ($color2) { - print($color2 ? 'style="background: #'.$color2.';"' : ''); + print 'style="background: #'.$color2.'; "'; } print 'class="'; print($style2 ? $style2.' ' : ''); - print 'onclickopenref center'.($title2 ? ' classfortooltip' : '').($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_15_'.($ids2 ? $ids2 : 'none').'"'.($title2 ? ' title="'.$title2.'"' : '').'>'; + print 'center'.($title2 ? ' classfortooltip' : '').($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_15_'.($ids2 ? $ids2 : 'none').'"'.($title2 ? ' title="'.$title2.'"' : '').'>'; print $string2; print ''; @@ -1707,11 +2435,11 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($style3 == 'peruser_notbusy') { print 'style="border: 1px solid #'.($color3 ? $color3 : "888").' !important" '; } elseif ($color3) { - print($color3 ? 'style="background: #'.$color3.';"' : ''); + print 'style="background: #'.$color3.'; "'; } print 'class="'; - print($style3 ? $style3.' ' : ''); - print 'onclickopenref center'.($title2 ? ' classfortooltip' : '').($title3 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_30_'.($ids3 ? $ids3 : 'none').'"'.($title3 ? ' title="'.$title3.'"' : '').'>'; + print $style3.' '; + print 'center'.($title2 ? ' classfortooltip' : '').($title3 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_30_'.($ids3 ? $ids3 : 'none').'"'.($title3 ? ' title="'.$title3.'"' : '').'>'; print $string3; print ''; @@ -1719,11 +2447,11 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($style4 == 'peruser_notbusy') { print 'style="border: 1px solid #'.($color4 ? $color4 : "888").' !important" '; } elseif ($color4) { - print($color4 ? 'style="background: #'.$color4.';"' : ''); + print 'style="background: #'.$color4.'; "'; } print 'class="'; - print($style4 ? $style4.' ' : ''); - print 'onclickopenref center'.($title3 ? ' classfortooltip' : '').($title4 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_45_'.($ids4 ? $ids4 : 'none').'"'.($title4 ? ' title="'.$title4.'"' : '').'>'; + print $style4.' '; + print 'center'.($title3 ? ' classfortooltip' : '').($title4 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_45_'.($ids4 ? $ids4 : 'none').'"'.($title4 ? ' title="'.$title4.'"' : '').'>'; print $string4; print ''; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index a1905157121..3b5a124fa4a 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -156,13 +156,13 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire") && is_object($pr $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")"; $sql .= " AND p.fk_soc = s.rowid"; $sql .= " AND p.fk_statut = ".Propal::STATUS_DRAFT; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { @@ -256,13 +256,13 @@ if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "l $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE p.entity IN (".getEntity($supplierproposalstatic->element).")"; $sql .= " AND p.fk_statut = ".SupplierProposal::STATUS_DRAFT; $sql .= " AND p.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { @@ -355,13 +355,13 @@ if (isModEnabled('order') && $user->hasRight('commande', 'lire') && is_object($o $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")"; $sql .= " AND c.fk_statut = ".Commande::STATUS_DRAFT; $sql .= " AND c.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { @@ -457,13 +457,13 @@ if ((isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE cf.entity IN (".getEntity($supplierorderstatic->element).")"; $sql .= " AND cf.fk_statut = ".CommandeFournisseur::STATUS_DRAFT; $sql .= " AND cf.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { @@ -556,7 +556,7 @@ if (isModEnabled('intervention') && is_object($fichinterstatic)) { $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE f.entity IN (".getEntity('intervention').")"; @@ -565,7 +565,7 @@ if (isModEnabled('intervention') && is_object($fichinterstatic)) { if ($socid) { $sql .= " AND f.fk_soc = ".((int) $socid); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } @@ -641,12 +641,12 @@ if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) { $sql .= ", s.canvas"; $sql .= ", s.datec, s.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")"; $sql .= " AND s.client IN (".Societe::CUSTOMER.", ".Societe::PROSPECT.", ".Societe::CUSTOMER_AND_PROSPECT.")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } // Add where from hooks @@ -750,7 +750,7 @@ if (isModEnabled('propal') && is_object($propalstatic)) { $sql .= " AND c.fk_soc = s.rowid"; // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } // Search on sale representative @@ -845,7 +845,7 @@ if (isModEnabled('order')) { $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; @@ -854,7 +854,7 @@ if (isModEnabled('order')) { if ($socid) { $sql .= " AND c.fk_soc = ".((int) $socid); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= " ORDER BY c.tms DESC"; @@ -933,12 +933,12 @@ if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $use $sql .= ", s.canvas"; $sql .= ", s.datec as dc, s.tms as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")"; $sql .= " AND s.fournisseur = ".Societe::SUPPLIER; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } // Add where from hooks @@ -1049,13 +1049,13 @@ if (isModEnabled('contract') && $user->hasRight("contrat", "lire") && 0) { // TO $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."contrat as c"; $sql .= ", ".MAIN_DB_PREFIX."product as p"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.entity IN (".getEntity($staticcontrat->element).")"; $sql .= " AND c.fk_soc = s.rowid"; $sql .= " AND c.fk_product = p.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { @@ -1125,13 +1125,13 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")"; $sql .= " AND p.fk_soc = s.rowid"; $sql .= " AND p.fk_statut = ".Propal::STATUS_VALIDATED; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { @@ -1245,13 +1245,13 @@ if (isModEnabled('order') && $user->hasRight('commande', 'lire') && is_object($o $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")"; $sql .= " AND c.fk_soc = s.rowid"; $sql .= " AND c.fk_statut IN (".Commande::STATUS_VALIDATED.", ".Commande::STATUS_SHIPMENTONPROCESS.")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index b36538b2a68..0920ddae516 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -799,7 +799,7 @@ if ($action == 'create') { // aaa // Print mail form print load_fiche_titre($langs->trans("NewMailing"), $availablelink, 'object_email'); - print dol_get_fiche_head(array(), '', '', -4, '', 0, '', ''); + print dol_get_fiche_head(array(), '', '', 0, '', 0, '', ''); print '
'; - if ($canedit && $mode == 'show_peruser') { + if ($canedit /* && $mode == 'show_peruser' */) { // mode is forced to show_peruser // Filter on days print ''; print img_picto('', 'clock', 'class="fawidth30 inline-block marginleftonly"'); @@ -942,7 +1629,7 @@ while ($currentdaytoshow < $lastdaytoshow) { } } } else { - /* Use this list to have for all users */ + /* Use this list to have lines for all users */ $sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity"; $sql .= " FROM ".$db->prefix()."user as u"; if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { @@ -1073,7 +1760,7 @@ if (getDolGlobalString('AGENDA_USE_EVENT_TYPE') && getDolGlobalString('AGENDA_US print '
'.$langs->trans("Legend").':
'; foreach ($colorsbytype as $code => $color) { if ($color) { - print '
 
'; + print '
 
'; print $langs->trans("Action".$code) != "Action".$code ? $langs->trans("Action".$code) : $labelbytype[$code]; //print $code; print '
'; @@ -1091,6 +1778,7 @@ if (getDolGlobalString('AGENDA_USE_EVENT_TYPE') && getDolGlobalString('AGENDA_US } print "\n".''; + print "\n"; // Add js code to manage click on a box @@ -1187,22 +1875,21 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & // We are in a particular day for $username, now we scan all events foreach ($eventarray as $daykey => $notused) { - $annee = dol_print_date($daykey, '%Y', 'tzuserrel'); - $mois = dol_print_date($daykey, '%m', 'tzuserrel'); - $jour = dol_print_date($daykey, '%d', 'tzuserrel'); - //var_dump("daykey=$daykey day=$day jour=$jour, month=$month mois=$mois, year=$year annee=$annee"); + $annee = (int) dol_print_date($daykey, '%Y', 'tzuserrel'); + $mois = (int) dol_print_date($daykey, '%m', 'tzuserrel'); + $jour = (int) dol_print_date($daykey, '%d', 'tzuserrel'); + //var_dump("daykey=$daykey day=$day jour=$jour, month=$month mois=$mois, year=$year annee=$annee ".dol_print_date($daykey, 'dayhour', 'gmt')); + //var_dump($notused); - - if ($day == $jour && (int) $month == (int) $mois && $year == $annee) { // Is it the day we are looking for when calling function ? + if ($day == $jour && (int) $month == $mois && $year == $annee) { // Is it the day we are looking for when calling function ? //var_dump("day=$day jour=$jour month=$month mois=$mois year=$year annee=$annee"); // Scan all event for this date foreach ($eventarray[$daykey] as $index => $event) { - //print 'daykey='.$daykey.'='.dol_print_date($daykey, 'dayhour', 'gmt').' '.$year.'-'.$month.'-'.$day.' -> This event: '.$event->id.' '.$index.' is open for this daykey '.$annee.'-'.$mois.'-'.$jour."
\n"; + //print 'daykey='.$daykey.'='.dol_print_date($daykey, 'dayhour', 'gmt').' '.$year.'-'.$month.'-'.$day.' -> The event id '.$event->id.' index '.$index.' is open for this daykey '.$annee.'-'.$mois.'-'.$jour."
\n"; //var_dump($event); $keysofuserassigned = array_keys($event->userassigned); - $ponct = ($event->date_start_in_calendar == $event->date_end_in_calendar); if (!in_array($username->id, $keysofuserassigned)) { continue; // We discard record if event is from another user than user we want to show @@ -1219,6 +1906,11 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $color = -1; $cssclass = ''; $colorindex = -1; + + if ($event->type_code == 'HOLIDAY') { + $cssclass = 'family_holiday'; + } + if (in_array($user->id, $keysofuserassigned)) { $cssclass = 'family_mytasks'; @@ -1326,30 +2018,35 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases1[$h][$event->id]['string'] .= ' - '.$event->label; } $cases1[$h][$event->id]['typecode'] = $event->type_code; - $cases1[$h][$event->id]['color'] = $color; - if ($event->fk_project > 0) { - if (empty($cacheprojects[$event->fk_project])) { - $tmpproj = new Project($db); - $tmpproj->fetch($event->fk_project); - $cacheprojects[$event->fk_project] = $tmpproj; + if ($event->type_code == 'HOLIDAY') { + $cases1[$h][$event->id]['css'] = 'peruser_holiday '; + } else { + $cases1[$h][$event->id]['color'] = $color; + + if ($event->fk_project > 0) { + if (empty($cacheprojects[$event->fk_project])) { + $tmpproj = new Project($db); + $tmpproj->fetch($event->fk_project); + $cacheprojects[$event->fk_project] = $tmpproj; + } + $cases1[$h][$event->id]['string'] .= ', '.$langs->trans("Project").': '.$cacheprojects[$event->fk_project]->ref.' - '.$cacheprojects[$event->fk_project]->title; } - $cases1[$h][$event->id]['string'] .= ', '.$langs->trans("Project").': '.$cacheprojects[$event->fk_project]->ref.' - '.$cacheprojects[$event->fk_project]->title; - } - if ($event->socid > 0) { - if (empty($cachethirdparties[$event->socid])) { - $tmpthirdparty = new Societe($db); - $tmpthirdparty->fetch($event->socid); - $cachethirdparties[$event->socid] = $tmpthirdparty; + if ($event->socid > 0) { + if (empty($cachethirdparties[$event->socid])) { + $tmpthirdparty = new Societe($db); + $tmpthirdparty->fetch($event->socid); + $cachethirdparties[$event->socid] = $tmpthirdparty; + } + $cases1[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; } - $cases1[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; - } - if ($event->contact_id > 0) { - if (empty($cachecontacts[$event->contact_id])) { - $tmpcontact = new Contact($db); - $tmpcontact->fetch($event->contact_id); - $cachecontacts[$event->contact_id] = $tmpcontact; + if ($event->contact_id > 0) { + if (empty($cachecontacts[$event->contact_id])) { + $tmpcontact = new Contact($db); + $tmpcontact->fetch($event->contact_id); + $cachecontacts[$event->contact_id] = $tmpcontact; + } + $cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } - $cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } if ($event->date_start_in_calendar < $b1 && $dateendtouse > $b) { @@ -1369,30 +2066,35 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases2[$h][$event->id]['string'] .= ' - '.$event->label; } $cases2[$h][$event->id]['typecode'] = $event->type_code; - $cases2[$h][$event->id]['color'] = $color; - if ($event->fk_project > 0) { - if (empty($cacheprojects[$event->fk_project])) { - $tmpproj = new Project($db); - $tmpproj->fetch($event->fk_project); - $cacheprojects[$event->fk_project] = $tmpproj; + if ($event->type_code == 'HOLIDAY') { + $cases2[$h][$event->id]['css'] = 'peruser_holiday '; + } else { + $cases2[$h][$event->id]['color'] = $color; + + if ($event->fk_project > 0) { + if (empty($cacheprojects[$event->fk_project])) { + $tmpproj = new Project($db); + $tmpproj->fetch($event->fk_project); + $cacheprojects[$event->fk_project] = $tmpproj; + } + $cases2[$h][$event->id]['string'] .= ', '.$langs->trans("Project").': '.$cacheprojects[$event->fk_project]->ref.' - '.$cacheprojects[$event->fk_project]->title; } - $cases2[$h][$event->id]['string'] .= ', '.$langs->trans("Project").': '.$cacheprojects[$event->fk_project]->ref.' - '.$cacheprojects[$event->fk_project]->title; - } - if ($event->socid > 0) { - if (empty($cachethirdparties[$event->socid])) { - $tmpthirdparty = new Societe($db); - $tmpthirdparty->fetch($event->socid); - $cachethirdparties[$event->socid] = $tmpthirdparty; + if ($event->socid > 0) { + if (empty($cachethirdparties[$event->socid])) { + $tmpthirdparty = new Societe($db); + $tmpthirdparty->fetch($event->socid); + $cachethirdparties[$event->socid] = $tmpthirdparty; + } + $cases2[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; } - $cases2[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; - } - if ($event->contact_id > 0) { - if (empty($cachecontacts[$event->contact_id])) { - $tmpcontact = new Contact($db); - $tmpcontact->fetch($event->contact_id); - $cachecontacts[$event->contact_id] = $tmpcontact; + if ($event->contact_id > 0) { + if (empty($cachecontacts[$event->contact_id])) { + $tmpcontact = new Contact($db); + $tmpcontact->fetch($event->contact_id); + $cachecontacts[$event->contact_id] = $tmpcontact; + } + $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } - $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } if ($event->date_start_in_calendar < $b2 && $dateendtouse > $b1) { @@ -1412,30 +2114,35 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases3[$h][$event->id]['string'] .= ' - '.$event->label; } $cases3[$h][$event->id]['typecode'] = $event->type_code; - $cases3[$h][$event->id]['color'] = $color; - if ($event->fk_project > 0) { - if (empty($cacheprojects[$event->fk_project])) { - $tmpproj = new Project($db); - $tmpproj->fetch($event->fk_project); - $cacheprojects[$event->fk_project] = $tmpproj; + if ($event->type_code == 'HOLIDAY') { + $cases3[$h][$event->id]['css'] .= 'peruser_holiday '; + } else { + $cases3[$h][$event->id]['color'] = $color; + + if ($event->fk_project > 0) { + if (empty($cacheprojects[$event->fk_project])) { + $tmpproj = new Project($db); + $tmpproj->fetch($event->fk_project); + $cacheprojects[$event->fk_project] = $tmpproj; + } + $cases3[$h][$event->id]['string'] .= ', '.$langs->trans("Project").': '.$cacheprojects[$event->fk_project]->ref.' - '.$cacheprojects[$event->fk_project]->title; } - $cases3[$h][$event->id]['string'] .= ', '.$langs->trans("Project").': '.$cacheprojects[$event->fk_project]->ref.' - '.$cacheprojects[$event->fk_project]->title; - } - if ($event->socid > 0) { - if (empty($cachethirdparties[$event->socid])) { - $tmpthirdparty = new Societe($db); - $tmpthirdparty->fetch($event->socid); - $cachethirdparties[$event->socid] = $tmpthirdparty; + if ($event->socid > 0) { + if (empty($cachethirdparties[$event->socid])) { + $tmpthirdparty = new Societe($db); + $tmpthirdparty->fetch($event->socid); + $cachethirdparties[$event->socid] = $tmpthirdparty; + } + $cases3[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; } - $cases3[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; - } - if ($event->contact_id > 0) { - if (empty($cachecontacts[$event->contact_id])) { - $tmpcontact = new Contact($db); - $tmpcontact->fetch($event->contact_id); - $cachecontacts[$event->contact_id] = $tmpcontact; + if ($event->contact_id > 0) { + if (empty($cachecontacts[$event->contact_id])) { + $tmpcontact = new Contact($db); + $tmpcontact->fetch($event->contact_id); + $cachecontacts[$event->contact_id] = $tmpcontact; + } + $cases3[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } - $cases3[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } if ($event->date_start_in_calendar < $c && $dateendtouse > $b2) { @@ -1455,30 +2162,35 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases4[$h][$event->id]['string'] .= ' - '.$event->label; } $cases4[$h][$event->id]['typecode'] = $event->type_code; - $cases4[$h][$event->id]['color'] = $color; - if ($event->fk_project > 0) { - if (empty($cacheprojects[$event->fk_project])) { - $tmpproj = new Project($db); - $tmpproj->fetch($event->fk_project); - $cacheprojects[$event->fk_project] = $tmpproj; + if ($event->type_code == 'HOLIDAY') { + $cases4[$h][$event->id]['css'] = 'peruser_holiday '; + } else { + $cases4[$h][$event->id]['color'] = $color; + + if ($event->fk_project > 0) { + if (empty($cacheprojects[$event->fk_project])) { + $tmpproj = new Project($db); + $tmpproj->fetch($event->fk_project); + $cacheprojects[$event->fk_project] = $tmpproj; + } + $cases4[$h][$event->id]['string'] .= ', '.$langs->trans("Project").': '.$cacheprojects[$event->fk_project]->ref.' - '.$cacheprojects[$event->fk_project]->title; } - $cases4[$h][$event->id]['string'] .= ', '.$langs->trans("Project").': '.$cacheprojects[$event->fk_project]->ref.' - '.$cacheprojects[$event->fk_project]->title; - } - if ($event->socid > 0) { - if (empty($cachethirdparties[$event->socid])) { - $tmpthirdparty = new Societe($db); - $tmpthirdparty->fetch($event->socid); - $cachethirdparties[$event->socid] = $tmpthirdparty; + if ($event->socid > 0) { + if (empty($cachethirdparties[$event->socid])) { + $tmpthirdparty = new Societe($db); + $tmpthirdparty->fetch($event->socid); + $cachethirdparties[$event->socid] = $tmpthirdparty; + } + $cases4[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; } - $cases4[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; - } - if ($event->contact_id > 0) { - if (empty($cachecontacts[$event->contact_id])) { - $tmpcontact = new Contact($db); - $tmpcontact->fetch($event->contact_id); - $cachecontacts[$event->contact_id] = $tmpcontact; + if ($event->contact_id > 0) { + if (empty($cachecontacts[$event->contact_id])) { + $tmpcontact = new Contact($db); + $tmpcontact->fetch($event->contact_id); + $cachecontacts[$event->contact_id] = $tmpcontact; + } + $cases4[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } - $cases4[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } } else { @@ -1499,6 +2211,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases2[$h][$event->id]['color'] = $color; $cases3[$h][$event->id]['color'] = $color; $cases4[$h][$event->id]['color'] = $color; + $cases1[$h][$event->id]['css'] = ''; + $cases2[$h][$event->id]['css'] = ''; + $cases3[$h][$event->id]['css'] = ''; + $cases4[$h][$event->id]['css'] = ''; } } $i++; @@ -1514,10 +2230,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $color2 = ''; $color3 = ''; $color4 = ''; - $style1 = ''; - $style2 = ''; - $style3 = ''; - $style4 = ''; + $style1 = 'onclickopenref '; + $style2 = 'onclickopenref '; + $style3 = 'onclickopenref '; + $style4 = 'onclickopenref '; $string1 = ' '; $string2 = ' '; $string3 = ' '; @@ -1533,13 +2249,16 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { - $style1 = 'peruser_notbusy'; + $style1 .= 'peruser_notbusy '; } else { - $style1 = 'peruser_busy'; + $style1 .= 'peruser_busy '; } foreach ($cases1[$h] as $id => $ev) { if ($ev['busy']) { - $style1 = 'peruser_busy'; + $style1 = 'onclickopenref peruser_busy'; + } + if ($ev['css']) { + $style1 .= ' '.$ev['css']; } } } @@ -1550,13 +2269,16 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { - $style2 = 'peruser_notbusy'; + $style2 .= 'peruser_notbusy '; } else { - $style2 = 'peruser_busy'; + $style2 .= 'peruser_busy '; } foreach ($cases2[$h] as $id => $ev) { if ($ev['busy']) { - $style2 = 'peruser_busy'; + $style2 = 'onclickopenref peruser_busy'; + } + if ($ev['css']) { + $style2 .= ' '.$ev['css']; } } } @@ -1567,13 +2289,16 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { - $style3 = 'peruser_notbusy'; + $style3 .= 'peruser_notbusy '; } else { - $style3 = 'peruser_busy'; + $style3 .= 'peruser_busy '; } foreach ($cases3[$h] as $id => $ev) { if ($ev['busy']) { - $style3 = 'peruser_busy'; + $style3 = 'onclickopenref peruser_busy'; + } + if ($ev['css']) { + $style3 .= ' '.$ev['css']; } } } @@ -1584,13 +2309,16 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { - $style4 = 'peruser_notbusy'; + $style4 .= 'peruser_notbusy '; } else { - $style4 = 'peruser_busy'; + $style4 .= 'peruser_busy '; } foreach ($cases4[$h] as $id => $ev) { if ($ev['busy']) { - $style4 = 'peruser_busy'; + $style4 = 'onclickopenref peruser_busy'; + } + if ($ev['css']) { + $style4 .= ' '.$ev['css']; } } } @@ -1683,11 +2411,11 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($style1 == 'peruser_notbusy') { print 'style="border: 1px solid #'.($color1 ? $color1 : "888").' !important" '; } elseif ($color1) { - print($color1 ? 'style="background: #'.$color1.';"' : ''); + print 'style="background: #'.$color1.'; "'; } print 'class="'; print($style1 ? $style1.' ' : ''); - print 'onclickopenref center'.($title2 ? ' classfortooltip' : '').($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_00_'.($ids1 ? $ids1 : 'none').'"'.($title1 ? ' title="'.$title1.'"' : '').'>'; + print 'center'.($title2 ? ' classfortooltip' : '').($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_00_'.($ids1 ? $ids1 : 'none').'"'.($title1 ? ' title="'.$title1.'"' : '').'>'; print $string1; print '
'; @@ -831,17 +831,21 @@ if ($action == 'create') { // aaa } print '
'; - print '

'; + print '
'; print ''; - print ''; + print ''; + print ''; - print ''; + print ''; + print ''; - print ''; + print ''; + print ''; - print ''; + print ''; + print ''; // Other attributes $parameters = array(); @@ -852,7 +856,8 @@ if ($action == 'create') { // aaa } print '
'.$langs->trans("MailFrom").'
'.$langs->trans("MailFrom").''.img_picto('', 'email', 'class="pictofixedwidth"').'
'.$langs->trans("MailErrorsTo").'
'.$langs->trans("MailErrorsTo").''.img_picto('', 'email', 'class="pictofixedwidth"').'
'.$langs->trans("MailReply").'
'.$langs->trans("MailReply").''.img_picto('', 'email', 'class="pictofixedwidth"').'
'; - print '

'; + + print '
'; print ''; print ''; @@ -889,7 +894,7 @@ if ($action == 'create') { // aaa print '
'; // wysiwyg editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('bodyemail', GETPOST('bodyemail', 'restricthtmlallowunvalid'), '', 600, 'dolibarr_mailings', '', true, -1, getDolGlobalInt('FCKEDITOR_ENABLE_MAILING'), 20, '90%'); + $doleditor = new DolEditor('bodyemail', GETPOST('bodyemail', 'restricthtmlallowunvalid'), '', 600, 'dolibarr_mailings', '', true, -1, getDolGlobalInt('FCKEDITOR_ENABLE_MAILING'), 20, '100%'); $doleditor->Create(); print '
'; @@ -1129,7 +1134,7 @@ if ($action == 'create') { // aaa } print $text; if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') { print ' ('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', getDolGlobalString('MAIN_MAIL_SMTP_SERVER')).')'; } } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) { @@ -1329,7 +1334,7 @@ if ($action == 'create') { // aaa $readonly = 1; // wysiwyg editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, -1, getDolGlobalInt('FCKEDITOR_ENABLE_MAILING'), 20, '90%', $readonly); + $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, -1, getDolGlobalInt('FCKEDITOR_ENABLE_MAILING'), 20, '100%', $readonly); $doleditor->Create(); } else { print dol_htmlentitiesbr($object->body); @@ -1548,19 +1553,19 @@ if ($action == 'create') { // aaa if ($action == 'edit') { // wysiwyg editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, -1, getDolGlobalInt('FCKEDITOR_ENABLE_MAILING'), 20, '90%'); + $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, -1, getDolGlobalInt('FCKEDITOR_ENABLE_MAILING'), 20, '100%'); $doleditor->Create(); } if ($action == 'edittxt') { // wysiwyg editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, -1, 0, 20, '90%'); + $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, -1, 0, 20, '100%'); $doleditor->Create(); } if ($action == 'edithtml') { // HTML source editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, -1, 'ace', 20, '90%'); + $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, -1, 'ace', 20, '100%'); $doleditor->Create(0, '', false, 'HTML Source', 'php'); } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index ce1ef8fbcce..ed5e64a5a39 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -476,7 +476,7 @@ if ($object->fetch($id) >= 0) { } print $text; if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') { print ' ('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', getDolGlobalString('MAIN_MAIL_SMTP_SERVER')).')'; } } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) { @@ -678,7 +678,7 @@ if ($object->fetch($id) >= 0) { print '
'; } - print '
'; + print '

'; } // List of selected targets diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f2ca321604a..f815cd849ed 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -17,7 +17,7 @@ * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Lenin Rivas * Copyright (C) 2023 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -238,7 +238,7 @@ if (empty($reshook)) { } } - $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOSTINT('entity') : null), (GETPOSTINT('update_prices') ? true : false), (GETPOSTINT('update_desc') ? true : false)); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOSTINT('entity') : null), (GETPOST('update_prices') == 'on'), (GETPOST('update_desc') == 'on')); if ($result > 0) { $warningMsgLineList = array(); // check all product lines are to sell otherwise add a warning message for each product line is not to sell @@ -2164,7 +2164,7 @@ if ($action == 'create') { $sday = date("d", $tmpdte); print $form->selectDate($syear."-".$smonth."-".$sday, 'date_livraison', 0, 0, 0, "addprop"); } else { - $tmp_date_delivery = GETPOST('date_delivery') ? : -1; + $tmp_date_delivery = GETPOST('date_delivery') ?: -1; print $form->selectDate($tmp_date_delivery, 'date_livraison', 0, 0, 0, "addprop", 1, 1); } print ''; @@ -2174,7 +2174,7 @@ if ($action == 'create') { $langs->load("projects"); print ''; print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a78da69017f..7457acd4e36 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -19,7 +19,7 @@ * Copyright (C) 2022 OpenDSI * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -146,23 +146,23 @@ class Propal extends CommonObject /** * @var int|'' - * @deprecated + * @deprecated Use $date_validation * @see $date_validation */ public $datev; /** - * @var integer|'' $date_validation; + * @var int|'' */ public $date_validation; /** - * @var integer|'' $date_signature; + * @var int|'' */ public $date_signature; /** - * @var User $user_signature + * @var User */ public $user_signature; @@ -356,7 +356,7 @@ class Propal extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -497,7 +497,7 @@ class Propal extends CommonObject $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $this->thirdparty, $tva_npr); // multiprices - if ($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') && $this->thirdparty->price_level) { $price = $prod->multiprices[$this->thirdparty->price_level]; } else { $price = $prod->price; @@ -634,7 +634,7 @@ class Propal extends CommonObject */ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0, $noupdateafterinsertline = 0) { - global $mysoc, $conf, $langs; + global $mysoc, $langs; dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except); @@ -659,7 +659,7 @@ class Propal extends CommonObject } $remise_percent = price2num($remise_percent); - $qty = (float) price2num($qty); + $qty = (float) price2num($qty, 'MS'); $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); @@ -709,6 +709,20 @@ class Propal extends CommonObject $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); + if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($fk_product); + if (abs($qty) < $tmpproduct->packaging) { + $qty = (float) $tmpproduct->packaging; + } else { + if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) { + $coeff = intval(abs($qty) / $tmpproduct->packaging) + 1; + $qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS'); + setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); + } + } + } + // Clean vat code $reg = array(); $vat_src_code = ''; @@ -758,7 +772,7 @@ class Propal extends CommonObject $this->line->fk_propal = $this->id; $this->line->label = $label; $this->line->desc = $desc; - $this->line->qty = $qty; + $this->line->qty = (float) $qty; $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; @@ -974,6 +988,18 @@ class Propal extends CommonObject $this->line->rang = $rangmax + 1; } + if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { + if ($qty < $this->line->packaging) { + $qty = $this->line->packaging; + } else { + if (!empty($this->line->packaging) && ($qty % $this->line->packaging) > 0) { + $coeff = intval($qty / $this->line->packaging) + 1; + $qty = $this->line->packaging * $coeff; + setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); + } + } + } + $this->line->id = $rowid; $this->line->label = $label; $this->line->desc = $desc; @@ -2925,7 +2951,7 @@ class Propal extends CommonObject // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } // Search on sale representative @@ -3448,7 +3474,7 @@ class Propal extends CommonObject } // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } // Search on sale representative @@ -3625,7 +3651,7 @@ class Propal extends CommonObject // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } // Search on sale representative @@ -3745,7 +3771,7 @@ class Propal extends CommonObject if (is_null($this->project) || (is_object($this->project) && $this->project->isEmpty())) { $res = $this->fetchProject(); if ($res > 0 && $this->project instanceof Project) { - $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1); + $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, '1'); } } } @@ -3988,7 +4014,7 @@ class Propal extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/comm/propal/class/propaleligne.class.php b/htdocs/comm/propal/class/propaleligne.class.php index ea403b5b363..b976193a0e1 100644 --- a/htdocs/comm/propal/class/propaleligne.class.php +++ b/htdocs/comm/propal/class/propaleligne.class.php @@ -343,6 +343,10 @@ class PropaleLigne extends CommonObjectLine */ public $multicurrency_total_ttc; + /** + * @var float + */ + public $packaging; /** * Class line Constructor @@ -369,6 +373,7 @@ class PropaleLigne extends CommonObjectLine $sql .= ' pd.localtax1_tx, pd.localtax2_tx, pd.total_localtax1, pd.total_localtax2,'; $sql .= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc,'; $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,'; + $sql .= ' p.packaging,'; $sql .= ' pd.date_start, pd.date_end, pd.product_type'; $sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid'; @@ -418,6 +423,8 @@ class PropaleLigne extends CommonObjectLine $this->product_desc = $objp->product_desc; $this->fk_unit = $objp->fk_unit; + $this->packaging = $objp->packaging; + $this->date_start = $this->db->jdate($objp->date_start); $this->date_end = $this->db->jdate($objp->date_end); diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index a96dc3486f8..ab24c41a58b 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -145,7 +145,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -170,7 +170,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(".$this->field_date.",'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -194,7 +194,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(".$this->field_date.",'%m') as dm, SUM(p.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -219,7 +219,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(".$this->field_date.",'%m') as dm, AVG(p.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -242,7 +242,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(".$this->field_date.",'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -269,7 +269,7 @@ class PropaleStats extends Stats $sql .= " FROM ".$this->from; $sql .= " INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 1f79dadeb1d..79e32cc27d7 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -296,7 +296,8 @@ foreach ($object->fields as $key => $val) { } }*/ -if (!$user->hasRight('societe', 'client', 'voir')) { +// Check only if it's an internal user (external users are already filtered by company whatever are permissions on this) +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 474c50a7ff7..5fb70cfcc54 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2021-2025 Frédéric France * Copyright (C) 2022 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify @@ -304,7 +304,7 @@ class Commande extends CommonOrder // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -1634,6 +1634,20 @@ class Commande extends CommonOrder $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); + if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($fk_product); + if (abs($qty) < $tmpproduct->packaging) { + $qty = (float) $tmpproduct->packaging; + } else { + if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) { + $coeff = intval(abs($qty) / $tmpproduct->packaging) + 1; + $qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS'); + setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); + } + } + } + // Clean vat code $reg = array(); $vat_src_code = ''; @@ -1689,7 +1703,7 @@ class Commande extends CommonOrder $this->line->fk_commande = $this->id; $this->line->label = $label; $this->line->desc = $desc; - $this->line->qty = $qty; + $this->line->qty = (float) $qty; $this->line->ref_ext = $ref_ext; $this->line->vat_src_code = $vat_src_code; @@ -1813,7 +1827,7 @@ class Commande extends CommonOrder $localtax2_tx = get_localtax($tva_tx, 2, $this->thirdparty, $mysoc, $tva_npr); // multiprix - if ($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') && $this->thirdparty->price_level) { $price = $prod->multiprices[$this->thirdparty->price_level]; } else { $price = $prod->price; @@ -1849,21 +1863,21 @@ class Commande extends CommonOrder $this->lines[] = $line; /** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE - if (getDolGlobalString('PRODUIT_SOUSPRODUITS')) { - $prod = new Product($this->db); - $prod->fetch($idproduct); - $prod -> get_sousproduits_arbo(); - $prods_arbo = $prod->get_arbo_each_prod(); - if(count($prods_arbo) > 0) - { - foreach($prods_arbo as $key => $value) - { - // print "id : ".$value[1].' :qty: '.$value[0].'
'; - if not in lines { - $this->add_product($value[1], $value[0]); - } - } - } + * if (getDolGlobalString('PRODUIT_SOUSPRODUITS')) { + * $prod = new Product($this->db); + * $prod->fetch($idproduct); + * $prod -> get_sousproduits_arbo(); + * $prods_arbo = $prod->get_arbo_each_prod(); + * if(count($prods_arbo) > 0) + * { + * foreach($prods_arbo as $key => $value) + * { + * // print "id : ".$value[1].' :qty: '.$value[0].'
'; + * if not in lines { + * $this->add_product($value[1], $value[0]); + * } + * } + * } **/ } } @@ -2106,8 +2120,6 @@ class Commande extends CommonOrder public function fetch_lines($only_product = 0, $loadalsotranslation = 0) { // phpcs:enable - global $langs, $conf; - $this->lines = array(); $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx, l.ref_ext,'; @@ -2116,7 +2128,7 @@ class Commande extends CommonOrder $sql .= ' l.fk_unit,'; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; $sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch, p.barcode as product_barcode,'; - $sql .= ' p.weight, p.weight_units, p.volume, p.volume_units'; + $sql .= ' p.weight, p.weight_units, p.volume, p.volume_units, p.packaging'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as l'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; $sql .= ' WHERE l.fk_commande = '.((int) $this->id); @@ -2191,6 +2203,7 @@ class Commande extends CommonOrder $line->weight_units = $objp->weight_units; $line->volume = $objp->volume; $line->volume_units = $objp->volume_units; + $line->packaging = $objp->packaging; $line->date_start = $this->db->jdate($objp->date_start); $line->date_end = $this->db->jdate($objp->date_end); @@ -2658,16 +2671,16 @@ class Commande extends CommonOrder $sql = "SELECT s.rowid, s.nom as name, s.client,"; $sql .= " c.rowid as cid, c.ref"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", sc.fk_soc, sc.fk_user"; } $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX.$this->table_element." as c"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.entity IN (".getEntity('commande').")"; $sql .= " AND c.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { @@ -3163,6 +3176,18 @@ class Commande extends CommonOrder $this->line->rang = $rangmax + 1; } + if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { + if ($qty < $this->line->packaging) { + $qty = $this->line->packaging; + } else { + if (!empty($this->line->packaging) && fmod($qty, $this->line->packaging) > 0) { + $coeff = intval($qty / $this->line->packaging) + 1; + $qty = $this->line->packaging * $coeff; + setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); + } + } + } + $this->line->id = $rowid; $this->line->label = $label; $this->line->desc = $desc; @@ -3492,7 +3517,7 @@ class Commande extends CommonOrder $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as c"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".((int) $user->id); $clause = " AND"; @@ -3667,6 +3692,7 @@ class Commande extends CommonOrder /** * getTooltipContentArray + * * @param array $params params to construct tooltip data * @since v18 * @return array{picto?:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string} @@ -3702,7 +3728,7 @@ class Commande extends CommonOrder if (is_null($this->project) || (is_object($this->project) && $this->project->isEmpty())) { $res = $this->fetchProject(); if ($res > 0 && $this->project instanceof Project) { - $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1); + $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, '1'); } } } @@ -4001,7 +4027,7 @@ class Commande extends CommonOrder $sql = "SELECT count(co.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as co"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".((int) $user->id); $clause = "AND"; @@ -4045,7 +4071,7 @@ class Commande extends CommonOrder */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf, $langs; + global $langs; $langs->load("orders"); $outputlangs->load("products"); diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index f7fb16a08d2..c56d95c38ef 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -159,7 +159,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -184,7 +184,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -208,7 +208,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -233,7 +233,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -256,7 +256,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg"; $sql .= " FROM ".$this->from; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; @@ -282,7 +282,7 @@ class CommandeStats extends Stats $sql .= " FROM ".$this->from; $sql .= " INNER JOIN ".$this->from_line." ON c.rowid = tl.fk_commande"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; diff --git a/htdocs/commande/class/orderline.class.php b/htdocs/commande/class/orderline.class.php index e16bde3054e..ec78db8e44d 100644 --- a/htdocs/commande/class/orderline.class.php +++ b/htdocs/commande/class/orderline.class.php @@ -145,6 +145,10 @@ class OrderLine extends CommonOrderLine */ public $skip_update_total; + /** + * @var float + */ + public $packaging; /** * Constructor @@ -170,6 +174,7 @@ class OrderLine extends CommonOrderLine $sql .= ' cd.fk_unit,'; $sql .= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,'; $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc, p.tobatch as product_tobatch,'; + $sql .= ' p.packaging,'; $sql .= ' cd.date_start, cd.date_end, cd.vat_src_code'; $sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; @@ -224,6 +229,7 @@ class OrderLine extends CommonOrderLine $this->product_desc = $objp->product_desc; $this->product_tobatch = $objp->product_tobatch; $this->fk_unit = $objp->fk_unit; + $this->packaging = $objp->packaging; $this->date_start = $this->db->jdate($objp->date_start); $this->date_end = $this->db->jdate($objp->date_end); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index c6bc5234b45..cfbd0fafdb9 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -105,7 +105,7 @@ if (isModEnabled('order')) { $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; @@ -114,7 +114,7 @@ if (isModEnabled('order')) { if ($socid) { $sql .= " AND c.fk_soc = ".((int) $socid); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } @@ -171,7 +171,7 @@ $sql .= ", s.code_client"; $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; -if (!$user->hasRight('societe', 'client', 'voir')) { +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; @@ -180,7 +180,7 @@ $sql .= " AND c.entity IN (".getEntity('commande').")"; if ($socid) { $sql .= " AND c.fk_soc = ".((int) $socid); } -if (!$user->hasRight('societe', 'client', 'voir')) { +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= " ORDER BY c.tms DESC"; @@ -257,7 +257,7 @@ if (isModEnabled('order')) { $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; @@ -266,7 +266,7 @@ if (isModEnabled('order')) { if ($socid) { $sql .= " AND c.fk_soc = ".((int) $socid); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= " ORDER BY c.rowid DESC"; @@ -346,7 +346,7 @@ if (isModEnabled('order')) { $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; @@ -355,7 +355,7 @@ if (isModEnabled('order')) { if ($socid) { $sql .= " AND c.fk_soc = ".((int) $socid); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= " ORDER BY c.rowid DESC"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 8ebdb007055..59148913edd 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -951,9 +951,8 @@ $sql .= ' AND c.entity IN ('.getEntity('commande').')'; if ($socid > 0) { $sql .= ' AND s.rowid = '.((int) $socid); } - // Restriction on sale representative -if (!$permissiontoreadallthirdparty) { +if (empty($user->socid) && !$permissiontoreadallthirdparty) { $sql .= " AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $user->id).")"; if (getDolGlobalInt('MAIN_SEE_SUBORDINATES') && $userschilds) { $sql .= " OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user IN (".$db->sanitize(implode(',', $userschilds))."))"; @@ -1682,7 +1681,7 @@ if (!empty($arrayfields['p.title']['checked'])) { // Thirpdarty if (!empty($arrayfields['s.nom']['checked'])) { print '
'; } // Alias diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 2005e7d0fb2..94bd781bcdd 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -1,12 +1,12 @@ - * Copyright (C) 2004-2019 Laurent Destailleur - * Copyright (C) 2017 Pierre-Henry Favre - * Copyright (C) 2020 Maxime DEMAREST - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2022-2024 Alexandre Spangaro - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2001-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2019 Laurent Destailleur + * Copyright (C) 2017 Pierre-Henry Favre + * Copyright (C) 2020 Maxime DEMAREST + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2022-2025 Alexandre Spangaro + * Copyright (C) 2024-2025 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 @@ -622,7 +622,7 @@ $charge_sociales = new ChargeSociales($db); $various_payment = new PaymentVarious($db); $payment_loan = new PaymentLoan($db); -$title = $langs->trans("ComptaFiles").' - '.$langs->trans("List"); +$title = $langs->trans("AccountantFiles").' - '.$langs->trans("List"); $help_url = ''; llxHeader('', $title, $help_url); @@ -673,7 +673,7 @@ if (isModEnabled('project')) { $formproject = new FormProjets($db); $langs->load('projects'); print ''.$langs->trans('Project').":"; - print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, ''); + print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), (string) $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, ''); print ''; print '
'; } diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 31f7fc7ca20..451802d6c84 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -799,7 +799,7 @@ if ($action == 'create') { if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) { print '
'.$langs->trans("MailTopic").'
'.$langs->trans("Project").''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (string) $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); print ' id).'">'; print '
'; - print ''; + print 'socid) ? " disabled" : "").'>'; print '
'; - print ''; + print ''; print ''; $ibankey = FormBank::getIBANLabel($object); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 45a30fdef82..050e4267f95 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 JC Prieto * Copyright (C) 2022-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -348,7 +348,7 @@ class Account extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -2016,7 +2016,7 @@ class Account extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 7f38dab7af2..d46e5bd90dd 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -198,7 +198,7 @@ class PaymentVarious extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( // TODO: fill this array @@ -825,7 +825,7 @@ class PaymentVarious extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 8dc01195026..5d985f68ce0 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -1,9 +1,9 @@ - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2023 Laurent Destailleur * Copyright (C) 2023 Joachim Kueter - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -514,7 +514,7 @@ if ($action == 'create') { print ''; } @@ -597,7 +597,7 @@ if ($id) { array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1), array('type' => 'other', 'tdclass' => 'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)), array('type' => 'text', 'name' => 'clone_amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount)), - array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens").' '.$set_value_help, 'values' => $sensarray, 'default' => $object->sens), + array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens").' '.$set_value_help, 'values' => $sensarray, 'default' => (string) $object->sens), ); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); @@ -626,7 +626,7 @@ if ($id) { $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + $morehtmlref .= $formproject->select_projects(-1, (string) $object->fk_project, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); $morehtmlref .= ''; $morehtmlref .= ''; } else { @@ -739,7 +739,7 @@ if ($id) { } else { $bankaccountnotfound = 1; - print ''.$langs->trans("NoRecordfound").''; + print ''.$langs->trans("NoRecordFound").''; } print ''; print ''; diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 755c2f711eb..1449d27ffa6 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2009 Regis Houssin * Copyright (C) 2016 Marcos García * Copyright (C) 2018 Andreu Bisquerra - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -160,7 +160,7 @@ class CashControl extends CommonObject public $fk_user_creat; /** - * @var int|'' $date_valid + * @var int|'' */ public $date_valid; @@ -502,7 +502,7 @@ class CashControl extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index d4d1d6d758f..4b9d33c32af 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -226,6 +226,7 @@ if ($resql) { $totalqty = 0; $totalvat = 0; $totalvatperrate = array(); + $totalhtperrate = array(); $totallocaltax1 = 0; $totallocaltax2 = 0; $cachebankaccount = array(); @@ -257,8 +258,10 @@ if ($resql) { if ($line->tva_tx) { if (empty($totalvatperrate[$line->tva_tx])) { $totalvatperrate[$line->tva_tx] = 0; + $totalhtperrate[$line->tva_tx] = 0; } $totalvatperrate[$line->tva_tx] += $line->total_tva; + $totalhtperrate[$line->tva_tx] += $line->total_ht; } $totallocaltax1 += $line->total_localtax1; $totallocaltax2 += $line->total_localtax2; @@ -448,9 +451,9 @@ if ($resql) { } if (!empty($totalvatperrate) && is_array($totalvatperrate)) { - print '

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

'.$langs->trans("TotalHT").'
'.$langs->trans("TotalVAT").'
'; foreach ($totalvatperrate as $keyrate => $valuerate) { - print '
'.$langs->trans("VATRate").' '.vatrate($keyrate, true).' :
'.price($valuerate).'
'; + print '
'.$langs->trans("VATRate").' '.vatrate($keyrate, true).' :
'.price($totalhtperrate[$keyrate] ?? 0).'
'.price($valuerate).'
'; } } diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 5e67c50fb15..619e4e5a8ae 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -268,7 +268,7 @@ if (empty($reshook)) { $error++; } - // Get first contract linked to invoice used to generate template (facid is id of source invoice) + // Get first contract linked to invoice (or order or proposal) used to generate template (facid is id of source invoice) if (GETPOSTINT('facid') > 0) { $srcObject = new Facture($db); $srcObject->fetch(GETPOSTINT('facid')); @@ -278,9 +278,17 @@ if (empty($reshook)) { if (!empty($srcObject->linkedObjectsIds['contrat'])) { $contractidid = reset($srcObject->linkedObjectsIds['contrat']); - $object->origin = 'contrat'; + $object->origin_type = 'contrat'; $object->origin_id = $contractidid; - $object->linked_objects[$object->origin] = $object->origin_id; + $object->linked_objects[$object->origin_type] = $object->origin_id; + } elseif (!empty($srcObject->linkedObjectsIds['commande'])) { + $orderid = reset($srcObject->linkedObjectsIds['commande']); + + $object->linked_objects['commande'] = $orderid; + } elseif (!empty($srcObject->linkedObjectsIds['propal'])) { + $proposalid = reset($srcObject->linkedObjectsIds['propal']); + + $object->linked_objects['commande'] = $proposalid; } } @@ -1289,6 +1297,8 @@ if ($action == 'create') { } print "
'.$langs->trans("BankName").'
'.$langs->trans("BankName").''.$object->bank.'
'.$langs->trans("Project").''; print img_picto('', 'project', 'class="pictofixedwidth"'); - print $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1); + print $formproject->select_projects(-1, (string) $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1); print '
\n"; + print '
'; + print $form->buttonsSaveCancel("Create"); print "\n"; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ebede310b25..e374e52450e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -17,7 +17,7 @@ * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -891,11 +891,29 @@ if (empty($reshook)) { if ($line->product_type < 9 && $line->total_ht != 0) { // Remove lines with product_type greater than or equal to 9 and no need to create discount if amount is null $keyforvatrate = $line->tva_tx.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''); + if (!isset($amount_ht[$keyforvatrate])) { + $amount_ht[$keyforvatrate] = 0; + } $amount_ht[$keyforvatrate] += $line->total_ht; + if (!isset($amount_tva[$keyforvatrate])) { + $amount_tva[$keyforvatrate] = 0; + } $amount_tva[$keyforvatrate] += $line->total_tva; + if (!isset($amount_ttc[$keyforvatrate])) { + $amount_ttc[$keyforvatrate] = 0; + } $amount_ttc[$keyforvatrate] += $line->total_ttc; + if (!isset($multicurrency_amount_ht[$keyforvatrate])) { + $multicurrency_amount_ht[$keyforvatrate] = 0; + } $multicurrency_amount_ht[$keyforvatrate] += $line->multicurrency_total_ht; + if (!isset($multicurrency_amount_tva[$keyforvatrate])) { + $multicurrency_amount_tva[$keyforvatrate] = 0; + } $multicurrency_amount_tva[$keyforvatrate] += $line->multicurrency_total_tva; + if (!isset($multicurrency_amount_ttc[$keyforvatrate])) { + $multicurrency_amount_ttc[$keyforvatrate] = 0; + } $multicurrency_amount_ttc[$keyforvatrate] += $line->multicurrency_total_ttc; $i++; } @@ -3510,7 +3528,12 @@ if ($action == 'create') { // Overwrite some values if creation of invoice is from a predefined invoice if (empty($origin) && empty($originid) && GETPOSTINT('fac_rec') > 0) { - $invoice_predefined->fetch(GETPOSTINT('fac_rec')); + //$invoice_predefined->fetch(GETPOSTINT('fac_rec')); + foreach ($invoice_predefined->array_options as $key => $option) { + if (!isset($object->array_options[$key])) { + $object->array_options[$key] = $invoice_predefined->array_options[$key]; + } + } $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later if (empty($projectid)) { @@ -3674,7 +3697,8 @@ if ($action == 'create') { print $form->selectarray('typedeposit', $arraylist, $typedeposit, 0, 0, 0, '', 1); print '
'; - print ''.$langs->trans("AmountOrPercent").''; + print ''.$langs->trans("AmountOrPercent").''; + print ''; print '
'; @@ -4046,7 +4070,7 @@ if ($action == 'create') { $langs->load('projects'); print '
'.$langs->trans('Project').''; print img_picto('', 'project', 'class="pictofixedwidth"'); - print $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print $formproject->select_projects(($socid > 0 ? $socid : -1), (string) $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; print '
'.$langs->trans("Project").''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1); + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(-1, (string) $fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1); print '
'; // Date To Birth - print ''; - print ''; } if (!empty($arrayfields['s.email']['checked'])) { diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index fb32ec1747e..72fe0e4e0a7 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -409,6 +409,13 @@ if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') { // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + +$sql .= $db->order($sortfield, $sortorder); + //print $sql; // Count total nb of records @@ -524,6 +531,10 @@ if ($filter_datecloture_start != '') { } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// Add $param from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index a9a51bf849a..78ca677f9fa 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -334,9 +334,17 @@ if ($action == 'update' && !empty($permissiontoadd)) { } $object->$key = $value; - 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'); + + if ($key == 'pass_crypted' && property_exists($object, 'pass')) { + if (GETPOST("pass", "password")) { // If not provided, we do not change it. We never erase a password with empty. + $object->pass = GETPOST("pass", "password"); + } + // TODO Manadatory for password not yet managed + } else { + 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'); + } } // Validation of fields values diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 266bae09fc0..35a67a4c272 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1,10 +1,11 @@ * Copyright (C) 2018-2021 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -961,10 +962,10 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $filename .= '_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); } } - if ($year) { + if (!empty($year)) { $filename .= '_'.$year; } - if ($month) { + if (!empty($month)) { $filename .= '_'.$month; } if ($pagecount) { @@ -1357,18 +1358,36 @@ if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoa $result = $object->fetch($toselectid); //var_dump($contcats);exit; if ($result > 0) { - if ($obj->price_base_type == 'TTC') { - $newprice = $object->price_ttc * (100 + $pricepercentage) / 100; - $minprice = $object->price_min_ttc; - } else { - $newprice = $object->price * (100 + $pricepercentage) / 100; - $minprice = $object->price_min; - } - $res = $object->updatePrice($newprice, $obj->price_base_type, $user, $object->tva_tx, $minprice, 0, $object->tva_npr, 0, 0, array(), $object->default_vat_code); - if ($res > 0) { - $nbok++; - } else { - setEventMessages($object->error, $object->errors, 'errors'); + if (getDolGlobalString('PRODUCT_PRICE_UNIQ') + || getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { + if ($object->price_base_type == 'TTC') { + $newprice = $object->price_ttc * (100 + $pricepercentage) / 100; + $minprice = $object->price_min_ttc; + } else { + $newprice = $object->price * (100 + $pricepercentage) / 100; + $minprice = $object->price_min; + } + $res = $object->updatePrice($newprice, $object->price_base_type, $user, $object->tva_tx, $minprice, 0, $object->tva_npr, 0, 0, array(), $object->default_vat_code); + if ($res > 0) { + $nbok++; + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } elseif (getDolGlobalString('PRODUIT_MULTIPRICES')) { + $maxlevel = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); + for ($level = 1; $level <= $maxlevel; $level++) { + if ($object->price_base_type == 'TTC') { + $newprice = $object->multiprices_ttc[$level] * (100 + $pricepercentage) / 100; + $minprice = $object->multiprices_min_ttc[$level]; + } else { + $newprice = $object->multiprices[$level] * (100 + $pricepercentage) / 100; + $minprice = $object->multiprices_min[$level]; + } + $res = $object->updatePrice($newprice, $object->price_base_type, $user, $object->tva_tx, $minprice, $level, $object->tva_npr, 0, 0, array(), $object->default_vat_code); + if ($res > 0) { + $nbok++; + } + } } } else { setEventMessages($object->error, $object->errors, 'errors'); @@ -1941,6 +1960,7 @@ $parameters['uploaddir'] = $uploaddir; $parameters['massaction'] = $massaction; $parameters['diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction : null; +// @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('doMassActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 51f053c9eda..1ff4c1f1423 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -1,12 +1,12 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005 Simon Tosser - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010 Pierre Morin - * Copyright (C) 2013 Marcos García - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2004-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005 Simon Tosser + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2010 Pierre Morin + * Copyright (C) 2013 Marcos García + * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +49,7 @@ if (!defined('NOREQUIREAJAX')) { * @var Translate $langs * @var User $user */ - +$module = ''; if (!isset($mode) || $mode != 'noajax') { // For ajax call require_once '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -96,11 +96,15 @@ if (!isset($mode) || $mode != 'noajax') { // For ajax call } } else { // When no an ajax call (include from other file) + /** + * @var string $module + */ ' @phan-var-force int $section @phan-var-force string $module @phan-var-force string $showonrightsize '; + $rootdirfordoc = $conf->ecm->dir_output; $ecmdir = new EcmDirectory($db); @@ -233,6 +237,7 @@ if ($type == 'directory') { 'holiday', 'recruitment-recruitmentcandidature', 'banque', + 'bank-statement', 'chequereceipt', 'mrp-mo' ); @@ -286,6 +291,8 @@ if ($type == 'directory') { $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature'; } elseif ($module == 'banque') { $upload_dir = $conf->bank->dir_output; + } elseif ($module == 'bank-statement') { + $upload_dir = $conf->bank->dir_output.'/*/statement'; } elseif ($module == 'chequereceipt') { $upload_dir = $conf->bank->dir_output.'/checkdeposits'; } elseif ($module == 'mrp-mo') { @@ -300,7 +307,7 @@ if ($type == 'directory') { // Automatic list if (in_array($module, $automodules)) { - $param .= '&module='.$module; + $param .= '&module='.urlencode($module); if (isset($search_doc_ref) && $search_doc_ref != '') { $param .= '&search_doc_ref='.urlencode($search_doc_ref); } @@ -309,6 +316,7 @@ if ($type == 'directory') { $filter = preg_quote((string) $search_doc_ref, '/'); $filearray = dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting, 1); + //var_dump($filearray); // To allow external users,we must restrict $filearray to entries the user is a thirdparty. // This can be done by filtering on entries found into llx_ecm diff --git a/htdocs/core/ajax/mailtemplate.php b/htdocs/core/ajax/mailtemplate.php index 41054250305..fd6981b8c7f 100644 --- a/htdocs/core/ajax/mailtemplate.php +++ b/htdocs/core/ajax/mailtemplate.php @@ -73,16 +73,17 @@ if (GETPOSTISSET('content')) { foreach ($selectedPosts as $postId) { $post = getNewsDetailsById($postId); + $newsList .= '
-

' . htmlentities($post['title']) . '

-

' . htmlentities($post['description']) . '

- Created By: ' . htmlentities($post['user_fullname']) . ' +

' . htmlentities(empty($post['title']) ? '' : $post['title']) . '

+

' . htmlentities(empty($post['description']) ? '' : $post['description']) . '

+ Created By: ' . htmlentities(empty($post['user_fullname']) ? '' : $post['user_fullname']) . '
- ' . dol_print_date($post['date_creation'], 'daytext', 'tzserver', $langs) . ' + ' . dol_print_date((empty($post['date_creation']) ? dol_now() : $post['date_creation']), 'daytext', 'tzserver', $langs) . '
- ' . ($post['image'] ? 'Image' : 'Gray rectangle') . ' + ' . (!empty($post['image']) ? 'Image' : 'Gray rectangle') . '
'; } diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 17151fe3a4a..7c9659aaf5d 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -87,14 +87,14 @@ class box_actions extends ModeleBoxes $sql .= ", s.code_client, s.code_compta as code_compta_client, s.client"; $sql .= ", s.logo, s.email, s.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm AS ta, ".MAIN_DB_PREFIX."actioncomm AS a"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql .= " WHERE a.fk_action = ta.id"; $sql .= " AND a.entity IN (".getEntity('actioncomm').")"; $sql .= " AND a.percent >= 0 AND a.percent < 100"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")"; } if ($user->socid) { diff --git a/htdocs/core/boxes/box_actions_future.php b/htdocs/core/boxes/box_actions_future.php index 5d4e8dcd2e8..fbfa230883c 100644 --- a/htdocs/core/boxes/box_actions_future.php +++ b/htdocs/core/boxes/box_actions_future.php @@ -86,14 +86,14 @@ class box_actions_future extends ModeleBoxes $sql .= ", s.code_client, s.code_compta as code_compta_client, s.client"; $sql .= ", s.logo, s.email, s.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm AS ta, ".MAIN_DB_PREFIX."actioncomm AS a"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql .= " WHERE a.fk_action = ta.id"; $sql .= " AND a.entity IN (".getEntity('actioncomm').")"; //$sql .= " AND a.percent >= 0 AND a.percent < 100"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")"; } if ($user->socid) { diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 9ab9544671e..739ee6cb3eb 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -105,13 +105,13 @@ class box_activity extends ModeleBoxes $sql = "SELECT p.fk_statut, SUM(p.total_ttc) as Mnttot, COUNT(*) as nb"; $sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= ")"; $sql .= " WHERE p.entity IN (".getEntity('propal').")"; $sql .= " AND p.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { @@ -194,13 +194,13 @@ class box_activity extends ModeleBoxes $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb"; $sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= ")"; $sql .= " WHERE c.entity IN (".getEntity('commande').")"; $sql .= " AND c.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { @@ -279,12 +279,12 @@ class box_activity extends ModeleBoxes $data = array(); $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; $sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= ")"; $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 9825232ba94..2d9aae70395 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -89,12 +89,12 @@ class box_clients extends ModeleBoxes $sql .= ", s.logo, s.email, s.entity"; $sql .= ", s.datec, s.tms, s.status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE s.client IN (1, 3)"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } // Add where from hooks diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index e4ea864271a..7aadb7c1c72 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -97,7 +97,7 @@ class box_commandes extends ModeleBoxes $sql .= ", c.total_tva"; $sql .= ", c.total_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; @@ -105,7 +105,7 @@ class box_commandes extends ModeleBoxes if (getDolGlobalString('ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY')) { $sql .= " AND c.fk_statut = 1"; } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 6db28aca4f9..c9c8ae98986 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -102,11 +102,11 @@ class box_contacts extends ModeleBoxes if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index e7700692e3e..4ca3d92aa5b 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -80,12 +80,12 @@ class box_contracts extends ModeleBoxes $sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.tms as date_modification, c.fin_validite, c.date_cloture,"; $sql .= " c.ref_customer, c.ref_supplier"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity = ".$conf->entity; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php index 8dcd6a5ecc7..53d2179b05c 100644 --- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php +++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php @@ -85,12 +85,12 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes $sql .= ", s.outstanding_limit"; $sql .= ", s.datec, s.tms, s.status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE s.client IN (1, 3)"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index ee333e1eec5..95f4f631491 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -95,13 +95,13 @@ class box_factures extends ModeleBoxes $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND f.fk_statut > 0"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 511a041a035..b3a4e1fd0a6 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -93,12 +93,12 @@ class box_factures_fourn extends ModeleBoxes $sql .= ', f.date_lim_reglement as datelimite, f.tms, f.type'; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND f.entity = ".$conf->entity; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 21ef52a56fc..cd5a8c98eae 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -93,14 +93,14 @@ class box_factures_fourn_imp extends ModeleBoxes $sql2 = " FROM ".MAIN_DB_PREFIX."societe as s"; $sql2 .= ",".MAIN_DB_PREFIX."facture_fourn as f"; $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid = pf.fk_facturefourn"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql2 .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql2 .= " WHERE f.fk_soc = s.rowid"; $sql2 .= " AND f.entity IN (".getEntity('supplier_invoice').")"; $sql2 .= " AND f.paye = 0"; $sql2 .= " AND fk_statut = 1"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql2 .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index fb7e8f914ea..a4f91c30985 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -104,7 +104,7 @@ class box_factures_imp extends ModeleBoxes if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql2 .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql2 .= ", ".MAIN_DB_PREFIX."facture as f"; @@ -113,7 +113,7 @@ class box_factures_imp extends ModeleBoxes $sql2 .= " AND f.entity IN (".getEntity('invoice').")"; $sql2 .= " AND f.paye = 0"; $sql2 .= " AND fk_statut = 1"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql2 .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index ff12319eebe..0c771693b79 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -83,13 +83,13 @@ class box_ficheinter extends ModeleBoxes $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.logo, s.email, s.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= ", ".MAIN_DB_PREFIX."fichinter as f"; $sql .= " WHERE f.fk_soc = s.rowid "; $sql .= " AND f.entity = ".$conf->entity; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 6cd7b8c3bab..21f77044f1f 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -81,12 +81,12 @@ class box_fournisseurs extends ModeleBoxes $sql .= ", s.logo, s.email, s.entity"; $sql .= ", s.datec, s.tms, s.status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE s.fournisseur = 1"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } // Add where from hooks diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 7e2fb8d27d1..6948f00912f 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -97,7 +97,7 @@ class box_graph_propales_permonth extends ModeleBoxes if ($user->socid) { $socid = $user->socid; } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user } diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index db7710e960b..5e622fd0792 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2023 Frederic France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ class box_produits extends ModeleBoxes $this->db = $db; $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); - $tmpentry = array('enabled' => (isModEnabled("product") || isModEnabled("service")), 'perms' => ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')), 'module' => 'product|service'); + $tmpentry = array('enabled' => (int) (isModEnabled("product") || isModEnabled("service")), 'perms' => (string) (int) ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')), 'module' => 'product|service'); $showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); $this->urltoaddentry = DOL_URL_ROOT.'/product/card.php?action=create'; @@ -167,7 +167,7 @@ class box_produits extends ModeleBoxes $price = ($objp->price_base_type == 'HT') ? price($objp->price) : $price = price($objp->price_ttc); } else { //Parse the dynamic price - $productstatic->fetch($objp->rowid, '', '', 1); + $productstatic->fetch($objp->rowid, '', '', '1'); require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; $priceparser = new PriceParser($this->db); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index f2a18d04ccc..fc5448fed47 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Maxime Kohlhaas * Copyright (C) 2015-2021 Frédéric France * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ class box_produits_alerte_stock extends ModeleBoxes $this->db = $db; $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); - $tmpentry = array('enabled' => ((isModEnabled("product") || isModEnabled("service")) && isModEnabled('stock')), 'perms' => $user->hasRight('stock', 'lire'), 'module' => 'product|service|stock'); + $tmpentry = array('enabled' => (int) ((isModEnabled("product") || isModEnabled("service")) && isModEnabled('stock')), 'perms' => (string) (int) $user->hasRight('stock', 'lire'), 'module' => 'product|service|stock'); $showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); $this->urltoaddentry = DOL_URL_ROOT.'/product/card.php?action=create'; @@ -163,7 +163,7 @@ class box_produits_alerte_stock extends ModeleBoxes $price_base_type = $langs->trans($objp->price_base_type); $price = ($objp->price_base_type == 'HT') ? price($objp->price) : $price = price($objp->price_ttc); } else { //Parse the dynamic price - $productstatic->fetch($objp->rowid, '', '', 1); + $productstatic->fetch($objp->rowid, '', '', '1'); require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; $priceparser = new PriceParser($this->db); diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 09b12577f48..a4a280bfa9d 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -85,12 +85,12 @@ class box_propales extends ModeleBoxes $sql .= ", s.logo, s.email, s.entity"; $sql .= ", p.rowid, p.ref, p.fk_statut as status, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.total_tva, p.total_ttc, p.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE p.fk_soc = s.rowid"; $sql .= " AND p.entity IN (".getEntity('propal').")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index dd90e6f1910..16669191454 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -90,12 +90,12 @@ class box_prospect extends ModeleBoxes $sql .= ", s.fk_stcomm"; $sql .= ", s.datec, s.tms, s.status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE s.client IN (2, 3)"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } // Add where from hooks diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 172e26153fa..5d255f2887f 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -90,7 +90,7 @@ class box_services_contracts extends ModeleBoxes $sql .= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= ")"; diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 13ed4b8d54d..96cd2ccb416 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -78,7 +78,7 @@ class box_services_expired extends ModeleBoxes $sql .= " s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services"; $sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$this->db->idate($now)."'"; @@ -87,7 +87,7 @@ class box_services_expired extends ModeleBoxes if ($user->socid) { $sql .= ' AND c.fk_soc = '.((int) $user->socid); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid"; diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index a2d54f3e948..0dd5e4e0718 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -96,7 +96,7 @@ class box_shipments extends ModeleBoxes $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; } $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; @@ -106,7 +106,7 @@ class box_shipments extends ModeleBoxes if ($user->socid > 0) { $sql .= " AND s.rowid = ".((int) $user->socid); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND sc.fk_user = ".((int) $user->id); } else { $sql .= " ORDER BY e.tms DESC, e.date_delivery DESC, e.ref DESC"; diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 1c6c9475c09..52edf4b8fa4 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -88,12 +88,12 @@ class box_supplier_orders extends ModeleBoxes $sql .= ", c.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 2b89a8ed436..1eb4159ae4a 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -82,14 +82,14 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $sql .= ", c.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; $sql .= " AND c.date_livraison IS NOT NULL"; $sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 81be08a78b8..171100943fc 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -63,7 +63,7 @@ class Ccountry extends CommonDict /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> */ public $fields = array( 'label' => array('type' => 'varchar(250)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 15, 'notnull' => -1, 'showoncombobox' => 1) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index f37bfc34085..4bb9a8fbb08 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -5,9 +5,9 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Marcos García * Copyright (C) 2016-2023 Charlene Benke - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2020 Josep Lluís Amador - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Mélina Joum * Copyright (C) 2024 Nick Fragoulis * @@ -933,8 +933,10 @@ abstract class CommonDocGenerator array('line_date_end_rfc', 'date_end', 'dayrfc', 'auto', null) ); foreach ($date_specs as $date_spec) { - if (property_exists($line, $date_spec[1])) { - $resarray[$date_spec[0]] = dol_print_date($line->${$date_spec[1]}, $date_spec[2], $date_spec[3], $date_spec[4]); + $propertyname = $date_spec[1]; + if (property_exists($line, $propertyname)) { + // @phan-suppress-next-line PhanUndeclaredProperty + $resarray[$date_spec[0]] = dol_print_date($line->$propertyname, $date_spec[2], $date_spec[3], $date_spec[4]); } } @@ -1053,7 +1055,7 @@ abstract class CommonDocGenerator $array_key.'_tracking_number' => $object->tracking_number, $array_key.'_tracking_url' => $object->tracking_url, $array_key.'_shipping_method' => $object->listmeths[0]['libelle'], - $array_key.'_weight' => $object->trueWeight.' '.measuringUnitString(0, 'weight', (string) $object->weight_units), + $array_key.'_weight' => $object->trueWeight.' '.measuringUnitString(0, 'weight', $object->weight_units), $array_key.'_width' => $object->trueWidth.' '.measuringUnitString(0, 'size', $object->width_units), $array_key.'_height' => $object->trueHeight.' '.measuringUnitString(0, 'size', $object->height_units), $array_key.'_depth' => $object->trueDepth.' '.measuringUnitString(0, 'size', $object->depth_units), @@ -1090,31 +1092,31 @@ abstract class CommonDocGenerator // Set trueVolume and volume_units not currently stored into database if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { - $object->trueVolume = $object->trueWidth * $object->trueHeight * $object->trueDepth; - $object->volume_units = $object->size_units * 3; + $object->trueVolume = $object->trueWidth * $object->trueHeight * $object->trueDepth; + $object->volume_units = $object->size_units * 3; } $array_shipment[$array_key.'_total_ordered'] = (string) $totalOrdered; $array_shipment[$array_key.'_total_toship'] = (string) $totalToShip; if ($object->trueWeight) { - $array_shipment[$array_key.'_total_weight'] = (empty($totalWeight)) ? '' : showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); + $array_shipment[$array_key.'_total_weight'] = (empty($totalWeight)) ? '' : showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); } elseif (!empty($totalWeight)) { - $array_shipment[$array_key.'_total_weight'] = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1); + $array_shipment[$array_key.'_total_weight'] = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1); } else { - $array_shipment[$array_key.'_total_weight'] = ""; + $array_shipment[$array_key.'_total_weight'] = ""; } if (!empty($object->trueVolume)) { if ($object->volume_units < 50) { - $array_shipment[$array_key.'_total_volume'] = (empty($totalVolume)) ? '' : showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); + $array_shipment[$array_key.'_total_volume'] = (empty($totalVolume)) ? '' : showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); } else { - $array_shipment[$array_key.'_total_volume'] = (empty($totalVolume)) ? '' : price($object->trueVolume, 0, $outputlangs, 0, 0).' '.measuringUnitString(0, "volume", $object->volume_units); + $array_shipment[$array_key.'_total_volume'] = (empty($totalVolume)) ? '' : price($object->trueVolume, 0, $outputlangs, 0, 0).' '.measuringUnitString(0, "volume", $object->volume_units); } } elseif (!empty($totalVolume)) { - $array_shipment[$array_key.'_total_volume'] = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1); + $array_shipment[$array_key.'_total_volume'] = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1); } else { - $array_shipment[$array_key.'_total_volume'] = ""; + $array_shipment[$array_key.'_total_volume'] = ""; } return $array_shipment; @@ -1125,16 +1127,18 @@ abstract class CommonDocGenerator /** * Define array with couple substitution key => substitution value * - * @param array $object Dolibarr Object - * @param Translate $outputlangs Language object for output - * @param boolean|int $recursive Want to fetch child array or child object. - * @return array Array of substitution key->code + * @param array|CommonObject $object Dolibarr Object + * @param Translate $outputlangs Language object for output + * @param boolean|int $recursive Want to fetch child array or child object. + * @return array Array of substitution key->code */ public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = 1) { // phpcs:enable $array_other = array(); - if (is_array($object) && count($object)) { + + if ((is_array($object) && count($object)) || is_object($object)) { + // Loop on each entry of array or on each property of object foreach ($object as $key => $value) { if (in_array($key, array('db', 'fields', 'lines', 'modelpdf', 'model_pdf'))) { // discard some properties continue; @@ -1171,11 +1175,11 @@ abstract class CommonDocGenerator * Note that vars into substitutions array are formatted. * * @param CommonObject $object Object with extrafields (must have $object->array_options filled) - * @param array $array_to_fill Substitution array + * @param array $array_to_fill Substitution array * @param Extrafields $extrafields Extrafields object * @param string $array_key Prefix for name of the keys into returned array * @param Translate $outputlangs Lang object to use for output - * @return array Substitution array + * @return array Substitution array */ public function fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs) { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 13561f2de64..d22f304ca0d 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -3,8 +3,8 @@ * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -905,9 +905,9 @@ abstract class CommonInvoice extends CommonObject /** * Return label of object status * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto - * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise) - * @return string Label of status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto + * @param int|float $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here float amount paid if you have it, 1 otherwise) + * @return string Label of status */ public function getLibStatut($mode = 0, $alreadypaid = -1) { @@ -921,7 +921,7 @@ abstract class CommonInvoice extends CommonObject * @param int $paye Status field paye (or $recur) * @param int $status Id status * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto - * @param int $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, -1 otherwise) + * @param int|float $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here float amount paid if you have it, -1 otherwise) * @param int $type Type invoice. If -1, we use $this->type * @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer * @return string Label of status @@ -1984,7 +1984,7 @@ abstract class CommonInvoice extends CommonObject $s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";*/ } else { $s .= "S\n"; - $s .= dol_trunc($mysoc->name, 70, 'right', 'UTF-8', 1)."\n"; + $s .= dol_trunc((string) $mysoc->name, 70, 'right', 'UTF-8', 1)."\n"; $addresslinearray = explode("\n", $mysoc->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 @@ -2005,7 +2005,7 @@ abstract class CommonInvoice extends CommonObject $s .= ($this->multicurrency_code ? $this->multicurrency_code : $conf->currency)."\n"; // Buyer $s .= "S\n"; - $s .= dol_trunc($this->thirdparty->name, 70, 'right', 'UTF-8', 1)."\n"; + $s .= dol_trunc((string) $this->thirdparty->name, 70, 'right', 'UTF-8', 1)."\n"; $addresslinearray = explode("\n", $this->thirdparty->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 e4ab9a505d1..b8b04f032aa 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -140,7 +140,7 @@ abstract class CommonObject /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -1500,14 +1500,14 @@ abstract class CommonObject $sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user if ($source == 'internal') { - $sql .= ", '-1' as socid, t.statut as statuscontact, t.login, t.photo, t.gender"; + $sql .= ", '-1' as socid, t.statut as statuscontact, t.login, t.photo, t.gender, t.fk_country as country_id"; } if ($source == 'external' || $source == 'thirdparty') { - $sql .= ", t.fk_soc as socid, t.statut as statuscontact"; + $sql .= ", t.fk_soc as socid, t.statut as statuscontact, t.fk_pays as country_id"; } - $sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email"; + $sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email, t.address, t.zip, t.town"; if (empty($arrayoftcids)) { - $sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_label"; + $sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_label, co.label as country"; } $sql .= " FROM"; if (empty($arrayoftcids)) { @@ -1516,9 +1516,11 @@ abstract class CommonObject $sql .= " ".$this->db->prefix()."element_contact as ec"; if ($source == 'internal') { // internal contact (user) $sql .= " LEFT JOIN ".$this->db->prefix()."user as t on ec.fk_socpeople = t.rowid"; + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as co ON co.rowid = t.fk_country"; } if ($source == 'external' || $source == 'thirdparty') { // external contact (socpeople) $sql .= " LEFT JOIN ".$this->db->prefix()."socpeople as t on ec.fk_socpeople = t.rowid"; + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as co ON co.rowid = t.fk_pays"; } $sql .= " WHERE ec.element_id = ".((int) $this->id); if (empty($arrayoftcids)) { @@ -1566,6 +1568,11 @@ abstract class CommonObject 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'email' => $obj->email, + 'address' => $obj->address, + 'zip' => $obj->zip, + 'town' => $obj->town, + 'country_id' => $obj->country_id, + 'country' => $obj->country, 'login' => (empty($obj->login) ? '' : $obj->login), 'photo' => (empty($obj->photo) ? '' : $obj->photo), 'gender' => (empty($obj->gender) ? '' : $obj->gender), @@ -4182,7 +4189,11 @@ abstract class CommonObject { // phpcs:enable global $user, $hookmanager, $action; - $origin = (!empty($origin) ? $origin : $this->origin); + + if (empty($this->origin_type) && !empty($this->origin)) { + $this->origin_type = $this->origin; + } + $origin = (!empty($origin) ? $origin : $this->origin_type); $origin_id = (!empty($origin_id) ? $origin_id : $this->origin_id); $f_user = isset($f_user) ? $f_user : $user; @@ -4547,10 +4558,11 @@ abstract class CommonObject $deletetarget = true; } + $element = $this->getElementType(); $sourceid = (!empty($sourceid) ? $sourceid : $this->id); - $sourcetype = (!empty($sourcetype) ? $sourcetype : $this->element); + $sourcetype = (!empty($sourcetype) ? $sourcetype : $element); $targetid = (!empty($targetid) ? $targetid : $this->id); - $targettype = (!empty($targettype) ? $targettype : $this->element); + $targettype = (!empty($targettype) ? $targettype : $element); $this->db->begin(); $error = 0; @@ -4576,14 +4588,14 @@ abstract class CommonObject } else { if ($deletesource) { $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; + $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "'"; } elseif ($deletetarget) { $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; + $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "'"; } else { - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; + $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "')"; $sql .= " OR"; - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; + $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "')"; } } @@ -5790,7 +5802,7 @@ abstract class CommonObject */ protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams = null) { - global $conf, $langs, $user, $hookmanager, $action; + global $conf, $langs, $hookmanager, $action; $srctemplatepath = ''; @@ -6114,9 +6126,10 @@ abstract class CommonObject * @todo Move this into files.lib.php * * @param string $file Path file in UTF8 to original file to create thumbs from. + * @param int $quality Quality after compression (0=worst so better compression, 100=best so low or no compression). For thumbs, we force quality to 50 by default. * @return void */ - public function addThumbs($file) + public function addThumbs($file, $quality = 50) { $file_osencoded = dol_osencode($file); @@ -6129,7 +6142,6 @@ abstract class CommonObject $maxwidthmini = $tmparraysize['maxwidthmini']; $maxheightmini = $tmparraysize['maxheightmini']; //$quality = $tmparraysize['quality']; - $quality = 50; // For thumbs, we force quality to 50 // Create small thumbs for company (Ratio is near 16/9) // Used on logon for example @@ -6580,8 +6592,6 @@ abstract class CommonObject */ public function deleteExtraFields() { - global $conf; - if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { return 0; } @@ -7448,16 +7458,15 @@ abstract class CommonObject * Return HTML string to put an input field into a page * Code very similar with showInputField of extra fields * - * @param ?array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $val Array of properties for field to show (used only if ->fields not defined) - * Array of properties of field to show - * @param string $key Key of attribute - * @param string|string[] $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 array type must be array) - * @param string $moreparam To add more parameters on html input tag - * @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) - * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. - * @param int<0,1> $nonewbutton Force to not show the new button on field that are links to object - * @return string + * @param ?array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $val Array of properties for field to show (used only if ->fields not defined, so try to keep this null) + * @param string $key Key of attribute + * @param string|string[] $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 array type must be array) + * @param string $moreparam To add more parameters on html input tag + * @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) + * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. + * @param int<0,1> $nonewbutton Force to not show the new button on field that are links to object + * @return string */ public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) { @@ -8267,7 +8276,17 @@ abstract class CommonObject } } } - $objectfield = $this->element.($this->module ? '@'.$this->module : '').':'.$key.$keysuffix; + + // $param_list_array[0] can be the name of object (Example 'User' the field is linked to). Not as taking the information from the record in ->fields found from $objectfield. + + // $valparent is a string 'dataobject@module:keyoffieldinfieldsarray' to find the record field to link to. + // $valparent = $this->element.($this->module ? '@'.$this->module : '').':'.$key.$keysuffix; + + // $val is already the record field found at same place than found by $valparent but already loaded and may have been modified by parent caller. + + //$objectfield = $valparent; + $objectfield = $val; // Is better than using old method $valparent + $out = $form->selectForForms($param_list_array[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, (empty($val['disabled']) ? 0 : 1), '', $objectfield); if (!empty($param_list_array[2])) { // If the entry into $fields is set, we must add a create button @@ -9373,6 +9392,13 @@ abstract class CommonObject } } + if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('checkbox'))) { + if ($action == 'create') { + $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? $value : explode(',', $extrafields->attributes[$this->table_element]['default'][$key]); + } + } + + $labeltoshow = $langs->trans($label); $helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]); if ($display_type == 'card') { @@ -10472,7 +10498,7 @@ abstract class CommonObject } // Create lines - if (!empty($this->table_element_line) && !empty($this->fk_element)) { + if (!empty($this->table_element_line) && !empty($this->fk_element) && !empty($this->lines)) { foreach ($this->lines as $line) { $keyforparent = $this->fk_element; $line->$keyforparent = $this->id; @@ -10677,6 +10703,14 @@ abstract class CommonObject if (array_key_exists('user_modification_id', $fieldvalues) && !($fieldvalues['user_modification_id'] > 0)) { $fieldvalues['user_modification_id'] = $user->id; } + if (array_key_exists('pass_crypted', $fieldvalues) && property_exists($this, 'pass') && !empty($this->pass)) { + // @phan-suppress-next-line PhanUndeclaredProperty + $tmparray = dol_hash($this->pass, '0', 0, 1); + $fieldvalues['pass_crypted'] = $tmparray['pass_encrypted']; + if (array_key_exists('pass_encoding', $fieldvalues) && property_exists($this, 'pass_encoding')) { + $fieldvalues['pass_encoding'] = $tmparray['pass_encoding']; + } + } if (array_key_exists('ref', $fieldvalues)) { $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data } @@ -11040,7 +11074,7 @@ abstract class CommonObject $this->db->begin(); $statusfield = 'status'; - if (in_array($this->element, array('don', 'donation', 'shipping'))) { + if (in_array($this->element, array('don', 'donation', 'shipping', 'project_task'))) { $statusfield = 'fk_statut'; } diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 484ead2770d..173cd852be1 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -332,7 +332,7 @@ abstract class CommonObjectLine extends CommonObject } /** - * Return clicable link of object line (with eventually picto) + * Return clickable link of object line (optionally with picto) * May (should) also return information about the associated "parent" object. * To overload * diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index 5fbf92c7446..9ab9401c570 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ abstract class CommonOrder extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index c234a15a374..2a78aded5ac 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1,10 +1,12 @@ * 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 + * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +22,6 @@ * along with this program. If not, see . */ - /** * \file htdocs/core/class/conf.class.php * \ingroup core @@ -54,6 +55,9 @@ class Conf extends stdClass public $browser; //! To store some setup of generic modules + /** + * @var stdClass + */ public $mycompany; /** @@ -72,7 +76,13 @@ class Conf extends stdClass public $multicompany; //! To store module status of special module names + /** + * @var ?mixed + */ public $expedition_bon; + /** + * @var ?mixed + */ public $delivery_note; /** @@ -86,7 +96,7 @@ class Conf extends stdClass public $disable_compute; /** - * @var string 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:->getCurrencySymbol($this->currency) */ public $currency; @@ -150,12 +160,12 @@ class Conf extends stdClass public $entities = array(); /** - * @var int Set if we force param dol_hide_topmenu into login url + * @var int<0,1> 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 + * @var int<0,1> Set if we force param dol_hide_leftmenu into login url */ public $dol_hide_leftmenu; @@ -173,15 +183,45 @@ class Conf extends stdClass */ 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 + /** + * @var string + */ public $format_date_short; // Format of day with PHP/C tags (strftime functions) + /** + * @var string + */ public $format_date_short_java; // Format of day with Java tags + /** + * @var string + */ public $format_hour_short; + /** + * @var string + */ public $format_hour_short_duration; + /** + * @var string + */ public $format_date_text_short; + /** + * @var string + */ public $format_date_text; + /** + * @var string + */ public $format_date_hour_short; + /** + * @var string + */ public $format_date_hour_sec_short; + /** + * @var string + */ public $format_date_hour_text_short; + /** + * @var string + */ public $format_date_hour_text; /** @@ -307,12 +347,13 @@ class Conf extends stdClass */ public $productbatch; /** + * @var ?stdClass * @deprecated Use project */ public $projet; /** - * @var stdClass + * @var ?stdClass */ public $project; @@ -632,8 +673,9 @@ class Conf extends stdClass } // Object $mc + global $mc; + $mc = null; if (!defined('NOREQUIREMC') && isModEnabled('multicompany')) { - global $mc; $ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php'); if ($ret && class_exists('ActionsMulticompany')) { $mc = new ActionsMulticompany($db); @@ -1038,6 +1080,14 @@ class Conf extends stdClass $this->global->MAIN_MAX_DECIMALS_SHOWN = 8; } + // Non working days + if (!isset($this->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) { + $this->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1; + } + if (!isset($this->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) { + $this->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1; + } + // Default pdf option if (!isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) { $this->global->MAIN_PDF_DASH_BETWEEN_LINES = 1; // use dash between lines @@ -1134,10 +1184,10 @@ class Conf extends stdClass // Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx if (isset($this->agenda)) { $this->adherent->subscription = new stdClass(); - $this->adherent->subscription->warning_delay = (isset($this->global->MAIN_DELAY_MEMBERS) ? (int) $this->global->MAIN_DELAY_MEMBERS : 0) * 86400; + $this->adherent->subscription->warning_delay = getDolGlobalInt('MAIN_DELAY_MEMBERS') * 86400; } if (isset($this->agenda)) { - $this->agenda->warning_delay = (isset($this->global->MAIN_DELAY_ACTIONS_TODO) ? (int) $this->global->MAIN_DELAY_ACTIONS_TODO : 7) * 86400; + $this->agenda->warning_delay = getDolGlobalInt('MAIN_DELAY_ACTIONS_TODO', 7) * 86400; } if (isset($this->projet)) { $this->projet->warning_delay = (getDolGlobalInt('MAIN_DELAY_PROJECT_TO_CLOSE', 7) * 86400); @@ -1148,46 +1198,46 @@ class Conf extends stdClass if (isset($this->commande)) { $this->commande->client = new stdClass(); $this->commande->fournisseur = new stdClass(); - $this->commande->client->warning_delay = (isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS) ? (int) $this->global->MAIN_DELAY_ORDERS_TO_PROCESS : 2) * 86400; - $this->commande->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS) ? (int) $this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS : 7) * 86400; + $this->commande->client->warning_delay = getDolGlobalInt('MAIN_DELAY_ORDERS_TO_PROCESS', 2) * 86400; + $this->commande->fournisseur->warning_delay = getDolGlobalInt('MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS', 7) * 86400; } if (isset($this->propal)) { $this->propal->cloture = new stdClass(); $this->propal->facturation = new stdClass(); - $this->propal->cloture->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE) ? (int) $this->global->MAIN_DELAY_PROPALS_TO_CLOSE : 0) * 86400; - $this->propal->facturation->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_BILL) ? (int) $this->global->MAIN_DELAY_PROPALS_TO_BILL : 0) * 86400; + $this->propal->cloture->warning_delay = getDolGlobalInt('MAIN_DELAY_PROPALS_TO_CLOSE') * 86400; + $this->propal->facturation->warning_delay = getDolGlobalInt('MAIN_DELAY_PROPALS_TO_BILL') * 86400; } if (isset($this->facture)) { $this->facture->client = new stdClass(); $this->facture->fournisseur = new stdClass(); - $this->facture->client->warning_delay = (isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED) ? (int) $this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0) * 86400; - $this->facture->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY) ? (int) $this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY : 0) * 86400; + $this->facture->client->warning_delay = getDolGlobalInt('MAIN_DELAY_CUSTOMER_BILLS_UNPAYED') * 86400; + $this->facture->fournisseur->warning_delay = getDolGlobalInt('MAIN_DELAY_SUPPLIER_BILLS_TO_PAY') * 86400; } if (isset($this->contrat)) { $this->contrat->services = new stdClass(); $this->contrat->services->inactifs = new stdClass(); $this->contrat->services->expires = new stdClass(); - $this->contrat->services->inactifs->warning_delay = (isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES) ? (int) $this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0) * 86400; - $this->contrat->services->expires->warning_delay = (isset($this->global->MAIN_DELAY_RUNNING_SERVICES) ? (int) $this->global->MAIN_DELAY_RUNNING_SERVICES : 0) * 86400; + $this->contrat->services->inactifs->warning_delay = getDolGlobalInt('MAIN_DELAY_NOT_ACTIVATED_SERVICES') * 86400; + $this->contrat->services->expires->warning_delay = getDolGlobalInt('MAIN_DELAY_RUNNING_SERVICES') * 86400; } if (isset($this->commande)) { $this->bank->rappro = new stdClass(); $this->bank->cheque = new stdClass(); - $this->bank->rappro->warning_delay = (isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? (int) $this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 86400; - $this->bank->cheque->warning_delay = (isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? (int) $this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 86400; + $this->bank->rappro->warning_delay = getDolGlobalInt('MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE') * 86400; + $this->bank->cheque->warning_delay = getDolGlobalInt('MAIN_DELAY_CHEQUES_TO_DEPOSIT') * 86400; } if (isset($this->expensereport)) { $this->expensereport->approve = new stdClass(); - $this->expensereport->approve->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS) ? (int) $this->global->MAIN_DELAY_EXPENSEREPORTS : 0) * 86400; + $this->expensereport->approve->warning_delay = getDolGlobalInt('MAIN_DELAY_EXPENSEREPORTS') * 86400; $this->expensereport->payment = new stdClass(); - $this->expensereport->payment->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY) ? (int) $this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0) * 86400; + $this->expensereport->payment->warning_delay = getDolGlobalInt('MIN_DELAY_EXPENSEREPORTS_TO_PAY') * 86400; } if (isset($this->holiday)) { $this->holiday->approve = new stdClass(); - $this->holiday->approve->warning_delay = (isset($this->global->MAIN_DELAY_HOLIDAYS) ? (int) $this->global->MAIN_DELAY_HOLIDAYS : 0) * 86400; + $this->holiday->approve->warning_delay = getDolGlobalInt('MAIN_DELAY_HOLIDAYS') * 86400; } - if ((!empty($this->global->PRODUIT_MULTIPRICES) || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT)) { + if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT')) { $this->global->PRODUIT_MULTIPRICES_LIMIT = 5; } @@ -1197,10 +1247,10 @@ class Conf extends stdClass // For modules that want to disable top or left menu if (!empty($this->global->MAIN_HIDE_TOP_MENU)) { - $this->dol_hide_topmenu = $this->global->MAIN_HIDE_TOP_MENU; + $this->dol_hide_topmenu = (int) (bool) getDolGlobalInt('MAIN_HIDE_TOP_MENU'); } if (!empty($this->global->MAIN_HIDE_LEFT_MENU)) { - $this->dol_hide_leftmenu = $this->global->MAIN_HIDE_LEFT_MENU; + $this->dol_hide_leftmenu = (int) (bool) getDolGlobalInt('MAIN_HIDE_LEFT_MENU'); } if (empty($this->global->MAIN_SIZE_SHORTLIST_LIMIT)) { diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 34f5eb68660..71dbae2b866 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -488,7 +488,7 @@ class CUnits extends CommonDict $resql = $this->db->query($sql); if ($resql) { // TODO : add base col into unit dictionary table - $unit = $this->db->fetch_object($sql); + $unit = $this->db->fetch_object($resql); if ($unit) { // TODO : if base exists in unit dictionary table, remove this conversion exception and update conversion infos in database. // Example time hour currently scale 3600 will become scale 2 base 60 diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index 0d28daa0958..c92697a4a9f 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -76,7 +76,7 @@ class DefaultValues extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 3a695df5e97..5cd03e46f74 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -339,7 +339,7 @@ class DiscountAbsolute extends CommonObject include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $tmpinvoice = new Facture($this->db); $tmpinvoice->fetch($this->fk_facture_source); - $userid = $tmpinvoice->fk_user_author; // We use the author of invoice + $userid = $tmpinvoice->user_creation_id; // We use the author of invoice } // Insert request @@ -347,13 +347,15 @@ class DiscountAbsolute extends CommonObject $sql .= " (entity, datec, fk_soc, discount_type, fk_user, description,"; $sql .= " amount_ht, amount_tva, amount_ttc, tva_tx, vat_src_code,"; $sql .= " multicurrency_amount_ht, multicurrency_amount_tva, multicurrency_amount_ttc,"; - $sql .= " fk_facture_source, fk_invoice_supplier_source"; + $sql .= " fk_facture_source, fk_invoice_supplier_source, multicurrency_code, multicurrency_tx"; $sql .= ")"; $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec != '' ? $this->datec : dol_now())."', ".((int) $this->socid).", ".(empty($this->discount_type) ? 0 : intval($this->discount_type)).", ".((int) $userid).", '".$this->db->escape($this->description)."',"; $sql .= " ".price2num($this->amount_ht).", ".price2num($this->amount_tva).", ".price2num($this->amount_ttc).", ".price2num($this->tva_tx).", '".$this->db->escape($this->vat_src_code)."',"; $sql .= " ".price2num($this->multicurrency_amount_ht).", ".price2num($this->multicurrency_amount_tva).", ".price2num($this->multicurrency_amount_ttc).", "; $sql .= " ".($this->fk_facture_source ? ((int) $this->fk_facture_source) : "null").","; - $sql .= " ".($this->fk_invoice_supplier_source ? ((int) $this->fk_invoice_supplier_source) : "null"); + $sql .= " ".($this->fk_invoice_supplier_source ? ((int) $this->fk_invoice_supplier_source) : "null").","; + $sql .= " ".($this->multicurrency_code ? "'".$this->db->escape($this->multicurrency_code)."'" : "null").","; + $sql .= " ".($this->multicurrency_tx ? price2num($this->multicurrency_tx) : "null"); $sql .= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 79cff89f228..81fc746874d 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1,7 +1,7 @@ * Copyright (c) 2004-2015 Laurent Destailleur - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -55,7 +55,9 @@ class DolGraph private $_library; // Graphic library to use (jflot, chart, artichow) /** - * @var array Array of data + * @var array> Array of data + * @phpstan-var array + * @phan-var array */ public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) /** @@ -364,7 +366,7 @@ class DolGraph /** * Set data * - * @param array $data Data + * @param array $data Data * @return void * @see draw_jflot() for syntax of data array */ diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index fb2f9a289e4..bd1034abe3d 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -87,7 +87,7 @@ class EmailSenderProfile extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index d1f80baadb2..1a581c464e6 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -127,7 +127,7 @@ class Events // extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 752a1527f5b..9954624538e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -773,7 +773,7 @@ class ExtraFields $sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$this->db->sanitize($attrname)." (".$this->db->sanitize($attrname).")"; } else { dol_syslog(get_class($this).'::update_common', LOG_DEBUG); - $sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX IF EXISTS uk_".$table."_".$this->db->sanitize($attrname); + $sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX uk_".$table."_".$this->db->sanitize($attrname); } dol_syslog(get_class($this).'::update', LOG_DEBUG); $resql = $this->db->query($sql, 1, 'dml'); @@ -2065,7 +2065,7 @@ class ExtraFields } elseif ($type == 'price') { //$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); if ($value || $value == '0') { - $value = price($value, 0, $outputlangs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$outputlangs->getCurrencySymbol($conf->currency); + $value = price($value, 0, $outputlangs, 0, getDolGlobalInt('MAIN_MAX_DECIMALS_TOT'), -1).' '.$outputlangs->getCurrencySymbol($conf->currency); } } elseif ($type == 'pricecy') { $currency = $conf->currency; @@ -2076,7 +2076,7 @@ class ExtraFields $value = $pricetmp[0]; } if ($value || $value == '0') { - $value = price($value, 0, $outputlangs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1, $currency); + $value = price($value, 0, $outputlangs, 0, getDolGlobalInt('MAIN_MAX_DECIMALS_TOT'), -1, $currency); } } elseif ($type == 'select') { $valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : ''); @@ -2313,7 +2313,17 @@ class ExtraFields $tmpobject = new $classname($this->db); '@phan-var-force CommonObject $tmpobject'; $tmpobject->fetch($value); - $value = $tmpobject->getNomUrl(3); + + if (get_class($tmpobject) == 'Categorie') { + // For category object, rendering must use the same method than the one deinfed into showCategories() + $color = $tmpobject->color; + $sfortag = ''; + $sfortag .= $tmpobject->getNomUrl(3); + $sfortag .= ''; + $value = $sfortag; + } else { + $value = $tmpobject->getNomUrl(3); + } } } else { dol_syslog('Error bad setup of extrafield', LOG_WARNING); @@ -2428,8 +2438,22 @@ class ExtraFields * @param string $key Key of attribute * @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data * @return string Formatted value + * @deprecated Use getCSSClass() */ public function getAlignFlag($key, $extrafieldsobjectkey = '') + { + return $this->getCSSClass($key, $extrafieldsobjectkey); + } + + /** + * Return the CSS to use for this extrafield into list + * + * @param string $key Key of attribute + * @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data + * @param string $mode 'csslist' (used on td into table list), 'css' (used on create/update), 'cssview' (used on view) + * @return string Formatted value + */ + public function getCSSClass($key, $extrafieldsobjectkey = '', $mode = 'csslist') { $type = 'varchar'; if (!empty($extrafieldsobjectkey)) { @@ -2438,19 +2462,27 @@ class ExtraFields $cssstring = ''; - if (in_array($type, array('date', 'datetime', 'datetimegmt',))) { - $cssstring = "center"; - } elseif (in_array($type, array('int', 'price', 'double', 'duration'))) { - $cssstring = "right"; - } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip', 'icon'))) { - $cssstring = "center"; + if ($mode == 'csslist') { + if (in_array($type, array('date', 'datetime', 'datetimegmt',))) { + $cssstring = "center"; + } elseif (in_array($type, array('int', 'price', 'double', 'duration'))) { + $cssstring = "right"; + } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip', 'icon'))) { + $cssstring = "center"; + } + + if (!empty($this->attributes[$extrafieldsobjectkey][$mode][$key])) { + $cssstring .= ($cssstring ? ' ' : '').$this->attributes[$extrafieldsobjectkey][$mode][$key]; + } else { + if (in_array($type, array('ip'))) { + $cssstring .= ($cssstring ? ' ' : '').'tdoverflowmax150'; + } + } } - if (!empty($this->attributes[$extrafieldsobjectkey]['csslist'][$key])) { - $cssstring .= ($cssstring ? ' ' : '').$this->attributes[$extrafieldsobjectkey]['csslist'][$key]; - } else { - if (in_array($type, array('ip'))) { - $cssstring .= ($cssstring ? ' ' : '').'tdoverflowmax150'; + if ($mode == 'css' || $mode == 'cssview') { + if (!empty($this->attributes[$extrafieldsobjectkey][$mode][$key])) { + $cssstring = ($cssstring ? ' ' : '').$this->attributes[$extrafieldsobjectkey][$mode][$key]; } } diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 675a22ae0fe..31e4b64b6aa 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -1,8 +1,9 @@ * Copyright (C) 2011-2023 Laurent Destailleur * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -161,7 +162,7 @@ class FileUpload 'options' => &$options, 'element' => $element ), - $object, + $object, // @phan-suppress-current-line PhanTypeMismatchArgumentNullable $action ); diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 571b2b1fda3..9bc2935b2a2 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2025 Alexandre Spangaro * Copyright (C) 2020 OScss-Shop * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW @@ -406,11 +406,11 @@ class Fiscalyear extends CommonObject // phpcs:enable if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; - //$langs->load("mymodule@mymodule"); - $this->labelStatus[self::STATUS_OPEN] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatus[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Enabled'); - $this->labelStatusShort[self::STATUS_OPEN] = $langs->transnoentitiesnoconv('Enabled'); - $this->labelStatusShort[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Disabled'); + + $this->labelStatus[self::STATUS_OPEN] = $langs->transnoentitiesnoconv('FiscalYearOpened'); + $this->labelStatus[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('FiscalYearClosed'); + $this->labelStatusShort[self::STATUS_OPEN] = $langs->transnoentitiesnoconv('FiscalYearOpenedShort'); + $this->labelStatusShort[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('FiscalYearClosedShort'); } $statusType = 'status4'; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index fc8fc9ada54..2cdec011d65 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -1,8 +1,9 @@ * Copyright (C) 2010-2014 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9a1409b9b0d..537a0be605b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1,4 +1,5 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier @@ -80,6 +81,7 @@ class Form public $cache_types_paiements = array(); public $cache_conditions_paiements = array(); public $cache_transport_mode = array(); + /** @var array */ public $cache_availability = array(); public $cache_demand_reason = array(); public $cache_types_fees = array(); @@ -100,18 +102,18 @@ class Form /** * Output key field for an editable field * - * @param string $text Text of label or key to translate - * @param string $htmlname Name of select field ('edit' prefix will be added) - * @param string $preselected Value to show/edit (not used in this function) - * @param object $object Object (on the page we show) - * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. - * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) - * @param string $moreparam More param to add on a href URL. - * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. - * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' - * @param string $paramid Key of parameter for id ('id', 'socid') - * @param string $help Tooltip help - * @return string HTML edit field + * @param string $text Text of label or key to translate + * @param string $htmlname Name of select field ('edit' prefix will be added) + * @param string $preselected Value to show/edit (not used in this function) + * @param object $object Object (on the page we show) + * @param int<0,1> $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) + * @param string $moreparam More param to add on a href URL. + * @param int<0,1> $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. + * @param int<0,3> $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' + * @param string $paramid Key of parameter for id ('id', 'socid') + * @param string $help Tooltip help + * @return string HTML edit field */ public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '') { @@ -200,23 +202,23 @@ class Form /** * Output value of a field for an editable field * - * @param string $text Text of label (not used in this function) - * @param string $htmlname Name of select field - * @param string $value Value to show/edit - * @param CommonObject $object Object (that we want to show) - * @param boolean $perm Permission to allow button to edit parameter - * @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'phone', 'amount:99', 'numeric:99', + * @param string $text Text of label (not used in this function) + * @param string $htmlname Name of select field + * @param string|int $value Value to show/edit + * @param CommonObject|ActionsCardProduct|ActionsCardService $object Object (that we want to show) + * @param bool|int<0,1> $perm Permission to allow button to edit parameter + * @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'phone', 'amount:99', 'numeric:99', * 'text' or 'textarea:rows:cols%', 'safehtmlstring', 'restricthtml', * 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') - * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formatted price instead of numeric value, or a select combo). Use '' to use same than $value + * @param ?string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formatted price instead of numeric value, or a select combo). Use '' to use same than $value * @param ?CommonObject $extObject External object ??? - * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') + * @param string|array|null $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @param string $moreparam More param to add on the form on action href URL parameter - * @param int $notabletag Do no output table tags + * @param int<0,1> $notabletag Do no output table tags * @param string $formatfunc Call a specific method of $object->$formatfunc to output field in view mode (For example: 'dol_print_email') * @param string $paramid Key of parameter for id ('id', 'socid') * @param string $gm 'auto' or 'tzuser' or 'tzuserrel' or 'tzserver' (when $typeofdata is a date) - * @param array $moreoptions Array with more options. For example array('addnowlink'=>1), array('valuealreadyhtmlescaped'=>1) + * @param array $moreoptions Array with more options. For example array('addnowlink'=>1), array('valuealreadyhtmlescaped'=>1) * @param string $editaction [=''] use GETPOST default action or set action to edit mode * @return string HTML edit field */ @@ -332,7 +334,7 @@ class Form $ret .= '
diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 9c931d0503e..5ae58298924 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -210,18 +211,18 @@ if (is_array($param)) { array('varchar', 'phone', 'mail', 'url', 'ip', 'select', 'password', 'text', 'html'), - 'double'=>array('double', 'price'), - 'price'=>array('double', 'price'), - 'text'=>array('text', 'html'), - 'html'=>array('text', 'html'), - 'password'=>array('password', 'varchar'), - 'mail'=>array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), - 'url'=>array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), - 'phone'=>array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), - 'ip'=>array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), - 'select'=>array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), - 'date'=>array('date', 'datetime') + 'varchar' => array('varchar', 'phone', 'mail', 'url', 'ip', 'select', 'password', 'text', 'html'), + 'double' => array('double', 'price'), + 'price' => array('double', 'price'), + 'text' => array('text', 'html'), + 'html' => array('text', 'html'), + 'password' => array('password', 'varchar'), + 'mail' => array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), + 'url' => array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), + 'phone' => array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), + 'ip' => array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), + 'select' => array('varchar', 'phone', 'mail', 'url', 'ip', 'select'), + 'date' => array('date', 'datetime') ); /* Disabled because text is text on several lines, when varchar is text on 1 line, we should not be able to convert if ($size <= 255 && in_array($type, array('text', 'html'))) { @@ -256,12 +257,12 @@ if (in_array($type, array_keys($typewecanchangeinto))) {
'; + print '
'; $form = new Form($db); if ($object->birthday) { print $form->selectDate($object->birthday, 'birthday', 0, 0, 0, "perso", 1, 0); } else { print $form->selectDate('', 'birthday', 0, 0, 1, "perso", 1, 0); } - print ': '; + print '   '; if (!empty($object->birthday_alert)) { print ''; } else { diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index e785fc0a520..2dbc8c53381 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Open-Dsi * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2248,7 +2248,7 @@ class Contact extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 576ccc21f81..e2e5496e0c8 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2015-2018 Ferran Marcet * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -263,7 +263,7 @@ class Contrat extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -2068,7 +2068,7 @@ class Contrat extends CommonObject if (is_null($this->project) || (is_object($this->project) && $this->project->isEmpty())) { $res = $this->fetchProject(); if ($res > 0 && $this->project instanceof Project) { - $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1); + $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, '1'); } } } @@ -2294,7 +2294,7 @@ class Contrat extends CommonObject $this->from = " FROM ".MAIN_DB_PREFIX."contrat as c"; $this->from .= ", ".MAIN_DB_PREFIX."contratdet as cd"; $this->from .= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $this->from .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } @@ -2325,7 +2325,7 @@ class Contrat extends CommonObject if ($user->socid) { $sql .= " AND c.fk_soc = ".((int) $user->socid); } - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } @@ -2393,7 +2393,7 @@ class Contrat extends CommonObject $sql = "SELECT count(c.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."contrat as c"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".((int) $user->id); $clause = "AND"; @@ -2921,7 +2921,7 @@ class Contrat extends CommonObject * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/contrat/class/contratligne.class.php b/htdocs/contrat/class/contratligne.class.php index 5039a0e655c..09c42a1a632 100644 --- a/htdocs/contrat/class/contratligne.class.php +++ b/htdocs/contrat/class/contratligne.class.php @@ -299,7 +299,7 @@ class ContratLigne extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -494,7 +494,7 @@ class ContratLigne extends CommonObjectLine $sql .= " t.label,"; // This field is not used. Only label of product $sql .= " p.ref as product_ref,"; $sql .= " p.label as product_label,"; - $sql .= " p.description as product_desc,"; + $sql .= " p.description as product_description,"; $sql .= " p.fk_product_type as product_type,"; $sql .= " t.description,"; $sql .= " t.date_commande,"; diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index be2f81dc20f..1906560455c 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France * @@ -328,11 +328,11 @@ print '
'; // Last modified contracts $sql = 'SELECT '; -$sql .= " sum(".$db->ifsql("cd.statut=0", 1, 0).') as nb_initial,'; -$sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')", 1, 0).') as nb_running,'; -$sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')", 1, 0).') as nb_expired,'; -$sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')", 1, 0).') as nb_late,'; -$sql .= " sum(".$db->ifsql("cd.statut=5", 1, 0).') as nb_closed,'; +$sql .= " sum(".$db->ifsql("cd.statut=0", '1', '0').') as nb_initial,'; +$sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')", '1', '0').') as nb_running,'; +$sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')", '1', '0').') as nb_expired,'; +$sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')", '1', '0').') as nb_late,'; +$sql .= " sum(".$db->ifsql("cd.statut=5", '1', '0').') as nb_closed,'; $sql .= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut,"; $sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,"; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index a3adefa2526..52557b35668 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -9,7 +9,7 @@ * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2019 Nicolas Zabouri * Copyright (C) 2021-2024 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Benjamin Falière * @@ -212,7 +212,7 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan -if (!$user->hasRight('societe', 'client', 'voir')) { +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } @@ -325,11 +325,11 @@ $sql .= " state.code_departement as state_code, state.nom as state_name,"; // TODO Add a denormalized field "denormalized_lower_planned_end_date" so we can remove the HAVING and then, // remove completely the SUM and GROUP BY (faster). Status of each service can be read into the loop that build the list. $sql .= " MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") as lower_planned_end_date,"; // lowest expiration date among open service lines -$sql .= " SUM(".$db->ifsql("cd.statut=0", 1, 0).') as nb_initial,'; -$sql .= " SUM(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')", 1, 0).') as nb_running,'; -$sql .= " SUM(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')", 1, 0).') as nb_expired,'; -$sql .= " SUM(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')", 1, 0).') as nb_late,'; -$sql .= " SUM(".$db->ifsql("cd.statut=5", 1, 0).') as nb_closed'; +$sql .= " SUM(".$db->ifsql("cd.statut=0", '1', '0').') as nb_initial,'; +$sql .= " SUM(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')", '1', '0').') as nb_running,'; +$sql .= " SUM(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')", '1', '0').') as nb_expired,'; +$sql .= " SUM(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')", '1', '0').') as nb_late,'; +$sql .= " SUM(".$db->ifsql("cd.statut=5", '1', '0').') as nb_closed'; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -903,7 +903,7 @@ if (!empty($arrayfields['c.ref_supplier']['checked'])) { } if (!empty($arrayfields['s.nom']['checked'])) { print '
'; - print ''; + print 'socid > 0 ? " disabled" : "").'>'; print ''; } //else $ret.='
'; - $ret .= ''; + $ret .= ''; if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { $ret .= '
' . "\n"; } @@ -487,9 +489,9 @@ class Form * @param string $htmlname DIV ID (field name) * @param int $condition Condition to edit * @param string $inputType Type of input ('string', 'numeric', 'datepicker' ('day' do not work, don't know why), 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:loadmethod:savemethod:buttononly') - * @param string $editvalue When in edit mode, use this value as $value instead of value + * @param ?string $editvalue When in edit mode, use this value as $value instead of value * @param ?CommonObject $extObject External object - * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') + * @param string|array|null $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @return string HTML edit in place */ protected function editInPlace($object, $value, $htmlname, $condition, $inputType = 'textarea', $editvalue = null, $extObject = null, $custommsg = null) @@ -623,19 +625,19 @@ class Form * Show a text and picto with tooltip on text or picto. * Can be called by an instancied $form->textwithtooltip or by a static call Form::textwithtooltip * - * @param string $text Text to show - * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. - * @param int $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip on both - * @param int $direction -1=image is before, 0=no image, 1=image is after - * @param string $img Html code for image (use img_xxx() function to get it) - * @param string $extracss Add a CSS style to td tags - * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span - * @param string $incbefore Include code before the text - * @param int $noencodehtmltext Do not encode into html entity the htmltext - * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) - * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) - * @return string Code html du tooltip (texte+picto) - * @see textwithpicto() Use textwithpicto() instead of textwithtooltip if you can. + * @param string $text Text to show + * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. + * @param int<0,3> $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip on both + * @param int<-1,1> $direction -1=image is before, 0=no image, 1=image is after + * @param string $img Html code for image (use img_xxx() function to get it) + * @param string $extracss Add a CSS style to td tags + * @param int<0,3> $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span + * @param string $incbefore Include code before the text + * @param int<0,1> $noencodehtmltext Do not encode into html entity the htmltext + * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) + * @param int<0,1> $forcenowrap Force no wrap between text and picto (works with notabs=2 only) + * @return string Code html du tooltip (texte+picto) + * @see textwithpicto() Use textwithpicto() instead of textwithtooltip if you can. */ public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) { @@ -873,7 +875,7 @@ class Form console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); - if (atleastoneselected || ' . $alwaysvisible . ') + if (atleastoneselected || ' . ((int) $alwaysvisible) . ') { jQuery("."+name).show(); ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' @@ -933,9 +935,10 @@ class Form * @param int<0,1> $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...) * @param string[] $exclude_country_code Array of country code (iso2) to exclude * @param int<0,1> $hideflags Hide flags + * @param int<0,1> $forcecombo Force to load all values and output a standard combobox (with no beautification) * @return string HTML string with select */ - public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array(), $hideflags = 0) + public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array(), $hideflags = 0, $forcecombo = 0) { // phpcs:enable global $conf, $langs, $mysoc; @@ -1047,8 +1050,10 @@ class Form } // Make select dynamic - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); + if (empty($forcecombo)) { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); + } return $out; } @@ -1076,7 +1081,7 @@ class Form $langs->load("dict"); $out = ''; - $moreattrib = ''; + //$moreattrib = ''; $incotermArray = array(); $sql = "SELECT rowid, code"; @@ -1129,7 +1134,7 @@ class Form if ($conf->use_javascript_ajax && empty($disableautocomplete)) { $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; - $moreattrib .= ' autocomplete="off"'; + //$moreattrib .= ' autocomplete="off"'; } $out .= '' . "\n"; @@ -2132,7 +2137,7 @@ class Form * @param int $disabled If select list must be disabled * @param int[]|''|'hierarchy'|'hierarchyme' $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me * @param int[]|'' $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled - * @param string $force_entity '0' or list of Ids of environment to force, separated by a coma, or 'default' = do no extend to all entities allowed to superadmin. + * @param string $force_entity '0' or list of Ids of environment to force, separated by a comma, or 'default' = do no extend to all entities allowed to superadmin. * @param int $maxlength Maximum length of string into list (0=no limit) * @param int<-1,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param string $morefilter Add more filters into sql request (Example: '(employee:=:1)'). This value must not come from user input. @@ -2201,7 +2206,7 @@ class Form $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; } // Condition here should be the same than into societe->getSalesRepresentatives(). - if ($userissuperadminentityone && $force_entity != 'default') { + if ($userissuperadminentityone && $force_entity !== 'default') { if (!empty($force_entity)) { $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; } else { @@ -2559,7 +2564,7 @@ class Form * * @param string $action Value for $action * @param string $htmlname Field name in form - * @param int $show_empty 0=list without the empty value, 1=add empty value + * @param int<0,1> $show_empty 0=list without the empty value, 1=add empty value * @param int[] $exclude Array list of users id to exclude * @param int<0,1> $disabled If select list must be disabled * @param int[]|string $include Array list of users id to include or 'hierarchy' to have only supervised users @@ -2568,7 +2573,7 @@ class Form * @param int $maxlength Maximum length of string into list (0=no limit) * @param int<-1,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param string $morefilter Add more filters into sql request - * @param int $showproperties Show properties of each attendees + * @param int<0,1> $showproperties Show properties of each attendees * @param array}> $listofresourceid Array with properties of each resource * @return string HTML select string */ @@ -2637,7 +2642,7 @@ class Form $events = array(); $out .= img_picto('', 'resource', 'class="pictofixedwidth"'); - $out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0); + $out .= $formresources->select_resource_list(0, $htmlname, '', 1, 1, 0, $events, '', 2, 0); //$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); $out .= ' '; $out .= '
'; @@ -2654,17 +2659,17 @@ class Form * * @param int $selected Preselected products * @param string $htmlname Name of HTML select field (must be unique in page). - * @param int|string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) + * @param int|'' $filtertype Filter on product type (''=nofilter, 0=product, 1=service) * @param int $limit Limit on number of returned lines * @param int $price_level Level of price to show - * @param int $status Sell status: -1=No filter on sell status, 0=Products not on sell, 1=Products on sell - * @param int $finished 2=all, 1=finished, 0=raw material + * @param int<-1,1> $status Sell status: -1=No filter on sell status, 0=Products not on sell, 1=Products on sell + * @param int<0,2> $finished 2=all, 1=finished, 0=raw material * @param string $selected_input_value Value of preselected input text (for use with ajax) - * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) + * @param int<0,3> $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) * @param array $ajaxoptions Options for ajax_autocompleter * @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|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<0,1> $forcecombo Force to use combo box. * @param string $morecss Add more css on select * @param int<0,1> $hidepriceinlabel 1=Hide prices in label * @param string $warehouseStatus Warehouse status filter to count the quantity in stock. Following comma separated filter options can be used @@ -2722,8 +2727,6 @@ class Form $urloption .= '&warehouseid=' . (int) $warehouseId; } - $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions); - if (isModEnabled('variants') && is_array($selected_combinations)) { // Code to automatically insert with javascript the select of attributes under the select of product // when a parent of variant has been selected. @@ -2813,6 +2816,8 @@ class Form if ($hidelabel == 3) { $out .= img_picto($langs->trans("Search"), 'search'); } + + $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions); } else { $out .= $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus, $status_purchase, $warehouseId); } @@ -2964,7 +2969,7 @@ class Form if (count($warehouseStatusArray)) { $selectFieldsGrouped = ", sum(" . $this->db->ifsql("e.statut IS NULL", "0", "ps.reel") . ") as stock"; // e.statut is null if there is no record in stock } else { - $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; + $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", '0', "p.stock") . " AS stock"; } $sql = "SELECT "; @@ -3105,7 +3110,7 @@ class Form $sql .= $hookmanager->resPrint; // Add criteria on ref/label if ($filterkey != '') { - $sqlSupplierSearch= ''; + $sqlSupplierSearch = ''; $sql .= ' AND ('; $prefix = !getDolGlobalString('PRODUCT_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on @@ -3135,7 +3140,7 @@ class Form // include search in supplier ref if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { - $sqlSupplierSearch .= !empty($sqlSupplierSearch) ? ' OR ':''; + $sqlSupplierSearch .= !empty($sqlSupplierSearch) ? ' OR ' : ''; $sqlSupplierSearch .= " pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; } $sql .= ")"; @@ -3258,7 +3263,7 @@ class Form } else { if (isModEnabled('dynamicprices') && !empty($objp->fk_price_expression)) { $price_product = new Product($this->db); - $price_product->fetch($objp->rowid, '', '', 1); + $price_product->fetch($objp->rowid, '', '', '1'); require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; $priceparser = new PriceParser($this->db); @@ -3337,7 +3342,7 @@ class Form $outtva_tx = ''; $outdefault_vat_code = ''; $outqty = 1; - $outdiscount = 0; + $outdiscount = '0'; $maxlengtharticle = (!getDolGlobalString('PRODUCT_MAX_LENGTH_COMBO') ? 48 : $conf->global->PRODUCT_MAX_LENGTH_COMBO); @@ -3707,7 +3712,7 @@ class Form if ($selected > 0) { require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; $producttmpselect = new Product($this->db); - $producttmpselect->fetch($selected); + $producttmpselect->fetch((int) $selected); $selected_input_value = $producttmpselect->ref; unset($producttmpselect); } @@ -3730,7 +3735,7 @@ class Form * @param int $socid Id of supplier thirdparty (0 = no filter) * @param string $selected Product price preselected (must be 'id' in product_fournisseur_price or 'idprod_IDPROD') * @param string $htmlname Name of HTML select - * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) + * @param ''|int<0,1> $filtertype Filter on product type (''=nofilter, 0=product, 1=service) * @param string $filtre Generic filter. Data must not come from user input. * @param string $filterkey Filter of produdts * @param int $statut -1=Return all products, 0=Products not on buy, 1=Products on buy @@ -4071,16 +4076,16 @@ class Form $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; - $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; - $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; - $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; - $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; - $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; + $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; // the price with numeric international format + $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; // the price formatted in user language + $optstart .= ' data-discount="' . dol_escape_htmltag((string) $outdiscount) . '"'; + $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; // the rate with numeric international format + $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; // the rate formatted in user language $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; if (isModEnabled('multicurrency')) { $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; - $optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"'; + $optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag(price2num($objp->multicurrency_unitprice)) . '"'; // the price with numeric international format } } $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; @@ -4300,7 +4305,7 @@ class Form public function load_cache_conditions_paiements() { // phpcs:enable - global $langs; + global $langs, $hookmanager; $num = count($this->cache_conditions_paiements); if ($num > 0) { @@ -4309,7 +4314,9 @@ class Form dol_syslog(__METHOD__, LOG_DEBUG); - $sql = "SELECT rowid, code, libelle as label, deposit_percent"; + $this->cache_conditions_paiements = array(); + + $sql = "SELECT rowid, code, libelle as label, deposit_percent, entity"; $sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; $sql .= " AND active > 0"; @@ -4324,12 +4331,23 @@ class Form // Si traduction existe, on l'utilise, sinon on prend le libelle par default $label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); - $this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; - $this->cache_conditions_paiements[$obj->rowid]['label'] = $label; - $this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; + $this->cache_conditions_paiements[$obj->rowid]['code'] = (string) $obj->code; + $this->cache_conditions_paiements[$obj->rowid]['label'] = (string) $label; + $this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = (string) $obj->deposit_percent; + $this->cache_conditions_paiements[$obj->rowid]['entity'] = (int) $obj->entity; $i++; } + $parameters = array('context' => 'paymentterm'); + $reshook = $hookmanager->executeHooks('loadDictionaryCache', $parameters, $this); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + if (is_array($hookmanager->resArray) && count($hookmanager->resArray)) { + $this->cache_conditions_paiements = array_merge($this->cache_conditions_paiements, $hookmanager->resArray); + } + } else { + $this->cache_conditions_paiements = $hookmanager->resArray; + } + //$this->cache_conditions_paiements=dol_sort_array($this->cache_conditions_paiements, 'label', 'asc', 0, 0, 1); // We use the field sortorder of table return $num; @@ -4358,6 +4376,8 @@ class Form dol_syslog(__METHOD__, LOG_DEBUG); + $this->cache_availability = array(); + $langs->load('propal'); $sql = "SELECT rowid, code, label, position"; @@ -4373,9 +4393,9 @@ class Form // Si traduction existe, on l'utilise, sinon on prend le libelle par default $label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); - $this->cache_availability[$obj->rowid]['code'] = $obj->code; - $this->cache_availability[$obj->rowid]['label'] = $label; - $this->cache_availability[$obj->rowid]['position'] = $obj->position; + $this->cache_availability[$obj->rowid]['code'] = (string) $obj->code; + $this->cache_availability[$obj->rowid]['label'] = (string) $label; + $this->cache_availability[$obj->rowid]['position'] = (int) $obj->position; $i++; } @@ -4391,11 +4411,11 @@ class Form /** * Return the list of type of delay available. * - * @param string $selected Id du type de delais pre-selectionne - * @param string $htmlname Nom de la zone select - * @param string $filtertype To add a filter - * @param int $addempty Add empty entry - * @param string $morecss More CSS + * @param ''|int $selected Id du type de delais pre-selectionne + * @param string $htmlname Nom de la zone select + * @param string|int<0,1> $filtertype To add a filter + * @param int<0,1> $addempty Add empty entry + * @param string $morecss More CSS * @return void */ public function selectAvailabilityDelay($selected = '', $htmlname = 'availid', $filtertype = '', $addempty = 0, $morecss = '') @@ -4530,7 +4550,7 @@ class Form public function load_cache_types_paiements() { // phpcs:enable - global $langs; + global $langs, $hookmanager; $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements if ($num > 0) { @@ -4541,7 +4561,7 @@ class Form $this->cache_types_paiements = array(); - $sql = "SELECT id, code, libelle as label, type, active"; + $sql = "SELECT id, code, libelle as label, type, entity, active"; $sql .= " FROM " . $this->db->prefix() . "c_paiement"; $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; @@ -4554,14 +4574,25 @@ class Form // Si traduction existe, on l'utilise, sinon on prend le libelle par default $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); - $this->cache_types_paiements[$obj->id]['id'] = $obj->id; - $this->cache_types_paiements[$obj->id]['code'] = $obj->code; - $this->cache_types_paiements[$obj->id]['label'] = $label; - $this->cache_types_paiements[$obj->id]['type'] = $obj->type; - $this->cache_types_paiements[$obj->id]['active'] = $obj->active; + $this->cache_types_paiements[$obj->id]['id'] = (int) $obj->id; + $this->cache_types_paiements[$obj->id]['code'] = (string) $obj->code; + $this->cache_types_paiements[$obj->id]['label'] = (string) $label; + $this->cache_types_paiements[$obj->id]['type'] = (int) $obj->type; + $this->cache_types_paiements[$obj->id]['entity'] = (int) $obj->entity; + $this->cache_types_paiements[$obj->id]['active'] = (int) $obj->active; $i++; } + $parameters = array('context' => 'paymenttype'); + $reshook = $hookmanager->executeHooks('loadDictionaryCache', $parameters, $this); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + if (is_array($hookmanager->resArray) && count($hookmanager->resArray)) { + $this->cache_types_paiements = array_merge($this->cache_types_paiements, $hookmanager->resArray); + } + } else { + $this->cache_types_paiements = $hookmanager->resArray; + } + $this->cache_types_paiements = dol_sort_array($this->cache_types_paiements, 'label', 'asc', 0, 0, 1); return $num; @@ -5168,14 +5199,14 @@ class Form * * @param int|'' $selected Id account preselected * @param string $htmlname Name of select zone - * @param int $status Status of searched accounts (0=open, 1=closed, 2=both) + * @param int<0,2> $status Status of searched accounts (0=open, 1=closed, 2=both) * @param string $filtre To filter the list. This parameter must not come from input of users - * @param int|string $useempty 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>|string $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @param string $moreattrib To add more attribute on select - * @param int $showcurrency Show currency in label + * @param int<0,1> $showcurrency Show currency in label * @param string $morecss More CSS * @param int<0,1> $nooutput 1=Return string, do not send to output - * @return int|string If noouput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string. + * @return int|string If nooutput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string. */ public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '', $nooutput = 0) { @@ -5270,7 +5301,7 @@ class Form * @param int $showibanbic Show iban/bic in label * @param string $morecss More CSS * @param int<0,1> $nooutput 1=Return string, do not send to output - * @return int|string If noouput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string. + * @return int|string If nooutput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string. */ public function selectRib($selected = '', $htmlname = 'ribcompanyid', $filtre = '', $useempty = 0, $moreattrib = '', $showibanbic = 0, $morecss = '', $nooutput = 0) { @@ -5414,7 +5445,7 @@ class Form * @param string $page Page * @param string $selected Id of bank account * @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 formSelectAccount($page, $selected = '', $htmlname = 'fk_account', $addempty = 0) @@ -5436,7 +5467,7 @@ class Form if ($selected) { require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; $bankstatic = new Account($this->db); - $result = $bankstatic->fetch($selected); + $result = $bankstatic->fetch((int) $selected); if ($result) { print $bankstatic->getNomUrl(1); } @@ -5475,7 +5506,7 @@ class Form if ($selected) { require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $bankstatic = new CompanyBankAccount($this->db); - $result = $bankstatic->fetch($selected); + $result = $bankstatic->fetch((int) $selected); if ($result) { print $bankstatic->label; if ($showibanbic) { @@ -5494,7 +5525,7 @@ class Form * Return list of categories having chosen type * * @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated. - * @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element). Not used if $outputmode = 1. + * @param int|'auto'|'' $selected Id of category preselected or 'auto' (autoselect category if there is only one element). Not used if $outputmode = 1. * @param string $htmlname HTML field name * @param int $maxlength Maximum length for labels * @param int|string|int[] $fromid Keep only or Exclude (depending on $include parameter) all categories (including the leaf $fromid) into the tree after this id $fromid. @@ -5611,11 +5642,11 @@ class Form * @param string $title Title * @param string $question Question * @param string $action Action - * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) - * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', - * 'other', 'onecolumn' or 'hidden'... + * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) + * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', + * 'other', 'onecolumn' or 'hidden'... * @param string $selectedchoice "" or "no" or "yes" - * @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx + * @param int<0,2>|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int $height Force height of box * @param int $width Force width of box * @return void @@ -5644,9 +5675,9 @@ class Form * @param string $title Title * @param string $question Question * @param string $action Action - * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) - * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', - * 'other', 'onecolumn' or 'hidden'... + * @param null|string|array,tdclass?:string}>|array{text:string,0?:array{name:string,value?:string|float|bool,values?:string[],default?:string,label?:string,type:string,size?:int|string,morecss?:string,moreattr?:string,style?:string,inputko?:int<0,1>,tdclass?:string},1?:array{name:string,value?:string|float|bool,values?:string[],default?:string,label?:string,type:string,size?:int|string,morecss?:string,moreattr?:string,style?:string,inputko?:int<0,1>,tdclass?:string}} $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) + * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', + * 'other', 'onecolumn' or 'hidden'... * @param int<0,1>|''|'no'|'yes'|'1'|'0' $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0 * @param int<0,2>|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int|string $height Force height of box (0 = auto) @@ -6060,11 +6091,11 @@ class Form /** * Show a form to select a project * - * @param int $page Page + * @param string $page Page * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) * @param string $selected Id preselected project * @param string $htmlname Name of select field - * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable) + * @param int<0,2> $discard_closed Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable) * @param int $maxlength Max length * @param int $forcefocus Force focus on field (works with javascript only) * @param int<0,1> $nooutput No print is done. String is returned. @@ -6096,7 +6127,7 @@ class Form $out .= ''; if ($selected) { $projet = new Project($this->db); - $projet->fetch($selected); + $projet->fetch((int) $selected); $out .= $projet->getNomUrl(0, '', 1); } else { $out .= '' . $textifnoproject . ''; @@ -6116,11 +6147,11 @@ class Form /** * Show a form to select payment conditions * - * @param int $page Page + * @param string $page Page * @param string $selected Id condition pre-selectionne * @param string $htmlname Name of select html field - * @param int $addempty Add empty entry - * @param string $type Type ('direct-debit' or 'bank-transfer') + * @param int<0,1> $addempty Add empty entry + * @param ''|'direct-debit'|'bank-transfer' $type Type ('direct-debit' or 'bank-transfer') * @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates) * @param int $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters) * 0 : use default deposit percentage from entry @@ -6142,7 +6173,7 @@ class Form if ($type) { $out .= ''; } - $out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); + $out .= $this->getSelectConditionsPaiements((int) $selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); $out .= ''; $out .= ''; } else { @@ -6177,10 +6208,10 @@ class Form /** * Show a form to select a delivery delay * - * @param int $page Page + * @param string $page Page * @param string $selected Id condition pre-selectionne * @param string $htmlname Name of select html field - * @param int $addempty Add an empty entry + * @param int<0,1> $addempty Add an empty entry * @return void */ public function form_availability($page, $selected = '', $htmlname = 'availability', $addempty = 0) @@ -6318,7 +6349,7 @@ class Form if ($selected) { require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; $theuser = new User($this->db); - $theuser->fetch($selected); + $theuser->fetch((int) $selected); print $theuser->getNomUrl(1); } else { print " "; @@ -6336,8 +6367,8 @@ class Form * @param string $selected Id mode pre-selectionne * @param string $htmlname Name of select html field * @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz)) - * @param int $active Active or not, -1 = all - * @param int $addempty 1=Add empty entry + * @param int<-1,1> $active Active or not, -1 = all + * @param int<0,1> $addempty 1=Add empty entry * @param string $type Type ('direct-debit' or 'bank-transfer') * @param int<0,1> $nooutput 1=Return string, no output * @return string HTML output or '' @@ -6609,7 +6640,7 @@ class Form if ($selected) { require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; $contact = new Contact($this->db); - $contact->fetch($selected); + $contact->fetch((int) $selected); print $contact->getFullName($langs); } else { print " "; @@ -6652,7 +6683,7 @@ class Form if ($selected) { require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; $soc = new Societe($this->db); - $soc->fetch($selected); + $soc->fetch((int) $selected); $out .= $soc->getNomUrl(0, ''); } else { $out .= '' . $textifnothirdparty . ''; @@ -6978,7 +7009,7 @@ class Form // If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries // If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country $selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); - if (isInEEC($societe_vendeuse) && isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()) { + if (is_object($societe_vendeuse) && isInEEC($societe_vendeuse) && isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()) { // We also add the buyer country code if (is_numeric($type)) { if ($type == 1) { // We know product is a service @@ -7016,7 +7047,7 @@ class Form // Keep only the VAT qualified for $type_vat $arrayofvatrates = array(); foreach ($this->cache_vatrates as $cachevalue) { - if (empty($cachevalue['type_vat']) || $cachevalue['type_vat'] != $type_vat) { + if (empty($cachevalue['type_vat']) || $cachevalue['type_vat'] == $type_vat) { $arrayofvatrates[] = $cachevalue; } } @@ -7025,7 +7056,7 @@ class Form if ($num > 0) { // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '') - if ($defaulttx < 0 || dol_strlen($defaulttx) == 0) { + if (($defaulttx < 0 || dol_strlen($defaulttx) == 0) && is_object($societe_vendeuse)) { $tmpthirdparty = new Societe($this->db); $defaulttx = get_default_tva($societe_vendeuse, (is_object($societe_acheteuse) ? $societe_acheteuse : $tmpthirdparty), $idprod); @@ -7218,7 +7249,7 @@ class Form * @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. @@ -7325,17 +7356,17 @@ class Form if ($d) { // Show date with popup if ($usecalendar != 'combo') { - $formated_date = ''; + $formatted_date = ''; //print "e".$set_time." t ".$conf->format_date_short; if (strval($set_time) != '' && $set_time != -1) { - //$formated_date=dol_print_date($set_time,$conf->format_date_short); - $formated_date = dol_print_date($set_time, $langs->trans("FormatDateShortInput"), $gm); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript + //$formatted_date=dol_print_date($set_time,$conf->format_date_short); + $formatted_date = dol_print_date($set_time, $langs->trans("FormatDateShortInput"), $gm); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript } // Calendrier popup version eldy if ($usecalendar == "eldy") { // Input area to enter date manually - $retstring .= 'trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript $retstring .= ' autocomplete="off">'; @@ -7392,7 +7423,7 @@ class Form // Input area to enter date manually $retstring .= '
'; - $retstring .= 'trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript @@ -7831,7 +7862,7 @@ class Form if ($selected && empty($selected_input_value)) { require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; $tickettmpselect = new Ticket($this->db); - $tickettmpselect->fetch($selected); + $tickettmpselect->fetch((int) $selected); $selected_input_value = $tickettmpselect->ref; unset($tickettmpselect); } @@ -8027,7 +8058,7 @@ class Form * @param string $selected Preselected tickets * @param string $htmlname Name of HTML select field (must be unique in page). * @param string $filtertype To add a filter - * @param int $limit Limit on number of returned lines + * @param int<0,max> $limit Limit on number of returned lines * @param int $status Not used * @param string $selected_input_value Value of preselected input text (for use with ajax) * @param int<0,3> $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) @@ -8057,7 +8088,7 @@ class Form if ($selected && empty($selected_input_value)) { require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; $projecttmpselect = new Project($this->db); - $projecttmpselect->fetch($selected); + $projecttmpselect->fetch((int) $selected); $selected_input_value = $projecttmpselect->ref; unset($projecttmpselect); } @@ -8218,7 +8249,9 @@ class Form * * @param stdClass $objp Result set of fetch * @param string $opt Option (var used for returned value in string option format) - * @param array{key:string,value:string,type:string} $optJson Option (var used for returned value in json format) + * @param array{} $optJson Option (var used for returned value in json format) @phan-output-reference + * @phan-param array{key:string,value:string,type:string} $optJson Option (var used for returned value in json format) @phan-output-reference + * @phpstan-param-out array{key:string,value:string,type:string} $optJson * @param string $selected Preselected value * @param string $filterkey Filter key to highlight * @return void @@ -8286,7 +8319,7 @@ class Form if ($selected && empty($selected_input_value)) { require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; $adherenttmpselect = new Adherent($this->db); - $adherenttmpselect->fetch($selected); + $adherenttmpselect->fetch((int) $selected); $selected_input_value = $adherenttmpselect->ref; unset($adherenttmpselect); } @@ -8392,7 +8425,7 @@ class Form if (!$forcecombo) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); + $out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT')); } $out .= ''; + $listoffieldsforselection .= '
  • '; + $listoffieldsforselection .= '
  • '; $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); } } @@ -9575,7 +9614,11 @@ class Form foreach ($categories as $c) { $ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text foreach ($ways as $way) { - $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '
  • '; + $color = $c->color; + $sfortag = '
  • '; + $sfortag .= $way; + $sfortag .= '
  • '; + $toprint[] = $sfortag; } } if (empty($toprint)) { @@ -10208,7 +10251,15 @@ class Form if (is_object($hookmanager)) { $parameters = array('showrefnav' => true); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook - $object->next_prev_filter .= $hookmanager->resPrint; + if (!empty($hookmanager->resPrint)) { + if (empty($object->next_prev_filter) && preg_match('/^\s*AND/i', $hookmanager->resPrint)) { + $object->next_prev_filter = preg_replace('/^\s*AND\s*/i', '', $hookmanager->resPrint); + } elseif (!empty($object->next_prev_filter) && !preg_match('/^\s*AND/i', $hookmanager->resPrint)) { + $object->next_prev_filter .= ' AND '.$hookmanager->resPrint; + } else { + $object->next_prev_filter .= $hookmanager->resPrint; + } + } } $previous_ref = $next_ref = ''; @@ -10296,7 +10347,7 @@ class Form // For thirdparty, contact, user, member, the ref is the id, so we show something else if ($object->element == 'societe') { - $ret .= dol_htmlentities($object->name); + $ret .= dol_htmlentities((string) $object->name); // List of extra languages $arrayoflangcode = array(); @@ -10333,14 +10384,14 @@ class Form $ret .= $object->ref . '
    '; $fullname = $object->getFullName($langs); if ($object->morphy == 'mor' && $object->societe) { - $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); + $ret .= dol_htmlentities((string) $object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); } else { - $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); + $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities((string) $object->societe) . ')' : ''); } } elseif (in_array($object->element, array('contact', 'user'))) { $ret .= ''.dol_htmlentities($object->getFullName($langs)).''.$addgendertxt; } elseif ($object->element == 'usergroup') { - $ret .= dol_htmlentities($object->name); + $ret .= dol_htmlentities((string) $object->name); } elseif (in_array($object->element, array('action', 'agenda'))) { '@phan-var-force ActionComm $object'; $ret .= $object->ref . '
    ' . $object->label; @@ -10415,7 +10466,7 @@ class Form * @param string $imagesize 'mini', 'small' or '' (original) * @param int<0,1> $addlinktofullsize Add link to fullsize image * @param int<0,1> $cache 1=Accept to use image in cache - * @param string $forcecapture '', 'user' or 'environment'. Force parameter capture on HTML input file element to ask a smartphone to allow to open camera to take photo. Auto if ''. + * @param ''|'user'|'environment' $forcecapture '', 'user' or 'environment'. Force parameter capture on HTML input file element to ask a smartphone to allow to open camera to take photo. Auto if ''. * @param int<0,1> $noexternsourceoverwrite No overwrite image with extern source (like 'gravatar' or other module) * @return string HTML code to output photo * @see getImagePublicURLOfObject() @@ -11713,10 +11764,10 @@ class Form // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Load into cache list of invoice subtypes - * - * @return int Nb of lines loaded, <0 if KO - */ + * Load into cache list of invoice subtypes + * + * @return int Nb of lines loaded, <0 if KO + */ public function load_cache_invoice_subtype() { // phpcs:enable @@ -11759,15 +11810,15 @@ class Form /** - * Return list of invoice subtypes. - * - * @param int $selected Id of invoice subtype to preselect by default - * @param string $htmlname Select field name - * @param int<0,1> $addempty Add an empty entry - * @param int<0,1> $noinfoadmin 0=Add admin info, 1=Disable admin info - * @param string $morecss Add more CSS on select tag - * @return string String for the HTML select component - */ + * Return list of invoice subtypes. + * + * @param int $selected Id of invoice subtype to preselect by default + * @param string $htmlname Select field name + * @param int<0,1> $addempty Add an empty entry + * @param int<0,1> $noinfoadmin 0=Add admin info, 1=Disable admin info + * @param string $morecss Add more CSS on select tag + * @return string String for the HTML select component + */ public function getSelectInvoiceSubtype($selected = 0, $htmlname = 'subtypeid', $addempty = 0, $noinfoadmin = 0, $morecss = '') { global $langs, $user; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 39c0ff94ec2..800913719ee 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2017 Rui Strecht * Copyright (C) 2020 Open-Dsi * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -249,9 +249,9 @@ class FormCompany extends Form * The key of the list is the code (there can be several entries for a given code but in this case, the country field differs). * Thus the links with the departments are done on a department independently of its name. * - * @param string $selected Code state preselected - * @param int $country_codeid 0=list for all countries, otherwise country code or country rowid to show - * @param string $htmlname Id of department + * @param string $selected Code state preselected + * @param int|string $country_codeid 0=list for all countries, otherwise country code or country rowid to show + * @param string $htmlname Id of department * @return void */ public function select_departement($selected = '', $country_codeid = 0, $htmlname = 'state_id') @@ -267,11 +267,11 @@ class FormCompany extends Form * The key of the list is the code (there can be several entries for a given code but in this case, the country field differs). * Thus the links with the departments are done on a department independently of its name. * - * @param int $selected Code state preselected (must be state id) - * @param int $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show - * @param string $htmlname Id of department. If '', we want only the string with
    - textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"), 1, 0, '', 0, 2, 'helpvalue1')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"), 1, 0, '', 0, 2, 'helpvalue2')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"), 1, 0, '', 0, 2, 'helpvalue3')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelplink").'

    '.$langs->trans("Examples").':
    '.$listofexamplesforlink, 1, 0, '', 0, 2, 'helpvalue4')?>
    - textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"), 1, 0, '', 0, 2, 'helpvalue5')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpSeparator"), 1, 0, '', 0, 2, 'helpvalue6')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"), 1, 'info', '', 0, 2, 'helpvalue1')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist").(getDolGlobalInt('MAIN_FEATUREES_LEVEL') > 0 ? '
    '.$langs->trans("ExtrafieldParamHelpsellist2") : ''), 1, 'info', '', 0, 2, 'helpvalue2')?>
    + textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist").(getDolGlobalInt('MAIN_FEATUREES_LEVEL') > 0 ? '
    '.$langs->trans("ExtrafieldParamHelpsellist2") : ''), 1, 'info', '', 0, 2, 'helpvalue3')?>
    + textwithpicto('', $langs->trans("ExtrafieldParamHelplink").'

    '.$langs->trans("Examples").':
    '.$listofexamplesforlink, 1, 'info', '', 0, 2, 'helpvalue4')?>
    + textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"), 1, 'info', '', 0, 2, 'helpvalue5')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpSeparator"), 1, 'info', '', 0, 2, 'helpvalue6')?>
    '.dol_escape_htmltag($extrafields->attributes[$elementtype]['csslist'][$key])."'; + print ''; if (empty($extrafields->attributes[$elementtype]['entityid'][$key])) { print $langs->trans("All"); } else { diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index 1caee516fb9..86506de45d0 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010-2016 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,6 +42,10 @@ if (empty($object) || !is_object($object)) { print "Error, template page ".basename(__FILE__)." can't be called with no object defined."; exit; } +' +@phan-var-force ?string $fk_element +@phan-var-force ?Task[] $tasksarray +'; ?> diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index d29932c2c20..d9375ab26a9 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -3,7 +3,7 @@ * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Maxime Nicolas * Copyright (C) 2023 Benjamin GREMBI - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -21,15 +21,20 @@ * or see https://www.gnu.org/ */ -/* - * Code to output content when action is presend - * - * $trackid must be defined - * $modelmail - * $defaulttopic and $defaulttopiclang - * $diroutput - * $arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...); - * $file +/** + * @var string $trackid + * @var string $modelmail + * @var string $defaulttopic + * @var string $defaulttopiclang + * @var int<0,1> $diroutput + * @var string[] $arrayoffamiliestoexclude Example: array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...); + * @var string $file + * @var string $action + * @var CommonObject $object + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs */ ' @phan-var-force int<0,1> $diroutput @@ -54,6 +59,7 @@ if ($action == 'presend') { $titreform = 'SendMail'; $object->fetchProject(); + $ref = dol_sanitizeFileName($object->ref); if (!in_array($object->element, array('user', 'member'))) { //$fileparams['fullname'] can be filled from the card @@ -102,19 +108,31 @@ if ($action == 'presend') { $topicmail = $outputlangs->trans($defaulttopic, '__REF__ (__REF_CLIENT__)'); } - // Build document if it not exists + // Build document if it does not exists $forcebuilddoc = true; + // except for some cases where it can not exists if (in_array($object->element, array('user', 'member'))) { $forcebuilddoc = false; } if ($object->element == 'invoice_supplier' && !getDolGlobalString('INVOICE_SUPPLIER_ADDON_PDF')) { $forcebuilddoc = false; } + if ($object->element == 'project' && !getDolGlobalString('PROJECT_ADDON_PDF')) { + $forcebuilddoc = false; + } + if ($object->element == 'project_task' && !getDolGlobalString('PROJECT_TASK_ADDON_PDF')) { + $forcebuilddoc = false; + } if ($object->element == 'societe' && !getDolGlobalString('COMPANY_ADDON_PDF')) { $forcebuilddoc = false; } + if ($forcebuilddoc) { // If there is no default value for supplier invoice, we do not generate file, even if modelpdf was set by a manual generation if ((!$file || !is_readable($file)) && method_exists($object, 'generateDocument')) { + $hidedetails = $hidedetails?$hidedetails:''; + $hidedesc = $hidedetails?$hidedetails:''; + $hideref = $hidedetails?$hidedetails:''; + $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) { dol_print_error($db, $object->error, $object->errors); diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index 5ab7e7aa799..8e1c87a7a2e 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -50,7 +50,7 @@ foreach ($object->fields as $key => $val) { // Discard if field is a hidden field on form // Ensure $val['visible'] is treated as an integer $visible = (int) $val['visible']; - if (abs($visible) != 1 && abs($visible) != 3) { + if (abs($visible) != 1 && abs($visible) != 3 && abs($visible) != 6) { continue; } diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php index 530d34a15af..2fdd82a3b76 100644 --- a/htdocs/core/tpl/commonfields_edit.tpl.php +++ b/htdocs/core/tpl/commonfields_edit.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2017-2019 Laurent Destailleur + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,7 @@ /** * @var CommonObject $object * @var Conf $conf + * @var DoliDB $db * @var Form $form * @var FormAdmin $formadmin * @var Translate $langs diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index b96eaafb67b..1eeb8603cc5 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -1,6 +1,7 @@ - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +28,7 @@ /** * @var CommonObject $object * @var Conf $conf + * @var DoliDB $db * @var Form $form * @var FormAdmin $formadmin * @var Translate $langs @@ -39,6 +41,10 @@ if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit(1); } + +' +@phan-var-force ?string $keyforbreak +'; if (!is_object($form)) { $form = new Form($db); } @@ -50,7 +56,7 @@ if (!is_object($form)) { $object->fields = dol_sort_array($object->fields, 'position'); foreach ($object->fields as $key => $val) { - if (!empty($keyforbreak) && $key == $keyforbreak) { + if (isset($keyforbreak) && !empty($keyforbreak) && $key == $keyforbreak) { break; // key used for break on second column } @@ -139,7 +145,7 @@ $rightpart = ''; $alreadyoutput = 1; foreach ($object->fields as $key => $val) { if ($alreadyoutput) { - if (!empty($keyforbreak) && $key == $keyforbreak) { + if (isset($keyforbreak) && !empty($keyforbreak) && $key == $keyforbreak) { $alreadyoutput = 0; // key used for break on second column } else { continue; @@ -166,7 +172,7 @@ foreach ($object->fields as $key => $val) { if ($val['type'] == 'text' || $val['type'] == 'html') { $rightpart .= ' tdtop'; } - $rightpart.= '">'; + $rightpart .= '">'; $labeltoshow = ''; if (!empty($val['help'])) { $labeltoshow .= $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); @@ -206,7 +212,7 @@ foreach ($object->fields as $key => $val) { $out = $object->showOutputField($val, $key, $value, '', '', '', 0); $rightpart .= showValueWithClipboardCPButton($out, 0, $out); } else { - $rightpart.= $object->showOutputField($val, $key, $value, '', '', '', 0); + $rightpart .= $object->showOutputField($val, $key, $value, '', '', '', 0); } } if (preg_match('/^(text|html)/', $val['type'])) { diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 77251d73be8..3f4abfee8bb 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -2,8 +2,8 @@ /* Copyright (C) 2012 Regis Houssin * Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2015-2016 Charlie BENKE - * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,11 +27,19 @@ /** * @var ?CommonObject $object * @var ?CommonObject $objectsrc + * @var DoliDB $db * @var Form $form + * @var HookManager $hookmanager * @var Translate $langs * @var User $user * @var ?string $permission */ +' +@phan-var-force ?CommonObject $object +@phan-var-force ?CommonObject $objectsrc +@phan-var-force ?string $permission +'; + // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; @@ -39,11 +47,6 @@ if (empty($object) || !is_object($object)) { } -' -@phan-var-force ?CommonObject $object -@phan-var-force ?CommonObject $objectsrc -@phan-var-force ?string $permission -'; if (empty($preselectedtypeofcontact)) { $preselectedtypeofcontact = 0; } @@ -128,7 +131,7 @@ if ($permission) {
    - select_dolusers($user->id, 'userid', 1, (!empty($userAlreadySelected) ? $userAlreadySelected : null), 0, '', '', 0, 56, 0, '', 0, '', 'minwidth100imp widthcentpercentminusxx maxwidth400 userselectcontact'); + select_dolusers($user->id, 'userid', 1, (!empty($userAlreadySelected) ? $userAlreadySelected : null), 0, '', '', '0', 56, 0, '', 0, '', 'minwidth100imp widthcentpercentminusxx maxwidth400 userselectcontact'); if (empty($hideaddcontactforgroups) && $module == 'project') { print ' '.$langs->trans("or").' '; echo img_object('', 'group', 'class="pictofixedwidth"').$form->select_dolgroups(0, 'groupid', 1, '', 0, '', array(), '0', false, 'minwidth100imp widthcentpercentminusxx maxwidth400 groupselectcontact'); @@ -223,7 +226,7 @@ if ($permission) { // Prepare list -// TODO: replace this with 1 single direct SQL (for both eyernal and external string to use $db->sort($sortfield, $sortorder) +// TODO: replace this with 1 single direct SQL (for both internal and external string to use $db->sort($sortfield, $sortorder) $list = array(); foreach (array('internal', 'external') as $source) { if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) { @@ -384,6 +387,7 @@ print "\n"; if (is_object($hookmanager)) { $hookmanager->initHooks(array('contacttpl')); $parameters = array(); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action); } print "\n"; diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 31c19e08a7c..30d32ca1f6f 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -1,9 +1,11 @@ * Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +42,14 @@ if (empty($langs) || !is_object($langs)) { print "Error, template page can't be called as URL"; exit(1); } +' +@phan-var-force array $filearray +@phan-var-force ?int<0,1> $permtoedit +@phan-var-force ?int<0,1> $permission +@phan-var-force int<0,1> $permissiontoadd +@phan-var-force ?string $savingdocmask +@phan-var-force ?string $param +'; $langs->load("link"); @@ -67,7 +77,7 @@ if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket $disablemove = 0; } $parameters = array(); -$reshook = $hookmanager->executeHooks('isLinkedDocumentObjectNotMovable', $parameters, $object); +$reshook = $hookmanager->executeHooks('isLinkedDocumentObjectNotMovable', $parameters, $object); // @phan-suppress-current-line PhanTypeMismatchArgumentNullable if ($reshook) { $disablemove = $hookmanager->resArray['disablemove']; } @@ -191,7 +201,7 @@ $formfile->listOfLinks( $object, $permission, $action, - GETPOSTINT('linkid'), + (string) GETPOSTINT('linkid'), $param, 'formaddlink', array('afterlinktitle' => $formToAddALink, 'showhideaddbutton' => 1) diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php index 7d72a0cae3b..e2d6f68df44 100644 --- a/htdocs/core/tpl/extrafields_edit.tpl.php +++ b/htdocs/core/tpl/extrafields_edit.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2014 Maxime Kohlhaas * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,15 +25,15 @@ * $parameters */ - /** - * @var CommonObject $object - * @var Conf $conf - * @var ExtraFields $extrafields - * @var HookManager $hookmanager - * @var Translate $langs - * @var string $action - * @var array $parameters - */ +/** +* @var CommonObject $object +* @var Conf $conf +* @var ExtraFields $extrafields +* @var HookManager $hookmanager +* @var Translate $langs +* @var string $action +* @var array $parameters +*/ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { @@ -62,6 +63,7 @@ if (!isset($parameters)) { @phan-var-force Conf $conf @phan-var-force Translate $conf @phan-var-force array $parameters +@phan-var-force ?string $tpl_context '; $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index e7fb7e0ac2b..63421ff9021 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -45,7 +45,8 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield continue; } - $cssclass = $extrafields->getAlignFlag($key, $extrafieldsobjectkey); + $cssclasstd = $extrafields->getCSSClass($key, $extrafieldsobjectkey, 'csslist'); + $cssclassview = $extrafields->getCSSClass($key, $extrafieldsobjectkey, 'cssview'); $tmpkey = 'options_'.$key; @@ -64,7 +65,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield } // If field is a computed field, we make computation to get value if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) { - $objectoffield = $object; //For compatibility with the computed formula + $objectoffield = $object; // For compatibility with the computed formula $value = dol_eval((string) $extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '2'); if (is_numeric(price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { $obj->$tmpkey = price2num($value); @@ -74,11 +75,13 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield $valuetoshow = $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey, null, $object); $title = dol_string_nohtmltag($valuetoshow); - print ''; + print $cssclassview ? '' : ''; print $valuetoshow; + print $cssclassview ? '' : ''; print '
    '; + print ''; $tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key); if (in_array($typeofextrafield, array('varchar', 'mail', 'ip', 'url', 'int', 'double')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) { $searchclass = ''; diff --git a/htdocs/core/tpl/extrafields_list_search_param.tpl.php b/htdocs/core/tpl/extrafields_list_search_param.tpl.php index 4b539cfc0c3..ebb49d9a444 100644 --- a/htdocs/core/tpl/extrafields_list_search_param.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_param.tpl.php @@ -1,5 +1,27 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * @var Conf $conf + * @var CommonObject $object + */ + // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 6901b9a3472..a75c249c352 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -1,5 +1,27 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * @var Conf $conf + * @var CommonObject $object + */ + // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index 372e4341b90..801d081924b 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php @@ -1,10 +1,40 @@ + * Copyright (C) 2025 Frédéric France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * @var Conf $conf + * @var CommonObject $object + * @var ?Translate $langs + * + * @var ?string $extrafieldsobjectkey + * @var ?int $disablesortlink + * @var string $sortfield + * @var string $sortorder + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit(1); } +' +@phan-var-force ?int<0,1> $disablesortlink +'; if (empty($extrafieldsobjectkey) && is_object($object)) { $extrafieldsobjectkey = $object->table_element; @@ -26,7 +56,8 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table continue; } - $cssclass = $extrafields->getAlignFlag($key, $extrafieldsobjectkey); + $cssclasstd = $extrafields->getCSSClass($key, $extrafieldsobjectkey, 'csslist'); + $sortonfield = $extrafieldsobjectprefix.$key; if (!empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) { $sortonfield = ''; @@ -39,7 +70,7 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table $tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key]; // Show cell - print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, 'data-titlekey="'.$key.'"', $sortfield, $sortorder, $cssclass.' ', $disablesortlink, $tooltip)."\n"; + print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, 'data-titlekey="'.$key.'"', $sortfield, $sortorder, $cssclasstd.' ', $disablesortlink, $tooltip)."\n"; if (isset($totalarray) && isset($totalarray['nbfield'])) { $totalarray['nbfield']++; } diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index f643229c7d3..0227bd16ba7 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -167,6 +167,9 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att if ($object->element == 'product') { $keyforperm = 'produit'; } + if ($object->element == 'project') { + $keyforperm = 'projet'; + } if (isset($user->rights->$keyforperm)) { $permok = $user->hasRight($keyforperm, 'creer') || $user->hasRight($keyforperm, 'create') || $user->hasRight($keyforperm, 'write'); } @@ -251,6 +254,7 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att //TODO Improve element and rights detection if ($action == 'edit_extras' && $permok && GETPOST('attribute', 'restricthtml') == $tmpkeyextra) { + // Show the extrafield in create or edit mode $fieldid = 'id'; if ($object->table_element == 'societe') { $fieldid = 'socid'; @@ -266,6 +270,8 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att print ''; } else { + // Show the extrafield in view mode + //var_dump($tmpkeyextra.'-'.$value.'-'.$object->table_element); print $extrafields->showOutputField($tmpkeyextra, $value, '', $object->table_element, null, $object); } diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 7f46d5e76cc..1652b8fee92 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +35,14 @@ if (empty($conf) || !is_object($conf)) { exit; } +' +@phan-var-force Website $website +@phan-var-force string $filepathnoext +@phan-var-force string $pageid +@phan-var-force EcmDirectory $ecmdir +@phan-var-force int $section +'; + ?> @@ -50,8 +58,6 @@ if (empty($module)) { $module = 'ecm'; } -'@phan-var-force Website $website'; - $permtoadd = 0; $permtoupload = 0; $showroot = 0; @@ -106,6 +112,7 @@ if ($module == 'ecm') { print ''; } if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage medias of a web site + // @phan-suppress-next-line PhanTypeExpectedObjectPropAccess print 'ref).'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; print img_picto('', 'images', '', 0, 0, 0, '', 'size15x flip marginrightonly'); print ''; @@ -218,7 +225,7 @@ if ($action == 'confirmconvertimgwebp') { $formquestion['section'] = array('type' => 'hidden', 'value' => $section, 'name' => 'section'); $formquestion['filetoregenerate'] = array('type' => 'hidden', 'value' => $file, 'name' => 'filetoregenerate'); if ($module == 'medias') { - $formquestion['website'] = array('type' => 'hidden', 'value' => $website->ref, 'name' => 'website'); + $formquestion['website'] = array('type' => 'hidden', 'value' => $website->ref, 'name' => 'website'); // @phan-suppress-current-line PhanTypeExpectedObjectPropAccess } $param = ''; if (!empty($sortfield)) { diff --git a/htdocs/core/tpl/formlayoutai.tpl.php b/htdocs/core/tpl/formlayoutai.tpl.php index 4bae7f2551d..944f6d5722b 100644 --- a/htdocs/core/tpl/formlayoutai.tpl.php +++ b/htdocs/core/tpl/formlayoutai.tpl.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,6 +54,9 @@ if (empty($htmlname)) { @phan-var-force ?FormMail $formmail @phan-var-force string $showlinktolayout @phan-var-force string $showlinktolayoutlabel +@phan-var-force string $showlinktoai +@phan-var-force string $showlinktoailabel +@phan-var-force ?string $out '; if (!isset($out)) { diff --git a/htdocs/core/tpl/list_print_subtotal.tpl.php b/htdocs/core/tpl/list_print_subtotal.tpl.php index 5f04d570ce4..71dfa92158f 100644 --- a/htdocs/core/tpl/list_print_subtotal.tpl.php +++ b/htdocs/core/tpl/list_print_subtotal.tpl.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * @var Translate $langs + * @var array{nbfield:int,pos?:array,val?:array} $totalarray + */ '@phan-var-force array{nbfield:int,pos?:array,val?:array} $totalarray'; diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index d79d844484c..397328e146a 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -1,5 +1,7 @@ + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +23,10 @@ * @var Form $form * @var Translate $langs */ -'@phan-var-force array{nbfield:int,type?:array,pos?:array,val?:array} $totalarray'; +' +@phan-var-force array{nbfield:int,type?:array,pos?:array,val?:array} $totalarray +@phan-var-force ?string $sqlfields +'; if (!function_exists('printTotalValCell')) { // allow two list with total on same screen diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 3cf6e4f82eb..eee6cda2b3d 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -1,8 +1,9 @@ * Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -55,8 +56,12 @@ * @var int[] $arrayofselected */ ' +@phan-var-force string $string @phan-var-force CommonObject $objecttmp @phan-var-force int[] $toselect +@phan-var-force ?string $uploaddir +@phan-var-force int<0,1> $withmaindocfilemail +@phan-var-force string $sendto '; if (!empty($sall) || !empty($search_all)) { @@ -81,7 +86,7 @@ if ($massaction == 'preclonetasks') { $formquestion = array( // TODO If list of project is long and project is not on a thirdparty, the combo may be very long. // Solution: Allow only sameproject for cloning tasks ? - array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects($object->id, 'projectid', '', 0, 1, '', 0, array(), $object->socid, '1', 1, '', null, 1)), + array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects($object->id, 'projectid', '', 0, 1, '', 0, array(), $object->socid, '1', 1, '', array(), 1)), ); print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . $selected, $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590); } @@ -113,7 +118,7 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) { 'type' => 'other', 'name' => 'affecttag_'.$categ_type['code'], 'label' => '', - 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $categ_arbo_tmp, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, '', 0, '60%', '', '', $langs->transnoentitiesnoconv("SelectTheTagsToAssign")) + 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $categ_arbo_tmp, GETPOST('contcats_'.$categ_type['code'], 'array'), 0, 0, '', 0, '60%', '', '', $langs->transnoentitiesnoconv("SelectTheTagsToAssign")) ); } $formquestion[] = array( @@ -128,11 +133,15 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) { } } -if ($massaction == 'preupdateprice') { +if ($massaction == 'preupdateprice' + && (getDolGlobalString('PRODUCT_PRICE_UNIQ') + || getDolGlobalString('PRODUIT_CUSTOMER_PRICES') + || getDolGlobalString('PRODUIT_MULTIPRICES') + )) { $formquestion = array(); $valuefield = '
    '; - $valuefield .= '%'; + $valuefield .= ' %'; $valuefield .= '
    '; $formquestion[] = array( @@ -142,7 +151,12 @@ if ($massaction == 'preupdateprice') { 'value' => $valuefield ); - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmUpdatePrice"), $langs->trans("ConfirmUpdatePriceQuestion", count($toselect)), "updateprice", $formquestion, 1, 0, 200, 500, 1); + $descConfirmPreUpdatePrice=$langs->trans("ConfirmUpdatePriceQuestion", count($toselect)); + if (getDolGlobalString('PRODUIT_MULTIPRICES')) { + $descConfirmPreUpdatePrice=$langs->trans("ConfirmUpdatePriceQuestion", count($toselect)*getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT') .' ('.$langs->transnoentities('PricingRule').', '.$langs->transnoentities('MultiPricesNumPrices').')'); + } + + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmUpdatePrice"), $descConfirmPreUpdatePrice, "updateprice", $formquestion, 1, 0, 200, 500, 1); } if ($massaction == 'presetsupervisor') { @@ -418,7 +432,7 @@ if ($massaction == 'presetcommercial') { $formquestion[] = array('type' => 'other', 'name' => 'affectedcommercial', 'label' => $form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0), - 'value' => $form->multiselectarray('commercial', $userlist, null, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)); + 'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAllocateCommercial"), $langs->trans("ConfirmAllocateCommercialQuestion", count($toselect)), "affectcommercial", $formquestion, 1, 0, 200, 500, 1); } if ($massaction == 'unsetcommercial') { @@ -427,7 +441,7 @@ if ($massaction == 'unsetcommercial') { $formquestion[] = array('type' => 'other', 'name' => 'unassigncommercial', 'label' => $form->editfieldkey('UnallocateCommercial', 'commercial_id', '', $object, 0), - 'value' => $form->multiselectarray('commercial', $userlist, null, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)); + 'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmUnallocateCommercial"), $langs->trans("ConfirmUnallocateCommercialQuestion", count($toselect)), "unassigncommercial", $formquestion, 1, 0, 200, 500, 1); } @@ -437,7 +451,7 @@ if ($massaction == 'preapproveleave') { // Allow Pre-Mass-Action hook (eg for confirmation dialog) if (empty($toselect)) { - $toselect=[]; + $toselect = []; } $parameters = array( 'toselect' => &$toselect, @@ -445,6 +459,7 @@ $parameters = array( 'massaction' => $massaction ); +// @phan-suppress-next-line PhanTypeMismatchArgumentNullable $reshook = $hookmanager->executeHooks('doPreMassActions', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 00a07c89b85..a2283dae519 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -2,7 +2,8 @@ /* Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2020 Laurent Destailleur - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,12 +19,14 @@ * along with this program. If not, see . */ /** - * @var CommonObject $object + * @var ?CommonObject $object * @var Form $form * @var Translate $langs * @var User $user * - * @var int $permissionnote + * @var ?int<0,1> $permissionnote + * @var string $moreparam + * @var ?int $colwidth * @var string $cssclass */ // Protection to avoid direct call of template @@ -31,6 +34,11 @@ if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; exit(1); } +' +@phan-var-force ?int<0,1> $permissionnote +@phan-var-force string $moreparam +@phan-var-force ?int $colwidth +'; // $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create // $cssclass must be defined by caller. For example $cssclass='fieldtitle' @@ -126,7 +134,7 @@ print '
    '."\n print '
    '."\n"; $editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_public); print '
    '."\n"; -print $form->editfieldkey((empty($textNotePub) ? "NotePublic" : $textNotePub), $note_public, $value_public, $object, $permission, $typeofdatapub, $moreparam, '', 0); +print $form->editfieldkey((empty($textNotePub) ? "NotePublic" : $textNotePub), $note_public, $value_public, $object, $permission, $typeofdatapub, $moreparam, 0, 0); print '
    '."\n"; print '
    '."\n"; print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdatapub, '', null, null, $moreparam, 1)."\n"; @@ -137,7 +145,7 @@ if (empty($user->socid)) { print '
    '."\n"; $editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_private); print '
    '."\n"; - print $form->editfieldkey((empty($textNotePrive) ? "NotePrivate" : $textNotePrive), $note_private, $value_private, $object, $permission, $typeofdatapriv, $moreparam, '', 0); + print $form->editfieldkey((empty($textNotePrive) ? "NotePrivate" : $textNotePrive), $note_private, $value_private, $object, $permission, $typeofdatapriv, $moreparam, 0, 0); print '
    '."\n"; print '
    '."\n"; print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdatapriv, '', null, null, $moreparam, 1); diff --git a/htdocs/core/tpl/object_discounts.tpl.php b/htdocs/core/tpl/object_discounts.tpl.php index f1cd115e531..d768eb3e92e 100644 --- a/htdocs/core/tpl/object_discounts.tpl.php +++ b/htdocs/core/tpl/object_discounts.tpl.php @@ -1,6 +1,8 @@ * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +19,7 @@ * * Needs the following variables defined: * $object Proposal, order, invoice (including supplier versions) - * $thirdparty Thirdparty of object + * $thirdparty Third party of object * $absolute_discount Amount of fixed discounts available * $absolute_creditnote Amount of credit notes available * $discount_type 0 => Customer discounts, 1 => Supplier discounts @@ -30,6 +32,16 @@ */ print ''."\n"; +' +@phan-var-force Propal|Commande|CommandeFournisseur|Facture|FactureFournisseur $object +@phan-var-force Societe $thirdparty +@phan-var-force string $backtopage +@phan-var-force string $filtercreditnote +@phan-var-force string $filterabsolutediscount +@phan-var-force int<0,1> $discount_type +@phan-var-force int $resteapayer +'; + $objclassname = get_class($object); $isInvoice = in_array($object->element, array('facture', 'invoice', 'facture_fourn', 'invoice_supplier')); $isNewObject = empty($object->id) && empty($object->rowid); @@ -91,6 +103,7 @@ if ($absolute_discount > 0) { } else { // Discount available of type fixed amount (not credit note) $more = $addabsolutediscount; + // TODO: Check $resteapayer - is '$maxvalue' in form_remise_dispo() $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type); } } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 96cfc189c13..df96090135a 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -12,6 +12,7 @@ * Copyright (C) 2022 OpenDSI * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,8 +51,13 @@ if (empty($object) || !is_object($object)) { exit; } -'@phan-var-force CommonObject $this - @phan-var-force CommonObject $object'; +' +@phan-var-force CommonObject $this +@phan-var-force CommonObject $object +@phan-var-force Societe $buyer +@phan-var-force Societe $seller +@phan-var-force int<0,1> $usehm +'; $usemargins = 0; if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { @@ -457,6 +463,7 @@ if ($nolinesbefore) { } print '
    '; $coldisplay++; + $type_tva = 0; if ($object->element == 'propal' || $object->element == 'commande' || $object->element == 'facture' || $object->element == 'facturerec') { $type_tva = 1; } elseif ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { @@ -487,7 +494,7 @@ if ($nolinesbefore) { "> '; - print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units"); + print $form->selectUnits(empty($line->fk_unit) ? getDolGlobalInt('PRODUCT_USE_UNITS') : $line->fk_unit, "units"); print ' - + - + "> %%'.dol_print_date(dol_time_plus_duree($object->datestart, $i - 1, 'm'), 'day').''.price($insu, 0, '', 1, -1, -1, $conf->currency).''.price($int, 0, '', 1, -1, -1, $conf->currency).''.price($cap_rest).'
    '.price($insu, 0, '', 1, -1, -1, $conf->currency).''.price($int, 0, '', 1, -1, -1, $conf->currency).''.price($mens, 0, '', 1, -1, -1, $conf->currency).'
    '; print ''; print ''; // Start date @@ -345,8 +345,8 @@ if ($result) { print ''; print "\n"; - print ''; - print ''; + print ''; + print ''; print ''; if (getDolGlobalString('DISPLAY_MARGIN_RATES')) { print ''; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 1ec4b367601..a3fbcca6799 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Ferran Marcet - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -65,7 +65,7 @@ if (GETPOST('startdatemonth')) { $startdate = dol_mktime(0, 0, 0, GETPOSTINT('startdatemonth'), GETPOSTINT('startdateday'), GETPOSTINT('startdateyear')); } if (GETPOST('enddatemonth')) { - $enddate = dol_mktime(23, 59, 59, GETPOSTINT('enddatemonth'), GETPOSTINT('enddateday'), GETPOST('enddateyear')); + $enddate = dol_mktime(23, 59, 59, GETPOSTINT('enddatemonth'), GETPOSTINT('enddateday'), GETPOSTINT('enddateyear')); } // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context @@ -135,7 +135,7 @@ if ($socid > 0) { } else { print ''; print ''; } @@ -155,7 +155,7 @@ if (!$sortfield) { } // Products -$TRes = $form->select_produits_list('', '', '', '', 0, '', 1, 2, 1, 0, '', 1); +$TRes = $form->select_produits_list(0, '', '', 0, 0, '', 1, 2, 1, 0, '', 1); $TProducts = array(); foreach ($TRes as $prod) { @@ -168,7 +168,7 @@ print img_picto('', 'product').$form->multiselectarray('products', $TProducts, $ print ''; // Categories -$TCats = $form->select_all_categories('product', array(), '', 64, 0, 3); +$TCats = $form->select_all_categories('product', 0, '', 64, 0, 3); print ''; print ''; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index dac098bf848..459a1376dfb 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2020 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,7 @@ if (GETPOST('startdatemonth')) { $startdate = dol_mktime(0, 0, 0, GETPOSTINT('startdatemonth'), GETPOSTINT('startdateday'), GETPOSTINT('startdateyear')); } if (GETPOST('enddatemonth')) { - $enddate = dol_mktime(23, 59, 59, GETPOSTINT('enddatemonth'), GETPOSTINT('enddateday'), GETPOST('enddateyear')); + $enddate = dol_mktime(23, 59, 59, GETPOSTINT('enddatemonth'), GETPOSTINT('enddateday'), GETPOSTINT('enddateyear')); } // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context @@ -130,7 +131,7 @@ print img_picto('', 'product', 'class="pictofixedwidth"').$form->select_produits print ''; // Categories -$TCats = $form->select_all_categories('product', array(), '', 64, 0, 3); +$TCats = $form->select_all_categories('product', 0, '', 64, 0, 3); print ''; print ''; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index c29a2cb62a2..280ccc458ca 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -168,6 +169,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_head($head, 'margin', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; + $object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")"; dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref'); @@ -212,9 +214,9 @@ if ($id > 0 || !empty($ref)) { $sql .= " sc.fk_soc, sc.fk_user,"; } $sql .= " sum(d.total_ht) as selling_price,"; // may be negative or positive - $sql .= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty) as qty,"; // not always positive in case of Credit note - $sql .= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty * d.buy_price_ht * (d.situation_percent / 100)) as buying_price,"; // not always positive in case of Credit note - $sql .= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100))) as marge"; // not always positive in case of Credit note + $sql .= " ".$db->ifsql('f.type = 2', '-1', '1')." * sum(d.qty) as qty,"; // not always positive in case of Credit note + $sql .= " ".$db->ifsql('f.type = 2', '-1', '1')." * sum(d.qty * d.buy_price_ht * (d.situation_percent / 100)) as buying_price,"; // not always positive in case of Credit note + $sql .= " ".$db->ifsql('f.type = 2', '-1', '1')." * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100))) as marge"; // not always positive in case of Credit note $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."facture as f"; $sql .= ", ".MAIN_DB_PREFIX."facturedet as d"; diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index e2ccbe25dd2..41cb8f391cd 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -10,7 +10,7 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2011 Philippe Grand * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,6 +45,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; * @var string $dolibarr_main_url_root_alt */ +' +@phan-var-force ?string $dolibarr_main_db_prefix +@phan-var-force ?string $dolibarr_main_db_encryption +@phan-var-force ?string $dolibarr_main_db_cryptkey +@phan-var-force ?string $dolibarr_main_limit_users +@phan-var-force ?string $dolibarr_main_url_root_alt +'; + if (!function_exists('is_countable')) { /** * function is_countable (to remove when php version supported will be >= 7.3) @@ -99,7 +107,7 @@ if (!empty($dolibarr_main_document_root_alt)) { foreach ($values as $value) { $conf->file->dol_document_root['alt'.($i++)] = (string) $value; } - $values = preg_split('/[;,]/', $dolibarr_main_url_root_alt); + $values = preg_split('/[;,]/', (string) $dolibarr_main_url_root_alt); $i = 0; foreach ($values as $value) { if (preg_match('/^http(s)?:/', $value)) { @@ -178,14 +186,16 @@ unset($conf->db->pass); // This is to avoid password to be shown in memory/swap /* * Object $user */ -if (!defined('NOREQUIREUSER')) { +if (!defined('NOREQUIREUSER') && $db !== null) { $user = new User($db); } /* * Create the global $hookmanager object */ -$hookmanager = new HookManager($db); +if ($db !== null) { + $hookmanager = new HookManager($db); +} /* @@ -212,10 +222,12 @@ if (!is_numeric($conf->entity)) { } // Here we read database (llx_const table) and define conf var $conf->global->XXX. //print "We work with data into entity instance number '".$conf->entity."'"; -$conf->setValues($db); +if ($db !== null) { + $conf->setValues($db); +} // Create object $mysoc (A thirdparty object that contains properties of companies managed by Dolibarr. -if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) { +if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC') && $db != null) { require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $mysoc = new Societe($db); diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 86726bb5543..a947d497024 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2023 Laurent Destailleur * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2023 Alexandre Janniaux - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -67,7 +67,7 @@ $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09'); $module = GETPOST('module', 'alpha'); -$tab = GETPOST('tab', 'aZ09'); +$tab = (string) GETPOST('tab', 'aZ09'); $tabobj = GETPOST('tabobj', 'alpha'); $tabdic = GETPOST('tabdic', 'alpha'); $propertykey = GETPOST('propertykey', 'alpha'); @@ -77,6 +77,7 @@ if (empty($module)) { if (empty($tab)) { $tab = 'description'; } +'@phan-var-force string $tab'; // Workaround 'empty()' bug of phan if (empty($tabobj)) { $tabobj = 'newobjectifnoobj'; } @@ -850,6 +851,7 @@ if ($dirins && $action == 'initcli' && !empty($module) && $user->hasRight("modul $moduledescriptorfile = '/not_set/'; +$modulelowercase = null; // init Doc if ($dirins && $action == 'initdoc' && !empty($module) && $user->hasRight("modulebuilder", "run")) { @@ -1288,7 +1290,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname && $user->hasRi $position = 900; } // $alwayseditable - $alwayseditable=0; + $alwayseditable = 0; if ($fieldname == 'label') { $alwayseditable = 1; } else { @@ -2347,15 +2349,12 @@ if ($dirins && $action == 'generatepackage' && $user->hasRight("modulebuilder", $dirofmodule = dol_buildpath($modulelowercase, 0).'/bin'; $outputfilezip = $dirofmodule.'/'.$FILENAMEZIP; - if ($dirofmodule) { - if (!dol_is_dir($dirofmodule)) { - dol_mkdir($dirofmodule); - } - // Note: We exclude /bin/ to not include the already generated zip - $result = dol_compress_dir($dir, $outputfilezip, 'zip', '/\/bin\/|\.git|\.old|\.back|\.ssh/', $modulelowercase); - } else { - $result = -1; + + if (!dol_is_dir($dirofmodule)) { + dol_mkdir($dirofmodule); } + // Note: We exclude /bin/ to not include the already generated zip + $result = dol_compress_dir($dir, $outputfilezip, 'zip', '/\/bin\/|\.git|\.old|\.back|\.ssh/', $modulelowercase); if ($result > 0) { setEventMessages($langs->trans("ZipFileGeneratedInto", $outputfilezip), null); @@ -2706,12 +2705,9 @@ if ($action == 'set' && $user->admin && $user->hasRight("modulebuilder", "run")) if ($module) { $param .= '&module='.urlencode($module); } - if ($tab) { - $param .= '&tab='.urlencode($tab); - } - if ($tabobj) { - $param .= '&tabobj='.urlencode($tabobj); - } + + $param .= '&tab='.urlencode($tab); + $param .= '&tabobj='.urlencode($tabobj); $value = GETPOST('value', 'alpha'); $resarray = activateModule($value); @@ -2744,12 +2740,8 @@ if ($action == 'reset' && $user->admin && $user->hasRight("modulebuilder", "run" if ($module) { $param .= '&module='.urlencode($module); } - if ($tab) { - $param .= '&tab='.urlencode($tab); - } - if ($tabobj) { - $param .= '&tabobj='.urlencode($tabobj); - } + $param .= '&tab='.urlencode($tab); + $param .= '&tabobj='.urlencode($tabobj); $value = GETPOST('value', 'alpha'); $result = unActivateModule($value); @@ -3310,15 +3302,12 @@ if (is_array($listofmodules) && count($listofmodules) > 0) { $modulelowercase = strtolower($module); $param = ''; - if ($tab) { - $param .= '&tab='.urlencode($tab); - } if ($module) { $param .= '&module='.urlencode($module); } - if ($tabobj) { - $param .= '&tabobj='.urlencode($tabobj); - } + + $param .= '&tab='.urlencode($tab); + $param .= '&tabobj='.urlencode($tabobj); $urltomodulesetup = ''.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").''; @@ -3333,9 +3322,7 @@ if (is_array($listofmodules) && count($listofmodules) > 0) { $objMod = $moduleobj; $backtourlparam = ''; $backtourlparam .= ($backtourlparam ? '&' : '?').'module='.$module; // No urlencode here, done later - if ($tab) { - $backtourlparam .= ($backtourlparam ? '&' : '?').'tab='.$tab; // No urlencode here, done later - } + $backtourlparam .= ($backtourlparam ? '&' : '?').'tab='.$tab; // No urlencode here, done later $backtourl = $_SERVER["PHP_SELF"].$backtourlparam; $regs = array(); @@ -3493,7 +3480,7 @@ if ($module == 'initmodule') { print ''; print ''; print ''; -} elseif (!empty($module) && isset($modulelowercase)) { +} elseif (!empty($module) && $modulelowercase !== null) { // Tabs for module if (!$error) { $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; @@ -3848,6 +3835,7 @@ if ($module == 'initmodule') { } else { // Edit text file $fullpathoffile = dol_buildpath($file, 0, 1); // Description - level 2 + $content = ''; if ($fullpathoffile) { $content = file_get_contents($fullpathoffile); } @@ -4377,7 +4365,7 @@ if ($module == 'initmodule') { print $form->textwithpicto('', $langs->trans("InfoForApiFile"), 1, 'warning'); print '   '; // Comparing to null (phan considers $modulelowercase can be null here) - if ($modulelowercase !== null && !isModEnabled($modulelowercase)) { // If module is not activated + if (!isModEnabled($modulelowercase)) { // If module is not activated print ''.$langs->trans("ApiExplorer").''; } else { print ''.$langs->trans("ApiExplorer").''; @@ -6418,7 +6406,7 @@ if ($module == 'initmodule') { print ''; print ''; @@ -708,7 +709,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { @@ -719,9 +720,9 @@ while ($i < $imaxinloop) { print $moparent->getNomUrl(1); } } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); + print $object->showOutputField($val, $key, (string) $object->id, ''); } else { - print $object->showOutputField($val, $key, $object->$key, ''); + print $object->showOutputField($val, $key, (string) $object->$key, ''); } print ''; if (!$i) { @@ -744,7 +745,7 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -787,7 +788,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index 5120d8a3c98..fabcca4d0e1 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -3,7 +3,7 @@ * Copyright (C) 2022 Ferran Marcet * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,24 +130,24 @@ $objectlist = new MouvementStock($db); // Definition of fields for list $arrayfields = array( - 'm.rowid' => array('label' => "Ref", 'checked' => 1, 'position' => 1), - 'm.datem' => array('label' => "Date", 'checked' => 1, 'position' => 2), - 'p.ref' => array('label' => "ProductRef", 'checked' => 1, 'css' => 'maxwidth100', 'position' => 3), - 'p.label' => array('label' => "ProductLabel", 'checked' => 0, 'position' => 5), - 'm.batch' => array('label' => "BatchNumberShort", 'checked' => 1, 'position' => 8, 'enabled' => (isModEnabled('productbatch'))), - 'pl.eatby' => array('label' => "EatByDate", 'checked' => 0, 'position' => 9, 'enabled' => (isModEnabled('productbatch'))), - 'pl.sellby' => array('label' => "SellByDate", 'checked' => 0, 'position' => 10, 'enabled' => (isModEnabled('productbatch'))), - 'e.ref' => array('label' => "Warehouse", 'checked' => 1, 'position' => 100, 'enabled' => (!($id > 0))), // If we are on specific warehouse, we hide it - 'm.fk_user_author' => array('label' => "Author", 'checked' => 0, 'position' => 120), - 'm.inventorycode' => array('label' => "InventoryCodeShort", 'checked' => 1, 'position' => 130), - 'm.label' => array('label' => "MovementLabel", 'checked' => 1, 'position' => 140), - 'm.type_mouvement' => array('label' => "TypeMovement", 'checked' => 0, 'position' => 150), - 'origin' => array('label' => "Origin", 'checked' => 1, 'position' => 155), - 'm.fk_projet' => array('label' => 'Project', 'checked' => 0, 'position' => 180), - 'm.value' => array('label' => "Qty", 'checked' => 1, 'position' => 200), - 'm.price' => array('label' => "UnitPurchaseValue", 'checked' => 0, 'position' => 210) - //'m.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - //'m.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500) + 'm.rowid' => array('label' => "Ref", 'checked' => '1', 'position' => 1), + 'm.datem' => array('label' => "Date", 'checked' => '1', 'position' => 2), + 'p.ref' => array('label' => "ProductRef", 'checked' => '1', 'css' => 'maxwidth100', 'position' => 3), + 'p.label' => array('label' => "ProductLabel", 'checked' => '0', 'position' => 5), + 'm.batch' => array('label' => "BatchNumberShort", 'checked' => '1', 'position' => 8, 'enabled' => (string) (int) (isModEnabled('productbatch'))), + 'pl.eatby' => array('label' => "EatByDate", 'checked' => '0', 'position' => 9, 'enabled' => (string) (int) (isModEnabled('productbatch'))), + 'pl.sellby' => array('label' => "SellByDate", 'checked' => '0', 'position' => 10, 'enabled' => (string) (int) (isModEnabled('productbatch'))), + 'e.ref' => array('label' => "Warehouse", 'checked' => '1', 'position' => 100, 'enabled' => (string) (int) (!($id > 0))), // If we are on specific warehouse, we hide it + 'm.fk_user_author' => array('label' => "Author", 'checked' => '0', 'position' => 120), + 'm.inventorycode' => array('label' => "InventoryCodeShort", 'checked' => '1', 'position' => 130), + 'm.label' => array('label' => "MovementLabel", 'checked' => '1', 'position' => 140), + 'm.type_mouvement' => array('label' => "TypeMovement", 'checked' => '0', 'position' => 150), + 'origin' => array('label' => "Origin", 'checked' => '1', 'position' => 155), + 'm.fk_projet' => array('label' => 'Project', 'checked' => '0', 'position' => 180), + 'm.value' => array('label' => "Qty", 'checked' => '1', 'position' => 200), + 'm.price' => array('label' => "UnitPurchaseValue", 'checked' => '0', 'position' => 210) + //'m.datec'=>array('label'=>"DateCreation", 'checked'=>'0', 'position'=>500), + //'m.tms'=>array('label'=>"DateModificationShort", 'checked'=>'0', 'position'=>500) ); if (getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { unset($arrayfields['pl.sellby']); @@ -169,7 +169,7 @@ $permissiontoproduce = $permissiontoadd; $permissiontoupdatecost = $user->hasRight('bom', 'write'); // User who can define cost must have knowledge of pricing if ($permissiontoupdatecost) { - $arrayfields['m.price']['enabled'] = 1; + $arrayfields['m.price']['enabled'] = '1'; } $arrayofselected = array(); @@ -360,7 +360,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 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'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); @@ -1016,7 +1016,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // fk_project print ''; } diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index 304457df234..c2ba92da2ca 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,7 +134,7 @@ if ($id > 0 || !empty($ref)) { 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'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index bf68267ee2b..2e7fd89629b 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -3,7 +3,7 @@ * Copyright (C) 2023 Christian Humpel * Copyright (C) 2023 Vincent de Grandpré * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -142,7 +142,7 @@ if (empty($reshook)) { if ($action == 'confirm_cancel' && $confirm == 'yes' && !empty($permissiontoadd)) { $also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0); - $result = $object->cancel($user, 0, $also_cancel_consumed_and_produced_lines); + $result = $object->cancel($user, 0, (bool) $also_cancel_consumed_and_produced_lines); if ($result > 0) { header("Location: " . DOL_URL_ROOT.'/mrp/mo_card.php?id=' . $object->id); exit; @@ -152,7 +152,7 @@ if (empty($reshook)) { } } elseif ($action == 'confirm_delete' && $confirm == 'yes' && !empty($permissiontodelete)) { $also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0); - $result = $object->delete($user, 0, $also_cancel_consumed_and_produced_lines); + $result = $object->delete($user, 0, (bool) $also_cancel_consumed_and_produced_lines); if ($result > 0) { header("Location: " . $backurlforlist); exit; @@ -244,7 +244,7 @@ if (empty($reshook)) { $moline->array_options = $array_options; } - $resultline = $moline->create($user, false); // Never use triggers here + $resultline = $moline->create($user, 0); // Never use triggers here if ($resultline <= 0) { $error++; setEventMessages($moline->error, $moline->errors, 'errors'); @@ -297,9 +297,9 @@ if (empty($reshook)) { $stockmove->context['mrp_role'] = 'toconsume'; if ($qtytoprocess >= 0) { - $idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), $qtytoprocess, 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + $idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOSTINT('idwarehouse-'.$line->id.'-'.$i), $qtytoprocess, 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); } else { - $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), $qtytoprocess * -1, 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOSTINT('idwarehouse-'.$line->id.'-'.$i), $qtytoprocess * -1, 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); } if ($idstockmove < 0) { $error++; @@ -372,7 +372,7 @@ if (empty($reshook)) { $stockmove->origin_id = $object->id; $stockmove->context['mrp_role'] = 'toproduce'; - $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), $qtytoprocess, $pricetoprocess, $labelmovement, '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), dol_now(), $id_product_batch, $codemovement); + $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOSTINT('idwarehousetoproduce-'.$line->id.'-'.$i), $qtytoprocess, $pricetoprocess, $labelmovement, '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), dol_now(), $id_product_batch, $codemovement); if ($idstockmove < 0) { $error++; setEventMessages($stockmove->error, $stockmove->errors, 'errors'); @@ -680,7 +680,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 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'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); @@ -986,7 +986,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Extrafields Line if (is_object($objectline)) { $extrafields->fetch_name_optionals_label($object->table_element_line); - $temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', 1, 'line'); + $temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', '1', 'line'); if (!empty($temps)) { print ''; @@ -1146,7 +1146,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Extrafields Line if (!empty($extrafields)) { $line->fetch_optionals(); - $temps = $line->showOptionals($extrafields, 'edit', array(), '', '', 1, 'line'); + $temps = $line->showOptionals($extrafields, 'edit', array(), '', '', '1', 'line'); if (!empty($temps)) { $colspan = 10; print ''; @@ -1307,7 +1307,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Extrafields Line if (!empty($extrafields)) { $line->fetch_optionals(); - $temps = $line->showOptionals($extrafields, 'view', array(), '', '', 1, 'line'); + $temps = $line->showOptionals($extrafields, 'view', array(), '', '', '1', 'line'); if (!empty($temps)) { $colspan = 10; print ''; // Unit if (getDolGlobalInt('PRODUCT_USE_UNITS')) { - print ''; + print ''; } // Cost price if ($permissiontoupdatecost) { diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index e4cfc5b8435..3ba0e580b5b 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -3,7 +3,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2013-2020 Charlene BENKE - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,7 +60,7 @@ if ($object->element == 'mo') { echo ''; echo ''; diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 7b6a0436080..1fae83d4fe1 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -1,7 +1,7 @@ * Copyright (C) 2017 Charlie Benke - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -22,10 +22,14 @@ * @var CommonObject $this * @var Conf $conf * @var Form $form - * @var MoLine $line + * @var BOMLine $line * @var Translate $langs */ +' +@phan-var-force BOMLine $line +'; + // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; @@ -54,8 +58,8 @@ if ($line->fk_product > 0) { } $tmpbom = new BOM($db); $res = 0; -if ($line->fk_bom_child > 0) { - $res = $tmpbom->fetch($line->fk_bom_child); +if ((int) $line->fk_bom_child > 0) { + $res = $tmpbom->fetch((int) $line->fk_bom_child); } ?> @@ -81,7 +85,7 @@ print ''; // Qty print ''; // Unit -print ''; +print ''; // Stock print ''; + print ''; // Stock réel if ($sub_bom_product->stock_reel > 0) { diff --git a/htdocs/multicurrency/class/api_multicurrencies.class.php b/htdocs/multicurrency/class/api_multicurrencies.class.php index 50dff7401cc..ade16c56664 100644 --- a/htdocs/multicurrency/class/api_multicurrencies.class.php +++ b/htdocs/multicurrency/class/api_multicurrencies.class.php @@ -66,7 +66,7 @@ class MultiCurrencies extends DolibarrApi $sql = "SELECT t.rowid"; $sql .= " FROM ".$this->db->prefix()."multicurrency as t"; - $sql .= ' WHERE 1 = 1'; + $sql .= " WHERE t.entity IN (".getEntity('multicurrency').")"; // Add sql filters if ($sqlfilters) { $errormessage = ''; diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 8f4af567800..2523134ed36 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -190,13 +190,11 @@ class MultiCurrency extends CommonObject { dol_syslog('MultiCurrency::fetch', LOG_DEBUG); - global $conf; - - $sql = "SELECT"; - $sql .= ' c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' AS c'; + $sql = "SELECT c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user"; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." AS c"; if (!empty($code)) { - $sql .= ' WHERE c.code = \''.$this->db->escape($code).'\' AND c.entity = '.$conf->entity; + $sql .= " WHERE c.code = '".$this->db->escape($code)."'"; + $sql .= " AND c.entity IN (".getEntity($this->element).")"; } else { $sql .= ' WHERE c.rowid = '.((int) $id); } @@ -242,9 +240,10 @@ class MultiCurrency extends CommonObject public function fetchAllCurrencyRate() { $sql = "SELECT cr.rowid"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as cr'; - $sql .= ' WHERE cr.fk_multicurrency = '.((int) $this->id); - $sql .= ' ORDER BY cr.date_sync DESC'; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line." as cr"; + $sql .= " WHERE cr.entity IN (".getEntity($this->element).")"; + $sql .= " AND cr.fk_multicurrency = ".((int) $this->id); + $sql .= " ORDER BY cr.date_sync DESC"; $this->rates = array(); @@ -480,8 +479,10 @@ class MultiCurrency extends CommonObject { $sql = "SELECT cr.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line." as cr"; - $sql .= " WHERE cr.fk_multicurrency = ".((int) $this->id); - $sql .= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX.$this->table_element_line." AS cr2 WHERE cr2.fk_multicurrency = ".((int) $this->id).")"; + $sql .= " WHERE cr.entity IN (".getEntity($this->element).")"; + $sql .= " AND cr.fk_multicurrency = ".((int) $this->id); + $sql .= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX.$this->table_element_line." AS cr2"; + $sql .= " WHERE cr2.entity IN (".getEntity($this->element).") AND cr2.fk_multicurrency = ".((int) $this->id).")"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -521,12 +522,12 @@ class MultiCurrency extends CommonObject * * @param DoliDB $dbs Object db * @param string $code Code value search - * @param int|string $date_document Date from document (propal, order, invoice, ...) + * @param int $date_document Date from document (propal, order, invoice, ...) * * @return array{0:int,1:float} [0] => id currency * [1] => rate */ - public static function getIdAndTxFromCode($dbs, $code, $date_document = '') + public static function getIdAndTxFromCode($dbs, $code, $date_document = 0) { $sql1 = "SELECT m.rowid, mc.rate FROM ".MAIN_DB_PREFIX."multicurrency m"; @@ -698,11 +699,19 @@ class MultiCurrency extends CommonObject } return 1; } else { - dol_syslog("Failed to call endpoint ".$response->error->info, LOG_WARNING); - if ($mode == "cron") { - $this->output = $langs->trans('multicurrency_syncronize_error', $response->error->info); + if (isset($response->error->info)) { + $error_info_syslog = $response->error->info; // @phan-suppress-current-line PhanTypeExpectedObjectPropAccess + $error_info = $error_info_syslog; } else { - setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors'); + $error_info_syslog = json_encode($response); + $error_info = "No error information found (see syslog)"; + } + + dol_syslog("Failed to call endpoint ".$error_info_syslog, LOG_WARNING); + if ($mode == "cron") { + $this->output = $langs->trans('multicurrency_syncronize_error', $error_info); + } else { + setEventMessages($langs->trans('multicurrency_syncronize_error', $error_info), null, 'errors'); } return -1; } diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 01d197f0737..bd0dfdacadb 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -12,7 +12,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2023 Lenin Rivas - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -112,10 +112,10 @@ $fieldstosearchall = array( // Definition of fields for lists $arrayfields = array( - 'cr.date_sync' => array('label' => 'Date', 'checked' => 1), - 'cr.rate' => array('label' => 'Rate', 'checked' => 1), - 'cr.rate_indirect' => array('label' => 'RateIndirect', 'checked' => 0, 'enabled' => (!getDolGlobalString('MULTICURRENCY_USE_RATE_INDIRECT') ? 0 : 1)), - 'm.code' => array('label' => 'Code', 'checked' => 1), + 'cr.date_sync' => array('label' => 'Date', 'checked' => '1'), + 'cr.rate' => array('label' => 'Rate', 'checked' => '1'), + 'cr.rate_indirect' => array('label' => 'RateIndirect', 'checked' => '0', 'enabled' => (!getDolGlobalString('MULTICURRENCY_USE_RATE_INDIRECT') ? '0' : '1')), + 'm.code' => array('label' => 'Code', 'checked' => '1'), ); @@ -362,7 +362,8 @@ if ($search_rate) { if ($search_code) { $sql .= natural_search('m.code', $search_code); } -$sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'"; +$sql .= " WHERE cr.entity IN (".getEntity('multicurrency').")"; +$sql .= " AND m.code <> '".$db->escape($conf->currency)."'"; // Add where from hooks $parameters = array(); diff --git a/htdocs/opcachepreload.php b/htdocs/opcachepreload.php index 44c9a40e919..49324f96724 100644 --- a/htdocs/opcachepreload.php +++ b/htdocs/opcachepreload.php @@ -1,5 +1,6 @@ + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +28,6 @@ $files = array(); /* An array of files you want to preload */ -foreach ($files as $file) { +foreach ($files as $file) { // @phan-suppress-current-line PhanEmptyForeach opcache_compile_file($file); } diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index f1dcd56ce4e..a6bd6721a30 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2014 Marcos García * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,7 +61,7 @@ if (GETPOST('id')) { // Initialize objects $object = new Opensurveysondage($db); -$result = $object->fetch(0, $numsondage); +$result = $object->fetch('', $numsondage); if ($result <= 0) { dol_print_error($db, $object->error); exit; @@ -70,7 +70,7 @@ if ($result <= 0) { // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('surveycard', 'globalcard')); -$expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); +$expiredate = dol_mktime(0, 0, 0, GETPOSTINT('expiremonth'), GETPOSTINT('expireday'), GETPOSTINT('expireyear')); $permissiontoread = $user->hasRight('opensurvey', 'read'); $permissiontoadd = $user->hasRight('opensurvey', 'write'); @@ -201,6 +201,7 @@ if (empty($reshook)) { */ $form = new Form($db); +$userstatic = null; if ($object->fk_user_creat) { $userstatic = new User($db); @@ -271,7 +272,7 @@ if ($action == 'edit') { print yn($object->mailsonde); //If option is active and linked user does not have an email, we show a warning - if ($object->fk_user_creat && $object->mailsonde) { + if ($object->fk_user_creat && $object->mailsonde && $userstatic !== null) { if (!$userstatic->email) { print ' '.img_warning($langs->trans('NoEMail')); } @@ -330,7 +331,7 @@ print ''; // Author print ''; // Author print ''."\n"; } else { + $dejafait = null; if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true) { $nbofchoice = count($_SESSION["totalchoixjour"]); for ($j = 0; $j < $nbofchoice; $j++) { @@ -589,7 +590,7 @@ if (issetAndNoEmpty('totalchoixjour', $_SESSION) || $erreur) { //affichage des cases d'horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - if (isset($errheure[$i][$j]) && $errheure[$i][$j]) { + if (isset($errheure[$i][$j]) /* && $errheure[$i][$j] */) { // When an error is found, the checkbox background is red print ''."\n"; } else { diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 0cf7deab04f..d0904ab85ce 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -3,7 +3,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,6 +64,7 @@ foreach ($session_var as $var) { // On initialise également les autres variables $cocheplus = ''; $cochemail = ''; +$champdatefin = 0; // Jump to correct page if (!empty($creation_sondage_date) || !empty($creation_sondage_autre)) { @@ -181,6 +182,7 @@ if ($_SESSION["mailsonde"]) { print '
    '."\n"; +$allow_comments = ''; if ($_SESSION['allow_comments']) { $allow_comments = 'checked'; } @@ -189,6 +191,7 @@ if (GETPOSTISSET('allow_comments')) { } print '
    '."\n"; +$allow_spy = ''; if ($_SESSION['allow_spy']) { $allow_spy = 'checked'; } diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 86d0cb5700a..6593b6e40b2 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 NextGestion * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,7 +99,7 @@ class Partnership extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), @@ -1388,9 +1388,9 @@ class Partnership extends CommonObject /** * Return a thumb for kanban views * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php index 1c677e2b282..c259be9cda6 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,7 +82,7 @@ class mod_partnership_advanced extends ModeleNumRefPartnership // Parametrage du prefix $text .= '
    '; - $text .= ''; + $text .= ''; $text .= ''; diff --git a/htdocs/partnership/partnership_contact.php b/htdocs/partnership/partnership_contact.php index 5705aed571f..2880e555890 100644 --- a/htdocs/partnership/partnership_contact.php +++ b/htdocs/partnership/partnership_contact.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2021 NextGestion * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,7 +106,7 @@ if ($action == 'addcontact' && $permission) { } } elseif ($action == 'swapstatut' && $permission) { // Toggle the status of a contact - $result = $object->swapContactStatus(GETPOST('ligne')); + $result = $object->swapContactStatus(GETPOSTINT('ligne')); } elseif ($action == 'deletecontact' && $permission) { // Deletes a contact $result = $object->delete_contact($lineid); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index a02ad6b3864..74fa58b8d50 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2021 NextGestion * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -981,7 +981,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { @@ -1003,7 +1003,7 @@ while ($i < $imaxinloop) { print $object->thirdparty->town; } } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); + print $object->showOutputField($val, $key, (string) $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); } diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index d5ad4f5df4a..64e20348446 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -1,7 +1,7 @@ + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -93,12 +93,12 @@ if ($action == 'update') { } $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_pricerules (level, fk_level, var_percent, var_min_percent) VALUES ("; - $sql .= ((int) $i).", ".$db->escape($i_fk_level).", ".$i_var_percent.", ".$i_var_min_percent.")"; + $sql .= ((int) $i).", ".((int) $i_fk_level).", ".$i_var_percent.", ".$i_var_min_percent.")"; if (!$db->query($sql)) { //If we could not create, then we try updating $sql = "UPDATE ".MAIN_DB_PREFIX."product_pricerules"; - $sql .= " SET fk_level = ".$db->escape($i_fk_level).", var_percent = ".$i_var_percent.", var_min_percent = ".$i_var_min_percent." WHERE level = ".((int) $i); + $sql .= " SET fk_level = ".((int) $i_fk_level).", var_percent = ".$i_var_percent.", var_min_percent = ".$i_var_min_percent." WHERE level = ".((int) $i); if (!$db->query($sql)) { setEventMessages($langs->trans('ErrorSavingChanges'), null, 'errors'); diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index d38409f9eaa..130b4bc1ce7 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -9,7 +9,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2016 Charlie Benke * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -69,7 +69,7 @@ $select_pricing_rules = array( 'PRODUCT_PRICE_UNIQ' => $langs->trans('PriceCatalogue'), // Unique price 'PRODUIT_MULTIPRICES' => $langs->trans('MultiPricesAbility'), // Several prices according to a customer level 'PRODUIT_CUSTOMER_PRICES' => $langs->trans('PriceByCustomer'), // Different price for each customer - 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'=>$langs->trans('PriceByCustomeAndMultiPricesAbility'), // Different price for each customer and several prices according to a customer level + 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES' => $langs->trans('PriceByCustomeAndMultiPricesAbility'), // Different price for each customer and several prices according to a customer level ); $keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY'; if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || getDolGlobalString($keyforparam)) { @@ -169,6 +169,11 @@ if ($action == 'other') { $value = GETPOST('PRODUCT_USE_SUPPLIER_PACKAGING', 'alpha'); $res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value, 'chaine', 0, '', $conf->entity); } + + if (GETPOSTISSET('PRODUCT_USE_CUSTOMER_PACKAGING')) { + $value = GETPOST('PRODUCT_USE_CUSTOMER_PACKAGING', 'alpha'); + $res = dolibarr_set_const($db, "PRODUCT_USE_CUSTOMER_PACKAGING", $value, 'chaine', 0, '', $conf->entity); + } } @@ -358,8 +363,8 @@ foreach ($dirproduct as $dirroot) { print "\n"; } else { $disabled = false; - if (!(isModEnabled('multicompany') && ((is_object($mc) && !empty($mc->sharings['referent'])) && ($mc->sharings['referent'] == $conf->entity)))) { - } + // if (!(isModEnabled('multicompany') && ((is_object($mc) && !empty($mc->sharings['referent'])) && ($mc->sharings['referent'] == $conf->entity)))) { + // } print ''; // Preview @@ -608,7 +613,7 @@ print ''; // multiprix nombre de prix a proposer -if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { +if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { print ''; print ''; print ''; @@ -642,6 +647,17 @@ if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { print ''; } +// Use packaging during your sales +if (isModEnabled("order") || isModEnabled("invoice")) { + print ''; + print ''; + print ''; + print ''; +} + print '
    '.$langs->trans('ContactOfInvoice').''; -print img_picto('', 'user').$form->select_dolusers($agentid, 'agentid', 1, '', $user->hasRight('margins', 'read', 'all') ? 0 : 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print img_picto('', 'user').$form->select_dolusers($agentid, 'agentid', 1, null, $user->hasRight('margins', 'read', 'all') ? 0 : 1, '', '', '0', 0, 0, '', 0, '', 'maxwidth300'); print '
    ".$group_array['htmlname']."'.price(price2num($pv, 'MT')).''.price(price2num($pa, 'MT')).''.price(price2num((float) $pv, 'MT')).''.price(price2num((float) $pa, 'MT')).''.price(price2num($marge, 'MT')).''.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'
    '.$langs->trans('ThirdPartyName').''; - print img_picto('', 'company').$form->select_company(null, 'socid', '((client:=:1) OR (client:=:3))', 1, 0, 0); + print img_picto('', 'company').$form->select_company(0, 'socid', '((client:=:1) OR (client:=:3))', 1, 0, 0); print '
    '.$langs->trans('Category').'
    '.$langs->trans('Category').''; - $texttoshow = null; + $texttoshow = ''; if ($cron['jobtype'] == 'method') { $text = $langs->trans("CronClass"); $texttoshow = $langs->trans('CronModule').': '.$module.'
    '; @@ -6658,7 +6646,7 @@ if ($module == 'initmodule') { print '
    '; print ' '.$langs->trans("PathToModulePackage").' : '; - if (!dol_is_file($outputfilezip)) { + if ($outputfilezip === null || !dol_is_file($outputfilezip)) { print ''.$langs->trans("FileNotYetGenerated").''; } else { $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index d6e49e154b7..978192bb622 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -34,10 +34,10 @@ You can also get a ready-to-use instance in the cloud from https://saas.dolibarr If the module is a ready-to-deploy zip file, so with a name `module_xxx-version.zip` (e.g., when downloading it from a marketplace like [Dolistore](https://www.dolistore.com)), go to menu `Home> Setup> Modules> Deploy external module` and upload the zip file. -Note: If this screen tells you that there is no "custom" directory, check that your setup is correct: - '."\n"; print '
    '; @@ -642,7 +642,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 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'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); @@ -865,7 +865,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->hasRight('mrp', 'read'); // If you can read, you can build the PDF to read content $delallowed = $user->hasRight("mrp", "creer"); // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang); + print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang, '', $object); // Show links to link elements $tmparray = $form->showLinkToObjectBlock($object, array(), array('mo'), 1); @@ -873,7 +873,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $htmltoenteralink = $tmparray['htmltoenteralink']; print $htmltoenteralink; - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, false); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, array()); print '
    '; diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 9e5219d316f..b4e950d82e0 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +157,7 @@ if ($object->id) { 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'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index ea434e1187e..da3b60f5033 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -122,22 +123,22 @@ foreach ($object->fields as $key => $val) { if (!empty($val['visible'])) { $visible = (int) dol_eval((string) $val['visible'], 1); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } if ($key == 'fk_parent_line') { $visible = (int) dol_eval((string) $val['visible'], 1); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible <= 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible <= 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -270,7 +271,7 @@ foreach ($search as $key => $val) { } if ($key == 'status') { - $sql .= natural_search('t.status', $search[$key], 0); + $sql .= natural_search('t.status', (string) $search[$key], 0); continue; } @@ -445,8 +446,8 @@ print ''; print ''; $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')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$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')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); @@ -545,7 +546,7 @@ foreach ($object->fields as $key => $val) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -659,7 +660,7 @@ while ($i < $imaxinloop) { $selected = 1; } } - print $object->getKanbanView('', array('bom'=>($obj->fk_bom > 0 ? $bom : null), 'product'=>($obj->fk_product > 0 ? $product : null), 'selected' => $selected)); + print $object->getKanbanView('', array('bom' => ($obj->fk_bom > 0 ? $bom : null), 'product' => ($obj->fk_product > 0 ? $product : null), 'selected' => $selected)); if ($i == ($imaxinloop - 1)) { print '
    '; print '
    '; if ($objp->fk_project != 0) { - print $movement->get_origin($objp->fk_project, 'project'); + print $objectlist->get_origin($objp->fk_project, 'project'); } print '
    '; print $temps; @@ -1039,7 +1039,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } $qtyhourforline = 0; if ($line->fk_unit) { - $unitforline = measuringUnitString($line->fk_unit, '', '', 1); + $unitforline = measuringUnitString($line->fk_unit, '', null, 1); $qtyhourforline = convertDurationtoHour($line->qty, $unitforline); } @@ -1096,7 +1096,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; $useunit = (($tmpproduct->type == Product::TYPE_PRODUCT && getDolGlobalInt('PRODUCT_USE_UNITS')) || (($tmpproduct->type == Product::TYPE_SERVICE) && ($line->fk_unit))); if ($useunit) { - print measuringUnitString($line->fk_unit, '', '', 2); + print measuringUnitString($line->fk_unit, '', null, 2); } print '
    '; @@ -1186,7 +1186,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
    '; $useunit = (($tmpproduct->type == Product::TYPE_PRODUCT && getDolGlobalInt('PRODUCT_USE_UNITS')) || (($tmpproduct->type == Product::TYPE_SERVICE) && ($line->fk_unit))); if ($useunit) { - print measuringUnitString($line->fk_unit, '', '', 2); + print measuringUnitString($line->fk_unit, '', null, 2); } print '
    '; @@ -1671,7 +1671,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
    '.$line->qty.''.measuringUnitString($line->fk_unit, '', '', 1).''.measuringUnitString($line->fk_unit, '', null, 1).'
    ' . $langs->trans("ManufacturingOrder"); if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { - print ' '; echo '' . $objectlink->getNomUrl(1) . ''.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').''.measuringUnitString($this->tpl['fk_unit'], '', '', 1).''.measuringUnitString($this->tpl['fk_unit'], '', null, 1).''; if ($tmpproduct->isStockManaged()) { @@ -166,7 +170,7 @@ if ($resql) { } // Unit - print ''.measuringUnitString($sub_bom_line->fk_unit, '', '', 1).''.measuringUnitString($sub_bom_line->fk_unit, '', null, 1).'
    '; print $langs->trans("Author").''; -if ($object->fk_user_creat > 0) { +if ($object->fk_user_creat > 0 && $userstatic !== null) { print $userstatic->getLoginUrl(-1); } else { if ($action == 'edit') { diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 3d8135fa900..ca28657af40 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2014 Marcos García * Copyright (C) 2020-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,6 +60,13 @@ class Opensurveysondage extends CommonObject public $date_m; + /** + * Lines of the survey - Note: the type differs from CommonObjectLine[] ! + * + * @var array + */ + public $lines; + /** * 'type' field format: * 'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', @@ -101,7 +108,7 @@ class Opensurveysondage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'id_sondage' => array('type' => 'varchar(16)', 'label' => 'Idsondage', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => -1,), @@ -374,9 +381,9 @@ class Opensurveysondage extends CommonObject /** * 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) { @@ -438,9 +445,9 @@ class Opensurveysondage extends CommonObject /** * Delete object in database * - * @param User $user User that deletes - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @param string $numsondage Num sondage admin to delete + * @param User $user User that deletes + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @param string $numsondage Num sondage admin to delete * @return int Return integer <0 if KO, >0 if OK */ public function delete(User $user, $notrigger = 0, $numsondage = '') @@ -534,7 +541,7 @@ class Opensurveysondage extends CommonObject * @param int<0,2> $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) * @param int<0,1> $notooltip 1=Disable tooltip * @param string $morecss Add more css on link - * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values when clicking * @return string String with URL */ public function getNomUrl($withpicto = 0, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) @@ -719,8 +726,8 @@ class Opensurveysondage extends CommonObject /** * Deletes a comment of the poll * - * @param int $id_comment Id of the comment - * @return boolean False in case of the query fails, true if it was successful + * @param int $id_comment Id of the comment + * @return bool False in case of the query fails, true if it was successful */ public function deleteComment($id_comment) { @@ -758,7 +765,7 @@ class Opensurveysondage extends CommonObject /** * Return status label of Order * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label if status */ public function getLibStatut($mode) @@ -770,8 +777,8 @@ class Opensurveysondage extends CommonObject /** * Return label of status * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @param int $status Id status + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ public function LibStatut($status, $mode) @@ -809,7 +816,7 @@ class Opensurveysondage extends CommonObject /** * Return number of votes done for this survey. * - * @return int Number of votes + * @return int<0,max> Number of votes */ public function countVotes() { @@ -842,7 +849,7 @@ class Opensurveysondage extends CommonObject * @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 array|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/opensurvey/exportcsv.php b/htdocs/opensurvey/exportcsv.php index 94ed3aedfea..0b32e2dad24 100644 --- a/htdocs/opensurvey/exportcsv.php +++ b/htdocs/opensurvey/exportcsv.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013 Laurent Destailleur * Copyright (C) 2014 Marcos García * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +47,7 @@ if (GETPOST('id')) { // Initialize Objects $object = new Opensurveysondage($db); -$result = $object->fetch(0, $numsondage); +$result = $object->fetch('', $numsondage); if ($result <= 0) { dol_print_error(null, 'Failed to get survey id '.$numsondage); } diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 019de14845c..493d10157ab 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2017 Laurent Destailleur * Copyright (C) 2014 Marcos García * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -305,11 +306,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { - // Ensure $fieldstosearchall is set and array - if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) { - $fieldstosearchall = array(); - } - foreach ($fieldstosearchall as $key => $val) { + $fieldstosearchall = array(); + // @phan-suppress-next-line PhanEmptyForeach + foreach ($fieldstosearchall as $key => $val) { // @phpstan-ignore-line $fieldstosearchall[$key] = $langs->trans($val); } print '
    '.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'
    '; diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 8db118c97c1..829a0b79512 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -2,7 +2,7 @@ /* Copyright (C) 2013-2020 Laurent Destailleur * Copyright (C) 2014 Marcos García * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ $action = GETPOST('action', 'aZ09'); $numsondage = GETPOST("id", 'alphanohtml'); $object = new Opensurveysondage($db); -$result = $object->fetch(0, $numsondage); +$result = $object->fetch('', $numsondage); if ($result <= 0) { dol_print_error(null, 'Failed to get survey id '.$numsondage); } @@ -115,6 +115,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // bo $testmodifier = false; $testligneamodifier = false; $ligneamodifier = -1; +$modifier = ''; for ($i = 0; $i < $nblines; $i++) { if (GETPOSTISSET('modifierligne'.$i)) { $ligneamodifier = $i; @@ -226,6 +227,7 @@ if (GETPOSTISSET("ajoutercolonne") && $object->format == "D") { //on rajoute la valeur dans les valeurs $datesbase = explode(",", $object->sujet); $taillebase = count($datesbase); + $cleinsertion = -1; //recherche de l'endroit de l'insertion de la nouvelle date dans les dates deja entrées dans le tableau if ($nouvelledate < $datesbase[0]) { @@ -424,13 +426,14 @@ for ($i = 0; $i < $nbcolonnes; $i++) { */ $form = new Form($db); +$userstatic = null; if ($object->fk_user_creat) { $userstatic = new User($db); $userstatic->fetch($object->fk_user_creat); } -$result = $object->fetch(0, $numsondage); +$result = $object->fetch('', $numsondage); if ($result <= 0) { dol_print_error($db, $object->error); exit; @@ -538,7 +541,7 @@ print '
    '; print $langs->trans("Author").''; -if ($object->fk_user_creat) { +if ($object->fk_user_creat && $userstatic !== null) { print $userstatic->getLoginUrl(-1); } else { print dol_htmlentities($object->nom_admin); @@ -1064,6 +1067,7 @@ if (empty($testligneamodifier)) { // Select value of best choice (for checkbox columns only) $nbofcheckbox = 0; +$meilleurecolonne = null; for ($i = 0; $i < $nbcolonnes + 1; $i++) { if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { $nbofcheckbox++; diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index d12ff0eeb7e..e920cb783ec 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -49,7 +49,7 @@ $_SESSION["formatsondage"] = "D"; $erreur = false; $erreurNb = 0; $choixdate = ''; - +$errheure = array(); /* * Actions @@ -60,7 +60,6 @@ if (GETPOST('confirmation')) { // We save hours entered if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('nbrecaseshoraires', $_SESSION) === true) { $nbofchoice = count($_SESSION["totalchoixjour"]); - $errheure = array(); if ($nbofchoice * $_SESSION["nbrecaseshoraires"] > 200) { setEventMessages($langs->trans("ErrorFieldTooLong"), null, 'errors'); @@ -148,6 +147,7 @@ if (GETPOST('confirmation')) { $erreur = true; } + // Suppress notice regarding $_SESSION @phan-suppress-next-line PhanTypeMismatchArgument if (issetAndNoEmpty('horaires'.$i, $_SESSION) === false || issetAndNoEmpty((string) $j, $_SESSION['horaires'.$i]) === false) { if (issetAndNoEmpty('horaires'.$i, $_SESSION) === true) { $_SESSION["horaires$i"][$j] = ''; @@ -523,6 +523,7 @@ for ($i = 0; $i < $nbrejourmois + $premierjourmois; $i++) { if ($i < $premierjourmois) { print '
    '.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help').'  '; if (!$disabled) { print ''; @@ -499,7 +504,7 @@ foreach ($dirmodels as $reldir) { print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
    '.$langs->trans("MultiPricesNumPrices").'
    '.$form->textwithpicto($langs->trans("UseProductCustomerPackaging"), $langs->trans("PackagingForThisProductSellDesc")).''; + print ajax_constantonoff("PRODUCT_USE_CUSTOMER_PACKAGING", array(), $conf->entity, 0, 0, 0, 0); + //print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_CUSTOMER_PACKAGING) ? $conf->global->PRODUCT_USE_CUSTOMER_PACKAGING : 0), 1); + print '
    '; print '
    '; diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index 0b777f04943..77b16d06800 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -280,7 +280,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { } print '
    '; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
    '; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
    '; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; - print $form->textwithpicto('', $tooltip, 1, 1); + print $form->textwithpicto('', $tooltip, 1, 'help'); print '"; } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index aa46e7ccf0b..26b2db6e80b 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -6,6 +6,7 @@ * Copyright (C) 2021 Maxime Demarest * Copyright (C) 2021 Dorian Vabre * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,7 +45,7 @@ if (!defined('NOBROWSERNOTIF')) { } if (!defined('XFRAMEOPTIONS_ALLOWALL')) { - define('XFRAMEOPTIONS_ALLOWALL', '1'); + define('XFRAMEOPTIONS_ALLOWALL', '1'); } // For MultiCompany module. @@ -394,7 +395,7 @@ if (empty($ipaddress)) { $ipaddress = $_SESSION['ipaddress']; } if (empty($TRANSACTIONID)) { - $TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' :$_SESSION['TRANSACTIONID']; // pi_... or ch_... + $TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID']; // pi_... or ch_... if (empty($TRANSACTIONID) && GETPOST('payment_intent', 'alphanohtml')) { // For the case we use STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2 $TRANSACTIONID = GETPOST('payment_intent', 'alphanohtml'); @@ -588,7 +589,7 @@ if ($ispaymentok) { // Set output language $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? (string) $mysoc->default_lang : (string) $object->thirdparty->default_lang); $paymentdate = $now; $amount = $FinalPaymentAmt; $formatteddate = dol_print_date($paymentdate, 'dayhour', 'auto', $outputlangs); @@ -1445,7 +1446,7 @@ if ($ispaymentok) { $formmail = new FormMail($db); // Set output language $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? (string) $mysoc->default_lang : (string) $thirdparty->default_lang); // Load traductions files required by page $outputlangs->loadLangs(array("main", "members", "eventorganization")); // Get email content from template @@ -1653,18 +1654,18 @@ if ($ispaymentok) { } else { $booth->status = ConferenceOrBooth::STATUS_SUGGESTED; $resultboothupdate = $booth->update($user); - if ($resultboothupdate<0) { + if ($resultboothupdate < 0) { // Finding the thirdparty by getting the invoice $invoice = new Facture($db); $resultinvoice = $invoice->fetch($ref); - if ($resultinvoice<0) { + if ($resultinvoice < 0) { $postactionmessages[] = 'Could not find the associated invoice.'; $ispostactionok = -1; $error++; } else { $thirdparty = new Societe($db); $resultthirdparty = $thirdparty->fetch($invoice->socid); - if ($resultthirdparty<0) { + if ($resultthirdparty < 0) { $error++; setEventMessages(null, $thirdparty->errors, "errors"); } else { @@ -1893,10 +1894,11 @@ if ($ispaymentok) { $payerID = empty($PAYPALPAYERID) ? $_SESSION['payerID'] : $PAYPALPAYERID; // Set by newpayment.php $currencyCodeType = empty($_SESSION['currencyCodeType']) ? '' : $_SESSION['currencyCodeType']; - $FinalPaymentAmt = empty($_SESSION["FinalPaymentAmt"]) ? '': $_SESSION["FinalPaymentAmt"]; + $FinalPaymentAmt = empty($_SESSION["FinalPaymentAmt"]) ? '' : $_SESSION["FinalPaymentAmt"]; $paymentType = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType']; // Seems used by paypal only if (is_object($object) && method_exists($object, 'call_trigger')) { + '@phan-var-force CommonObject $object'; // Call trigger $result = $object->call_trigger('PAYMENTONLINE_PAYMENT_OK', $user); if ($result < 0) { @@ -1904,7 +1906,7 @@ if ($ispaymentok) { } // End call triggers } elseif (get_class($object) == 'stdClass') { - //In some case $object is not instantiate (for paiement on custom object) We need to deal with payment + //In some cases $object is not instantiated (for payment on custom object) We need to deal with payment include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; $paiement = new Paiement($db); $result = $paiement->call_trigger('PAYMENTONLINE_PAYMENT_OK', $user); diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index c835bdd1cf2..d769ac209a0 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -700,7 +700,7 @@ if ($action == "view_ticketlist") { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($arrayfields["ef.".$key]['checked'])) { print 'getAlignFlag($key, $object->table_element); + $cssstring = $extrafields->getCSSClass($key, $object->table_element, 'csslist'); if ($cssstring) { print ' class="'.$cssstring.'"'; } diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index e87dcdbd08e..94c94a778f7 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -387,7 +387,7 @@ if (!empty($object->socialnetworks) && is_array($object->socialnetworks)) { $listOfSocialNetworks = $object->socialnetworks; foreach ($listOfSocialNetworks as $key => $value) { if (!getDolUserString('USER_HIDE_SOCIALNETWORK_'.strtoupper($key), 0, $object)) { - $usersection .= '
    '.dol_print_socialnetworks($key, 0, $object->id, strtolower($key), $socialnetworksdict).'
    '; + $usersection .= '
    '.dol_print_socialnetworks($value, 0, $object->id, strtolower($key), $socialnetworksdict).'
    '; } } } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index f827643d2ea..37a0f4a7af6 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2016 Yasser Carreón * Copyright (C) 2018 Quentin Vial-Gouteyron - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -999,7 +999,7 @@ if ($action == 'create') { /** * @var array $suffix2numAsked map HTTP query parameter suffixes (like '1_0') to line indices so that * extrafields from HTTP query can be assigned to the correct dispatch line - */ + */ $suffix2numAsked = array(); $dispatchLines = array(); @@ -1648,7 +1648,7 @@ if ($action == 'create') { if ($volumeUnit < 50) { print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, getDolGlobalInt('MAIN_VOLUME_DEFAULT_ROUND', -1), getDolGlobalString("MAIN_VOLUME_DEFAULT_UNIT", 'no')); } else { - print $calculatedVolume.' '.measuringUnitString(0, "volume", (string) $volumeUnit); + print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit); } } if ($totalVolume > 0) { diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 55072848b4a..1516689de63 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Quentin Vial-Gouteyron * Copyright (C) 2022-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1447,9 +1447,9 @@ class Reception extends CommonObject /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php index 8a08ff920ff..905a96f9492 100644 --- a/htdocs/reception/dispatch.php +++ b/htdocs/reception/dispatch.php @@ -9,7 +9,7 @@ * Copyright (C) 2017-2022 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019-2020 Christophe Battarel - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -756,13 +756,13 @@ if ($id > 0 || !empty($ref)) { print '
    '; - $dlcdatesuffix = !empty($objd->sellby) ? dol_stringtotime($objd->sellby) : dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); + $dlcdatesuffix = !empty($objd->sellby) ? dol_stringtotime($objd->sellby) : dol_mktime(0, 0, 0, GETPOSTINT('dlc'.$suffix.'month'), GETPOSTINT('dlc'.$suffix.'day'), GETPOSTINT('dlc'.$suffix.'year')); print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, 0, 0, 1, ''); print ''; - $dluodatesuffix = !empty($objd->eatby) ? dol_stringtotime($objd->eatby) : dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); + $dluodatesuffix = !empty($objd->eatby) ? dol_stringtotime($objd->eatby) : dol_mktime(0, 0, 0, GETPOSTINT('dluo'.$suffix.'month'), GETPOSTINT('dluo'.$suffix.'day'), GETPOSTINT('dluo'.$suffix.'year')); print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, 0, 0, 1, ''); print ''; - $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); + $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOSTINT('dlc'.$suffix.'month'), GETPOSTINT('dlc'.$suffix.'day'), GETPOSTINT('dlc'.$suffix.'year')); print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, 0, 0, 1, ''); print ''; - $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); + $dluodatesuffix = dol_mktime(0, 0, 0, GETPOSTINT('dluo'.$suffix.'month'), GETPOSTINT('dluo'.$suffix.'day'), GETPOSTINT('dluo'.$suffix.'year')); print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, 0, 0, 1, ''); print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
    '; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
    '; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
    '.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; + // Customer code + print '
    '.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print '
    '; $tmpcode = $object->code_client; if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { @@ -1564,14 +1566,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
    '; print '
    '.$form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0).''; - print ''; + print '
    '.$form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0).''; + print ''; print ''; if ($conf->browser->layout == 'phone') { print ''; @@ -2332,8 +2334,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Nature of thirdparty $selectedprospect = (GETPOSTISSET('prospect') ? GETPOSTINT('prospect') : $selectedprospect); $selectedcustomer = (GETPOSTISSET('customer') ? GETPOSTINT('customer') : $selectedcustomer); - print ''; - print ''; + if ($conf->browser->layout != 'phone') { + print ''; + } + print ''; print ''; - print ''; print '
    '; $tmpcode = $object->code_fournisseur; if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { $tmpcode = $modCodeFournisseur->getNextValue($object, 1); @@ -1765,7 +1767,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Vat is used print '
    '; - print ''; // Assujeti par default en creation + print ''; // Assujeti par default en creation print '
    '.$form->editfieldkey('', 'customerprospect', '', $object, 0, 'string', '', 0).''; + print '
    '.$form->editfieldkey('', 'customerprospect', '', $object, 0, 'string', '', 0).'browser->layout != 'phone' ? 'colspan="3"' : 'colspan="2"').'>'; if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) { print ''; @@ -2393,7 +2398,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } print '
    '.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; + + print '
    '.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print ''; } - print ''; @@ -400,7 +401,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT // Price minimum print ''; @@ -485,7 +486,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT // Price print '\n"; try { @@ -228,7 +228,7 @@ if (!$rowid) { if ($servicestatus) { $url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id; } - print "\n"; // Stripe customer - print "\n"; // Link - print "\n"; // Origin - print "\n"; // Date payment - print '\n"; + print '\n"; // Type print '"; // Status - print '\n"; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index b63e8a10e9d..d9df53069b4 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1220,6 +1220,7 @@ class Stripe extends CommonObject $description = ""; $ref = ""; + $invoice = null; if ($origin == 'order') { $order = new Commande($this->db); $order->fetch($item); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index ec208b3e905..fd534683010 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -16,7 +16,7 @@ * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2022 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -192,7 +192,12 @@ class SupplierProposal extends CommonObject * @var array (Encoded as JSON in database) */ public $extraparams = array(); + + /** + * @var SupplierProposalLine[] + */ public $lines = array(); + /** * @var SupplierProposalLine */ @@ -1992,7 +1997,7 @@ class SupplierProposal extends CommonObject $ga = array(); $search_sale = 0; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } @@ -2261,7 +2266,7 @@ class SupplierProposal extends CommonObject public function load_board($user, $mode) { // phpcs:enable - global $conf, $user, $langs; + global $conf, $langs; $now = dol_now(); @@ -2269,7 +2274,7 @@ class SupplierProposal extends CommonObject $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.date_cloture as datefin"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".((int) $user->id); $clause = " AND"; @@ -2427,7 +2432,7 @@ class SupplierProposal extends CommonObject $sql = "SELECT count(p.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".((int) $user->id); $clause = "AND"; @@ -2799,9 +2804,9 @@ class SupplierProposal extends CommonObject /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 8046729f74c..a6b657987a0 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -74,8 +74,8 @@ $mode = GETPOST('mode', 'alpha'); $search_user = GETPOST('search_user', 'intcomma'); $search_sale = GETPOST('search_sale', 'intcomma'); $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); -$search_societe = GETPOST('search_societe', 'alpha'); -$search_societe_alias = GETPOST('search_societe_alias', 'alpha'); +$search_company = GETPOST('search_company', 'alpha'); +$search_company_alias = GETPOST('search_company_alias', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); @@ -208,7 +208,8 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan -if (!$user->hasRight('societe', 'client', 'voir')) { +// Check only if it's an internal user +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } @@ -246,8 +247,8 @@ if (empty($reshook)) { $search_user = ''; $search_sale = ''; $search_ref = ''; - $search_societe = ''; - $search_societe_alias = ''; + $search_company = ''; + $search_company_alias = ''; $search_montant_ht = ''; $search_montant_vat = ''; $search_montant_ttc = ''; @@ -304,6 +305,14 @@ $formcompany = new FormCompany($db); $now = dol_now(); +if ($socid > 0) { + $soc = new Societe($db); + $soc->fetch($socid); + if (empty($search_company)) { + $search_company = $soc->name; + } +} + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields @@ -372,14 +381,14 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { if ($search_ref) { $sql .= natural_search('sp.ref', $search_ref); } -if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) { - $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe); +if (empty($arrayfields['s.name_alias']['checked']) && $search_company) { + $sql .= natural_search(array("s.nom", "s.name_alias"), $search_company); } else { - if ($search_societe) { - $sql .= natural_search('s.nom', $search_societe); + if ($search_company) { + $sql .= natural_search('s.nom', $search_company); } - if ($search_societe_alias) { - $sql .= natural_search('s.name_alias', $search_societe_alias); + if ($search_company_alias) { + $sql .= natural_search('s.name_alias', $search_company_alias); } } if ($search_login) { @@ -581,11 +590,11 @@ if ($resql) { if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } - if ($search_societe) { - $param .= '&search_societe='.urlencode($search_societe); + if ($search_company) { + $param .= '&search_company='.urlencode($search_company); } - if ($search_societe_alias) { - $param .= '&search_societe_alias='.urlencode($search_societe_alias); + if ($search_company_alias) { + $param .= '&search_company_alias='.urlencode($search_company_alias); } if ($search_user > 0) { $param .= '&search_user='.urlencode((string) ($search_user)); @@ -752,12 +761,12 @@ if ($resql) { } if (!empty($arrayfields['s.nom']['checked'])) { print ''; } if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; } if (!empty($arrayfields['s.town']['checked'])) { diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index a1e33ab79a0..4e075c6d991 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -3,7 +3,7 @@ * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2021 Nicolas ZABOURI * Copyright (C) 2022 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -242,7 +242,7 @@ foreach ($dirmodels as $reldir) { } print ''; print "\n"; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index b2d9add1f77..c04c40a3d51 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -537,6 +537,10 @@ function MoreProducts(moreorless) { function ClickProduct(position, qty = 1) { console.log("ClickProduct at position"+position); + if ($('#invoiceid').val() == "") { + invoiceid = $('#invoiceid').val(); + Refresh(); + } $('#proimg'+position).animate({opacity: '0.5'}, 1); $('#proimg'+position).animate({opacity: '1'}, 100); if ($('#prodiv'+position).data('iscat')==1){ @@ -1027,6 +1031,7 @@ function ModalBox(ModalID) function DirectPayment(){ console.log("DirectPayment"); $("#poslines").load("invoice.php?place="+place+"&action=valid&token=&pay=LIQ", function() { + $('#invoiceid').val(""); }); } diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 4bc6cf0d0b3..b753dcef0eb 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -363,6 +363,7 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) { parent.$("#poslines").load("invoice.php?place=&action=valid&token=&pay="+payment+"&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() { if (amountpayed > || amountpayed == || amountpayed==0 ) { console.log("Close popup"); + parent.$('#invoiceid').val(""); parent.$.colorbox.close(); } else { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 92b1b7df0e0..2b42d7f9937 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -323,6 +323,7 @@ tr.liste_titre_filter th.liste_titre { text-align: unset; } input { font-size: unset; + box-sizing: border-box; } select.vmenusearchselectcombo { background-color: unset; @@ -2313,7 +2314,7 @@ datalist { .linkobject { cursor: pointer; } -table.tableforfield tr:not(.liste_titre)>td:first-of-type, tr.trforfield:not(.liste_titre)>td:first-of-type, div.tableforfield div.tagtr:not(.liste_titre)>div.tagtd:first-of-type { +table.tableforfield tr:not(.liste_titre)>td:first-of-type:not(.nottitleforfield), tr.trforfield:not(.liste_titre)>td:first-of-type, div.tableforfield div.tagtr:not(.liste_titre)>div.tagtd:first-of-type { color: var(--tableforfieldcolor); } @@ -2932,11 +2933,11 @@ img.photorefnoborder { display:none; background: var(--colorbackhmenu1); - /* background-image: linear-gradient(-45deg, , var(--colorbackhmenu1)); */ - - box-shadow: 0px 0px 4px #ddd; - - + + border-bottom: 1px solid var(--colorbackgrey); + box-shadow: 0 0 3px var(--colorbackgrey); + + } div#tmenu_tooltip { @@ -3148,7 +3149,7 @@ a.tmenuimage:hover{ /* To show text of top menu according to option THEME_TOPMENU_DISABLE_IMAGE */ -/* Text hidden by default */ +/* Text hidden by default when option THEME_TOPMENU_DISABLE_IMAGE */ .tmenulabel:not(.menuhider), .tmenulabel:not(.menuhider)::before { display: none; @@ -3161,7 +3162,7 @@ span.tmenuimage:not(.menuhider), span.tmenuimage:not(.menuhider)::before { margin-top: 8px !important; } -div.tmenucenter { /* we must have a field length of top menu to avoid size to change when in mode text on hover */ +div.tmenucenter { /* we set a size of each top menu entry to avoid size to change when in mode "text on hover". Note: When no reduction and full menu shown, there is no width forced, we rely on short labels only. */ width: 80px; overflow: hidden; text-overflow: ellipsis; @@ -5508,8 +5509,8 @@ div.boximport { .fieldrequired { font-weight: bold; color: var(--fieldrequiredcolor) !important; } -td.widthpictotitle, .table-fiche-title img.widthpictotitle { width: 38px; text-align: ; } -span.widthpictotitle { font-size: 1.7em; } +td.widthpictotitle, .table-fiche-title img.widthpictotitle { width: 34px; text-align: ; } +span.widthpictotitle { font-size: 1.5em; } table.titlemodulehelp tr td img.widthpictotitle { width: 80px; } .dolgraphtitle { margin-top: 6px; margin-bottom: 4px; } @@ -6138,6 +6139,7 @@ table.cal_month { border-spacing: 0px; } table.cal_month td:first-child { border-left: 0px; } table.cal_month td:last-child { border-right: 0px; } table.cal_month td { padding-left: 1px !important; padding-right: 1px !important; } +table.cal_month.cal_peruser td { padding-left: 0 !important; padding-right: 0 !important; } .cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_current_month_peruserleft { border-top: 0; border-left: solid 2px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_current_month_oneday { border-right: solid 1px #E0E0E0; } @@ -6153,7 +6155,7 @@ table.cal_month td { padding-left: 1px !important; padding-right: 1px !important .cal_today_peruser { background: #FDFDF0; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today_peruser_peruserleft { background: #FDFDF0; border-left: solid 2px #6C7C7B; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past { } -.cal_peruser { padding-top: 0 !important; padding-bottom: 0 !important; padding-: 1px !important; padding-: 1px !important; } +.cal_peruser { padding-top: 0 !important; padding-bottom: 0 !important; padding-: 0 !important; padding-: 0 !important; } .cal_impair { background: linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%); background: -o-linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%); @@ -6190,10 +6192,12 @@ td.small.cal_event { td.cal_other_month { opacity: 0.7; } - td.event-past span { opacity: 0.5; } +td.peruser_holiday_imp { + background-color: #aaa !important; +} .cal_available { background: #0060d450; } .cal_chosen { background: #0060d4; } @@ -7374,10 +7378,10 @@ span#select2-boxbookmark-container { /* To emulate select 2 style */ .select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr { - padding: 3px 5px 2px 5px; + padding: 3px 5px 3px 5px; margin: 0 0 2px 3px; position: relative; - line-height: 13px; + /* line-height: 1em; */ color: #333; cursor: default; border: 1px solid #aaaaaa; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 44f1ff7ddd8..24f981291a5 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -329,10 +329,10 @@ if (getDolGlobalString('THEME_INFOBOX_COLOR_ON_BACKGROUND')) { } if (!isset($conf->global->THEME_SATURATE_RATIO)) { - $conf->global->THEME_SATURATE_RATIO = 0.7; + $conf->global->THEME_SATURATE_RATIO = 0.8; } if (GETPOSTISSET('THEME_SATURATE_RATIO')) { - $conf->global->THEME_SATURATE_RATIO = GETPOSTINT('THEME_SATURATE_RATIO'); + $conf->global->THEME_SATURATE_RATIO = GETPOSTFLOAT('THEME_SATURATE_RATIO'); } ?> @@ -341,8 +341,8 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { color: #fff !important; opacity: 0.95; - global->THEME_SATURATE_RATIO)) { ?> - filter: saturate(global->THEME_SATURATE_RATIO; ?>); + + filter: saturate(); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 9ce2b990fcd..4fad79772c3 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -411,7 +411,7 @@ print 'fontsizesmaller='.$fontsizesmaller."\n"; print 'topMenuFontSize='.$topMenuFontSize."\n"; print 'toolTipBgColor='.$toolTipBgColor."\n"; print 'toolTipFontColor='.$toolTipFontColor."\n"; -print 'conf->global->THEME_SATURATE_RATIO='.getDolGlobalString('THEME_SATURATE_RATIO')." (must be between 0 and 1)\n"; +print 'getDolGlobalString("THEME_SATURATE_RATIO")='.getDolGlobalString('THEME_SATURATE_RATIO')." (must be between 0 and 1)\n"; print '*/'."\n"; diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index f2afc753cf4..a0588f5656b 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -34,10 +34,10 @@ if (getDolGlobalString('THEME_INFOBOX_COLOR_ON_BACKGROUND')) { } if (!isset($conf->global->THEME_SATURATE_RATIO)) { - $conf->global->THEME_SATURATE_RATIO = 0.7; + $conf->global->THEME_SATURATE_RATIO = 0.8; } if (GETPOSTISSET('THEME_SATURATE_RATIO')) { - $conf->global->THEME_SATURATE_RATIO = GETPOSTINT('THEME_SATURATE_RATIO'); + $conf->global->THEME_SATURATE_RATIO = GETPOSTFLOAT('THEME_SATURATE_RATIO'); } ?> @@ -241,8 +241,8 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { height: 94px; /* must be same height as min-height of .info-box */ width: 86px; background: var(--colorbacktitle1) !important; - global->THEME_SATURATE_RATIO)) { ?> - filter: saturate(global->THEME_SATURATE_RATIO; ?>); + + filter: saturate(); } @@ -459,10 +459,10 @@ if (getDolGlobalString('THEME_INFOBOX_COLOR_ON_BACKGROUND')) { } if (!isset($conf->global->THEME_SATURATE_RATIO)) { - $conf->global->THEME_SATURATE_RATIO = 0.7; + $conf->global->THEME_SATURATE_RATIO = 0.8; } if (GETPOSTISSET('THEME_SATURATE_RATIO')) { - $conf->global->THEME_SATURATE_RATIO = GETPOSTINT('THEME_SATURATE_RATIO'); + $conf->global->THEME_SATURATE_RATIO = GETPOSTFLOAT('THEME_SATURATE_RATIO'); } ?> .bg-infobox-project i.fa{ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 73c8d8f4e2b..185e9916abb 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -573,9 +573,11 @@ select.vmenusearchselectcombo { textarea:focus { /* v6 box-shadow: 0 0 4px #8091BF; */ border: 1px solid #aaa !important; + /* padding-left: 3px; padding-right: 3px; padding-top: 3px; + */ } input:focus, textarea:focus, button:focus:not(.button_search_x):not(.button_search):not(.button_removefilter), select:focus, @@ -609,10 +611,12 @@ select#date_startday, select#date_startmonth, select#date_endday, select#date_en margin-right: 4px; } -input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { - color: var(--colortext); +input, input.flat, form.flat select, select, select.flat, .dataTables_length label select { border: none; +} +input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { border: solid 1px var(--inputbordercolor); + color: var(--colortext); font-family: ; outline: none; margin: 0px 0px 0px 0px; @@ -2831,7 +2835,7 @@ td.nobordernopadding.widthpictotitle.col-picto { width: 14px; } span.widthpictotitle { - font-size: 1.3em; + font-size: 1em; } .table-list-of-attached-files .col-picto, .table-list-of-links .col-picto { opacity: 0.7 !important; @@ -4499,7 +4503,7 @@ tr.liste_titre_filter td.liste_titre { padding-top: 4px; padding-bottom: 3px; } -.liste_titre_create td:not(.linecoldescription), .liste_titre_create th, .liste_titre_create .tagtd +.liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd { border-top-width: 1px; border-top-color: var(--colortopbordertitle1); @@ -6067,6 +6071,8 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im table.cal_month { border-spacing: 0px; } table.cal_month td:first-child { border-left: 0px; } table.cal_month td:last-child { border-right: 0px; } +table.cal_month td { padding-left: 1px !important; padding-right: 1px !important; } +table.cal_month.cal_peruser td { padding-left: 0 !important; padding-right: 0 !important; } .cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_current_month_peruserleft { border-top: 0; border-left: solid 2px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_current_month_oneday { border-right: solid 1px #E0E0E0; } @@ -6115,6 +6121,12 @@ td.small.cal_event { td.cal_other_month { opacity: 0.7; } +td.event-past span { + opacity: 0.5; +} +td.peruser_holiday_imp { + background-color: #aaa !important; +} .cal_available { background: #0060d450; } .cal_chosen { background: #0060d4; } @@ -7220,10 +7232,10 @@ span#select2-boxbookmark-container, span#select2-boxcombo-container { /* To emulate select 2 style */ .select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr { - padding: 3px 5px 2px 5px; + padding: 3px 5px 3px 5px; margin: 0 0 2px 3px; position: relative; - line-height: 13px; + /* line-height: 1em; */ color: #444; cursor: default; border: 1px solid #ddd; @@ -7320,6 +7332,7 @@ select.multiselectononeline { box-shadow: none; -webkit-box-shadow: none !important; box-shadow: none !important; + margin-top: 1px !important; margin-bottom: 0 !important; } span.noborderoncategories a, li.noborderoncategories a { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index fce2b25fe37..84d5297f4c0 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2021 Alexandre Spangaro * Copyright (C) 2022-2023 Charlene Benke * Copyright (C) 2023 Benjamin Falière - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Irvine FLEITH * * This program is free software; you can redistribute it and/or modify @@ -77,6 +77,7 @@ $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); +$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma') ? GETPOST('sortfield', 'aZ09comma') : "a.datep"; $sortorder = GETPOST('sortorder', 'aZ09comma') ? GETPOST('sortorder', 'aZ09comma') : "desc"; $search_rowid = GETPOST('search_rowid'); @@ -786,7 +787,7 @@ if ($action == 'create' || $action == 'presend') { } // Default select all or no contact - $default = (getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') ? -2 : -3); + $default = (getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') ? '-2' : '-3'); $formquestion = array( array( 'name' => 'contactid', @@ -986,7 +987,7 @@ if ($action == 'create' || $action == 'presend') { } $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); if (!empty($object->socid)) { - $morehtmlref .= ' - '.img_picto($langs->trans("Tickets"), 'ticket', 'class="pictofixedwidth"').' '.$langs->trans("TicketHistory").''; + $morehtmlref .= ' - '.img_picto($langs->trans("Tickets"), 'ticket', 'class="pictofixedwidth"').' '.$langs->trans("TicketHistory").''; } } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index c3206e04120..6b2d9e759c9 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -162,17 +162,19 @@ class Tickets extends DolibarrApi if ($this->ticket->cache_msgs_ticket[$i]['fk_user_author'] > 0) { $user_action = new User($this->db); $user_action->fetch($this->ticket->cache_msgs_ticket[$i]['fk_user_author']); + } else { + $user_action = null; } // Now define messages $messages[] = array( - 'id' => $this->ticket->cache_msgs_ticket[$i]['id'], - 'fk_user_action' => $this->ticket->cache_msgs_ticket[$i]['fk_user_author'], - 'fk_user_action_socid' => $user_action->socid, - 'fk_user_action_string' => dolGetFirstLastname($user_action->firstname, $user_action->lastname), - 'message' => $this->ticket->cache_msgs_ticket[$i]['message'], - 'datec' => $this->ticket->cache_msgs_ticket[$i]['datec'], - 'private' => $this->ticket->cache_msgs_ticket[$i]['private'] + 'id' => $this->ticket->cache_msgs_ticket[$i]['id'], + 'fk_user_action' => $this->ticket->cache_msgs_ticket[$i]['fk_user_author'], + 'fk_user_action_socid' => $user_action === null ? '' : $user_action->socid, + 'fk_user_action_string' => $user_action === null ? '' : dolGetFirstLastname($user_action->firstname, $user_action->lastname), + 'message' => $this->ticket->cache_msgs_ticket[$i]['message'], + 'datec' => $this->ticket->cache_msgs_ticket[$i]['datec'], + 'private' => $this->ticket->cache_msgs_ticket[$i]['private'] ); $i++; } @@ -552,7 +554,6 @@ class Tickets extends DolibarrApi "cache_msgs_ticket", "cache_logs_ticket", "cache_types_tickets", - "cache_category_tickets", "regeximgext", "labelStatus", "labelStatusShort", diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index d34b0a2187e..ae86cfe6df9 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -87,7 +87,7 @@ class CTicketCategory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index cd1e659e1f5..92c95699183 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2023 Charlene Benke * Copyright (C) 2023-2024 Benjamin Falière * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -216,11 +216,6 @@ class Ticket extends CommonObject */ public $cache_types_tickets; - /** - * @var array Cache of Ticket categories - */ - public $cache_category_tickets; - /** * @var array cache msgs ticket */ @@ -465,7 +460,6 @@ class Ticket extends CommonObject } /** - * * Check if ref exists or not * * @param string $action Action @@ -890,7 +884,7 @@ class Ticket extends CommonObject $socid = $user->socid ?: 0; // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } // Search on sale representative @@ -1385,9 +1379,9 @@ class Ticket extends CommonObject */ public function loadCacheCategoriesTickets($publicgroup = -1) { - global $langs; + global $conf, $langs; - if ($publicgroup == -1 && !empty($this->cache_category_tickets) && count($this->cache_category_tickets)) { + if ($publicgroup == -1 && !empty($conf->cache['category_tickets']) && count($conf->cache['category_tickets'])) { // Cache already loaded return 0; } @@ -1409,18 +1403,18 @@ class Ticket extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $this->cache_category_tickets[$obj->rowid]['code'] = $obj->code; - $this->cache_category_tickets[$obj->rowid]['use_default'] = $obj->use_default; - $this->cache_category_tickets[$obj->rowid]['pos'] = $obj->pos; - $this->cache_category_tickets[$obj->rowid]['public'] = $obj->public; - $this->cache_category_tickets[$obj->rowid]['active'] = $obj->active; - $this->cache_category_tickets[$obj->rowid]['force_severity'] = $obj->force_severity; - $this->cache_category_tickets[$obj->rowid]['fk_parent'] = $obj->fk_parent; + $conf->cache['category_tickets'][$obj->rowid]['code'] = $obj->code; + $conf->cache['category_tickets'][$obj->rowid]['use_default'] = $obj->use_default; + $conf->cache['category_tickets'][$obj->rowid]['pos'] = $obj->pos; + $conf->cache['category_tickets'][$obj->rowid]['public'] = $obj->public; + $conf->cache['category_tickets'][$obj->rowid]['active'] = $obj->active; + $conf->cache['category_tickets'][$obj->rowid]['force_severity'] = $obj->force_severity; + $conf->cache['category_tickets'][$obj->rowid]['fk_parent'] = $obj->fk_parent; // If translation exists, we use it to store already translated string. // Warning: You should not use this and recompute the translated string into caller code to get the value into expected language $label = ($langs->trans("TicketCategoryShort".$obj->code) != "TicketCategoryShort".$obj->code ? $langs->trans("TicketCategoryShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); - $this->cache_category_tickets[$obj->rowid]['label'] = $label; + $conf->cache['category_tickets'][$obj->rowid]['label'] = $label; $i++; } @@ -3156,7 +3150,7 @@ class Ticket extends CommonObject $sql = "SELECT p.rowid, p.ref, p.datec as datec"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; - if (isModEnabled('societe') && !$user->hasRight('societe', 'client', 'voir') && !$user->socid) { + if (empty($user->socid) && isModEnabled('societe') && !$user->hasRight('societe', 'client', 'voir') && !$user->socid) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".((int) $user->id); $clause = " AND"; @@ -3220,7 +3214,7 @@ class Ticket extends CommonObject $sql = "SELECT count(p.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; - if (!$user->hasRight('societe', 'client', 'voir')) { + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".((int) $user->id); $clause = "AND"; @@ -3260,9 +3254,9 @@ class Ticket extends CommonObject /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index c54ebd897f0..009bf1536f8 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -126,7 +126,11 @@ $search_all = trim(GETPOST("search_all", 'alphanohtml')); $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') { - $search[$key] = GETPOST('search_'.$key, 'alpha'); + if (isset($val['arrayofkeyval'])) { + $search[$key] = GETPOST('search_'.$key, 'array'); + } else { + $search[$key] = GETPOST('search_'.$key, 'alpha'); + } } else { $search[$key] = ""; } @@ -394,13 +398,15 @@ foreach ($search as $key => $val) { $tmpkey = 't.' . $key; if ($key == 'fk_statut' && !empty($search['fk_statut'])) { $newarrayofstatus = array(); - foreach ($search['fk_statut'] as $key2 => $val2) { - if (in_array($val2, array('openall', 'closeall'))) { - continue; + if (is_array($search['fk_statut'])) { + foreach ($search['fk_statut'] as $key2 => $val2) { + if (in_array($val2, array('openall', 'closeall'))) { + continue; + } + $newarrayofstatus[] = $val2; } - $newarrayofstatus[] = $val2; } - if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) { + if ($search['fk_statut'] == 'openall' || (is_array($search['fk_statut']) && in_array('openall', $search['fk_statut']))) { $newarrayofstatus[] = Ticket::STATUS_NOT_READ; $newarrayofstatus[] = Ticket::STATUS_READ; $newarrayofstatus[] = Ticket::STATUS_ASSIGNED; @@ -408,7 +414,7 @@ foreach ($search as $key => $val) { $newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO; $newarrayofstatus[] = Ticket::STATUS_WAITING; } - if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) { + if ($search['fk_statut'] == 'closeall' || (is_array($search['fk_statut']) && in_array('closeall', $search['fk_statut']))) { $newarrayofstatus[] = Ticket::STATUS_CLOSED; $newarrayofstatus[] = Ticket::STATUS_CANCELED; } @@ -908,7 +914,11 @@ foreach ($object->fields as $key => $val) { //var_dump(array_values($search[$key])); $selectedarray = null; if (!empty($search[$key])) { - $selectedarray = array_values($search[$key]); + if (is_array($search[$key])) { + $selectedarray = array_values($search[$key]); + } else { + $selectedarray = array($search[$key]); // Compatibility with "Default search filters" + } } print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'search_status width150 onrightofpage', 1, 0, '', '', ''); print ''; diff --git a/htdocs/user/agenda.php b/htdocs/user/agenda.php index 60e4cb1863d..6b4719d18a4 100644 --- a/htdocs/user/agenda.php +++ b/htdocs/user/agenda.php @@ -50,7 +50,7 @@ if (!isset($id) || empty($id)) { } if (GETPOST('actioncode', 'array')) { - $actioncode = GETPOST('actioncode', 'array', 3); + $actioncode = GETPOST('actioncode', 'array:alpha', 3); if (!count($actioncode)) { $actioncode = '0'; } diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 61fadf541b6..64a4ff39cd3 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -1,4 +1,5 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2015 Laurent Destailleur @@ -7,7 +8,7 @@ * Copyright (C) 2015-2016 Marcos García * Copyright (C) 2015-2024 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -62,6 +63,16 @@ if (isModEnabled('accounting')) { * @var User $user */ +// $moreparam is used, but it is unclear how it is set, keeping the variable and ensuring it exists. +// $countrynotdefined is used, but it is unclear how it is set. +' +@phan-var-force ?string $moreparam +@phan-var-force ?string $countrynotdefined +'; +if (!isset($moreparam)) { + $moreparam = null; +} + // Load translation files required by page $langs->loadLangs(array('companies', 'commercial', 'banks', 'bills', 'trips', 'holiday', 'salaries')); @@ -104,8 +115,8 @@ if (empty($account->userid)) { // Define value to know what current user can do on users $selfpermission = ($user->id == $id && $user->hasRight('user', 'self', 'creer')); -$usercanadd = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write') ); -$usercanread = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read') ); +$usercanadd = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); +$usercanread = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read')); $permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $selfpermission); $permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write'); $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write'); @@ -1025,6 +1036,10 @@ if ($id && ($action == 'edit' || $action == 'create') && $permissiontoaddbankacc foreach ($bankaccount->getFieldsToShow(1) as $val) { $require = false; $tooltip = ''; + $name = 'UNKNOWN'; + $size = '8'; + $content = 'UNKNOWN'; + if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 19334550f40..2bdad47acc9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -13,7 +13,7 @@ * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2015-2018 Charlene Benke * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2018 David Beniamine * Copyright (C) 2024 MDW * @@ -70,17 +70,19 @@ if (isModEnabled('stock')) { * @var HookManager $hookmanager * @var Translate $langs * @var User $user + * + * @var string $dolibarr_main_authentication */ // Load translation files required by page $langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks', 'other')); $id = GETPOSTINT('id'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $mode = GETPOST('mode', 'alpha'); -$confirm = GETPOST('confirm', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $group = GETPOSTINT("group", 3); -$cancel = GETPOST('cancel', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'useracard'; // To manage different context of search if (empty($id) && $action != 'add' && $action != 'create') { @@ -876,6 +878,7 @@ $formother = new FormOther($db); $formcompany = new FormCompany($db); $formadmin = new FormAdmin($db); $formfile = new FormFile($db); +$formproduct = null; if (isModEnabled('stock')) { $formproduct = new FormProduct($db); } @@ -2566,32 +2569,32 @@ if ($action == 'create' || $action == 'adduserldap') { } if ($object->socid > 0 && !($object->contact_id > 0)) { // external user but no link to a contact - print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); - print img_picto('', 'contact'); + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); + print img_picto('', 'contact', 'class="pictofixedwidth"'); //print $form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); print $form->select_contact(0, 0, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif ($object->socid > 0 && $object->contact_id > 0) { // external user with a link to a contact - print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set - print img_picto('', 'contact'); + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set + print img_picto('', 'contact', 'class="pictofixedwidth"'); //print $form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); print $form->select_contact(0, $object->contact_id, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif (!($object->socid > 0) && $object->contact_id > 0) { // internal user with a link to a contact - print img_picto('', 'company').$form->select_company(0, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set - print img_picto('', 'contact'); + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(0, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set + print img_picto('', 'contact', 'class="pictofixedwidth"'); //print $form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); print $form->select_contact(0, $object->contact_id, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } else { // $object->socid is not > 0 here - print img_picto('', 'company').$form->select_company(0, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set - print img_picto('', 'contact'); + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(0, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set + print img_picto('', 'contact', 'class="pictofixedwidth"'); //print $form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); print $form->select_contact(0, 0, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 549bbb4454d..3c46fd80675 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -14,7 +14,7 @@ * Copyright (C) 2018-2021 Nicolas ZABOURI * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2019 Abbes Bahfir - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Lenin Rivas * * This program is free software; you can redistribute it and/or modify @@ -3345,9 +3345,9 @@ class User extends CommonObject /** * Return clickable link of object (optionally with picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 81b9945e780..04f014d7133 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Abbes Bahfir * Copyright (C) 2023-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1039,9 +1039,9 @@ class UserGroup extends CommonObject /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index 568d7b6d5d7..8c7a4d1b5fb 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2024 Regis Houssin * Copyright (C) 2011 Herve Prot * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,7 +60,7 @@ $search = array(); $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); +$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; @@ -87,6 +88,8 @@ if (!$sortorder) { $sortorder = "ASC"; } +$arrayfields = array(); + // List of fields to search into when doing a "search in all" $fieldstosearchall = array(); foreach ($object->fields as $key => $val) { @@ -126,7 +129,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array(); +$parameters = array('arrayfields' => &$arrayfields); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -145,6 +148,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } + $search_all = ''; $toselect = array(); $search_array_options = array(); } @@ -219,7 +223,9 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { // Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); - +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); +} $resql = $db->query($sql); if (!$resql) { dol_print_error($db); @@ -248,6 +254,10 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} + foreach ($search as $key => $val) { if (is_array($search[$key])) { foreach ($search[$key] as $skey) { @@ -256,16 +266,13 @@ foreach ($search as $key => $val) { } } } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { - $param .= '&search_'.$key.'month='.(GETPOSTINT('search_'.$key.'month')); - $param .= '&search_'.$key.'day='.(GETPOSTINT('search_'.$key.'day')); - $param .= '&search_'.$key.'year='.(GETPOSTINT('search_'.$key.'year')); + $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month'); + $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day'); + $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year'); } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } -if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); -} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks @@ -303,8 +310,8 @@ print ''; print ''; $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')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$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')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); if ($caneditperms) { $newcardbutton .= dolGetButtonTitleSeparator(); @@ -322,6 +329,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { $setupstring = ''; + // @phan-suppress-next-line PhanEmptyForeach foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); $setupstring .= $key."=".$val.";"; @@ -346,27 +354,27 @@ if (!empty($moreforfilter)) { print ''; } -$varpage=empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column ? 'left' : ''); // This also change content of $arrayfields with user setup $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); -print '
    '; -print '
    '; $tmpcode = $object->code_client; if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { @@ -2410,7 +2416,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
    '.$form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0).''; + print ''.$form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0).''; if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) { print 'browser->layout == 'phone' ? '' : ' colspan="3"').'>'; print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1); print ''; - $colspan = ($conf->browser->layout == 'phone' ? 2 : 4); - print ' '; + //$colspan = ($conf->browser->layout == 'phone' ? 2 : 4); + $colspan = 4; + print ''; // Address print ''; @@ -2550,7 +2557,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Social network if (isModEnabled('socialnetworks')) { - $colspan = ($conf->browser->layout == 'phone' ? 2 : 4); + //$colspan = ($conf->browser->layout == 'phone' ? 2 : 4); + $colspan = 4; $object->showSocialNetwork($socialnetworks, $colspan); @@ -2833,24 +2841,24 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (isModEnabled('accounting')) { /** @var FormAccounting $formaccounting */ // Accountancy_code_sell - print ''; + print ''; print ''; // Accountancy_code_buy - print ''; + print ''; print ''; } else { // For external software // Accountancy_code_sell - print ''; + print ''; print ''; // Accountancy_code_buy - print ''; + print ''; print ''; } diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 7847255fe64..bfdbf8c7920 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -86,7 +86,7 @@ class CompanyBankAccount extends Account // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => -1,), diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 107ee3af714..69701cab92c 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -72,7 +72,7 @@ class CompanyPaymentMode extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'Rowid', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8ced8b891c4..7c1e75992fc 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -174,7 +174,7 @@ class Societe extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), @@ -2525,7 +2525,7 @@ class Societe extends CommonObject // Position current discount $sql = "UPDATE ".MAIN_DB_PREFIX."societe "; - $sql .= " SET remise_supplier = '".$this->db->escape($remise)."'"; + $sql .= " SET remise_supplier = ".((float) $remise); $sql .= " WHERE rowid = ".((int) $this->id); $resql = $this->db->query($sql); if (!$resql) { @@ -2537,7 +2537,7 @@ class Societe extends CommonObject // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_supplier"; $sql .= " (entity, datec, fk_soc, remise_supplier, note, fk_user_author)"; - $sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; + $sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", ".((float) $remise).","; $sql .= " '".$this->db->escape($note)."',"; $sql .= " ".((int) $user->id); $sql .= ")"; @@ -2574,7 +2574,7 @@ class Societe extends CommonObject global $langs; // Clean parameters - $remise = price2num($remise); + $remise = (float) price2num($remise); $desc = trim($desc); // Check parameters @@ -2603,15 +2603,26 @@ class Societe extends CommonObject $discount->socid = $this->id; $discount->discount_type = $discount_type; + $discount->multicurrency_code = $this->multicurrency_code; + list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); + $discount->multicurrency_tx = $this->multicurrency_tx; if ($price_base_type == 'TTC') { - $discount->amount_ttc = $discount->multicurrency_amount_ttc = price2num($remise, 'MT'); - $discount->amount_ht = $discount->multicurrency_amount_ht = price2num((float) $remise / (1 + (float) $vatrate / 100), 'MT'); - $discount->amount_tva = $discount->multicurrency_amount_tva = price2num((float) $discount->amount_ttc - (float) $discount->amount_ht, 'MT'); + $discount->multicurrency_amount_ttc = price2num($remise * (float) $discount->multicurrency_tx, 'MT'); + $discount->multicurrency_amount_ht = price2num(((float) $remise / (1 + (float) $vatrate / 100)) * (float) $discount->multicurrency_tx, 'MT'); + $discount->multicurrency_amount_tva = price2num(((float) $discount->amount_ttc - (float) $discount->amount_ht) * (float) $discount->multicurrency_tx, 'MT'); + + $discount->amount_ttc = price2num($remise, 'MT'); + $discount->amount_ht = price2num((float) $remise / (1 + (float) $vatrate / 100), 'MT'); + $discount->amount_tva = price2num((float) $discount->amount_ttc - (float) $discount->amount_ht, 'MT'); } else { - $discount->amount_ht = $discount->multicurrency_amount_ht = price2num($remise, 'MT'); - $discount->amount_tva = $discount->multicurrency_amount_tva = price2num((float) $remise * (float) $vatrate / 100, 'MT'); - $discount->amount_ttc = $discount->multicurrency_amount_ttc = price2num((float) $discount->amount_ht + (float) $discount->amount_tva, 'MT'); + $discount->amount_ht = price2num($remise, 'MT'); + $discount->amount_tva = price2num((float) $remise * (float) $vatrate / 100, 'MT'); + $discount->amount_ttc = price2num((float) $discount->amount_ht + (float) $discount->amount_tva, 'MT'); + + $discount->multicurrency_amount_ht = price2num($remise * (float) $discount->multicurrency_tx, 'MT'); + $discount->multicurrency_amount_tva = price2num(((float) $remise * (float) $vatrate / 100) * (float) $discount->multicurrency_tx, 'MT'); + $discount->multicurrency_amount_ttc= price2num(((float) $discount->amount_ht + (float) $discount->amount_tva) * (float) $discount->multicurrency_tx, 'MT'); } $discount->tva_tx = (float) price2num($vatrate); @@ -3009,15 +3020,15 @@ class Societe extends CommonObject /** * Return a link on thirdparty (with picto) * - * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) - * @param string $option Target of link (''=auto, 'nolink'=no link, 'customer', 'prospect', 'supplier', 'project', 'agenda', ...) - * @param int $maxlen Max length of name - * @param int $notooltip 1=Disable tooltip - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @param int $noaliasinname 1=Do not add alias into the link ref - * @param string $target add attribute target - * @param string $morecss More CSS - * @return string String with URL + * @param int<0,2> $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) + * @param string $option Target of link (''=auto, 'nolink'=no link, 'customer', 'prospect', 'supplier', 'project', 'agenda', ...) + * @param int<0,max> $maxlen Max length of name + * @param int<0,1> $notooltip 1=Disable tooltip + * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int<0,1> $noaliasinname 1=Do not add alias into the link ref + * @param string $target add attribute target + * @param string $morecss More CSS + * @return string String with URL */ public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target = '', $morecss = '') { @@ -4233,7 +4244,7 @@ class Societe extends CommonObject public function isACompany() { // Define if third party is treated as company (or not) when nature is unknown - $isACompany = getDolGlobalInt('MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES'); + $isACompany = getDolGlobalInt('MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES', 1); // default if not set is 1 because it was like this in all past versions // Now try to guess using different tips if (!empty($this->tva_intra)) { @@ -4241,12 +4252,9 @@ class Societe extends CommonObject } elseif (!empty($this->idprof1) || !empty($this->idprof2) || !empty($this->idprof3) || !empty($this->idprof4) || !empty($this->idprof5) || !empty($this->idprof6)) { $isACompany = 1; } else { - if (!getDolGlobalString('MAIN_CUSTOMERS_ARE_COMPANIES_EVEN_IF_SET_AS_INDIVIDUAL')) { - // TODO Add a field is_a_company into dictionary - if (preg_match('/^TE_PRIVATE/', $this->typent_code)) { + if (!getDolGlobalString('MAIN_CUSTOMERS_ARE_COMPANIES_EVEN_IF_SET_AS_INDIVIDUAL')) { // never or rarely set + if (preg_match('/^TE_PRIVATE/', $this->typent_code)) { // TODO Add a field is_a_company into dictionary $isACompany = 0; - } else { - $isACompany = 1; } } else { $isACompany = 1; @@ -5443,7 +5451,6 @@ class Societe extends CommonObject * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @param string $element Filter on this element of default contact type ('facture', 'propal', 'commande' ...) * @return array|int Array of contacts, -1 if error - * */ public function getContacts($list = 0, $code = '', $element = '') { @@ -5713,6 +5720,16 @@ class Societe extends CommonObject // End call triggers } + if (!$error) { + // We finally remove the old thirdparty + if ($soc_origin->delete($soc_origin->id, $user) < 1) { + $this->error = $soc_origin->error; + $this->errors = $soc_origin->errors; + $error++; + } + } + + if (!$error) { // Move files from the dir of the third party to delete into the dir of the third party to keep if (!empty($conf->societe->multidir_output[$this->entity])) { @@ -5731,16 +5748,6 @@ class Societe extends CommonObject } } - - if (!$error) { - // We finally remove the old thirdparty - if ($soc_origin->delete($soc_origin->id, $user) < 1) { - $this->error = $soc_origin->error; - $this->errors = $soc_origin->errors; - $error++; - } - } - if (!$error) { $this->db->commit(); return 0; diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index e97ec89d8fa..c28581683b7 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + /** * Class for SocieteAccount */ @@ -93,7 +94,7 @@ class SocieteAccount extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( @@ -103,7 +104,7 @@ class SocieteAccount extends CommonObject 'pass_encoding' => array('type' => 'varchar(24)', 'label' => 'PassEncoding', 'visible' => 0, 'enabled' => 1, 'position' => 30), 'pass_crypted' => array('type' => 'password', 'label' => 'Password', 'visible' => -1, 'enabled' => 1, 'position' => 31, 'notnull' => 1), 'pass_temp' => array('type' => 'varchar(128)', 'label' => 'Temp', 'visible' => 0, 'enabled' => 0, 'position' => 32, 'notnull' => -1,), - 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'visible' => 1, 'enabled' => 1, 'position' => 40, 'notnull' => -1, 'index' => 1, 'picto' => 'company', 'css' => 'maxwidth300 widthcentpercentminusxx'), + 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'visible' => -6, 'enabled' => 1, 'position' => 40, 'notnull' => -1, 'index' => 1, 'picto' => 'company', 'css' => 'maxwidth300 widthcentpercentminusxx'), 'site' => array('type' => 'varchar(128)', 'label' => 'WebsiteTypeLabel', 'visible' => 0, 'enabled' => 0, 'position' => 41, 'notnull' => 1, 'default' => '', 'help' => 'Name of the website or service if this is account on an external website or service', 'csslist' => 'tdoverflowmax150', 'arrayofkeyval' => array(/* For static analysis, filled in constructor */)), 'fk_website' => array('type' => 'integer:Website:website/class/website.class.php', 'label' => 'WebSite', 'visible' => 0, 'enabled' => 0, 'position' => 42, 'notnull' => -1, 'index' => 1, 'picto' => 'website', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), 'site_account' => array('type' => 'varchar(128)', 'label' => 'ExternalSiteAccount', 'visible' => 0, 'enabled' => 1, 'position' => 44, 'help' => 'A key to identify the account on external web site if this is an account on an external website'), @@ -147,6 +148,10 @@ class SocieteAccount extends CommonObject * @var string */ public $pass_crypted; + /** + * @var string + */ + public $pass; /** * @var string */ @@ -161,6 +166,12 @@ class SocieteAccount extends CommonObject * @var string */ public $site; + + /** + * @var int + */ + public $fk_website; + /** * @var ?string */ @@ -257,6 +268,15 @@ class SocieteAccount extends CommonObject */ public function create(User $user, $notrigger = 0) { + global $langs; + + if ($this->site == 'dolibarr_website') { + if ((int) $this->fk_website <= 0) { + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Website")); + return -1; + } + } + return $this->createCommon($user, $notrigger); } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 2a6d965b012..a84b221ab06 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015-2017 Ferran Marcet * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -416,7 +416,7 @@ if (!empty($sql_select)) { $sql .= $where; $sql .= dolSqlDateFilter($dateprint, 0, $month, $year); if ($sref) { - $sql .= " AND ".$db->sanitize($doc_number)." LIKE '%".$db->escape($sref)."%'"; + $sql .= " AND ".$db->sanitize((string) $doc_number)." LIKE '%".$db->escape($sref)."%'"; } if ($sprod_fulldescr) { // We test both case description is correctly saved of was save after dol_escape_htmltag(). diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index bd82817b05e..449a7b02a9b 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -14,7 +14,7 @@ * Copyright (C) 2021-2025 Frédéric France * Copyright (C) 2022 Anthony Berton * Copyright (C) 2023 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Benjamin Falière * Copyright (C) 2024 Nick Fragoulis * @@ -319,7 +319,7 @@ $arrayfields = array( 's.fk_prospectlevel' => array('label' => "ProspectLevel", 'position' => 62, 'checked' => $checkprospectlevel), 's.fk_stcomm' => array('label' => "StatusProsp", 'position' => 63, 'checked' => $checkstcomm), 's2.nom' => array('label' => 'ParentCompany', 'position' => 64, 'checked' => 0), - 's.ip' => array('type'=>'ip', 'label' => "IPAddress", 'checked' => -2, 'position' => 500), + 's.ip' => array('type' => 'ip', 'label' => "IPAddress", 'checked' => -2, 'position' => 500), 's.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 501), 's.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 505), 's.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 520, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))), @@ -1730,27 +1730,27 @@ if (!empty($arrayfields['s.url']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['s.siren']['checked'])) { - print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 'info'), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.siret']['checked'])) { - print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 'info'), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.ape']['checked'])) { - print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 'info'), $_SERVER["PHP_SELF"], "s.ape", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.idprof4']['checked'])) { - print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 'info'), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.idprof5']['checked'])) { - print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[5], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[5], 1, 'info'), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.idprof6']['checked'])) { - print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[6], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[6], 1, 'info'), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.tva_intra']['checked'])) { diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 774e274a426..acf931e6d84 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1575,14 +1575,13 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print_liste_field_titre("Label"); print_liste_field_titre($form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem"))); // external system ID - print_liste_field_titre("Bank"); + //print_liste_field_titre("Bank"); print_liste_field_titre("RIB"); print_liste_field_titre("IBAN"); print_liste_field_titre("BIC"); if (isModEnabled('prelevement')) { print_liste_field_titre("RUM"); print_liste_field_titre("DateRUM"); - print_liste_field_titre("WithdrawMode"); } print_liste_field_titre("Default", '', '', '', '', '', '', '', 'center '); if (!getDolGlobalInt('SOCIETE_DISABLE_BANKACCOUNT') && getDolGlobalInt("SOCIETE_RIB_ALLOW_ONLINESIGN")) { @@ -1604,7 +1603,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; // Label - print ''; + print ''; + // External system ID print ''; + // Bank name - print ''; + //print ''; + // Account number $string = ''; foreach ($rib->getFieldsToShow() as $val) { @@ -1646,15 +1650,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' //} if (!empty($rib->label) && $rib->number) { if (!checkBanForAccount($rib)) { - $string .= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning'); + $string .= img_picto($langs->trans("ValueIsNotValid"), 'warning', 'class="pictofixedwidth"').$string; } else { - $string .= ' '.img_picto($langs->trans("ValueIsValid"), 'info'); + $string .= img_picto($langs->trans("ValueIsValid"), 'info', 'class="pictofixedwidth"').$string; } } } // EndFor $rib_list as $rib print ''; + // IBAN print ''; - print ''; + print ''; + // Date print ''; - - // FRST or RCUR - print ''; } // Default @@ -1722,7 +1727,12 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $modelselected = getDolGlobalString('BANKADDON_PDF'); } - $out .= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth125'); + $morecss = 'maxwidth125'; + if ($conf->browser->layout == 'phone') { + $morecss = 'maxwidth100'; + } + + $out .= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100 '.$morecss); $out .= ajax_combobox('modelrib'.$rib->id); // Language code (if multilang) @@ -1730,14 +1740,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); $defaultlang = $langs->getDefaultLang(); - $morecss = 'maxwidth150'; - if ($conf->browser->layout == 'phone') { - $morecss = 'maxwidth100'; - } $out .= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, array(), 0, 0, 0, $morecss); } // Button - $out .= ''; - //var_dump($src); print ''; + // Date print ''; - // Mode mandate - print ''; } @@ -1900,7 +1901,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if ($nbremote == 0 && $nblocal == 0) { $colspan = 10; if (isModEnabled('prelevement')) { - $colspan += 3; + $colspan += 2; } if (!getDolGlobalInt('SOCIETE_DISABLE_BANKACCOUNT') && getDolGlobalInt("SOCIETE_RIB_ALLOW_ONLINESIGN")) { $colspan++; @@ -2125,6 +2126,7 @@ if ($socid && $action == 'editcard' && $permissiontoaddupdatepaymentinformation) print '
    '; + print '
    '; print '
    '; @@ -2437,12 +2443,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Status - print '
    '.$form->editfieldkey('Status', 'status', '', $object, 0).''; + print '
    '.$form->editfieldkey('Status', 'status', '', $object, 0).'
     
    '.$form->editfieldkey('Address', 'address', '', $object, 0).'
    '.$langs->trans("ProductAccountancySellCode").'
    '.$langs->trans("ProductAccountancySellCode").''; print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, array(), 1, 1); print '
    '.$langs->trans("ProductAccountancyBuyCode").'
    '.$langs->trans("ProductAccountancyBuyCode").''; print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, array(), 1, 1); print '
    '.$langs->trans("ProductAccountancySellCode").'
    '.$langs->trans("ProductAccountancySellCode").''; print '
    '.$langs->trans("ProductAccountancyBuyCode").'
    '.$langs->trans("ProductAccountancyBuyCode").''; print '
    '.dol_escape_htmltag($rib->label).''.dolPrintHTML($rib->label); + print '
    '.dolPrintHTML($rib->bank).''; + print '
    '; if (!empty($rib->stripe_card_ref) && !empty($rib->ext_payment_site)) { @@ -1624,8 +1626,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } print dol_escape_htmltag($rib->stripe_card_ref); print ''.dol_escape_htmltag($rib->bank).''.dol_escape_htmltag($rib->bank).''; print $string; print ''; if (!empty($rib->iban)) { @@ -1677,12 +1682,12 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if (isModEnabled('prelevement')) { // RUM //print ''.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).''.dol_escape_htmltag($rib->rum).''.dolPrintHTML($rib->rum); + print '
    '.dolPrintHTML($rib->frstrecur).''; // FRST or RCUR + print '
    '.dol_print_date($rib->date_rum, 'day').''.dol_escape_htmltag($rib->frstrecur).''; - //var_dump($src); - print ''; - //var_dump($src); print '
    '; print ''; @@ -2150,6 +2152,7 @@ if ($socid && $action == 'editcard' && $permissiontoaddupdatepaymentinformation) print '
    '.$langs->trans("Label").'
    '; print ''; + print ''; print dol_get_fiche_end(); @@ -2171,6 +2174,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print '
    '; + print '
    '; print ''; print ''; @@ -2247,10 +2251,12 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print ""; print '
    '.$langs->trans("Label").'
    '; + print '
    '; if (isModEnabled('prelevement')) { print '
    '; + print '
    '; print ''; // RUM @@ -2271,6 +2277,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print ''; print '
    '; + print '
    '; } print ''; @@ -2296,6 +2303,7 @@ if ($socid && $action == 'createcard' && $permissiontoaddupdatepaymentinformatio print '
    '; + print '
    '; print ''; print ''; @@ -2320,6 +2328,7 @@ if ($socid && $action == 'createcard' && $permissiontoaddupdatepaymentinformatio print ''; print '
    '.$langs->trans("Label").'
    '; + print '
    '; print ''; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 24a7f838ad8..e06605e8a66 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -8,6 +8,7 @@ * Copyright (C) 2023 Alexandre Spangaro * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Mélina Joum + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -216,8 +217,8 @@ if (empty($reshook)) { $result = $prodcustprice->update($user, 0, $update_child_soc); if ($result > 0) { $extrafields->fetch_name_optionals_label("product_customer_price"); - $extralabels = !empty($extrafields->attributes["product_customer_price"]['label']) ? $extrafields->attributes["product_customer_price"]['label'] : ''; - $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price"); + $extralabels = !empty($extrafields->attributes["product_customer_price"]['label']) ? $extrafields->attributes["product_customer_price"]['label'] : ''; + $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price"); if (!empty($extralabels) && is_array($extralabels)) { $productcustomerprice = new ProductCustomerPrice($db); $res = $productcustomerprice->fetch($prodcustprice->id); @@ -392,7 +393,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT // Price print '
    '; $text = $langs->trans('SellingPrice'); - print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 1); + print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help'); print ''; print ''; print '
    '; $text = $langs->trans('MinPrice'); - print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 1); + print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help'); print ''; print '
    '; $text = $langs->trans('SellingPrice'); - print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 1); + print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help'); print ''; if ($prodcustprice->price_base_type == 'TTC') { print ''; @@ -497,7 +498,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT // Price minimum print '
    '; $text = $langs->trans('MinPrice'); - print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 1); + print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help'); print ''; if ($prodcustprice->price_base_type == 'TTC') { print ''; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 4ed8e18f7d6..e245f49d91b 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -35,6 +35,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -471,10 +472,10 @@ $objecttmp = new SocieteAccount($db); $trackid = 'thi'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; -/*if ($sall) +/*if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print '
    '.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
    '; + print '
    '.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'
    '; }*/ $moreforfilter = ''; @@ -684,15 +685,14 @@ while ($i < $imaxinloop) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; - /*if ($key == 'status') { - print $objectwebsiteaccount->getLibStatut(5); - } elseif ($key == 'rowid') { - print $objectwebsiteaccount->showOutputField($val, $key, $object->id, ''); - } else { - print $objectwebsiteaccount->showOutputField($val, $key, $object->$key, ''); - }*/ if ($key == 'login') { print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); + } elseif ($key == 'fk_website') { + if ($obj->$key > 0) { + $tmpwebsite = new Website($db); + $tmpwebsite->fetch($obj->$key); + print $tmpwebsite->getNomUrl(1); + } } else { print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); } diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 9325d0cf0ea..98ebb3690c6 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -131,7 +131,7 @@ if (!$rowid) { print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left '); print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'center '); print "
    "; + print ''; print "".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id.""; if ($charge->payment_intent) { print '
    '.$charge->payment_intent.''; @@ -236,7 +236,7 @@ if (!$rowid) { print "
    "; + print ''; if (isModEnabled('stripe') && !empty($stripeacc)) { $connect = $stripeacc.'/'; } @@ -250,7 +250,7 @@ if (!$rowid) { print ""; + print ''; if ($societestatic->id > 0) { print $societestatic->getNomUrl(1); } elseif ($memberstatic->id > 0) { @@ -259,7 +259,7 @@ if (!$rowid) { print ""; + print ''; if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") { $object = new Commande($db); $object->fetch($charge->metadata->dol_id); @@ -282,7 +282,7 @@ if (!$rowid) { print "'.dol_print_date($charge->created, 'dayhour')."'.dol_print_date($charge->created, 'dayhour')."'; print $type; @@ -290,7 +290,7 @@ if (!$rowid) { // Amount print ''.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."'; + print ''; print $status; print "'; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, 'info'); print '
    '."\n"; +print '
    '; // You can use div-table-responsive-no-min if you don't need reserved height for your table +print '
    '."\n"; -// Fields title search -// -------------------------------------------------------------------- -// ... $totalarray = array(); $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- -print ''; -if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; - $totalarray['nbfield']++; +print ''; +// Action column +if ($conf->main_checkbox_left_column) { + print ''; } print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder); $totalarray['nbfield']++; @@ -386,7 +394,7 @@ $totalarray['nbfield']++; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; /*if (!empty($arrayfields['anotherfield']['checked'])) { @@ -394,7 +402,7 @@ print $hookmanager->resPrint; $totalarray['nbfield']++; }*/ // Action column -if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { +if (!$conf->main_checkbox_left_column) { print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } @@ -441,11 +449,11 @@ while ($i < $imaxinloop) { print ''; } } else { - // Show here line of result + // Show line of result $j = 0; print ''; // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($conf->main_checkbox_left_column) { print '
    '; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print '
    '; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -498,11 +506,11 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if (empty($conf->main_checkbox_left_column)) { print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -539,6 +547,10 @@ if ($num == 0) { $db->free($resql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print '
    '."\n"; print ''."\n"; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 69ee963dfbc..d0222f18e45 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -339,6 +339,7 @@ if ($user->admin) { if (!empty($object->socid)) { print info_admin(showModulesExludedForExternal($modules))."\n"; } +print '
    '; $parameters = array('permsgroupbyentity' => $permsgroupbyentity); $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -346,7 +347,7 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -$listofexpandedmodules = array(); +//$listofexpandedmodules = array(); print "\n"; diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 07554b580d3..2a6fd052745 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Marcos García * Copyright (C) 2022 Open-Dsi * Copyright (C) 2023-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,7 +97,7 @@ class ProductAttribute extends CommonObject * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), @@ -1237,7 +1237,7 @@ class ProductAttribute extends CommonObject * Return a thumb for kanban views * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param ?array $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index c84fbb7d6ed..158d00758e9 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -66,7 +66,7 @@ class ProductAttributeValue extends CommonObjectLine * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index e32143113c6..eb1ecceddc4 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -425,7 +425,7 @@ if (!empty($id) || !empty($ref)) { print dol_get_fiche_head($head, 'combinations', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter + $object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")"; dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', ''); diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 796809ccaf1..f5a7984ac83 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -92,7 +92,7 @@ class Target extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/webportal/class/webportalinvoice.class.php b/htdocs/webportal/class/webportalinvoice.class.php index be5c6e808c2..edbfa2040a3 100644 --- a/htdocs/webportal/class/webportalinvoice.class.php +++ b/htdocs/webportal/class/webportalinvoice.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -93,7 +93,7 @@ class WebPortalInvoice extends Facture // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 1,), @@ -270,9 +270,9 @@ class WebPortalInvoice extends Facture /** * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/webportal/class/webportalmember.class.php b/htdocs/webportal/class/webportalmember.class.php index 7d50d3ec397..e44a633319a 100644 --- a/htdocs/webportal/class/webportalmember.class.php +++ b/htdocs/webportal/class/webportalmember.class.php @@ -109,7 +109,7 @@ class WebPortalMember extends Adherent // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10,), diff --git a/htdocs/webportal/class/webportalorder.class.php b/htdocs/webportal/class/webportalorder.class.php index 48ac04bbf73..1cbf082dccb 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -94,7 +94,7 @@ class WebPortalOrder extends Commande // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10,), @@ -264,7 +264,7 @@ class WebPortalOrder extends Commande * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data + * @param ?array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/webportal/class/webportalpartnership.class.php b/htdocs/webportal/class/webportalpartnership.class.php index 4c8c9f44dbb..d91c64c818e 100644 --- a/htdocs/webportal/class/webportalpartnership.class.php +++ b/htdocs/webportal/class/webportalpartnership.class.php @@ -93,7 +93,7 @@ class WebPortalPartnership extends Partnership // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id",), diff --git a/htdocs/webportal/class/webportalpropal.class.php b/htdocs/webportal/class/webportalpropal.class.php index 3cff9e7c028..838080a666c 100644 --- a/htdocs/webportal/class/webportalpropal.class.php +++ b/htdocs/webportal/class/webportalpropal.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -94,7 +94,7 @@ class WebPortalPropal extends Propal // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id",), @@ -256,9 +256,9 @@ class WebPortalPropal extends Propal /** * Return a thumb for kanban views * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/webportal/controllers/document.controller.class.php b/htdocs/webportal/controllers/document.controller.class.php index 3a0d338c917..6ea2e265d61 100644 --- a/htdocs/webportal/controllers/document.controller.class.php +++ b/htdocs/webportal/controllers/document.controller.class.php @@ -212,10 +212,9 @@ class DocumentController extends Controller exit; } - $fileSize = dol_filesize($fullpath_original_file); // the returned value is in byte - $fileSizeMaxDefault = 20 * 1024 * 1024; // 20 Mo by default - $fileSizeMax = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED', $fileSizeMaxDefault); - if ($fileSize > $fileSizeMax) { + $fileSize = dol_filesize($fullpath_original_file); + $fileSizeMax = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED'); + if ($fileSizeMax && $fileSize > $fileSizeMax) { dol_syslog('ErrorFileSizeTooLarge: ' . $fileSize); print 'ErrorFileSizeTooLarge: ' . $fileSize . ' (max ' . $fileSizeMax . ')'; exit; diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index 4f9091a3df4..87921d46d99 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -420,7 +420,7 @@ function getProject($authentication, $id = '', $ref = '') foreach ($listofreferent as $key => $tablename) { $elements[$key] = array(); $element_array = $project->get_element_list($key, $tablename); - if (count($element_array) > 0 && is_array($element_array)) { + if (is_array($element_array) && count($element_array) > 0) { foreach ($element_array as $element) { $tmp = explode('_', $element); $idofelement = count($tmp) > 0 ? $tmp[0] : ""; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 43dc5599601..ae56eae9af4 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -790,6 +790,8 @@ class Website extends CommonObject dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); } + $newidforhome = 0; + if (!$error) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder dolCopyDir($pathofwebsiteold, $pathofwebsitenew, getDolGlobalString('MAIN_UMASK'), 0, [], 2); @@ -812,8 +814,6 @@ class Website extends CommonObject $pathofmediasimagenew = DOL_DATA_ROOT.'/medias/image/'.$newref; dolCopyDir($pathofmediasimageold, $pathofmediasimagenew, getDolGlobalString('MAIN_UMASK'), 0); - $newidforhome = 0; - // Duplicate pages $objectpages = new WebsitePage($this->db); $listofpages = $objectpages->fetchAll($fromid); @@ -901,25 +901,31 @@ class Website extends CommonObject $result = ''; - $label = ''.$langs->trans("WebSite").''; + $label = ''.img_picto('', 'website', 'class="pictofixedwidth"').$langs->trans("WebSite").''; $label .= '
    '; $label .= ''.$langs->trans('Ref').': '.$this->ref.'
    '; $label .= ''.$langs->trans('MainLanguage').': '.$this->lang; - $linkstart = 'picto ? $this->picto : 'generic'), ($notooltip ? '' : 'class="classfortooltip"')).$linkend); - if ($withpicto != 2) { - $result .= ' '; - } + */ + if (!empty($this->virtualhost)) { + $linkstart = ''; + $linkend = ''; + } else { + $linkstart = $linkend = ''; } - $result .= $linkstart.$this->ref.$linkend; + + $result .= $linkstart; + if ($withpicto) { + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), 'class="pictofixedwidth'.($notooltip ? '' : ' classfortooltip').'"'); + } + $result .= $this->ref; + $result .= $linkend; + return $result; } @@ -1167,7 +1173,7 @@ class Website extends CommonObject $line .= "'".$this->db->escape($objectpageold->status)."', "; $line .= "'".$this->db->idate($objectpageold->date_creation)."', "; $line .= "'".$this->db->idate($objectpageold->date_modification)."', "; - $line .= ($objectpageold->import_key ? "'".$this->db->escape($objectpageold->import_key)."'" : "null").", "; + $line .= ($objectpageold->import_key ? "'".$this->db->escape((string) $objectpageold->import_key)."'" : "null").", "; $line .= "'".$this->db->escape($objectpageold->grabbed_from)."', "; $line .= "'".$this->db->escape($objectpageold->type_container)."', "; @@ -1344,6 +1350,7 @@ class Website extends CommonObject // Search the $maxrowid because we need it later $sqlgetrowid = 'SELECT MAX(rowid) as max from '.MAIN_DB_PREFIX.'website_page'; + $maxrowid = 0; $resql = $this->db->query($sqlgetrowid); if ($resql) { $obj = $this->db->fetch_object($resql); @@ -1358,6 +1365,7 @@ class Website extends CommonObject } $objectpagestatic = new WebsitePage($this->db); + $aliasesarray = null; // Regenerate the php files for pages $fp = fopen($sqlfile, "r"); @@ -1759,6 +1767,8 @@ class Website extends CommonObject return -1; } + $destdir = null; // Otherwise only set when 'WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE' is not falsy. + $destdirrel = ''; // Otherwise only set when 'WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE' is not falsy. // Replace modified files into the doctemplates directory. if (getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')) { // If the user has not specified a path @@ -1792,6 +1802,11 @@ class Website extends CommonObject } } + if ($destdir === null) { + setEventMessages("The destination path is not determined.", null, 'errors'); + return -1; + } + dol_mkdir($destdir); if (!is_writable($destdir)) { diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 59c5afa6c8d..5df3a715b33 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -163,7 +163,7 @@ class WebsitePage extends CommonObject public $fk_object; /** - * @var int Another ID that is the $id but with an offset so that ID of pages of the website start at 1 + * @var int Another ID that is the but with an offset so that ID of pages of the website start at 1 */ public $newid; @@ -198,7 +198,7 @@ class WebsitePage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), @@ -661,7 +661,7 @@ class WebsitePage extends CommonObject return -1; } $tmppage = new WebsitePage($this->db); - $tmppage->fetch($this->fk_page); + $tmppage->fetch((int) $this->fk_page); if ($tmppage->lang == $this->lang) { $this->error = "ErrorLanguageOfTranslatedPageIsSameThanThisPage"; return -1; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index bb683e00854..eab30a6de09 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016-2023 Laurent Destailleur * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,7 +64,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; */ // Load translation files required by the page -$langs->loadLangs(array("admin", "other", "website", "errors")); +$langs->loadLangs(array("admin", "other", "website")); // Security check if (!$user->hasRight('website', 'read')) { @@ -2078,12 +2078,10 @@ if ($action == 'updatemeta' && $usercanedit) { $langs->load("errors"); if ($db->lasterrno == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $error++; - $langs->load("errors"); setEventMessages($langs->trans("ErrorAPageWithThisNameOrAliasAlreadyExists"), null, 'errors'); $action = 'editmeta'; } else { $error++; - $langs->load("errors"); setEventMessages($objectpage->error, $objectpage->errors, 'errors'); $action = 'editmeta'; } @@ -3788,6 +3786,9 @@ if (!GETPOST('hide_websitemenu')) { $htmltext = ''; $htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSource", $url); + $htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSourceb", $url); + $htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSourcec", $url); + $htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSourced", $url); $htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSource1", $url); $htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSource2", $url); $htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSource3", $url); @@ -3936,8 +3937,10 @@ if ($action == 'editcss') { // Clean the manifestjson file to remove php code and get only html part $manifestjsoncontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP( \?>)?\n*/ims', '', $manifestjsoncontent); } else { - $manifestjsoncontent = GETPOST('WEBSITE_MANIFEST_JSON', 'restricthtml'); + $manifestjsoncontent = trim(GETPOST('WEBSITE_MANIFEST_JSON', 'restricthtmlallowunvalid')); + $manifestjsoncontent = str_replace('
    '; print $langs->trans('PublicAuthorAlias'); print ''; - print ''; + print ''; print '
    '; diff --git a/htdocs/website/samples/page-sample-dynamiccontent.html b/htdocs/website/samples/page-sample-dynamiccontent.html index d66e04cfd01..2f33407960a 100644 --- a/htdocs/website/samples/page-sample-dynamiccontent.html +++ b/htdocs/website/samples/page-sample-dynamiccontent.html @@ -38,6 +38,9 @@ __(AnotherContainer)__


    __(YouCanEditHtmlSource)__ +__(YouCanEditHtmlSourceb)__ +__(YouCanEditHtmlSourcec)__ +__(YouCanEditHtmlSourced)__

    Page created by __WEBSITE_CREATED_BY__
    diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index 5d32d0e23ca..49e6440b8d7 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -64,9 +64,21 @@ if (!empty($hashp)) { if ($moduleparttocheck == $modulepart) { // We remove first level of directory $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir - //var_dump($original_file); exit; + //var_dump($original_file); exit(0); } else { + // Security options + + // X-Content-Type-Options + header("X-Content-Type-Options: nosniff"); + + // X-Frame-Options + if (!getDolGlobalString('WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES')) { + header("X-Frame-Options: SAMEORIGIN"); + } + + http_response_code(401); print 'Bad link. File is from another module part.'; + exit(1); } } else { $modulepart = $moduleparttocheck; @@ -77,8 +89,19 @@ if (!empty($hashp)) { $original_file = getImageFileNameForSize($original_file, $extname); } } else { + // Security options + + // X-Content-Type-Options + header("X-Content-Type-Options: nosniff"); + + // X-Frame-Options + if (!getDolGlobalString('WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES')) { + header("X-Frame-Options: SAMEORIGIN"); + } + + http_response_code(404); print "ErrorFileNotFoundWithSharedLink"; - exit; + exit(2); } } @@ -106,10 +129,11 @@ if (GETPOSTISSET('type')) { $original_file = str_replace("../", "/", $original_file); // Cache or not -if (GETPOST("cache", 'aZ09') || image_format_supported($original_file) >= 0) { +$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int, or a hash +if ($cachestring || image_format_supported($original_file) >= 0) { // Important: Following code is to avoid page request by browser and PHP CPU at // each Dolibarr page access. - header('Cache-Control: max-age=3600, public, must-revalidate'); + header('Cache-Control: max-age='.((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600').', public, must-revalidate'); header('Pragma: cache'); // This is to avoid having Pragma: no-cache } @@ -196,15 +220,19 @@ if ($rss) { $error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile; dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); + + http_response_code(500); print $error; - exit(-1); + exit(3); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); + + http_response_code(500); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(4); } } @@ -244,7 +272,7 @@ if ($rss) { } // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); - exit; + exit(5); } elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file)) { // Get logos readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file)); @@ -263,8 +291,9 @@ if ($rss) { // Security: // Limit access if permissions are wrong if (!$accessallowed) { + http_response_code(403); print 'Access forbidden'; - exit; + exit(6); } // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension @@ -282,8 +311,9 @@ if ($rss) { // This test if file exists should be useless. We keep it to find bug more easily if (!file_exists($fullpath_original_file_osencoded)) { + http_response_code(404); print "ErrorFileDoesNotExists: ".dol_escape_htmltag($original_file); - exit; + exit(7); } // Permissions are ok and file found, so we return it diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 0561b1f8ebf..2dd8f75ba7a 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -415,6 +415,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } + // Modify + if ($permissiontoadd) { + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=edit&token='.newToken(), '', $permissiontoadd); + } + // Clone if ($permissiontoadd) { print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd); diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index a4e9c3157cd..8478f75527e 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL * Copyright (C) 2023-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,7 +96,7 @@ class Workstation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), @@ -727,9 +727,9 @@ class Workstation extends CommonObject /** * Return a thumb for kanban views * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array{string,mixed} $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param ?array $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 78115ea8da0..36d3638e971 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -37,7 +37,7 @@ class WorkstationResource extends CommonObject public $element = 'workstationresource'; /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer', 'label' => 'Workstation', 'enabled' => 1, 'position' => 10, 'visible' => 1), diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index ce1f3bea2b8..0f623d57564 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -36,7 +36,7 @@ class WorkstationUserGroup extends CommonObject public $element = 'workstationusergroup'; /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer', 'label' => 'Workstation', 'enabled' => 1, 'position' => 10, 'visible' => 1), diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 15e4f76a034..c93b540984e 100644 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -327,10 +328,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteWorkstation'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 'action-delete'); } + $formquestion = array(); // Clone confirmation if ($action == 'clone') { // Create an array for form - $formquestion = array(); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index cab56314ff3..a6cae084088 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -72,7 +72,7 @@ class Hook extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int<-5,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,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array( diff --git a/test/phpunit/CommonClassTest.class.php b/test/phpunit/CommonClassTest.class.php index d083e842758..7e71bfda436 100644 --- a/test/phpunit/CommonClassTest.class.php +++ b/test/phpunit/CommonClassTest.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2023 Alexandre Janniaux - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -37,6 +37,9 @@ global $conf,$user,$langs,$db; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +// Delete the log file to avoid problem of writing permission on it +@unlink(DOL_DATA_ROOT.'/dolibarr.log'); + if (empty($user->id)) { print "Load permissions for admin user nb 1\n"; @@ -168,6 +171,16 @@ abstract class CommonClassTest extends TestCase print "##[group]$className::$failedTestMethod failed - $argsText.".PHP_EOL; print "## ".get_class($t).": {$t->getMessage()}".PHP_EOL; + // Show some information about where it happened + foreach ($t->getTrace() as $idx => $trace) { + if (isset($trace['file'], $trace['line']) // Only if we have a file name + && !preg_match('/(?:\bphar\b|Framework)/', $trace['file']) // Only if it's not in phpunit + ) { + print "## backtrace($idx): From {$trace['file']}:{$trace['line']}.".PHP_EOL; + } + } + + if ($nbLinesToShow) { $newLines = count($last_lines); if ($newLines > 0) { diff --git a/test/phpunit/DiscountTest.php b/test/phpunit/DiscountTest.php index e7ed4908d8a..530d6f8eff2 100644 --- a/test/phpunit/DiscountTest.php +++ b/test/phpunit/DiscountTest.php @@ -69,7 +69,7 @@ class DiscountTest extends CommonClassTest $localobject = new DiscountAbsolute($db); $localobject->initAsSpecimen(); - $localobject->fk_soc = $socid; + $localobject->socid = $socid; $result = $localobject->create($user); $this->assertLessThan($result, 0); diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 1fe6809e0b2..88ee9465e6a 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -300,7 +300,7 @@ class FilesLibTest extends CommonClassTest // Again to test there is error when deleting a non existing file with option disableglob $result = dol_delete_file($conf->admin->dir_temp.'/file3.csv', 1, 1); print __METHOD__." result=".$result."\n"; - $this->assertFalse($result, 'delete file that does not exists with disableglo must return ko'); + $this->assertFalse($result, 'delete file that does not exists with disabling glob must return ko'); // Again to test there is no error when deleting a non existing file without option disableglob $result = dol_delete_file($conf->admin->dir_temp.'/file3csv', 0, 1); diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 9770cb09c46..135a83de392 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -372,18 +372,23 @@ class FunctionsLibTest extends CommonClassTest $input = "yahoo.com"; $result = isValidMXRecord($input); - print __METHOD__." result=".$result."\n"; + print __METHOD__." ".$input." result=".$result."\n"; $this->assertEquals(1, $result); $input = "yhaoo.com"; $result = isValidMXRecord($input); - print __METHOD__." result=".$result."\n"; + print __METHOD__." ".$input." result=".$result."\n"; $this->assertEquals(0, $result); $input = "dolibarr.fr"; $result = isValidMXRecord($input); - print __METHOD__." result=".$result."\n"; + print __METHOD__." ".$input." result=".$result."\n"; $this->assertEquals(0, $result); + + $input = "usace.army.mil"; + $result = isValidMXRecord($input); + print __METHOD__." ".$input." result=".$result."\n"; + $this->assertEquals(1, $result); } /** @@ -1133,6 +1138,18 @@ class FunctionsLibTest extends CommonClassTest $result = dol_escape_htmltag($input, 1); $this->assertEquals('x&<b>#</b>,"', $result); + $input = ''; // & and " are converted into html entities, are not removed + $result = dol_escape_htmltag($input, 1, 1, 'common', 0, 1); + $this->assertEquals('', $result); + + $input = ''; // & and " are converted into html entities, are not removed + $result = dol_escape_htmltag($input, 1, 1, 'common'); + $this->assertEquals('', $result); + + $input = ''; // & and " are converted into html entities, are not removed + $result = dol_escape_htmltag($input, 1); + $this->assertEquals('<img src="data:image/png;base64, 123/456+789==" style="height: 123px; width:456px">', $result); + $input = ''; // & and " are converted into html entities, are not removed $result = dol_escape_htmltag($input, 1, 1, 'common', 0, 1); $this->assertEquals('', $result); diff --git a/test/phpunit/LangTest.php b/test/phpunit/LangTest.php index 5b7a22b247e..2442b165848 100644 --- a/test/phpunit/LangTest.php +++ b/test/phpunit/LangTest.php @@ -1,7 +1,7 @@ * Copyright (C) 2023 Alexandre Janniaux - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -26,7 +26,7 @@ * \remarks To run this script as CLI: phpunit filename.php */ -global $conf,$user,$langs,$db; +global $conf, $user, $langs, $db; //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; @@ -104,7 +104,7 @@ class LangTest extends CommonClassTest } /** - * testLang + * testTransWithHTMLInParam * * @return void */ @@ -138,6 +138,44 @@ class LangTest extends CommonClassTest return; } + /** + * testTransWithPercent + * + * @return void + */ + public function testTransWithPercent(): void + { + global $conf,$user,$langs,$db; + $conf = $this->savconf; + $user = $this->savuser; + $langs = $this->savlangs; + $db = $this->savdb; + + include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; + + $newlang = new Translate('', $conf); + $newlang->setDefaultLang('fr_FR'); + $newlang->load("main"); + + $result = $newlang->trans("DatabaseConnection"); + print "result=".$result.PHP_EOL; + $this->assertEquals('Connexion à la base', $result); + + $result = $newlang->transnoentities("FormatDateHourSecShort"); + print "result=".$result.PHP_EOL; + $this->assertEquals('%d/%m/%Y %H:%M:%S', $result); + + $newlang = new Translate('', $conf); + $newlang->setDefaultLang('en_US'); + $newlang->load("main"); + + $result = $newlang->transnoentities("FormatDateHourText"); + print "result=".$result.PHP_EOL; + $this->assertEquals('%B %d, %Y, %I:%M %p', $result); + + return; + } + /** * testLang * @dataProvider langDataProvider @@ -156,14 +194,14 @@ class LangTest extends CommonClassTest include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; - $prefix = __METHOD__."($code) "; $tmplangs = new Translate('', $conf); $langcode = $code; $tmplangs->setDefaultLang($langcode); $tmplangs->load("main"); - print PHP_EOL.$prefix."Check language file".PHP_EOL; + print PHP_EOL.$prefix."Check language files".PHP_EOL; + $result = $tmplangs->transnoentitiesnoconv("FONTFORPDF"); print $prefix."FONTFORPDF=".$result.PHP_EOL; $this->assertTrue(in_array($result, array('msungstdlight', 'stsongstdlight', 'helvetica', 'DejaVuSans', 'cid0jp', 'cid0kr', 'freemono', 'freeserif')), 'Error bad value '.$result.' for FONTFORPDF in main.lang file '.$code); @@ -193,14 +231,14 @@ class LangTest extends CommonClassTest unset($tmplangs); - print $prefix."Check some syntax rules in the language file".PHP_EOL; + print $prefix."Check syntax rules in the language files".PHP_EOL; $filesarray2 = scandir(DOL_DOCUMENT_ROOT.'/langs/'.$code); foreach ($filesarray2 as $key => $file) { if (! preg_match('/\.lang$/', $file)) { continue; } - //print 'Check lang file '.$file.PHP_EOL; + //print $prefix.'Check lang file '.$file.PHP_EOL; $filecontent = file_get_contents(DOL_DOCUMENT_ROOT.'/langs/'.$code.'/'.$file); $result = preg_match('/=--$/m', $filecontent); // A special % char we don't want. We want the common one. @@ -222,7 +260,7 @@ class LangTest extends CommonClassTest $reg = array(); $result = preg_match('/(.*)\'notranslate\'/im', $filecontent, $reg); // A sequence of char we don't want //print $prefix."Result for checking we don't have bad percent char = ".$result.PHP_EOL; - $this->assertTrue($result == 0, 'Found a sequence tag \'notranslate\' in the translation file '.$code.'/'.$file.' in line '.empty($reg[1]) ? '' : $reg[1]); + $this->assertTrue($result == 0, 'Found a sequence tag \'notranslate\' in the translation file '.$code.'/'.$file.' in line '.(empty($reg[1]) ? '' : $reg[1])); if (!in_array($code, array('ar_SA'))) { $reg = array(); diff --git a/test/phpunit/ODFTest.php b/test/phpunit/ODFTest.php index 8700f0a52a6..441469edd48 100644 --- a/test/phpunit/ODFTest.php +++ b/test/phpunit/ODFTest.php @@ -28,6 +28,7 @@ global $conf,$user,$langs,$db; //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php'; require_once dirname(__FILE__).'/../../htdocs/includes/odtphp/odf.php'; require_once dirname(__FILE__).'/CommonClassTest.class.php'; @@ -50,6 +51,43 @@ $langs->load("main"); */ class ODFTest extends CommonClassTest { + /** + * test ODF convertVarToOdf + * + * @return int + */ + public function testGetSubstitutionarrayEachVarObject() + { + global $conf,$user,$langs,$db; + $conf = $this->savconf; + $user = $this->savuser; + $langs = $this->savlangs; + $db = $this->savdb; + + $localobject = new Commande($db); + $localobject->fetch(1); + + $localobject->lines[0]->date_start = dol_now(); + $localobject->lines[0]->date_end = dol_now() + 84600; + + $result = $localobject->generateDocument('generic_order_odt', $langs); + print __METHOD__." result=".$result."\n"; + + $this->assertEquals(1, $result); + + + $filefound = DOL_DOCUMENT_ROOT.'/core/modules/commande/doc/doc_generic_order_odt.modules.php'; + require_once $filefound; + + $objdoc = new doc_generic_order_odt($db); + + $result = $objdoc->get_substitutionarray_each_var_object($localobject, $langs); + + $this->assertEquals(1, $result['object_id']); + } + + + /** * test ODF convertVarToOdf *