diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 384ef39880e..671a266c767 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -19,7 +19,7 @@ jobs: # This is faster for a big repo. - name: Get all changed php files (if PR) id: changed-php - uses: tj-actions/changed-files@v42 + uses: tj-actions/changed-files@v43 if: github.event_name == 'pull_request' with: files: | @@ -57,7 +57,7 @@ jobs: # The next uses git, which is slow for a bit repo. # - name: Get all changed php files (if PR) # id: changed-php - # uses: tj-actions/changed-files@v42 + # uses: tj-actions/changed-files@v43 # if: github.event_name == 'pull_request' # with: # files: | @@ -67,13 +67,16 @@ jobs: uses: shivammathur/setup-php@v2 # Install when we're going to run phpcs if: | - steps.changed-php.outputs.any_changed == 'true' - || + ! cancelled() && ( - github.event_name == 'push' - && ( - github.event.ref == 'refs/heads/develop' - || endsWith(github.event.ref, '.0') + steps.changed-php.outputs.any_changed == 'true' + || + ( + github.event_name == 'push' + && ( + github.event.ref == 'refs/heads/develop' + || endsWith(github.event.ref, '.0') + ) ) ) with: @@ -82,7 +85,7 @@ jobs: tools: phpcs - name: Run some pre-commit hooks on selected changed files only - if: steps.changed-php.outputs.any_changed == 'true' + if: "! cancelled() && steps.changed-php.outputs.any_changed == 'true'" env: ALL_CHANGED_FILES: ${{ steps.changed-php.outputs.all_changed_files }} run: | @@ -103,7 +106,7 @@ jobs: ls -l ~/.cache/pre-commit/ - name: Convert Raw Log to Annotations - uses: mdeweerd/logToCheckStyle@v2024.2.9 + uses: mdeweerd/logToCheckStyle@v2024.3.4 if: ${{ failure() }} with: in: ${{ env.RAW_LOG }} diff --git a/.github/workflows/windows-ci.yaml b/.github/workflows/windows-ci.yaml index f8441c438fc..cb467055156 100644 --- a/.github/workflows/windows-ci.yaml +++ b/.github/workflows/windows-ci.yaml @@ -67,60 +67,12 @@ jobs: ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }}-${{ github.head_ref }}- ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }}-${{ github.base_ref }}- ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }}- - - name: Create local php.ini + + - name: Create local php.ini with open_basedir restrictions shell: cmd - if: false - # Note: Setting the basedir before initialising the database results in open_basedir errors # Objective: separate step, and before database initialisation to verify open_basedir restrictions - run: |- - ECHO "==== Show INI file usage before our configuration ===" - php --ini - ECHO "==== Set PHP_INI_SCAN_DIR to include the INI File we create ===" - mkdir %PHP_INI_SCAN_DIR% - SET INIFILE="%PHP_INI_SCAN_DIR%\dolibarr.ini" - SET HTDOCS_DIR=%CD%\htdocs - SET DATA_DIR=%CD%\documents - SET TEST_DIR=%CD%\test - SET INITDEMO_DIR=%CD%\dev\initdemo - ECHO "==== Create INI file to set open_basedir ===" - echo [php] > %INIFILE% - echo open_basedir^="%HTDOCS_DIR%;%DATA_DIR%;%TEST_DIR%;%INITDEMO_DIR%;%PHPROOT%" >> %INIFILE% - ECHO "==== Show contents of INI file to set open_basedir ===" - type %INIFILE% - REM Next line disables open_basedir limitation (to limit errors) - SET PHP_INI_SCAN_DIR= - ECHO "==== Verify it is used by PHP ===" - php --ini - - name: Run Bash script - # Note this is bash (MSYS) on Windows - shell: bash - # Note: Initialise the database (possibly from cache) and set some variables. - run: | - # Check if database cache is present (visually, to remove once ok) - ls -l - # Run bash script to initialise database - ${SHELL} -xv dev/setup/phpunit/setup_conf.sh - sed -i -e 's/stopOnFailure="[^"]*"/stopOnFailure="false"/' test/phpunit/phpunittest.xml - # Check if database cache is present after the script (visually, to remove once ok) - ls -l - echo "TEE=$(cygpath -w "$(which tee)")" >> "$GITHUB_ENV" - echo "BASEDIR=$(realpath .)" >> "$GITHUB_ENV" - - name: Start web server - id: server - if: false - # Objective: Start php server in separate step (but after open_basedir restriction setup!) - run: | - Start-Process -FilePath "php.exe" -WindowStyle Hidden -ArgumentList "-S ${{ env.PHPSERVER_DOMAIN_PORT }} -t htdocs > ${{ env.PHPSERVER_LOG }}" -PassThru - curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}" - shell: powershell - - name: Run PHPUnit tests - # continue-on-error: true - shell: cmd - # setting up php.ini, starting the php server are currently in this step run: |- echo "BASEDIR=%CD%" >> %GITHUB_ENV% - start /B php -S %PHPSERVER_DOMAIN_PORT% -t htdocs >> %PHPSERVER_LOG% 2>&1 - curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}" ECHO "==== Show INI file usage before our configuration ===" php --ini ECHO "==== Set PHP_INI_SCAN_DIR to include the INI File we create ===" @@ -139,17 +91,70 @@ jobs: type %INIFILE% ECHO "==== Verify it is used by PHP ===" php --ini + REM TEST OPEN_BASEDIR restriction is not limiting wrongly + REM THE DATA_DIR MUST BE CREATED HERE - open_base does not allow it's creation + mkdir "%DATA_DIR%" + mkdir "%DATA_DIR%\mytest" + php -r "$d=implode(DIRECTORY_SEPARATOR,[__DIR__,'documents','mytest']);echo 'IS_DIR '.$d.' '.((int) is_dir($d)).PHP_EOL;" + php -r "$d=__DIR__.'\documents/mytest';echo 'TEST PATH IS SHOWN: '.$d.PHP_EOL;" + php -r "$d=__DIR__.'\documents/mytest';echo 'IS_DIR '.$d.' '.((int) is_dir($d)).PHP_EOL;" + ECHO "The above should show 2 successful tests" + + - name: Run Bash script that Initialises the database + # Note this is bash (MSYS) on Windows + shell: bash + run: | + ECHO "#[group]Directory contents to verify cache files, ..." + ls -l + ECHO "#[endgroup]" + ECHO "==== Verify openbase_dir restriction" + php --ini + # Run bash script to initialise database + ECHO "==== Start 'setup_conf.sh' to setup database" + ${SHELL} -xv dev/setup/phpunit/setup_conf.sh + ## Updating test configuration to not stop on first failure (to see all errors) - need sed + sed -i -e 's/stopOnFailure="[^"]*"/stopOnFailure="false"/' test/phpunit/phpunittest.xml + ECHO "#[group]Directory contents after database setup to verify cache files, ..." + ls -l + ECHO "#[endgroup]" + # Export some tool paths to reuse the from CMD shell. + echo "TAIL=$(cygpath -w "$(which tail)")" >> "$GITHUB_ENV" + echo "GREP=$(cygpath -w "$(which grep)")" >> "$GITHUB_ENV" + echo "TEE=$(cygpath -w "$(which tee)")" >> "$GITHUB_ENV" + echo "BASEDIR=$(realpath .)" >> "$GITHUB_ENV" + + - name: Run PHPUnit tests + # continue-on-error: true + shell: cmd + # setting up php.ini, starting the php server are currently in this step + run: |- + ECHO "==== Visually verify our dolibarr.INI file usage ===" + php --ini + ECHO "==== Add our web server information to the config file ===" echo $dolibarr_main_url_root="http://${{ env.PHPSERVER_DOMAIN_PORT }}"; >> htdocs/conf/conf.php + ECHO "#[group]==== Dolibarr config file contents" cat htdocs/conf/conf.php + ECHO "#[endgroup]" + ECHO "==== START PHP server" + start /B php -S %PHPSERVER_DOMAIN_PORT% -t htdocs >> %PHPSERVER_LOG% 2>&1 + ECHO "#[group]==== Output from curl on PHP server" curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}" + ECHO "#[endgroup]" + ECHO "==== START PHPUNIT TESTS" REM 'DOSKEY' USED to recover error code (no pipefile equivalent in windows?) ( php "%PHPROOT%\phpunit" -d memory_limit=-1 -c %CD%\test\phpunit\phpunittest.xml "test\phpunit\AllTests.php" --exclude-group WindowsWaitingForFix & call doskey /exename=err err=%%^^errorlevel%% ) | "${{ env.TEE }}" "${{ env.PHPUNIT_LOG }}" + echo "" + echo "Ensure that PHPUNIT completed (no early exit from code)" + "${{ env.TAIL }}" -5 "${{ env.PHPUNIT_LOG }}" | "${{ env.GREP }}" -qE "(OK .*[0-9]+ tests.*[0-9]+ assertions|Tests: [0-9]+)" || EXIT /B 1 + echo "PHPUNIT seems to have completed with a test result, reuse the exit code" for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A + - name: Convert Raw Log to Annotations - uses: mdeweerd/logToCheckStyle@v2024.2.9 + uses: mdeweerd/logToCheckStyle@v2024.3.4 if: ${{ failure() }} with: in: ${{ env.PHPUNIT_LOG }} + - name: Provide dolibarr and phpunit logs as artifact uses: actions/upload-artifact@v4 if: ${{ ! cancelled() }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 45f51d5c5db..814f144508c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,7 +62,9 @@ repos: rev: v6.2.1 hooks: - id: beautysh - exclude: (?x)^(dev/setup/git/hooks/pre-commit)$ + exclude: | + (?x)^(dev/setup/git/hooks/pre-commit + )$ args: [--tab] # Run local script @@ -77,6 +79,13 @@ repos: # ``` - repo: local hooks: + - name: Find missing/unused/duplicate language keys + id: check-translations + files: (?x)^(htdocs/langs/en_US/.*\.lang) + language: script + entry: ./dev/translation/sanity_check_trans_missing_unused.sh + pass_filenames: false + args: [list] - id: local-precommit-script name: Run local script before commit if it exists language: system diff --git a/ChangeLog b/ChangeLog index 3207490752d..6580a4e5dda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,22 +25,24 @@ The following changes may create regressions for some external modules, but were * Properties ->date_update and ->date_modification were merged into date_modification. * All CLI tools (into /scripts) return a positive value to the shell if error (0 remains success) for a better cross platform compatibility. On linux the exit(-1) was caught as 255, it may be now exit(1) so will be caught as 1. -* the parameter $filter of method fetchAll does not accept array of SQL but must be a string of an Universal Search Filter syntax. +* The parameter $filter of method fetchAll does not accept array of SQL but must be a string of an Universal Search Filter syntax. * Use of dol_eval with parameter $returnvalue=0 is deprecated. * The signature for all ->delete() method has been modified to match the modulebuilder template (so first paramis now always $user), except the delete for thirdparty (still accept the id of thirdparty to delete as first parameter). Will probably be modified into another version. -* Route for API /thirdparties/gateways has been renamed into /thirdparties/accounts -* The $userdoneid in actioncomm class is deprecated. Please use $userownerid instead. -* The field fk_user_done in actioncomm table is deprecated. Please use fk_user_action instead. -* The AGENDA_ENABLE_DONEBY hidden option is deprecated. +* Route for API /thirdparties/gateways has been renamed into /thirdparties/accounts to better match the api object name. +* The AGENDA_ENABLE_DONEBY hidden option has been removed. So $userdoneid in actioncomm class is deprecated. Please use $userownerid instead. Also, + the field $fk_user_done in actioncomm table is deprecated. Please use $fk_user_action instead. +* The table commande_fournisseur_dispatch has been renamed into receptiondet_batch to better match its goal. ***** ChangeLog for 19.0.1 compared to 19.0.0 ***** FIX: 16.0 - parent company gets emptied when updating a third party from the card in edit mode (#28269) +FIX: 17.0: $num doesn't take trigger-modified newref into account, leading to inconsistencies if BILL_SUPPLIER_VALIDATE changes the invoice's ref (#28684) FIX: #22948 +FIX: #24265 regression cannot see all product on takepos (#28753) FIX: #28205 -FIX: 28251 Fixing subpermission name on api_multicurrencies.class.php (#28252) +FIX: #28251 Fixing subpermission name on api_multicurrencies.class.php (#28252) FIX: #28369 FIX: #28429 FIX: #28491 (#28522) @@ -49,6 +51,8 @@ FIX: #28533 Mo::deleteLine removes the "main" MoLine if consumed line is delete FIX: #28564 FIX: Adding the dependencies list feature for extrafields "select" (#28549) FIX: Add new hidden conf "DISABLE_QTY_OVERWRITTEN" (#28523) +FIX: Amount of localtaxes in foreign currency was wrong on screen and PDF +FIX: an error in a complex else condition FIX: avoid error "Column 'entity' in where clause is ambiguous" (#28270) FIX: avoid Unknown column 'pfp.ref_fourn' (#28145) FIX: avoid warning "error parsing attribute name in Entity" (#28543) @@ -59,34 +63,48 @@ FIX: Bad picto on list of permission of a user when user not admin FIX: bad timezone for the start/end date of an event FIX: Better test on validity of compute field syntax with parenthesis FIX: close #28279 -FIX: disabled pito of menu must be greyed. +FIX: Count of virtual stock at Services and MoLine with disabled stock change (#28580) +FIX: disabled picto of menu must be greyed. FIX: Don't display column when it's out of date (#28271) FIX: duplicate with lines: 414-416 (#28358) +FIX: edit bank suggested for credit transfer payment in invoice setup FIX: Error When cloning fourn price no default value for tva_tx (#28368) +FIX: fatal error Unsupported operand types when recording load payment +FIX: Fix create shipping with product who have negative stocks on warehouse but the negative stock transfer is allowed (#26217) FIX: migration missing 2 columns in llx_resource and 1 in llx_user FIX: missing trans FIX: notification module: for supplier orders (any of the 3 triggers), user can choose an e-mail template in conf, but the conf is not used when sending the notification (#28216) -FIX: Not truncate the multicurrency rate shown on cards (even if the global MAIN_MAX_DECIMALS_SHOWN is set to 0) (#28211) +FIX: Not trancate the multicurrency rate shown on cards (even if the global MAIN_MAX_DECIMALS_SHOWN is set to 0) (#28211) +FIX: Option MAIN_DOC_USE_TIMING can be a string with date format FIX: Payment on customer invoice - Remove accountid in url if empty for apply default value (#28156) FIX: Pb in redirect of a website page in USEDOLIBARRSERVER mode +FIX: permission on payment file of a tax FIX: PHP Warning: Undefined variable $lib (#28342) +FIX: PHP Warning: Undefined variable $mode (#28697) FIX: Picto for mime +FIX: Picto in top menu FIX: position of field in list of field in shipment list FIX: postgresql error (#28542) FIX: quote in sql request FIX: Responsive on admin project FIX: Shipment closing action has wrong value (#28174) +FIX: skip adding tab if user doesn't have permission (#28698) FIX: some tooltips has disappeared on invoice action button FIX: Special code is now transmitted by args only in order supplier (#28546) +FIX: Special code is now transmitted by args only in order supplier (#28619) FIX: subscription must be editable when accounting isn't reconciled (#28469) +FIX: Translation for select (#28677) +FIX: upload odt files should not start/end with space FIX: Value of field int = 0 from modulebuilder must not be set to null +FIX: Wrong currency shown in TakePOS payment page +FIX: #yogosha21416 ***** ChangeLog for 19.0.0 compared to 18.0.0 ***** For users: ---------- -NEW: Compatibility with PHP 8.2 +NEW: Compatibility with PHP 8.2 (warning must be disabled) NEW: Module Workstation (used to enhance the module BOM and Manufacturing Order) is now stable NEW: Add a CLI tool to regenerate all documents NEW: Add a confirmation popup when deleting extrafields @@ -10105,7 +10123,7 @@ For developers: WARNING: - A lot of class files (*.class.php) has moved into subdirectories. So If you use or develop non official modules that includes Dolibarr classes, you will have to rename - path to thoose classes into the include function. + path to those classes into the include function. - Also, parameters of the "fetch()" method for class "User" has changed to reflect other fetch methods. - If you build a personalised themes, you must rename the style sheet into style.css.php. diff --git a/build/exe/doliwamp/Languages/MyCatalan.isl b/build/exe/doliwamp/Languages/MyCatalan.isl index cb1066b5f91..c2f8ad5791d 100644 --- a/build/exe/doliwamp/Languages/MyCatalan.isl +++ b/build/exe/doliwamp/Languages/MyCatalan.isl @@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=L'instal·lador DoliWamp intentarà iniciar o reini OldVersionFoundAndMoveInNew=S'ha trobat una versió antiga de base de dades i ha estat moguda per a ser utilitzada per la nova versió de Dolibarr OldVersionFoundButFailedToMoveInNew=S'ha trobat una versió antiga de base de dades, però no es pot moure per a ser utilitzada per la nova versió de Dolibarr -DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2015". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp. +DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2017". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp. ContinueAnyway=Continua igualment (el procés d'instal·lació podria fallar sense aquest prerequisit) diff --git a/build/exe/doliwamp/Languages/MyEnglish.isl b/build/exe/doliwamp/Languages/MyEnglish.isl index 2a6c8b9a4ba..566d4410334 100644 --- a/build/exe/doliwamp/Languages/MyEnglish.isl +++ b/build/exe/doliwamp/Languages/MyEnglish.isl @@ -44,5 +44,5 @@ DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by the new Dolibarr version OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with the new Dolibarr version -DLLMissing=Your Windows installation is missing The "Microsoft Visual C++ Redistributable for Visual Studio 2015" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. +DLLMissing=Your Windows installation is missing The "Microsoft Visual C++ Redistributable for Visual Studio 2017" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170) and restart DoliWamp installation/upgrade after. ContinueAnyway=Continue anyway (install process may fail without this prerequisite) diff --git a/build/exe/doliwamp/Languages/MyFrench.isl b/build/exe/doliwamp/Languages/MyFrench.isl index 6c6294fb7c4..2fb684657a5 100644 --- a/build/exe/doliwamp/Languages/MyFrench.isl +++ b/build/exe/doliwamp/Languages/MyFrench.isl @@ -44,5 +44,5 @@ DoliWampWillStartApacheMysql=L'installeur DoliWamp va maintenant d OldVersionFoundAndMoveInNew=Une ancienne version de base a t trouve et dplace pour fonctionner avec la nouvelle version de Dolibarr. OldVersionFoundButFailedToMoveInNew=Une ancienne version de base a t trouve mais ne peut tre dplace pour tre utilise avec la nouvelle version de Dolibarr. -DLLMissing=L'installation de votre Windows est incomplte. Il manque le composant "Micrsoft Visual C++ Redistributable for Visual Studio 2015". Installer la version 32-bit (vcredist_x86.exe) d'abord (vous pourrez le trouver https://www.microsoft.com/fr-fr/download/) puis relancer l'installation de DoliWamp aprs. +DLLMissing=L'installation de votre Windows est incomplte. Il manque le composant "Micrsoft Visual C++ Redistributable for Visual Studio 2017". Installer la version 32-bit (vcredist_x86.exe) d'abord (vous pourrez le trouver https://www.microsoft.com/fr-fr/download/) puis relancer l'installation de DoliWamp aprs. ContinueAnyway=Continuer malgr tout (le process d'installaton chouera) diff --git a/build/exe/doliwamp/Languages/MyGerman.isl b/build/exe/doliwamp/Languages/MyGerman.isl index 132260b7273..7d7fa1662a8 100644 --- a/build/exe/doliwamp/Languages/MyGerman.isl +++ b/build/exe/doliwamp/Languages/MyGerman.isl @@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=Die DoliWamp-Installation wird nun starten oder Apa OldVersionFoundAndMoveInNew=Eine alte Datenbankversion wurde gefunden und verschoben, um von der neuen Dolibarr-Version verwendet zu werden. OldVersionFoundButFailedToMoveInNew=Eine alte Datenbankversion wurde gefunden, konnte jedoch nicht verschoben werden, um mit der neuen Dolibarr-Version verwendet zu werden. -DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2015" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. +DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2017" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. ContinueAnyway=Fahren Sie trotzdem fort (der Installationsvorgang kann ohne diese Voraussetzung fehlschlagen). diff --git a/build/exe/doliwamp/Languages/MySpanish.isl b/build/exe/doliwamp/Languages/MySpanish.isl index 6880a9263e1..4500e776672 100644 --- a/build/exe/doliwamp/Languages/MySpanish.isl +++ b/build/exe/doliwamp/Languages/MySpanish.isl @@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=El instalador DoliWamp intentará iniciar o reinici OldVersionFoundAndMoveInNew=Se ha encontrado una versión antigua de base de datos y ha sido movida para ser utilizada por la nueva versión de Dolibarr OldVersionFoundButFailedToMoveInNew=Se ha encontrado una versión antigua de base de datos, pero no se pudo mover para ser utilizada por la nueva versión de Dolibarr -DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2015". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp. +DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2017". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp. ContinueAnyway=Continua igualmente (el proceso de instalación podría fallar sin este prerequisito) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index beeec222c2a..1a14058de68 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -100,9 +100,9 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi ; Apache, Php, Mysql ; Put here path of Wampserver applications -; Value OK: apache 2.4.51, php 7.3.33, mariadb10.6.5 (wampserver3.2.6_x64.exe) +; Value OK: apache 2.4.51, php 7.4.26, mariadb10.6.5 (wampserver3.2.6_x64.exe) Source: "C:\wamp64\bin\apache\apache2.4.51\*.*"; DestDir: "{app}\bin\apache\apache2.4.51"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" -Source: "C:\wamp64\bin\php\php7.3.33\*.*"; DestDir: "{app}\bin\php\php7.3.33"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" +Source: "C:\wamp64\bin\php\php7.4.26\*.*"; DestDir: "{app}\bin\php\php7.4.26"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" Source: "C:\wamp64\bin\mariadb\mariadb10.6.5\*.*"; DestDir: "{app}\bin\mariadb\mariadb10.6.5"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe" ; Mysql data files (does not overwrite if exists) @@ -121,7 +121,7 @@ Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flag Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.51\conf"; Flags: ignoreversion; Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion; Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mariadb\mariadb10.6.5"; Flags: ignoreversion; -Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php7.3.33"; Flags: ignoreversion; +Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php7.4.26"; Flags: ignoreversion; Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion; Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion; Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion; @@ -228,7 +228,7 @@ begin //version des applis, a modifier pour chaque version de WampServer 2 apacheVersion := '2.4.51'; - phpVersion := '7.3.33' ; + phpVersion := '7.4.26' ; mysqlVersion := '10.6.5'; smtpServer := 'localhost'; diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 654bca95256..674d6e2fd01 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -14,11 +14,11 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke > Install InnoSetup For example by running isetup-5.5.8.exe (https://www.jrsoftware.org) https://files.jrsoftware.org/is/5/ > Install WampServer into "C:\wamp64" to have Apache, PHP and MariaDB - For example by running wampserver3.2.6_x64.exe (https://www.wampserver.com). + For example by running wampserver3.2.6_x64.exe (https://www.wampserver.com). See file build/exe/doliwamp.iss to know the doliwamp version currently setup. > Add path to ISCC into PATH windows var: Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH -> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommended), +> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommended), open file build/exe/doliwamp.iss and click on button "Compile". The .exe file will be build into directory build. @@ -29,12 +29,13 @@ Prerequisites to build autoexe DoliWamp package from Windows: > Install Perl for Windows (https://strawberryperl.com/) > Install isetup-5.5.8.exe (https://www.jrsoftware.org) -> Install WampServer-3.2.*-64.exe (Apache 2.4.51, PHP 7.3.33, MariaDB 10.6.5 for example. Version must match the values found into doliwamp.iss) +> Install Microsoft Visual C++ Redistributable 2017 (https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170) +> Install WampServer-3.2.6-64.exe (Apache 2.4.51, PHP 7.4.26, MariaDB 10.6.5 for example. Version must match the values found into doliwamp.iss) > Install GIT for Windows (https://git-scm.com/ => You must choose option "Add Git bash profile", "Git commit as-is") -> Install Dolibarr current version: - git clone https://github.com/dolibarr/dolibarr or git clone --branch X.Y https://github.com/dolibarr/dolibarr +> Install Dolibarr current version: + git clone https://github.com/dolibarr/dolibarr or git clone --branch X.Y https://github.com/dolibarr/dolibarr -> Add the path of PHP (C:\wamp64\bin\php\php7.3.33) and InnoSetup (C:\Program Files (x86)\Inno Setup 5) into the %PATH% of Windows. +> Add the path of PHP (C:\wamp64\bin\php\php7.4.26) and InnoSetup (C:\Program Files (x86)\Inno Setup 5) into the %PATH% of Windows. > Create a config file c:\dolibarr\dolibarr\htdocs\conf\conf.php with content /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" @@ -69,7 +70,7 @@ 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 +This files describe steps made by Dolibarr packaging team to make a complete release of Dolibarr, step by step. - Check all files are committed. @@ -86,9 +87,9 @@ 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 +- 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 +- Run makepack-dolibarr.pl again with option to publish files on sourceforge. This will also add official tag. - Edit symbolic links in directory "/home/dolibarr/wwwroot/files/stable/xxx" on server to point to new files (used by some web sites). diff --git a/dev/initdemo/mysqldump_dolibarr_19.0.0.sql b/dev/initdemo/mysqldump_dolibarr_19.0.0.sql index 83d4645572a..78a4358879e 100644 --- a/dev/initdemo/mysqldump_dolibarr_19.0.0.sql +++ b/dev/initdemo/mysqldump_dolibarr_19.0.0.sql @@ -1389,7 +1389,7 @@ CREATE TABLE `llx_c_action_trigger` ( LOCK TABLES `llx_c_action_trigger` WRITE; /*!40000 ALTER TABLE `llx_c_action_trigger` DISABLE KEYS */; -INSERT INTO `llx_c_action_trigger` VALUES (131,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1,NULL),(132,'COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1,NULL),(133,'PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2,NULL),(134,'PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3,NULL),(135,'ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4,NULL),(136,'ORDER_CLOSE','Customer order classify delivered','Executed when a customer order is set delivered','commande',5,NULL),(137,'ORDER_CLASSIFY_BILLED','Customer order classify billed','Executed when a customer order is set to billed','commande',5,NULL),(138,'ORDER_CANCEL','Customer order canceled','Executed when a customer order is canceled','commande',5,NULL),(139,'ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5,NULL),(140,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6,NULL),(141,'BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7,NULL),(142,'BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8,NULL),(143,'BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9,NULL),(144,'BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9,NULL),(145,'ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11,NULL),(146,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',12,NULL),(147,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13,NULL),(148,'ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14,NULL),(149,'BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15,NULL),(150,'BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16,NULL),(151,'BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17,NULL),(152,'BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17,NULL),(153,'CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18,NULL),(154,'SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20,NULL),(155,'SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21,NULL),(156,'MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22,NULL),(158,'MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',24,NULL),(159,'MEMBER_MODIFY','Member modified','Executed when a member is modified','member',24,NULL),(160,'MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25,NULL),(161,'FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',19,NULL),(162,'FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19,NULL),(163,'FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19,NULL),(164,'FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19,NULL),(165,'FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19,NULL),(166,'PROJECT_CREATE','Project creation','Executed when a project is created','project',140,NULL),(167,'PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2,NULL),(168,'PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2,NULL),(169,'PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2,NULL),(170,'TASK_CREATE','Task created','Executed when a project task is created','project',35,NULL),(171,'TASK_MODIFY','Task modified','Executed when a project task is modified','project',36,NULL),(172,'TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37,NULL),(173,'BILL_SUPPLIER_UNVALIDATE','Supplier invoice unvalidated','Executed when a supplier invoice status is set back to draft','invoice_supplier',15,NULL),(174,'PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141,NULL),(175,'PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',142,NULL),(176,'ORDER_SUPPLIER_CREATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11,NULL),(177,'ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',12,NULL),(178,'ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',12,NULL),(179,'ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14,NULL),(180,'PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30,NULL),(181,'PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30,NULL),(182,'PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30,NULL),(183,'EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201,NULL),(185,'EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202,NULL),(186,'EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203,NULL),(187,'EXPENSE_REPORT_PAID','Expense report billed','Executed when an expense report is set as billed','expensereport',204,NULL),(192,'HOLIDAY_CREATE','Leave request created','Executed when a leave request is created','holiday',221,NULL),(193,'HOLIDAY_VALIDATE','Leave request validated','Executed when a leave request is validated','holiday',222,NULL),(194,'HOLIDAY_APPROVE','Leave request approved','Executed when a leave request is approved','holiday',223,NULL),(210,'MEMBER_SENTBYMAIL','Mails sent from member card','Executed when you send email from member card','member',23,NULL),(211,'CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18,NULL),(212,'PROPOSAL_SUPPLIER_VALIDATE','Price request validated','Executed when a commercial proposal is validated','proposal_supplier',10,NULL),(213,'PROPOSAL_SUPPLIER_SENTBYMAIL','Price request sent by mail','Executed when a commercial proposal is sent by mail','proposal_supplier',10,NULL),(214,'PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10,NULL),(215,'PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10,NULL),(216,'MEMBER_SUBSCRIPTION_CREATE','Member subscribtion recorded','Executed when a member subscribtion is deleted','member',24,NULL),(217,'MEMBER_SUBSCRIPTION_MODIFY','Member subscribtion modified','Executed when a member subscribtion is modified','member',24,NULL),(218,'MEMBER_SUBSCRIPTION_DELETE','Member subscribtion deleted','Executed when a member subscribtion is deleted','member',24,NULL),(225,'COMPANY_DELETE','Third party deleted','Executed when you delete third party','societe',1,NULL),(226,'PROPAL_DELETE','Customer proposal deleted','Executed when a customer proposal is deleted','propal',2,NULL),(227,'ORDER_DELETE','Customer order deleted','Executed when a customer order is deleted','commande',5,NULL),(228,'BILL_DELETE','Customer invoice deleted','Executed when a customer invoice is deleted','facture',9,NULL),(229,'PROPOSAL_SUPPLIER_DELETE','Price request deleted','Executed when a customer proposal delete','proposal_supplier',10,NULL),(230,'ORDER_SUPPLIER_DELETE','Supplier order deleted','Executed when a supplier order is deleted','order_supplier',14,NULL),(231,'BILL_SUPPLIER_DELETE','Supplier invoice deleted','Executed when a supplier invoice is deleted','invoice_supplier',17,NULL),(232,'CONTRACT_DELETE','Contract deleted','Executed when a contract is deleted','contrat',18,NULL),(233,'FICHINTER_DELETE','Intervention is deleted','Executed when a intervention is deleted','ficheinter',35,NULL),(234,'EXPENSE_REPORT_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',204,NULL),(249,'TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161,NULL),(250,'TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163,NULL),(251,'TICKET_ASSIGNED','Ticket assigned','Executed when a ticket is assigned to another user','ticket',164,NULL),(252,'TICKET_CLOSE','Ticket closed','Executed when a ticket is closed','ticket',165,NULL),(253,'TICKET_SENTBYMAIL','Ticket message sent by email','Executed when a message is sent from the ticket record','ticket',166,NULL),(254,'TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',167,NULL),(261,'USER_SENTBYMAIL','Email sent','Executed when an email is sent from user card','user',300,NULL),(262,'BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650,NULL),(263,'BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651,NULL),(264,'BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652,NULL),(265,'BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653,NULL),(266,'BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654,NULL),(351,'MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660,NULL),(352,'MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661,NULL),(353,'MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662,NULL),(354,'MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663,NULL),(365,'CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50,NULL),(366,'CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51,NULL),(367,'CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52,NULL),(368,'RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500,NULL),(369,'RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502,NULL),(370,'RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504,NULL),(371,'RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506,NULL),(372,'RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510,NULL),(373,'RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512,NULL),(374,'RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514,NULL),(375,'RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516,NULL),(392,'COMPANY_MODIFY','Third party update','Executed when you update third party','societe',1,NULL),(393,'CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51,NULL),(394,'ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13,NULL),(395,'MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27,NULL),(396,'USER_CREATE','User created','Executed when a user is created','user',301,NULL),(397,'USER_MODIFY','User update','Executed when a user is updated','user',302,NULL),(398,'USER_DELETE','User update','Executed when a user is deleted','user',303,NULL),(399,'USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304,NULL),(400,'USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305,NULL),(402,'HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801,NULL),(405,'HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802,NULL),(406,'HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804,NULL),(407,'PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2,NULL),(408,'ORDER_MODIFY','Customer order modified','Executed when a customer order is set modified','commande',5,NULL),(409,'BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7,NULL),(410,'PROPOSAL_SUPPLIER_MODIFY','Price request modified','Executed when a commercial proposal is modified','proposal_supplier',10,NULL),(411,'ORDER_SUPPLIER_MODIFY','Supplier order request modified','Executed when a supplier order is modified','order_supplier',13,NULL),(412,'BILL_SUPPLIER_MODIFY','Supplier invoice modified','Executed when a supplier invoice is modified','invoice_supplier',15,NULL),(413,'CONTRACT_MODIFY','Contract modified','Executed when a contract is modified','contrat',18,NULL),(414,'SHIPPING_MODIFY','Shipping modified','Executed when a shipping is modified','shipping',20,NULL),(415,'FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30,NULL),(417,'EXPENSE_REPORT_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',202,NULL),(455,'PROJECT_SENTBYMAIL','Project sent by mail','Executed when a project is sent by email','project',144,NULL),(511,'SHIPPING_DELETE','Shipping sent is deleted','Executed when a shipping is deleted','shipping',21,NULL),(512,'RECEPTION_VALIDATE','Reception validated','Executed when a reception is validated','reception',22,NULL),(513,'RECEPTION_SENTBYMAIL','Reception sent by mail','Executed when a reception is sent by mail','reception',22,NULL),(543,'PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141,NULL),(584,'ACTION_CREATE','Action added','Executed when an action is added to the agenda','agenda',700,NULL),(591,'BILLREC_CREATE','Template invoices created','Executed when a Template invoices is created','facturerec',900,NULL),(592,'BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901,NULL),(593,'BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902,NULL),(594,'BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903,NULL),(875,'PARTNERSHIP_CREATE','Partnership created','Executed when a partnership is created','partnership',58000,NULL),(876,'PARTNERSHIP_MODIFY','Partnership modified','Executed when a partnership is modified','partnership',58002,NULL),(877,'PARTNERSHIP_SENTBYMAIL','Mails sent from partnership file','Executed when you send email from partnership file','partnership',58004,NULL),(878,'PARTNERSHIP_DELETE','Partnership deleted','Executed when a partnership is deleted','partnership',58006,NULL),(879,'PROJECT_CLOSE','Project closed','Executed when a project is closed','project',145,NULL),(881,'COMPANY_RIB_CREATE','Third party payment information created','Executed when a third party payment information is created','societe',1,NULL),(882,'COMPANY_RIB_MODIFY','Third party payment information updated','Executed when a third party payment information is updated','societe',1,NULL),(883,'COMPANY_RIB_DELETE','Third party payment information deleted','Executed when a third party payment information is deleted','societe',1,NULL),(884,'FICHINTER_CLOSE','Intervention is done','Executed when a intervention is done','ficheinter',36,NULL); +INSERT INTO `llx_c_action_trigger` VALUES (131,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1,NULL),(132,'COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1,NULL),(133,'PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2,NULL),(134,'PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3,NULL),(135,'ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4,NULL),(136,'ORDER_CLOSE','Customer order classify delivered','Executed when a customer order is set delivered','commande',5,NULL),(137,'ORDER_CLASSIFY_BILLED','Customer order classify billed','Executed when a customer order is set to billed','commande',5,NULL),(138,'ORDER_CANCEL','Customer order canceled','Executed when a customer order is canceled','commande',5,NULL),(139,'ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5,NULL),(140,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6,NULL),(141,'BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7,NULL),(142,'BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is canceled','facture',8,NULL),(143,'BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9,NULL),(144,'BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9,NULL),(145,'ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11,NULL),(146,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',12,NULL),(147,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13,NULL),(148,'ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14,NULL),(149,'BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15,NULL),(150,'BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16,NULL),(151,'BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17,NULL),(152,'BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17,NULL),(153,'CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18,NULL),(154,'SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20,NULL),(155,'SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21,NULL),(156,'MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22,NULL),(158,'MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',24,NULL),(159,'MEMBER_MODIFY','Member modified','Executed when a member is modified','member',24,NULL),(160,'MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25,NULL),(161,'FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',19,NULL),(162,'FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19,NULL),(163,'FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19,NULL),(164,'FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19,NULL),(165,'FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19,NULL),(166,'PROJECT_CREATE','Project creation','Executed when a project is created','project',140,NULL),(167,'PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2,NULL),(168,'PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2,NULL),(169,'PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2,NULL),(170,'TASK_CREATE','Task created','Executed when a project task is created','project',35,NULL),(171,'TASK_MODIFY','Task modified','Executed when a project task is modified','project',36,NULL),(172,'TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37,NULL),(173,'BILL_SUPPLIER_UNVALIDATE','Supplier invoice unvalidated','Executed when a supplier invoice status is set back to draft','invoice_supplier',15,NULL),(174,'PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141,NULL),(175,'PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',142,NULL),(176,'ORDER_SUPPLIER_CREATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11,NULL),(177,'ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',12,NULL),(178,'ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',12,NULL),(179,'ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14,NULL),(180,'PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30,NULL),(181,'PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30,NULL),(182,'PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30,NULL),(183,'EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201,NULL),(185,'EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202,NULL),(186,'EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203,NULL),(187,'EXPENSE_REPORT_PAID','Expense report billed','Executed when an expense report is set as billed','expensereport',204,NULL),(192,'HOLIDAY_CREATE','Leave request created','Executed when a leave request is created','holiday',221,NULL),(193,'HOLIDAY_VALIDATE','Leave request validated','Executed when a leave request is validated','holiday',222,NULL),(194,'HOLIDAY_APPROVE','Leave request approved','Executed when a leave request is approved','holiday',223,NULL),(210,'MEMBER_SENTBYMAIL','Mails sent from member card','Executed when you send email from member card','member',23,NULL),(211,'CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18,NULL),(212,'PROPOSAL_SUPPLIER_VALIDATE','Price request validated','Executed when a commercial proposal is validated','proposal_supplier',10,NULL),(213,'PROPOSAL_SUPPLIER_SENTBYMAIL','Price request sent by mail','Executed when a commercial proposal is sent by mail','proposal_supplier',10,NULL),(214,'PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10,NULL),(215,'PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10,NULL),(216,'MEMBER_SUBSCRIPTION_CREATE','Member subscribtion recorded','Executed when a member subscribtion is deleted','member',24,NULL),(217,'MEMBER_SUBSCRIPTION_MODIFY','Member subscribtion modified','Executed when a member subscribtion is modified','member',24,NULL),(218,'MEMBER_SUBSCRIPTION_DELETE','Member subscribtion deleted','Executed when a member subscribtion is deleted','member',24,NULL),(225,'COMPANY_DELETE','Third party deleted','Executed when you delete third party','societe',1,NULL),(226,'PROPAL_DELETE','Customer proposal deleted','Executed when a customer proposal is deleted','propal',2,NULL),(227,'ORDER_DELETE','Customer order deleted','Executed when a customer order is deleted','commande',5,NULL),(228,'BILL_DELETE','Customer invoice deleted','Executed when a customer invoice is deleted','facture',9,NULL),(229,'PROPOSAL_SUPPLIER_DELETE','Price request deleted','Executed when a customer proposal delete','proposal_supplier',10,NULL),(230,'ORDER_SUPPLIER_DELETE','Supplier order deleted','Executed when a supplier order is deleted','order_supplier',14,NULL),(231,'BILL_SUPPLIER_DELETE','Supplier invoice deleted','Executed when a supplier invoice is deleted','invoice_supplier',17,NULL),(232,'CONTRACT_DELETE','Contract deleted','Executed when a contract is deleted','contrat',18,NULL),(233,'FICHINTER_DELETE','Intervention is deleted','Executed when a intervention is deleted','ficheinter',35,NULL),(234,'EXPENSE_REPORT_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',204,NULL),(249,'TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161,NULL),(250,'TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163,NULL),(251,'TICKET_ASSIGNED','Ticket assigned','Executed when a ticket is assigned to another user','ticket',164,NULL),(252,'TICKET_CLOSE','Ticket closed','Executed when a ticket is closed','ticket',165,NULL),(253,'TICKET_SENTBYMAIL','Ticket message sent by email','Executed when a message is sent from the ticket record','ticket',166,NULL),(254,'TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',167,NULL),(261,'USER_SENTBYMAIL','Email sent','Executed when an email is sent from user card','user',300,NULL),(262,'BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650,NULL),(263,'BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651,NULL),(264,'BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652,NULL),(265,'BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653,NULL),(266,'BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654,NULL),(351,'MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660,NULL),(352,'MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661,NULL),(353,'MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662,NULL),(354,'MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663,NULL),(365,'CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50,NULL),(366,'CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51,NULL),(367,'CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52,NULL),(368,'RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500,NULL),(369,'RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502,NULL),(370,'RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504,NULL),(371,'RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506,NULL),(372,'RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510,NULL),(373,'RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512,NULL),(374,'RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514,NULL),(375,'RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516,NULL),(392,'COMPANY_MODIFY','Third party update','Executed when you update third party','societe',1,NULL),(393,'CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51,NULL),(394,'ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13,NULL),(395,'MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27,NULL),(396,'USER_CREATE','User created','Executed when a user is created','user',301,NULL),(397,'USER_MODIFY','User update','Executed when a user is updated','user',302,NULL),(398,'USER_DELETE','User update','Executed when a user is deleted','user',303,NULL),(399,'USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304,NULL),(400,'USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305,NULL),(402,'HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801,NULL),(405,'HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802,NULL),(406,'HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804,NULL),(407,'PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2,NULL),(408,'ORDER_MODIFY','Customer order modified','Executed when a customer order is set modified','commande',5,NULL),(409,'BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7,NULL),(410,'PROPOSAL_SUPPLIER_MODIFY','Price request modified','Executed when a commercial proposal is modified','proposal_supplier',10,NULL),(411,'ORDER_SUPPLIER_MODIFY','Supplier order request modified','Executed when a supplier order is modified','order_supplier',13,NULL),(412,'BILL_SUPPLIER_MODIFY','Supplier invoice modified','Executed when a supplier invoice is modified','invoice_supplier',15,NULL),(413,'CONTRACT_MODIFY','Contract modified','Executed when a contract is modified','contrat',18,NULL),(414,'SHIPPING_MODIFY','Shipping modified','Executed when a shipping is modified','shipping',20,NULL),(415,'FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30,NULL),(417,'EXPENSE_REPORT_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',202,NULL),(455,'PROJECT_SENTBYMAIL','Project sent by mail','Executed when a project is sent by email','project',144,NULL),(511,'SHIPPING_DELETE','Shipping sent is deleted','Executed when a shipping is deleted','shipping',21,NULL),(512,'RECEPTION_VALIDATE','Reception validated','Executed when a reception is validated','reception',22,NULL),(513,'RECEPTION_SENTBYMAIL','Reception sent by mail','Executed when a reception is sent by mail','reception',22,NULL),(543,'PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141,NULL),(584,'ACTION_CREATE','Action added','Executed when an action is added to the agenda','agenda',700,NULL),(591,'BILLREC_CREATE','Template invoices created','Executed when a Template invoices is created','facturerec',900,NULL),(592,'BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901,NULL),(593,'BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902,NULL),(594,'BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903,NULL),(875,'PARTNERSHIP_CREATE','Partnership created','Executed when a partnership is created','partnership',58000,NULL),(876,'PARTNERSHIP_MODIFY','Partnership modified','Executed when a partnership is modified','partnership',58002,NULL),(877,'PARTNERSHIP_SENTBYMAIL','Mails sent from partnership file','Executed when you send email from partnership file','partnership',58004,NULL),(878,'PARTNERSHIP_DELETE','Partnership deleted','Executed when a partnership is deleted','partnership',58006,NULL),(879,'PROJECT_CLOSE','Project closed','Executed when a project is closed','project',145,NULL),(881,'COMPANY_RIB_CREATE','Third party payment information created','Executed when a third party payment information is created','societe',1,NULL),(882,'COMPANY_RIB_MODIFY','Third party payment information updated','Executed when a third party payment information is updated','societe',1,NULL),(883,'COMPANY_RIB_DELETE','Third party payment information deleted','Executed when a third party payment information is deleted','societe',1,NULL),(884,'FICHINTER_CLOSE','Intervention is done','Executed when a intervention is done','ficheinter',36,NULL); /*!40000 ALTER TABLE `llx_c_action_trigger` ENABLE KEYS */; UNLOCK TABLES; diff --git a/dev/setup/phpunit/setup_conf.sh b/dev/setup/phpunit/setup_conf.sh index 9c11bb5f332..fb04546ab0f 100755 --- a/dev/setup/phpunit/setup_conf.sh +++ b/dev/setup/phpunit/setup_conf.sh @@ -5,6 +5,8 @@ TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR:=$(realpath "$(dirname "$0")/../../..")} MYSQL=${MYSQL:=mysql} MYSQLDUMP=${MYSQLDUMP:="${MYSQL}dump"} +PHP=${PHP:=php} +PHP_OPT="-d error_reporting=32767" DB=${DB:=mariadb} DB_ROOT=${DB_ROOT:=root} @@ -198,9 +200,9 @@ if [ "$load_cache" != "1" ] ; then pVer=${VERSIONS[0]} for v in "${VERSIONS[@]:1}" ; do LOGNAME="${TRAVIS_BUILD_DIR}/upgrade${pVer//./}${v//./}" - php upgrade.php "$pVer" "$v" ignoredbversion > "${LOGNAME}.log" - php upgrade2.php "$pVer" "$v" ignoredbversion > "${LOGNAME}-2.log" - php step5.php "$pVer" "$v" ignoredbversion > "${LOGNAME}-3.log" + "${PHP}" $PHP_OPT upgrade.php "$pVer" "$v" ignoredbversion > "${LOGNAME}.log" + "${PHP}" $PHP_OPT upgrade2.php "$pVer" "$v" ignoredbversion > "${LOGNAME}-2.log" + "${PHP}" $PHP_OPT step5.php "$pVer" "$v" ignoredbversion > "${LOGNAME}-3.log" pVer="$v" done @@ -208,11 +210,11 @@ if [ "$load_cache" != "1" ] ; then { - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_ProductBatch,MAIN_MODULE_SupplierProposal,MAIN_MODULE_STRIPE,MAIN_MODULE_ExpenseReport - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KnowledgeManagement,MAIN_MODULE_EventOrganization,MAIN_MODULE_PARTNERSHIP - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_EmailCollector + "${PHP}" $PHP_OPT upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_ProductBatch,MAIN_MODULE_SupplierProposal,MAIN_MODULE_STRIPE,MAIN_MODULE_ExpenseReport + "${PHP}" $PHP_OPT upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP + "${PHP}" $PHP_OPT upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT + "${PHP}" $PHP_OPT upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KnowledgeManagement,MAIN_MODULE_EventOrganization,MAIN_MODULE_PARTNERSHIP + "${PHP}" $PHP_OPT upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_EmailCollector } > $TRAVIS_BUILD_DIR/enablemodule.log ) && save_db_cache fi diff --git a/dev/setup/pre-commit/README.md b/dev/setup/pre-commit/README.md index c5c35e81829..c2a1e4901cb 100644 --- a/dev/setup/pre-commit/README.md +++ b/dev/setup/pre-commit/README.md @@ -85,7 +85,7 @@ export SKIP=no-commit-to-branch # In your .bashrc or session. There is much more you can do with pre-commit, check out its [documentation](https://pre-commit.com). -Now your commit is less likely to fail in the Continuous Intagration (CI) run +Now your commit is less likely to fail in the Continuous Integration (CI) run on github.\ CI also runs pre-commit to help maintain code quality. diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index eb737b9690e..3a31b4b232b 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -3,6 +3,7 @@ /* * Copyright (C) 2023 Laurent Destailleur * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -708,7 +709,7 @@ if (count($output_phan_json) != 0) { $tmpphan .= ''; $tmpphan .= ''.$line_range_txt.''; $tmpphan .= ''; - $tmpphan .= ''.dolPrintLabel($notice['description']).''; + $tmpphan .= ''.dolPrintLabel($notice['description']).''; $tmpphan .= ''; $tmpphan .= "\n"; diff --git a/dev/tools/codespell/codespell-dict.txt b/dev/tools/codespell/codespell-dict.txt index c40c7608602..047de65a4a8 100644 --- a/dev/tools/codespell/codespell-dict.txt +++ b/dev/tools/codespell/codespell-dict.txt @@ -9,10 +9,13 @@ aploha->alpha aplohanothtml->alphanohtml aplphanothtml->alphanohtml choosed->chosen +cumuled->cumulative dokument->document dolibar->dolibarr +dolibarrr->dolibarr dollibar->dolibarr dollibarr->dolibarr +thoose->those # fiche->card mot de passe->password not de passe->password diff --git a/dev/tools/codespell/codespell-ignore.txt b/dev/tools/codespell/codespell-ignore.txt index 0c84807010b..1eccff84fd5 100644 --- a/dev/tools/codespell/codespell-ignore.txt +++ b/dev/tools/codespell/codespell-ignore.txt @@ -27,6 +27,8 @@ thead ue whitelist ws +# Thirdparty should be Third party or Third-party but ignoring it because it's omnipresent +thirdparty # Code string ect tempdate diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index 80e4f25e296..5ca2d3880c1 100644 --- a/dev/tools/codespell/codespell-lines-ignore.txt +++ b/dev/tools/codespell/codespell-lines-ignore.txt @@ -278,6 +278,8 @@ - informations,medias,uptodate,reenable,crypted,developpers - ned * @param array $TWeek array of week numbers + * @param string[] $TWeek array of week numbers + * @param string[] $TWeek array of week numbers (week 1 must be '01') * @param array $TWeek Array of week numbers * Copyright (C) 2019 Tim Otte * Copyright (C) 2019 Tim Otte @@ -326,6 +328,7 @@ $usercanread = (($user->hasRight('stock', 'mouvement', 'lire'))); * The hook contaxt thirdpartycard has been renamed thirdpartycontact * The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere. - New: Add proposals into referer page of thirdparty. +AmountIn NEW: ModuleBuilder: Checkin comments begin and end before each actions for /F "tokens=2 delims=," %%i in ('tasklist /FI "IMAGENAME eq php.exe" /FO CSV /NH') do ( foreach ($TWeek as $week_number) { diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index c56fd81b5d6..f39b1262064 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,29 +9,21 @@ */ return [ // # Issue statistics: - // PhanPluginDuplicateIfStatements : 30+ occurrences // PhanParamSignatureMismatch : 25+ occurrences // PhanPluginSuspiciousParamPosition : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences - // PhanTypeArraySuspiciousNull : 10+ occurrences - // PhanTypeInvalidUnaryOperandNumeric : 8 occurrences + // PhanTypeMismatchReturn : 8 occurrences // PhanRedefineFunctionInternal : 6 occurrences - // PhanPluginUnsafeEval : 5 occurrences - // PhanParamSuspiciousOrder : 4 occurrences + // PhanTypeArraySuspiciousNull : 6 occurrences // PhanParamTooMany : 4 occurrences - // PhanPluginSuspiciousParamOrder : 4 occurrences - // PhanUndeclaredFunctionInCallable : 4 occurrences + // PhanTypeMismatchReturnNullable : 3 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanAccessPropertyStaticAsNonStatic : 1 occurrence - // PhanNoopArray : 1 occurrence - // PhanNoopArrayAccess : 1 occurrence // PhanNoopStringLiteral : 1 occurrence - // PhanPluginAlwaysReturnFunction : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ - 'htdocs/adherents/stats/geo.php' => ['PhanTypeArraySuspiciousNull'], 'htdocs/adherents/type.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/admin/receiptprinter.php' => ['PhanRedefineFunctionInternal'], 'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp'], @@ -39,53 +31,39 @@ return [ 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected'], 'htdocs/categories/viewcat.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/collab/index.php' => ['PhanParamTooMany'], - 'htdocs/comm/action/index.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/accounting-files.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany'], 'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/core/actions_massactions.inc.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/class/commondocgenerator.class.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnsafeEval'], + 'htdocs/core/class/commonobject.class.php' => ['PhanTypeMismatchReturnNullable'], + 'htdocs/core/class/extrafields.class.php' => ['PhanTypeMismatchReturnNullable'], 'htdocs/core/class/html.form.class.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/core/class/html.formmail.class.php' => ['PhanNoopArray'], - 'htdocs/core/class/rssparser.class.php' => ['PhanUndeclaredFunctionInCallable'], 'htdocs/core/db/mysqli.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/db/pgsql.class.php' => ['PhanParamSignatureMismatch'], - 'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch'], + 'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturnNullable'], 'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp'], - 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'], + 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanRedefineFunctionInternal'], 'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/core/lib/usergroups.lib.php' => ['PhanNoopArrayAccess'], - 'htdocs/core/menus/standard/auguria_menu.php' => ['PhanParamSuspiciousOrder'], - 'htdocs/core/menus/standard/eldy_menu.php' => ['PhanParamSuspiciousOrder'], - 'htdocs/core/menus/standard/empty.php' => ['PhanParamSuspiciousOrder'], - 'htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php' => ['PhanParamSignatureMismatch'], - 'htdocs/core/modules/member/doc/pdf_standard.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/modules/movement/doc/pdf_standard.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'], + 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], - 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/expedition/class/api_shipments.class.php' => ['PhanTypeMismatchReturn'], + 'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanTypeMismatchReturn'], + 'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanTypeMismatchReturn'], + 'htdocs/fourn/class/fournisseur.facture.class.php' => ['PhanTypeMismatchReturn'], 'htdocs/intracommreport/list.php' => ['PhanAccessPropertyStaticAsNonStatic'], - 'htdocs/loan/class/paymentloan.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/mrp/class/mo.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/product/admin/product_tools.php' => ['PhanNoopStringLiteral'], + 'htdocs/product/class/product.class.php' => ['PhanTypeMismatchReturn'], 'htdocs/projet/tasks/list.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/public/bookcal/index.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/public/opensurvey/index.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/public/recruitment/index.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/societe/class/companybankaccount.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/takepos/invoice.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/user/class/user.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/variants/class/ProductCombination.class.php' => ['PhanPluginSuspiciousParamPosition'], 'internal' => ['PhanUndeclaredConstant'], ], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 4232427191a..01043b3adc3 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -171,6 +171,7 @@ $VALID_MODULE_MAPPING = array( 'syslog' => 'Syslog', 'takepos' => 'TakePos', 'tax' => 'Tax', + 'theme_datacolor' => 'array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int},3:array{0:int,1:int,2:int}}', 'ticket' => 'Ticket', 'user' => 'User', 'variants' => 'Variants', @@ -277,7 +278,7 @@ return [ 'objectoffield' => '\CommonObject', 'senderissupplier' => 'int<0,1,2>', 'user' => '\User', - 'website' => '\WebSite', + 'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 // Disable because Phan infers Website type 'websitepage' => '\WebSitePage', 'websitepagefile' => 'string', // 'object' => '\CommonObject', // Deprecated, not enabled because conflicts with $object assignments @@ -317,6 +318,7 @@ return [ // to `exclude_analysis_directory_list`. "exclude_analysis_directory_list" => [ 'htdocs/includes/', + 'htdocs/install/doctemplates/websites/', 'htdocs/core/class/lessc.class.php', // External library PHAN_DIR . '/stubs/', ], @@ -370,7 +372,7 @@ return [ 'ConstantVariablePlugin', // Warns about values that are actually constant //'HasPHPDocPlugin', // Requires PHPDoc - 'InlineHTMLPlugin', // html in PHP file, or at end of file + // 'InlineHTMLPlugin', // html in PHP file, or at end of file //'NonBoolBranchPlugin', // Requires test on bool, nont on ints //'NonBoolInLogicalArithPlugin', 'NumericalComparisonPlugin', @@ -408,7 +410,7 @@ return [ 'suppress_issue_types' => [ // Dolibarr uses a lot of internal deprecated stuff, not reporting 'PhanDeprecatedProperty', - 'PhanDeprecatedFunction', + // 'PhanDeprecatedFunction', //'PhanCompatibleNegativeStringOffset', // 'PhanPluginDuplicateExpressionAssignment', // Nulls are likely mostly false positives @@ -435,10 +437,11 @@ return [ // 'PhanPluginUnknownMethodReturnType', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginWhitespaceTab', // Dolibarr uses tabs - 'PhanPluginWhitespaceTrailing', // Should be handled by other tools + // 'PhanPluginWhitespaceTrailing', // 'PhanPluginCanUsePHP71Void', 'PhanPluginUnknownArrayMethodReturnType', - 'PhanTypeMismatchArgumentInternal', + // 'PhanTypeMismatchArgumentInternal', + 'PhanTypeMismatchArgumentNullableInternal', 'PhanPluginDuplicateAdjacentStatement', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchProperty', @@ -446,7 +449,7 @@ return [ 'PhanRedefinedClassReference', // 'PhanPluginNoCommentOnClass', // 'PhanPluginNotFullyQualifiedGlobalConstant', - 'PhanTypeMismatchDefault', + // 'PhanTypeMismatchDefault', // 'PhanPluginPHPDocHashComment', 'PhanPluginShortArrayList', 'PhanPluginUnknownArrayPropertyType', @@ -454,10 +457,10 @@ return [ // 'PhanPluginNoCommentOnProtectedProperty', // 'PhanPluginDescriptionlessCommentOnPublicMethod', // 'PhanPluginUnknownClosureParamType', - 'PhanPluginUnknownClosureReturnType', + // 'PhanPluginUnknownClosureReturnType', // 'PhanPluginNoCommentOnProtectedMethod', // 'PhanTypeArraySuspicious', - 'PhanTypeMismatchPropertyProbablyReal', + // 'PhanTypeMismatchPropertyProbablyReal', // 'PhanPluginNoCommentOnPrivateMethod', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeInvalidLeftOperandOfAdd', @@ -466,12 +469,13 @@ return [ 'PhanPluginUnknownArrayFunctionParamType', // 'PhanPluginDescriptionlessCommentOnPublicProperty', // 'PhanPluginUnknownFunctionParamType', // Finds certain errors in PHPdoc typing - 'PhanTypeSuspiciousStringExpression', + // 'PhanTypeSuspiciousStringExpression', // 'PhanPluginRedundantAssignment', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeInvalidRightOperandOfNumericOp', - 'PhanPluginInlineHTML', + // 'PhanPluginInlineHTML', + // 'PhanPluginInlineHTMLTrailing', // 'PhanPluginUnknownFunctionReturnType', // 'PhanPluginDescriptionlessCommentOnProtectedProperty', 'PhanPluginRedundantAssignmentInGlobalScope', @@ -485,27 +489,26 @@ return [ // 'PhanTypeInvalidUnaryOperandIncOrDec', // 'PhanPluginDescriptionlessCommentOnClass', 'PhanPluginEmptyStatementIf', - 'PhanPluginInlineHTMLTrailing', // 'PhanUndeclaredStaticMethod', // 'PhanPluginDescriptionlessCommentOnPrivateMethod', - 'PhanPluginPrintfIncompatibleArgumentType', + // 'PhanPluginPrintfIncompatibleArgumentType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanRedefineClass', 'PhanRedefineFunction', - 'PhanTypeInvalidLeftOperandOfBitwiseOp', + // 'PhanTypeInvalidLeftOperandOfBitwiseOp', // 'PhanTypeMismatchDimAssignment', // 'PhanPluginDescriptionlessCommentOnProtectedMethod', - 'PhanPluginPrintfIncompatibleArgumentTypeWeak', - 'PhanUndeclaredVariableAssignOp', - 'PhanTypeExpectedObjectOrClassName', + // 'PhanPluginPrintfIncompatibleArgumentTypeWeak', + // 'PhanUndeclaredVariableAssignOp', + // 'PhanTypeExpectedObjectOrClassName', 'PhanEmptyFQSENInClasslike', - 'PhanTypeMismatchArgumentInternalReal', + // 'PhanTypeMismatchArgumentInternalReal', // 'PhanUnextractableAnnotationElementName', // 'PhanCommentParamWithoutRealParam', // 'PhanRedefinedExtendedClass', 'PhanTypeComparisonFromArray', 'PhanPluginConstantVariableBool', - 'PhanPluginPrintfVariableFormatString', + // 'PhanPluginPrintfVariableFormatString', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeSuspiciousNonTraversableForeach', @@ -517,16 +520,16 @@ return [ // 'PhanTypeMismatchDeclaredParam', // 'PhanCommentDuplicateMagicMethod', // 'PhanParamSpecial1', - 'PhanPluginInlineHTMLLeading', - 'PhanPluginUseReturnValueInternalKnown', + // 'PhanPluginInlineHTMLLeading', + // 'PhanPluginUseReturnValueInternalKnown', // 'PhanRedefinedInheritedInterface', // 'PhanTypeComparisonToArray', 'PhanTypeConversionFromArray', // 'PhanTypeInvalidLeftOperandOfIntegerOp', // 'PhanTypeMismatchArgumentInternalProbablyReal', - 'PhanTypeMismatchBitwiseBinaryOperands', + // 'PhanTypeMismatchBitwiseBinaryOperands', 'PhanTypeMismatchDimEmpty', - 'PhanTypeSuspiciousEcho', + // 'PhanTypeSuspiciousEcho', // 'PhanNoopBinaryOperator', // 'PhanTypeInvalidBitwiseBinaryOperator', // 'PhanPluginDescriptionlessCommentOnFunction', @@ -550,14 +553,14 @@ return [ // 'PhanTypeInstantiateTraitStaticOrSelf', // 'PhanUndeclaredInvokeInCallable', // 'PhanNoopProperty', - 'PhanNoopVariable', + // 'PhanNoopVariable', // 'PhanPluginPrintfUnusedArgument', // 'PhanSyntaxReturnExpectedValue', // 'PhanAccessClassInternal', // 'PhanCompatibleAccessMethodOnTraitDefinition', // 'PhanNoopSwitchCases', // 'PhanNoopTernary', - 'PhanNoopUnaryOperator', + // 'PhanNoopUnaryOperator', // 'PhanParamNameIndicatingUnusedInClosure', // 'PhanParamSignatureRealMismatchTooFewParametersInternal', // 'PhanPluginEmptyStatementSwitch', @@ -589,9 +592,9 @@ return [ // 'PhanPluginPrintfNotPercent', // Detects fishy stuff with '%' format and suggests %% 'PhanPossiblyUndeclaredGlobalVariable', // 'PhanPluginPossiblyStaticProtectedMethod', - 'PhanTypeMismatchReturn', + // 'PhanTypeMismatchReturn', // 'PhanPluginMoreSpecificActualReturnType', - 'PhanTypeMismatchReturnProbablyReal', + // 'PhanTypeMismatchReturnProbablyReal', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', // 'PhanPluginUnreachableCode', @@ -604,7 +607,7 @@ return [ // 'PhanTypeMismatchPropertyDefault', // 'PhanPluginAlwaysReturnMethod', // 'PhanPluginMissingReturnMethod', - 'PhanUndeclaredTypeReturnType', + // 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredClassProperty', 'PhanTypeArraySuspiciousNullable', // 'PhanPluginInconsistentReturnMethod', @@ -613,7 +616,7 @@ return [ 'PhanNonClassMethodCall', // 'PhanPluginNoAssert', // 'PhanTypeMismatchReturnSuperType', - 'PhanTypeMismatchArgumentSuperType', + // 'PhanTypeMismatchArgumentSuperType', 'PhanPluginDuplicateConditionalTernaryDuplication', ], // You can put relative paths to internal stubs in this config option. diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 91b2894cd26..b5f0123526c 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -170,6 +170,7 @@ $VALID_MODULE_MAPPING = array( 'syslog' => 'Syslog', 'takepos' => 'TakePos', 'tax' => 'Tax', + 'theme_datacolor' => 'array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int},3:array{0:int,1:int,2:int}}', 'ticket' => 'Ticket', 'user' => 'User', 'variants' => 'Variants', @@ -217,7 +218,7 @@ return [ 'disablemove' => 'int<0,1>', 'disableremove' => 'int<0,1>', // Found in dol_eval - 'website' => '\WebSite', + 'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 // Disable because Phan infers Website type 'websitepage' => '\WebSitePage', 'websitepagefile' => 'string', 'action' => 'string', @@ -262,6 +263,7 @@ return [ // to `exclude_analysis_directory_list`. "exclude_analysis_directory_list" => [ 'htdocs/includes/', + 'htdocs/install/doctemplates/websites/', 'htdocs/core/class/lessc.class.php', // External library PHAN_DIR . '/stubs/', ], @@ -311,7 +313,7 @@ return [ 'ConstantVariablePlugin', // Warns about values that are actually constant //'HasPHPDocPlugin', // Requires PHPDoc - 'InlineHTMLPlugin', // html in PHP file, or at end of file + // 'InlineHTMLPlugin', // html in PHP file, or at end of file 'NonBoolBranchPlugin', // Requires test on bool, nont on ints 'NonBoolInLogicalArithPlugin', 'NumericalComparisonPlugin', diff --git a/dev/tools/phan/config_fixer.php b/dev/tools/phan/config_fixer.php index 86f1765defb..b12c94d6468 100644 --- a/dev/tools/phan/config_fixer.php +++ b/dev/tools/phan/config_fixer.php @@ -92,6 +92,7 @@ return [ // to `exclude_analysis_directory_list`. "exclude_analysis_directory_list" => [ 'htdocs/includes/', + 'htdocs/install/doctemplates/websites/', 'htdocs/core/class/lessc.class.php', // External library PHAN_DIR . '/stubs/', ], diff --git a/dev/tools/phan/stubs/restler.php b/dev/tools/phan/stubs/restler.php index 68dfd64b3a6..507d9415fce 100644 --- a/dev/tools/phan/stubs/restler.php +++ b/dev/tools/phan/stubs/restler.php @@ -1,5 +1,8 @@ + */ // phpcs:disable PEAR.Commenting,Generic.NamingConventions,PEAR.NamingConventions,Squiz.Scope.MethodScope.Missing + namespace Luracast\Restler { /** * Interface for the cache system that manages caching of given data @@ -142,7 +145,11 @@ namespace Luracast\Restler { */ class AutoLoader { - protected static $instance, $perfectLoaders, $rogueLoaders = array(), $classMap = array(), $aliases = array( + protected static $instance; + protected static $perfectLoaders; + protected static $rogueLoaders = array(); + protected static $classMap = array(); + protected static $aliases = array( // aliases and prefixes instead of null list aliases 'Luracast\\Restler' => null, 'Luracast\\Restler\\Format' => null, @@ -312,6 +319,7 @@ namespace Luracast\Restler { } } } + namespace { /** * Interface iAuthenticate only exists for compatibility mode for Restler 2 and below, it should @@ -322,6 +330,7 @@ namespace { public function __isAuthenticated(); } } + namespace Luracast\Restler { /** * Interface for composing response @@ -404,6 +413,7 @@ namespace Luracast\Restler { } } } + namespace Luracast\Restler\Data { /** * Restler is using many ValueObjects across to make it easy for the developers @@ -1180,6 +1190,7 @@ namespace Luracast\Restler\Data { } } } + namespace Luracast\Restler { /** * Static class to hold all restler defaults, change the values to suit your @@ -1713,6 +1724,7 @@ namespace Luracast\Restler { public function __setAuthenticationStatus($isAuthenticated = false); } } + namespace Luracast\Restler\Filter { /** * Describe the purpose of this class/interface/trait @@ -1782,6 +1794,7 @@ namespace Luracast\Restler\Filter { } } } + namespace Luracast\Restler { /** * Storing and retrieving a message or array of key value pairs for one time use using $_SESSION @@ -1900,6 +1913,7 @@ namespace Luracast\Restler { } } } + namespace Luracast\Restler\Format { /** * Interface for creating custom data formats @@ -2378,7 +2392,7 @@ namespace Luracast\Restler\Format { * * @example return ['Illuminate\\View\\View' => 'illuminate/view:4.2.*'] */ - public abstract function getDependencyMap(); + abstract public function getDependencyMap(); protected function checkDependency($class = null) { } @@ -2802,7 +2816,7 @@ namespace Luracast\Restler\Format { public function decode($data) { } - function isWritable() + public function isWritable() { } } @@ -2936,6 +2950,7 @@ namespace Luracast\Restler\Format { } } } + namespace Luracast\Restler { /** * Default Cache that writes/reads human readable files for caching purpose @@ -3223,7 +3238,7 @@ namespace Luracast\Restler { /** * @param string $namespace */ - function __construct($namespace = 'restler') + public function __construct($namespace = 'restler') { } /** @@ -3663,7 +3678,7 @@ namespace Luracast\Restler { * Instance of the current format class * which implements the iFormat interface * - * @var iFormat + * @var Format\iFormat * @example jsonFormat, xmlFormat, yamlFormat etc */ public $requestFormat; @@ -3673,7 +3688,7 @@ namespace Luracast\Restler { * Instance of the current format class * which implements the iFormat interface * - * @var iFormat + * @var Format\iFormat * @example jsonFormat, xmlFormat, yamlFormat etc */ public $responseFormat; @@ -3695,7 +3710,7 @@ namespace Luracast\Restler { /** * method information including metadata * - * @var ApiMethodInfo + * @var Data\ApiMethodInfo */ public $apiMethodInfo; /** @@ -3897,7 +3912,7 @@ namespace Luracast\Restler { * Parses the request to figure out format of the request data * * @throws RestException - * @return iFormat any class that implements iFormat + * @return Format\iFormat any class that implements iFormat * @example JsonFormat */ protected function getRequestFormat() @@ -3947,7 +3962,7 @@ namespace Luracast\Restler { * Extension, if present, overrides the Accept header * * @throws RestException - * @return iFormat + * @return Format\iFormat * @example JsonFormat */ protected function negotiateResponseFormat() @@ -4241,7 +4256,7 @@ namespace Luracast\Restler { * @param array $data Data collected from the request * * @throws RestException - * @return ApiMethodInfo + * @return Data\ApiMethodInfo */ public static function find($path, $httpMethod, $version = 1, array $data = array()) { @@ -4258,7 +4273,7 @@ namespace Luracast\Restler { * @param array $call * @param $data * - * @return ApiMethodInfo + * @return Data\ApiMethodInfo * * @access private */ @@ -4403,6 +4418,7 @@ namespace Luracast\Restler { } } } + namespace Luracast\Restler\UI { /** * Class Emmet @@ -4751,6 +4767,7 @@ namespace Luracast\Restler\UI { } } } + namespace Luracast\Restler { /** * Information gathered about the api user is kept here using static methods @@ -4932,6 +4949,7 @@ namespace Luracast\Restler { } } } + namespace { /** * Include function in the root namespace to include files optimized @@ -4945,6 +4963,7 @@ namespace { { } } + namespace { function exceptions() { diff --git a/dev/translation/duplicate_translation_keys.lst b/dev/translation/duplicate_translation_keys.lst new file mode 100644 index 00000000000..4e2c4f3b7a8 --- /dev/null +++ b/dev/translation/duplicate_translation_keys.lst @@ -0,0 +1,265 @@ +# File with duplicate translation keys that are ignored for +# reporting duplicates. +# FYI: Headers generated on https://manytools.org/hacker-tools/ascii-banner/ - DOS Rebel or ANSI Shadow +# Can also use 'figlet' tool (installable with `apt-get install figlet`) +# +# ██████████ +# ░░███░░░░░█ +# ░███ █ ░ █████ █████ ████████ ██████ ████████ █████ ██████ █████ +# ░██████ ░░███ ░░███ ░░███░░███ ███░░███░░███░░███ ███░░ ███░░███ ███░░ +# ░███░░█ ░░░█████░ ░███ ░███░███████ ░███ ░███ ░░█████ ░███████ ░░█████ +# ░███ ░ █ ███░░░███ ░███ ░███░███░░░ ░███ ░███ ░░░░███░███░░░ ░░░░███ +# ██████████ █████ █████ ░███████ ░░██████ ████ █████ ██████ ░░██████ ██████ +# ░░░░░░░░░░ ░░░░░ ░░░░░ ░███░░░ ░░░░░░ ░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░░░░ +# ░███ +# █████ +# ░░░░░ +# Expenses and trips overlap quite a bit, which is by design +# +AUTHOR +AUTHORPAIEMENT +AddTrip +AllExpenseReport +AllExpenseReports +AnyOtherInThisListCanValidate +AttachTheNewLineToTheDocument +AucuneLigne +BrouillonnerTrip +CANCEL_USER +CarCategory +ClassifyRefunded +CompanyVisited +ConfirmBrouillonnerTrip +ConfirmCancelTrip +ConfirmCloneExpenseReport +ConfirmDeleteTrip +ConfirmPaidTrip +ConfirmRefuseTrip +ConfirmSaveTrip +ConfirmValideTrip +DATE_CANCEL +DATE_PAIEMENT +DATE_REFUS +DATE_SAVE +DefaultCategoryCar +DefaultRangeNumber +DeleteTrip +EX_BRE +EX_CAM +EX_CAM_VP +EX_CAR +EX_CUR +EX_DOC +EX_EMM +EX_FUE +EX_FUE_VP +EX_GUM +EX_HOT +EX_IND +EX_KME +EX_OTR +EX_PAR +EX_PAR_VP +EX_POS +EX_SUM +EX_SUO +EX_TAX +EX_TOL +EX_TOL_VP +ErrorBadValueForParameter +ErrorDoubleDeclaration +ErrorRecordNotFound +Error_EXPENSEREPORT_ADDON_NotDefined +ExpenseRangeOffset +ExpenseReportApplyTo +ExpenseReportApproved +ExpenseReportApprovedMessage +ExpenseReportCanceled +ExpenseReportCanceledMessage +ExpenseReportConstraintViolationError +ExpenseReportConstraintViolationWarning +ExpenseReportDateEnd +ExpenseReportDateStart +ExpenseReportDomain +ExpenseReportIkDesc +ExpenseReportLimitAmount +ExpenseReportLimitOn +ExpenseReportLine +ExpenseReportPaid +ExpenseReportPaidMessage +ExpenseReportPayment +ExpenseReportRef +ExpenseReportRefused +ExpenseReportRefusedMessage +ExpenseReportRestrictive +ExpenseReportRuleErrorOnSave +ExpenseReportRuleSave +ExpenseReportRulesDesc +ExpenseReportWaitingForApproval +ExpenseReportWaitingForApprovalMessage +ExpenseReportWaitingForReApproval +ExpenseReportWaitingForReApprovalMessage +ExpenseReportsIk +ExpenseReportsRules +ExpenseReportsToApprove +ExpenseReportsToPay +ExpensesArea +FeesKilometersOrAmout +LastExpenseReports +ListOfFees +ListOfTrips +ListToApprove +ListTripsAndExpenses +MOTIF_CANCEL +MOTIF_REFUS +ModePaiement +NOT_AUTHOR +NewTrip +NoTripsToExportCSV +OnExpense +PDFStandardExpenseReports +PaidTrip +REFUSEUR +RangeIk +RangeNum +SaveTrip +ShowExpenseReport +ShowTrip +TF_BUS +TF_CAR +TF_ESSENCE +TF_HOTEL +TF_LUNCH +TF_METRO +TF_OTHER +TF_PEAGE +TF_TAXI +TF_TRAIN +TF_TRIP +TripCard +TripId +TripNDF +TripSociete +Trips +TripsAndExpenses +TripsAndExpensesStatistics +TypeFees +UploadANewFileNow +VALIDATOR +VALIDOR +ValidateAndSubmit +ValidatedWaitingApproval +ValideTrip +byEX_DAY +byEX_EXP +byEX_MON +byEX_YEA +expenseReportCatDisabled +expenseReportCoef +expenseReportCoefUndefined +expenseReportOffset +expenseReportPrintExample +expenseReportRangeDisabled +expenseReportRangeFromTo +expenseReportRangeMoreThan +expenseReportTotalForFive +nolimitbyEX_DAY +nolimitbyEX_EXP +nolimitbyEX_MON +nolimitbyEX_YEA +# +# █████████ █████ ███ +# ███░░░░░███ ░░███ ░░░ +# ░███ ░░░ ███████ ████████ ████ ████████ ██████ +# ░░█████████ ░░░███░ ░░███░░███░░███ ░░███░░███ ███░░███ +# ░░░░░░░░███ ░███ ░███ ░░░ ░███ ░███ ░███░███████ +# ███ ░███ ░███ ███ ░███ ░███ ░███ ░███░███░░░ +# ░░█████████ ░░█████ █████ █████ ░███████ ░░██████ +# ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░███░░░ ░░░░░░ +# ░███ +# █████ +# ░░░░░ +# Stripe is similar to Paybox and has some keys in common +# +AccountParameter +CSSUrlForPaymentForm +Continue +Creditor +FollowingUrlAreAvailableToMakePayments +InformationToFindParameters +PaymentCode +PaymentForm +ThisIsInformationOnPayment +ThisScreenAllowsYouToPay +ToComplete +UsageParameter +WelcomeOnPaymentPage +YourEMail + + + +############################################################# +############################################################# +AccountancyCode +AffectedTo +AvailableFormats +BIC +BankTransferAmount +Buy +ByDefaultInList +ByYear +CashDesk +ChooseFileToImport +ConfirmCloneAsk +ContractSigned +ContractStatusClosed +CreateUser +CreatedBy +Customer +CustomerInvoicePayment +DatabaseName +DatabaseServer +DeleteFromCat +DeleteType +DriverType +ExportableDatas +ExportsArea +History +IBAN +IdModule +InterventionSentByEMail +InvoiceRef +InvoiceSubtype +LanguageFile +LineId +ListOfStockMovements +Location +MinimumAmount +Movements +NewSubscription +NewUser +NoSupplierOrder +NoticePeriod +OrderWaiting +PriceFormatInCurrentLanguage +Prospect +Prospect +ReOpen +ReceptionClassifyClosedInDolibarr +Rejects +Salaries +Sell +Server +ShowCompany +ShowTask +ShowTypeCard +StatusInterInvoiced +StatusToPay +Stock +Stocks +SubscriptionPayment +Suppliers +Type +Unit +Upgrade +WithdrawalReceipt diff --git a/dev/translation/dynamic_translation_keys.lst b/dev/translation/dynamic_translation_keys.lst new file mode 100644 index 00000000000..47ab2e14a79 --- /dev/null +++ b/dev/translation/dynamic_translation_keys.lst @@ -0,0 +1,3685 @@ +# Dynamic Translations - Could be ($key) in code. +# Purpose: do not list these keys as unused. +# +# Note: organise the keys in alphabetical order, +# keeping the module section in alphabetical +# order as well, except for "Others" which +# is kept last. + +# Ai +AiDescription +AiDescriptionLong +AiSetup +AI_API_CHATGPT_ENDPOINT +AI_API_CHATGPT_KEY + +# datapolicy +DATAPOLICY_ADHERENT +DATAPOLICY_CONTACT_CLIENT +DATAPOLICY_CONTACT_FOURNISSEUR +DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT +DATAPOLICY_CONTACT_PROSPECT +DATAPOLICY_CONTACT_PROSPECT_CLIENT +DATAPOLICY_TIERS_CLIENT +DATAPOLICY_TIERS_FOURNISSEUR +DATAPOLICY_TIERS_NIPROSPECT_NICLIENT +DATAPOLICY_TIERS_PROSPECT +DATAPOLICY_TIERS_PROSPECT_CLIENT + +# fournisseur +CodePaymentTerm +IdPaymentTerm +LabelPaymentTerm + +# website_template +Message +Map +Reservation + +# Others +ACCOUNTING_ACCOUNT_CUSTOMER +ACCOUNTING_ACCOUNT_CUSTOMER_Desc +ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY +ACCOUNTING_ACCOUNT_EXPENSEREPORT +ACCOUNTING_ACCOUNT_SUPPLIER +ACCOUNTING_ACCOUNT_SUPPLIER_Desc +ACCOUNTING_ACCOUNT_SUSPENSE +ACCOUNTING_ACCOUNT_TRANSFER_CASH +ACCOUNTING_BANK_JOURNAL +ACCOUNTING_DATE_START_BINDING +ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER +ACCOUNTING_EXPENSEREPORT_JOURNAL +ACCOUNTING_EXPORT_AMOUNT +ACCOUNTING_EXPORT_DATE +ACCOUNTING_EXPORT_DEVISE +ACCOUNTING_EXPORT_ENDLINE +ACCOUNTING_EXPORT_FORMAT +ACCOUNTING_EXPORT_GLOBAL_ACCOUNT +ACCOUNTING_EXPORT_LABEL +ACCOUNTING_EXPORT_PIECE +ACCOUNTING_EXPORT_PREFIX_SPEC +ACCOUNTING_EXPORT_SEPARATORCSV +ACCOUNTING_HAS_NEW_JOURNAL +ACCOUNTING_INVENTORY_JOURNAL +ACCOUNTING_LENGTH_AACCOUNT +ACCOUNTING_LENGTH_DESCRIPTION +ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT +ACCOUNTING_LENGTH_GACCOUNT +ACCOUNTING_LIMIT_LIST_VENTILATION +ACCOUNTING_LIST_SORT_VENTILATION_DONE +ACCOUNTING_LIST_SORT_VENTILATION_TODO +ACCOUNTING_MISCELLANEOUS_JOURNAL +ACCOUNTING_PRODUCT_BUY_ACCOUNT +ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT +ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT +ACCOUNTING_PRODUCT_SOLD_ACCOUNT +ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT +ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT +ACCOUNTING_PURCHASE_JOURNAL +ACCOUNTING_RESULT_LOSS +ACCOUNTING_RESULT_PROFIT +ACCOUNTING_REVENUESTAMP_BUY_ACCOUNT +ACCOUNTING_REVENUESTAMP_SOLD_ACCOUNT +ACCOUNTING_SELL_JOURNAL +ACCOUNTING_SERVICE_BUY_ACCOUNT +ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT +ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT +ACCOUNTING_SERVICE_SOLD_ACCOUNT +ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT +ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT +ACCOUNTING_SOCIAL_JOURNAL +ACCOUNTING_VAT_BUY_ACCOUNT +ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT +ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT +ACCOUNTING_VAT_PAY_ACCOUNT +ACCOUNTING_VAT_SOLD_ACCOUNT +ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT +AGENDA_EVENT_CURRENT_COLOR +AGENDA_EVENT_FUTURE_COLOR +AGENDA_EVENT_PAST_COLOR +AGENDA_SHOW_LINKED_OBJECT +APPROVEDInDolibarr +ASSET_ACCOUNTANCY_CATEGORY +AbandonmentComment +AccountAccountingSuggest +AccountCard +AccountLabel +AccountRef +AccountancyAreaDescDonation +AccountancyAreaDescLoan +AccountancyAreaDescSal +AccountancyAreaDescSubscription +AccountancyCodeAsset +AccountancyCodeDepreciationAsset +AccountancyCodeDepreciationExpense +AccountancyErrorMismatchLetterCode +AccountancyHome +AccountancyTreasuryArea +AccountingCategoriesDesc +AccountingJournal +AccountingPeriodCard +AccountsArea +AccountsCategoriesShort +AchatTelechargement +ActionAC_CLO +ActionAC_COM +ActionAC_EMAIL +ActionAC_EMAILING +ActionAC_EMAIL_IN +ActionAC_EVENTORGANIZATION +ActionAC_FAC +ActionAC_FAX +ActionAC_INT +ActionAC_OTH +ActionAC_OTH_AUTO +ActionAC_OTH_AUTOShort +ActionAC_PROP +ActionAC_RDV +ActionAC_REL +ActionAC_SHIP +ActionAC_SUP_INV +ActionAC_SUP_ORD +ActionAC_TEL +ActionByCP +ActionRunningNotStarted +ActionsOnReception +ActionsOnShipping +ActionsOnSupplierProposal +ActionsOwnedByShort +ActivateOn +ActivateService +ActiveOn +AddAddress +AddAll +AddCompteFromBK +AddDiscount +AddElement +AddEventToUserOkCP +AddFiles +AddInventoryProduct +AddLink +AddLoan +AddRelativeDiscount +AddResource +AddSalary +AddSalaryPayment +AddSocialContribution +AddSupplierOrder +AddThisArticle +AddVariousPayment +AddressesForCompany +AdminLoginAlreadyExists +Agendas +AllAgreementSend +AllExportedMovementsWereRecordedAsExported +AllProductServicePrices +AllProducts +AllRIB +AllReceptions +AllSms +AllWidgetsWereEnabled +AllowCommentOnProject +AllowCommentOnTask +AllowUnknownPeopleSuggestBooth +AllowUnknownPeopleSuggestConf +AlreadyRead +Always +AmountByMonth +AmountIn +AmountInvoiced +AmountInvoicedHT +AmountInvoicedTTC +AmountLT1 +AmountLT1ES +AmountLT2 +AmountLT2ES +AmountOfRegistrationPaid +AmountPaymentDistributedOnInvoice +AmountRequested +AmountSalary +AmountToTransfer +AnalyticCode +AnnualByCompanies +AnnualByCompaniesDueDebtMode +AnnualByCompaniesInputOutputMode +AnnualSummaryDueDebtMode +AnnualSummaryInputOutputMode +AnotherContainer +AnswerCandidature +Answered +ApplicantIpAddress +ApplicantOrVisitor +ApplyMassCategories +ApplyPMP +AppointmentDuration +ApproveSms +ApprovedBy2 +Article +AskPrice +AssetAccountancyCodeAcceleratedDepreciation +AssetAccountancyCodeAsset +AssetAccountancyCodeDepreciationAcceleratedDepreciation +AssetAccountancyCodeDepreciationAsset +AssetAccountancyCodeDepreciationEconomic +AssetAccountancyCodeDepreciationExpense +AssetAccountancyCodeEndowmentAcceleratedDepreciation +AssetAccountancyCodeProceedsFromSales +AssetAccountancyCodeProvisionAcceleratedDepreciation +AssetAccountancyCodeReceivableOnAssignment +AssetAccountancyCodeValueAssetSold +AssetAccountancyCodeVatCollected +AssetAccountancyCodeVatDeductible +AssetAcquisitionType +AssetAcquisitionTypeNew +AssetAcquisitionTypeOccasion +AssetAcquisitionValueHT +AssetDateAcquisition +AssetDateStart +AssetDepreciationOptionAcceleratedDepreciation +AssetDepreciationOptionAmountBaseDeductibleHT +AssetDepreciationOptionAmountBaseDepreciationHT +AssetDepreciationOptionDegressiveRate +AssetDepreciationOptionDepreciationType +AssetDepreciationOptionDepreciationTypeDegressive +AssetDepreciationOptionDepreciationTypeExceptional +AssetDepreciationOptionDepreciationTypeLinear +AssetDepreciationOptionDuration +AssetDepreciationOptionDurationType +AssetDepreciationOptionDurationTypeAnnual +AssetDepreciationOptionDurationTypeDaily +AssetDepreciationOptionDurationTypeMonthly +AssetDepreciationOptionEconomic +AssetDepreciationOptionRate +AssetDepreciationOptionTotalAmountLastDepreciationHT +AssetNotDepreciated +AssetNumber +AssetRecorded +AssetRecoveredVAT +AssetReversalAmountHT +AssetReversalDate +AssetType +AssetTypeFinancial +AssetTypeInProgress +AssetTypeIntangible +AssetTypeTangible +AssetsLines +AssetsType +AssetsTypeId +AssetsTypeLabel +AssetsTypes +AssignDedicatedAccountingAccount +AssignTask +Assigned +AssociatedProductsNumber +AttachJoinedDocumentsToObject +AucuneLigne +AutoFillFormFieldBeforeSubmit +AutomaticClosing +Automation +AvailabilityTypeAV_1M +AvailabilityTypeAV_1W +AvailabilityTypeAV_2W +AvailabilityTypeAV_3W +AvailabilityTypeAV_NOW +BICNumber +BILL_DELETEInDolibarr +BILL_SUPPLIER_DELETEInDolibarr +BOMLine +BOM_CLOSEInDolibarr +BOM_DELETEInDolibarr +BOM_REOPENInDolibarr +BOM_UNVALIDATEInDolibarr +BOM_VALIDATEInDolibarr +BOOKCAL_PUBLIC_INTERFACE_TOPIC +BackOffice +BackToChartofaccounts +BackToHelpCenter +BackToHomePage +Balancing +BankAccountNumberKey +BankCode +BankColorizeMovementName1 +BankColorizeMovementName2 +BankDetails +BankLineNotReconciled +BankToPay +BankTransactionForCategory +BankTransferPayment +BankTransferRequestsDone +BankTransfers +Banner +BarcodeDescC128 +BarcodeDescC39 +BarcodeDescDATAMATRIX +BarcodeDescEAN13 +BarcodeDescEAN8 +BarcodeDescISBN +BarcodeDescQRCODE +BarcodeDescUPC +BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry +BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry +BillAddress +BillOfMaterialsLines +BillShortStatusClosedPaidPartially +BillShortStatusClosedUnpaid +BillShortStatusConverted +BillShortStatusNotRefunded +BillShortStatusPaidBackOrConverted +BillShortStatusStarted +BillStatus +BillStatusNotRefunded +BillsAndSalaries +BillsCustomer +BillsCustomersUnpaidForCompany +BillsLate +BillsSuppliersUnpaidForCompany +BlockedLogActivatedBecauseRequiredByYourCountryLegislation +BlockedLogAreRequiredByYourCountryLegislation +BlockedLogBillDownload +BlockedLogBillPreview +BlockedlogInfoDialog +BlogPost +BodyNotIn +BomAndBomLines +BookCalAbout +BookCalAboutPage +BookcalLabelAvailabilityHelp +BookeppingLineAlreayExists +Booking +BookmarksMenuShortCut +Boolean +Bottom +BoxCurrentAccounts +BoxCustomersOutstandingBillReached +BoxDolibarrStateBoard +BoxFicheInter +BoxGlobalActivity +BoxGoodCustomers +BoxLastActions +BoxLastContacts +BoxLastContracts +BoxLastCustomerBills +BoxLastCustomerOrders +BoxLastCustomerShipments +BoxLastCustomers +BoxLastKnowledgerecordModifiedContent +BoxLastManualEntries +BoxLastMembers +BoxLastMembersSubscriptions +BoxLastModifiedMembers +BoxLastProducts +BoxLastProposals +BoxLastProspects +BoxLastRssInfos +BoxLastSupplierBills +BoxLastSuppliers +BoxLatestSupplierOrders +BoxLatestSupplierOrdersAwaitingReception +BoxOldestActions +BoxOldestExpiredServices +BoxOldestUnpaidCustomerBills +BoxOldestUnpaidSupplierBills +BoxProductsAlertStock +BoxSuspenseAccount +BoxTicketLastXDayswidget +BoxTitleLastActionsToDo +BoxTitleLastCustomersOrProspects +BoxTitleLastModifiedCustomerBills +BoxTitleLastModifiedCustomerOrders +BoxTitleLastModifiedPropals +BoxTitleLastModifiedSupplierBills +BoxTitleLatestModifiedSupplierOrders +BoxesActivated +BoxesAvailable +BrowserMethodDescription +BugTracker +Build +BulkActions +BuyingPriceNumShort +ByAccounts +ByCountry +ByDate +ByDay +ByDefaultInList +ByExpenseIncome +ByMonth +BySalesRepresentative +ByTown +CANCELInDolibarr +COMPANY_DELETEInDolibarr +CONTACT_DELETEInDolibarr +CONTRACT_DELETEInDolibarr +CREATEInDolibarr +CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT +CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT +CRUDCreateWrite +CRUDRead +CalcModeEngagement +CalcModeLT1 +CalcModeLT1Debt +CalcModeLT1Rec +CalcModeLT2 +CalcModeLT2Rec +CalcModeVATDebt +CalcModeVATEngagement +CancelPartnershipForExpiredMembers +CancelUpdate +CancelUpload +CanceledById +CanceledByLogin +CannotRemoveDirectoryContainsFiles +CannotRemoveDirectoryContainsFilesOrDirs +CantSuggest +CardBill +CardContent +CardProduct0 +CardProduct1 +Cards +CashAccounts +CashDeskBankCB +CashDeskBankCash +CashDeskBankCheque +CashDeskMenu +CashDeskOn +CashDeskProducts +CashDeskStock +CashDeskThirdParty +CashDeskWarehouse +CashDeskYouDidNotDisableStockDecease +CashFence +CatContactList +CatContactsLinks +CatCusLinks +CatCusList +CatList +CatListAll +CatMemberList +CatMembersLinks +CatProdLinks +CatProdList +CatProjectsLinks +CatProjectsList +CatSupLinks +CatSupList +CatUsersLinks +CatUsersList +CategId +CategTypeNotFound +CategoryDeleted +ChartofaccountsId +CheckBank +ChequeBordereau +ChequesReceipts +Choose +ChooseCategory +ChooseProduct/Service +ChooseYourDemoProfilMore +CivilityCode +CivilityDR +CivilityMLE +CivilityMME +CivilityMMEShort +CivilityMR +CivilityMRShort +CivilityMTRE +ClassCreditedConfirm +ClassNotFoundIntoPathWarning +Classify +ClassifyBill +ClassifyClosed +ClassifyUnbilled +CleanFixHistory +CleanHistory +CleanUnfinishedCronjob +CleanUnfinishedCronjobShort +ClickToRefresh +CloneCombinationsProduct +CloseBill +CloseEtablishment +CloseFiscalYear +CloseProcessedOrdersAutomatically +CloseService +Closed2 +ClosedById +ClosedByLogin +Closing +CodeLastResult +CodePaymentMode +Codemulticurrency +CollapseBOMHelp +ColumnNewPMP +Commercial +CommercialProposal +CommercialProposalsShort +CompanyHasCreditNote +CompanyHasDownPaymentOrCommercialDiscount +CompanyHasNoCategory +CompanyIsInCustomersCategories +CompanyIsInSuppliersCategories +CompatibleAfterUpdate +CompatibleUpTo +Completed +CompressSyslogs +Conciliated +Conciliation +ConfAttendeeSubscriptionConfirmation +ConferenceAttendeeFee +ConferenceOrBoothInformation +ConfirmActivateService +ConfirmClassifyPaidPartiallyReasonAvoir +ConfirmClassifyPaidPartiallyReasonAvoirDesc +ConfirmClassifyPaidPartiallyReasonDiscountNoVat +ConfirmClassifyPaidPartiallyReasonDiscountNoVatDesc +ConfirmClassifyPaidPartiallyReasonDiscountVat +ConfirmClassifyPaidPartiallyReasonOther +ConfirmClassifyPaidPartiallyReasonOtherDesc +ConfirmClassifyPaidPartiallyReasonProductReturned +ConfirmClassifyPaidPartiallyReasonProductReturnedDesc +ConfirmClonePage +ConfirmCloseService +ConfirmDeleteAsset +ConfirmDeleteAssetType +ConfirmDeleteCptCategory +ConfirmDeleteMvtPartial +ConfirmFlushInventory +ConfirmMassCloneQuestion +ConfirmMassCloneToOneProject +ConfirmPasswordReset +ConfirmSendCardByMail +ConfirmValidSms +ConsumptionEfficiency +ContactCreatedByEmailCollector +ContactDefault_agenda +ContactDefault_commande +ContactDefault_contrat +ContactDefault_facture +ContactDefault_fichinter +ContactDefault_invoice_supplier +ContactDefault_order_supplier +ContactDefault_project +ContactDefault_project_task +ContactDefault_propal +ContactDefault_supplier_proposal +ContactDefault_ticket +ContactHasNoCategory +ContactId +ContactIsInCategories +ContentsNotVisibleByAllShort +ContentsVisibleByAllShort +Continue +ContractEndDate +ContractLines +ContractStartDate +ContractsAndLine +Copy +CorporateHomePage +CountLastUrlCheckError +CountryCode +CreateAccount +CreateBanque +CreateBookmark +CreateCalcSchedule +CreateCandidature +CreateDraft +CreateDraftIntervention +CreateGuichet +CreateLeadAndThirdParty +CreateMailing +CreateSms +CreateTicketAndThirdParty +CreatedById +CreatedByLogin +CreditTransferFile +CronAdd +CronId +CurentlyUsingPhysicalStock +CurentlyUsingVirtualStock +CurrencyAUD +CurrencyCAD +CurrencyCHF +CurrencyCentEUR +CurrencyCentINR +CurrencyCentSingEUR +CurrencyCentSingINR +CurrencyCode +CurrencyCodeId +CurrencyEUR +CurrencyFRF +CurrencyGBP +CurrencyINR +CurrencyMAD +CurrencyMGA +CurrencyMUR +CurrencyNOK +CurrencyPrice +CurrencySingAUD +CurrencySingCAD +CurrencySingCHF +CurrencySingEUR +CurrencySingFRF +CurrencySingGBP +CurrencySingINR +CurrencySingMAD +CurrencySingMGA +CurrencySingMUR +CurrencySingNOK +CurrencySingTND +CurrencySingUAH +CurrencySingUSD +CurrencySingXAF +CurrencySingXOF +CurrencySingXPF +CurrencyTND +CurrencyThousandthSingTND +CurrencyUAH +CurrencyUSD +CurrencyUnitPrice +CurrencyXAF +CurrencyXOF +CurrencyXPF +Currencyeuros +CurrentAccounts +CurrentDedicatedAccountingAccount +CurrentPA +CurrentProductPrice +CurrentSalary +CurrentStock +CurrentTranslationString +CurrentValue +CustomReceipt +CustomerCard +CustomerCodeShort +CustomerIBAN +CustomerInvoicePayment +CustomerInvoicePaymentBack +CustomersInvoicesAndInvoiceLines +CustomersInvoicesAndPayments +CustomersOrdersAndOrdersLines +Cut +DATAPOLICYJob +DATAPOLICYReturn +DATAPOLICY_ADHERENT +DATAPOLICY_BLOCKCHECKBOX +DATAPOLICY_CONTACT_CLIENT +DATAPOLICY_CONTACT_FOURNISSEUR +DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT +DATAPOLICY_CONTACT_PROSPECT +DATAPOLICY_CONTACT_PROSPECT_CLIENT +DATAPOLICY_PORTABILITE +DATAPOLICY_TIERS_CLIENT +DATAPOLICY_TIERS_FOURNISSEUR +DATAPOLICY_TIERS_NIPROSPECT_NICLIENT +DATAPOLICY_TIERS_PROSPECT +DATAPOLICY_TIERS_PROSPECT_CLIENT +DAV_ALLOW_ECM_DIR +DAV_ALLOW_ECM_DIRTooltip +DAV_ALLOW_PRIVATE_DIR +DAV_ALLOW_PRIVATE_DIRTooltip +DAV_ALLOW_PUBLIC_DIR +DAV_ALLOW_PUBLIC_DIRTooltip +DELETEInDolibarr +DOL_ACTIVATE_BUZZER +DOL_ALIGN_CENTER +DOL_ALIGN_LEFT +DOL_ALIGN_RIGHT +DOL_BEEP +DOL_BEEP_ALTERNATIVE +DOL_BOLD +DOL_BOLD_DISABLED +DOL_CUT_PAPER_FULL +DOL_CUT_PAPER_PARTIAL +DOL_DEFAULT_HEIGHT_WIDTH +DOL_DOUBLE_HEIGHT +DOL_DOUBLE_WIDTH +DOL_LINE_FEED +DOL_LINE_FEED_REVERSE +DOL_PRINT_BARCODE +DOL_PRINT_BARCODE_CUSTOMER_ID +DOL_PRINT_CURR_DATE +DOL_PRINT_LOGO +DOL_PRINT_LOGO_OLD +DOL_PRINT_OBJECT_LINES +DOL_PRINT_QRCODE +DOL_PRINT_TEXT +DOL_UNDERLINE +DOL_UNDERLINE_DISABLED +DOL_USE_FONT_A +DOL_USE_FONT_B +DOL_USE_FONT_C +DOL_VALUE_CUSTOMER_ACCOUNT_BALANCE +DOL_VALUE_CUSTOMER_FIRSTNAME +DOL_VALUE_CUSTOMER_LASTNAME +DOL_VALUE_CUSTOMER_MAIL +DOL_VALUE_CUSTOMER_MOBILE +DOL_VALUE_CUSTOMER_PHONE +DOL_VALUE_CUSTOMER_POINTS +DOL_VALUE_CUSTOMER_SKYPE +DOL_VALUE_CUSTOMER_TAX_NUMBER +DOL_VALUE_DAY +DOL_VALUE_DAY_LETTERS +DOL_VALUE_MONTH +DOL_VALUE_MONTH_LETTERS +DOL_VALUE_MYSOC_NAME +DOL_VALUE_OBJECT_POINTS +DONATION_ACCOUNTINGACCOUNT +DataCodeIDSourceIsInsertedInto +DataComeFromNoWhere +DataIDSourceIsInsertedInto +DataIsInsertedInto +DataUsedToSuggestAccount +DateActionBegin +DateAndHour +DateAndTime +DateEmploymentEnd +DateEmploymentStart +DateEndEvent +DateEndInMonth +DateEndPlannedMo +DateFormatYYYYMM +DateFormatYYYYMMDD +DateFormatYYYYMMDDHHMM +DateInvoiceWithTime +DateLastCollectResult +DateLastGenerationShort +DateLastLogin +DateLastcollectResultOk +DateLimit +DateMovement +DateMustBeAfterThan +DateMustBeBeforeThan +DateOfLine +DatePartnershipEnd +DatePartnershipStart +DatePreviousLogin +DateSending +DateStartEvent +DateStartInMonth +DateStartPlannedMo +DebugBarDesc +Deductible +DefaultCategoryCar +DefaultPaymentConditionsRetainedWarranty +DefaultPrice +DefaultPrinter +DefaultPuttingDescUpToDate +DefaultPuttingPricesUpToDate +DefaultRIB +DefaultRangeNumber +Defaultfortype +DefineEventUserCP +Delays_MAIN_DELAY_ACTIONS_TODO +Delays_MAIN_DELAY_CHEQUES_TO_DEPOSIT +Delays_MAIN_DELAY_CUSTOMER_BILLS_UNPAYED +Delays_MAIN_DELAY_EXPENSEREPORTS +Delays_MAIN_DELAY_HOLIDAYS +Delays_MAIN_DELAY_MEMBERS +Delays_MAIN_DELAY_NOT_ACTIVATED_SERVICES +Delays_MAIN_DELAY_ORDERS_TO_PROCESS +Delays_MAIN_DELAY_PROJECT_TO_CLOSE +Delays_MAIN_DELAY_PROPALS_TO_BILL +Delays_MAIN_DELAY_PROPALS_TO_CLOSE +Delays_MAIN_DELAY_RUNNING_SERVICES +Delays_MAIN_DELAY_SUPPLIER_BILLS_TO_PAY +Delays_MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS +Delays_MAIN_DELAY_TASKS_TODO +Delays_MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE +DeleteASms +DeleteAnAssetType +DeleteArticle +DeleteCptCategory +DeleteSms +DemandReasonTypeSRC_CAMP_EMAIL +DemandReasonTypeSRC_CAMP_FAX +DemandReasonTypeSRC_CAMP_MAIL +DemandReasonTypeSRC_CAMP_PHO +DemandReasonTypeSRC_COMM +DemandReasonTypeSRC_EMPLOYEE +DemandReasonTypeSRC_INTE +DemandReasonTypeSRC_PARTNER +DemandReasonTypeSRC_SHOP +DemandReasonTypeSRC_SPONSORING +DemandReasonTypeSRC_SRC_CUSTOMER +DemandReasonTypeSRC_WOM +DemoCompanyAll +DemoCompanyManufacturing +DemoCompanyProductAndStocks +DemoCompanyServiceOnly +DemoCompanyShopWithCashDesk +DemoFundation +DemoFundation2 +Denied +DepositGenerated +DepositId +Deposits +DescADHERENT_AUTOREGISTER_NOTIF_MAIL +DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT +DescADHERENT_CC_MAIL_FROM +DescADHERENT_EMAIL_TEMPLATE_AUTOREGISTER +DescADHERENT_EMAIL_TEMPLATE_CANCELATION +DescADHERENT_EMAIL_TEMPLATE_EXCLUSION +DescADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION +DescADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION +DescADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION +DescADHERENT_MAILMAN_ADMIN_PASSWORD +DescADHERENT_MAILMAN_LISTS +DescADHERENT_MAILMAN_UNSUB_URL +DescADHERENT_MAILMAN_URL +DescADHERENT_MAIL_FROM +DescADHERENT_SPIP_DB +DescADHERENT_SPIP_PASS +DescADHERENT_SPIP_SERVEUR +DescADHERENT_SPIP_USER +DescThirdPartyReport +DescWareHouse +DescriptionLong +DescriptionOfLine +DeskCode +DetailByAccount +DictionaryAccountancyJournal +DictionaryAccountancysystem +DictionaryActions +DictionaryAssetDisposalType +DictionaryAvailability +DictionaryBatchStatus +DictionaryCanton +DictionaryCivility +DictionaryCompanyJuridicalType +DictionaryCompanyType +DictionaryCountry +DictionaryCurrency +DictionaryDepartment +DictionaryEMailTemplates +DictionaryEcotaxe +DictionaryExpenseTaxCat +DictionaryExpenseTaxRange +DictionaryFees +DictionaryFormatCards +DictionaryFunction +DictionaryHolidayTypes +DictionaryInvoiceSubtype +DictionaryMeasuringUnits +DictionaryOpportunityStatus +DictionaryOrderMethods +DictionaryPaymentConditions +DictionaryPaymentModes +DictionaryProductNature +DictionaryProspectContactLevel +DictionaryProspectContactStatus +DictionaryProspectLevel +DictionaryProspectStatus +DictionaryPublicHolidays +DictionaryRegion +DictionaryResourceType +DictionarySendingMethods +DictionarySocialContributions +DictionarySocialNetworks +DictionarySource +DictionaryStaff +DictionaryTransportMode +DictionaryTypeContact +DictionaryTypeOfContainer +DictionaryUnits +Difference +Dimensions +DirectPrint +Disassemble +Dispatch +DispatchVerb +DoCreditTransferBeforePayments3 +DoNotAutofillButAutoConcat +DoNotRemovePreviousCombinations +DoNotShowMyTasksOnly +DoNotUseDescriptionOfProdut +DoNotUseInProduction +DoTest +Docref +DocumentModelStandard +Documents2 +DolibarrReceiptPrinter +DontForgetCreateTokenOauthMod +DraftInvoiceDeleted +DraftPropals +DraftSuppliersOrders +Drafts +DurationEffective +DurationOfLine +DurationOfRange +Dynamiccontent +EMailHostPort +EMailRecipient +EMailTextProposalClosedRefusedWeb +EMailTextProposalClosedSignedWeb +ENABLEDISABLEInDolibarr +EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH +EVENTORGANIZATION_CATEG_THIRDPARTY_CONF +EVENTORGANIZATION_FILTERATTENDEES_CAT +EVENTORGANIZATION_FILTERATTENDEES_TYPE +EVENTORGANIZATION_SECUREKEY +EVENTORGANIZATION_TASK_LABEL +EVENTORGANIZATION_TASK_LABELTooltip +EVENTORGANIZATION_TASK_LABELTooltip2 +EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH +EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT +EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH +EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF +EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES +EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER +EXPENSE_REPORT_APPROVEInDolibarr +EXPENSE_REPORT_CREATEInDolibarr +EXPENSE_REPORT_DELETEInDolibarr +EXPENSE_REPORT_REFUSEDInDolibarr +EXPENSE_REPORT_VALIDATEInDolibarr +EX_BRE +EX_CAM +EX_CAM_VP +EX_CAR +EX_CUR +EX_DOC +EX_EMM +EX_FUE +EX_FUE_VP +EX_GUM +EX_HOT +EX_IND +EX_KME +EX_OTR +EX_PAR +EX_PAR_VP +EX_POS +EX_SUM +EX_SUO +EX_TAX +EX_TOL +EX_TOL_VP +EarlyClosingComment +EarlyClosingReason +EditMailing +EditMedias +EditMenu +EditPassword +EditProductCombinations +EditSms +EmailCollectorDescription +EmailCollectorExampleToCollectAnswersFromExternalEmailSoftwareDesc +EmailCollectorTargetDir +EmailRecruiter +EmployeeFirstname +EmployeeLastname +EmployeeSkillsUpdated +EmployeesInThisPosition +EmptyPage +EnableFeatureFor +EnabledAndDisabled +EndPointFor +EndSubscription +ErrNoSkillSelected +ErrUnzipFails +ErrorAVirtualProductCantBeUsedIntoABomOrMo +ErrorAccountingJournalIsAlreadyUse +ErrorActionCommPropertyUserowneridNotDefined +ErrorAddEventToUserCP +ErrorBadBarCodeSyntax +ErrorBadCustomerCodeSyntax +ErrorBadDefinitionOfMenuArrayInModuleDescriptor +ErrorBadMaskBadRazMonth +ErrorBadMaskFailedToLocatePosOfSequence +ErrorBadSupplierCodeSyntax +ErrorBadThirdPartyName +ErrorBadValueForParamNotAString +ErrorBankReceiptAlreadyExists +ErrorBarCodeAlreadyUsed +ErrorBarCodeRequired +ErrorBillNotFound +ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder +ErrorCannotAddThisParentWarehouse +ErrorCantDeletePaymentReconciliated +ErrorCantDeletePaymentSharedWithPayedInvoice +ErrorCantSaveADoneUserWithZeroPercentage +ErrorCantSetReceptionToTotalDoneWithReceptionDenied +ErrorCantSetReceptionToTotalDoneWithReceptionToApprove +ErrorCantUseRazIfNoYearInMask +ErrorCantUseRazInStartedYearIfNoYearMonthInMask +ErrorCounterMustHaveMoreThan3Digits +ErrorCreateBankAccount +ErrorCreatingProductAttributeValue +ErrorCustomerCodeAlreadyUsed +ErrorCustomerCodeRequired +ErrorDeleteLineNotAllowedByObjectStatus +ErrorDeleteNotPossibleLineIsConsolidated +ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible +ErrorDeletingGeneratedProducts +ErrorDescRequiredForFreeProductLines +ErrorDirNotWritable +ErrorDurationForServiceNotDefinedCantCalculateHourlyPrice +ErrorEqualModule +ErrorFailedToLoadRSSFile +ErrorFeatureNeedJavascript +ErrorFicheinterCompanyDoesNotExist +ErrorFieldMustHaveXChar +ErrorFileAlreadyExists +ErrorInvalidSubtype +ErrorInvoiceLoadThirdParty +ErrorInvoiceLoadThirdPartyKey +ErrorLanguageMandatoryIfPageSetAsTranslationOfAnother +ErrorLanguageOfTranslatedPageIsSameThanThisPage +ErrorLoginDisabled +ErrorLoginDoesNotExists +ErrorLoginHasNoEmail +ErrorMandatoryParametersNotProvided +ErrorMaxNumberReachForThisMask +ErrorNewRefIsAlreadyUsed +ErrorNoImagickReadimage +ErrorNoTmpDir +ErrorPROJECTLEADERRoleMissingRestoreIt +ErrorPartialFile +ErrorPaymentConditionsNotEligibleToDepositCreation +ErrorPrefixRequired +ErrorPriceCantBeLowerThanMinPrice +ErrorPriceExpression1 +ErrorPriceExpression10 +ErrorPriceExpression11 +ErrorPriceExpression14 +ErrorPriceExpression17 +ErrorPriceExpression19 +ErrorPriceExpression2 +ErrorPriceExpression20 +ErrorPriceExpression21 +ErrorPriceExpression22 +ErrorPriceExpression23 +ErrorPriceExpression24 +ErrorPriceExpression3 +ErrorPriceExpression4 +ErrorPriceExpression5 +ErrorPriceExpression6 +ErrorPriceExpression8 +ErrorPriceExpression9 +ErrorPropalNotFound +ErrorRecordAlreadyInAccountingDeletionNotPossible +ErrorRecordIsUsedCantDelete +ErrorReplaceStringEmpty +ErrorSmsRecipientIsEmpty +ErrorSubjectIsRequired +ErrorSupplierCodeAlreadyUsed +ErrorSupplierCodeRequired +ErrorThereIsSomeDeliveries +ErrorThirdpartiesMerge +ErrorThirpdartyOrMemberidIsMandatory +ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved +ErrorThisPaymentModeIsNotSepa +ErrorTicketRefRequired +ErrorTitleAlreadyExists +ErrorUpdateRate +ErrorUploadBlockedByAddon +ErrorUploadFileDragDrop +ErrorUploadFileDragDropPermissionDenied +ErrorVATIntraNotConfigured +ErrorWebServerUserHasNotPermission +Error_COMMANDE_SUPPLIER_ADDON_NotDefined +Error_EXPENSEREPORT_ADDON_NotDefined +Error_OrderNotChecked +Errors +EscompteOffered +EstimatedDuration +EstimatedDurationDesc +EstimatedStockValue +EstimatedStockValueSell +EvenUnsubscribeDesc +EventOrganizationConferenceOrBoothMenuLeft +EventOrganizationDescription +EventOrganizationEmailAskBooth +EventOrganizationEmailAskConf +EventOrganizationEmailBoothPayment +EventOrganizationEmailRegistrationPayment +EventOrganizationMassEmailAttendees +EventOrganizationMassEmailSpeakers +EventOrganizationMenuLeft +EventOrganizationSetup +EventType +EventUserModified +EvntOrgCancelled +EvntOrgConfirmed +EvntOrgDone +EvntOrgDraft +EvntOrgDuration +EvntOrgNotQualified +EvntOrgRegistrationBoothHelpMessage +EvntOrgRegistrationBoothWelcomeMessage +EvntOrgRegistrationConfHelpMessage +EvntOrgRegistrationConfWelcomeMessage +EvntOrgSuggested +Excel95FormatDesc +ExcessPaidMulticurrency +ExcessReceivedMulticurrency +ExitEditMode +ExpAuto10CV +ExpAuto10PCV +ExpAuto11CV +ExpAuto11PCV +ExpAuto12CV +ExpAuto12PCV +ExpAuto13PCV +ExpAuto3CV +ExpAuto3PCV +ExpAuto4CV +ExpAuto4PCV +ExpAuto5CV +ExpAuto5PCV +ExpAuto6CV +ExpAuto6PCV +ExpAuto7CV +ExpAuto7PCV +ExpAuto8CV +ExpAuto8PCV +ExpAuto9CV +ExpAuto9PCV +ExpAutoCat +ExpCyclo +ExpCycloCat +ExpMoto12CV +ExpMoto345CV +ExpMoto5PCV +ExpMotoCat +ExpenseRangeOffset +ExpenseReportJournal +ExpenseReportLine +ExpenseReportRuleErrorOnSave +ExpenseReportsJournal +ExpenseReportsRulesSetup +ExportCardToFormat +ExportDataset_banque_1 +ExportDataset_banque_2 +ExportDataset_company_1 +ExportDataset_company_2 +ExportDataset_event1 +ExportDataset_fournisseur_1 +ExportDataset_fournisseur_2 +ExportDataset_fournisseur_3 +ExportDataset_invoice_1 +ExportDataset_invoice_2 +ExportDataset_member_1 +ExportDataset_produit_1 +ExportDataset_service_1 +ExportDataset_tax_1 +ExportDataset_ticket_1 +ExportDataset_user_1 +ExportNotSupported +ExportSetup +Exports +ExternalRef +ExternalURLMustStartWithHttp +ExternalWarehouse +ExtraInfos +ExtrafieldCheckBox +ExtrafieldCheckBoxFromList +ExtrafieldIP +ExtrafieldLink +ExtrafieldMail +ExtrafieldParamHelpcheckbox +ExtrafieldParamHelpradio +ExtrafieldPassword +ExtrafieldPhone +ExtrafieldPrice +ExtrafieldPriceWithCurrency +ExtrafieldRadio +ExtrafieldSelect +ExtrafieldSelectList +ExtrafieldSeparator +ExtrafieldUrl +FCKeditorForCompany +FCKeditorForMail +FCKeditorForMailing +FCKeditorForNotePrivate +FCKeditorForNotePublic +FCKeditorForProductDetails +FCKeditorForTicket +FCKeditorForUserSignature +FECFormatCredit +FECFormatDebit +FECFormatEntryDate +FECFormatEntryNum +FECFormatGeneralAccountLabel +FECFormatGeneralAccountNumber +FECFormatJournalCode +FECFormatJournalLabel +FECFormatLabelOperation +FECFormatMulticurrencyAmount +FECFormatMulticurrencyCode +FECFormatPieceDate +FECFormatPieceRef +FECFormatReconcilableCode +FECFormatReconcilableDate +FECFormatSubledgerAccountLabel +FECFormatSubledgerAccountNumber +FECFormatValidateDate +FailedToAddCodeIntoDescriptor +Feature +FeatureIsSupportedInInOutModeOnly +Features +FichinterNoContractLinked +FieldNeedSource +FieldTarget +FieldTitle +FileFormat +FileIsTooBig +FileUploaded +FileWithDataToImport +Filehtpasswd +FilesUpdated +FillAndSaveAccountIdAndSecret +FilterRefOrLabelOrBC +FinanceJournal +FindYourSEPAMandate +Fingerprints +Float +FlushInventory +FormCreateRate +FormUpdateRate +FormatedExportDesc2 +FormatedExportDesc3 +FormatedImportDesc2 +FreeModule +FrequencyPer_d +FrequencyPer_m +FrequencyPer_y +FrequencyUnit +FrontOffice +FullPhoneNumber +FunctionTest +FutureManager +FutureTransaction +GanttView +Gb +GeneralOptions +GigaBytes +GlobalVariableUpdaterHelp0 +GlobalVariableUpdaterHelp1 +GlobalVariableUpdaterHelpFormat0 +GlobalVariableUpdaterHelpFormat1 +GlobalVariableUpdaterType0 +GlobalVariableUpdaterType1 +Go +GoToHelpPage +GoToListOfTimeConsumed +GoToWikiHelpPage +GoodBye +GoogleAuthConfigured +GoogleAuthNotConfigured +GroupCard +GroupDeleted +HOLIDAY_APPROVEInDolibarr +HOLIDAY_CREATEInDolibarr +HOLIDAY_DELETEInDolibarr +HOLIDAY_MODIFYInDolibarr +HOLIDAY_VALIDATEInDolibarr +HR +HRM_DEFAULT_SKILL_DESCRIPTION +HRM_EMAIL_EXTERNAL_SERVICE +HRM_MAXRANK +HTPasswordExport +HalfDay +HasAbsoluteDiscountFromSupplier +HasCreditNoteFromSupplier +HasDownPaymentOrCommercialDiscountFromSupplier +HasNoAbsoluteDiscountFromSupplier +HasNoRelativeDiscountFromSupplier +HasRelativeDiscountFromSupplier +HeightUnits +HelpWarehouseStockTransferDestination +HelpWarehouseStockTransferSource +HideChildProducts +HideOpeningBalance +HolidayBalanceMonthlyUpdate +HostCharset +HtmlText +Human +HumanMachine +IBANNumber +IDCountry +INCVATONLY +INTRACOMMREPORT_NUM_AGREMENT +INTRACOMMREPORT_NUM_DECLARATION +INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT +IPCreation +IPLastLogin +IPModification +IPOfApplicant +IPPreviousLogin +IdAgenda +IdCompany +IdContact +IdPaymentMode +IdProduct +IdProposal +IdRecord +IdResource +IdSocialContribution +IdTaskTime +IdThirdParty +IdTransaction +IdWarehouse +Identification +IfJobIsLocatedAtAPartner +IfModuleEnabled +IfZeroItIsNotAVirtualProduct +IfZeroItIsNotUsedByVirtualProduct +ImapEncryption +ImapEncryptionHelp +ImportAccountingEntries +ImportAccountingEntriesFECFormat +ImportDatasetProjects +ImportDatasetTasks +ImportDataset_company_1 +ImportDataset_company_2 +ImportDataset_company_3 +ImportDataset_company_4 +ImportDataset_member_1 +ImportDataset_produit_1 +ImportDataset_resource_1 +ImportDataset_service_1 +ImportDataset_tax_contrib +ImportDataset_tax_vat +ImportDataset_user_1 +ImportSetup +InWorkingOrder +IncludeClosedAccount +IncludeDocsAlreadyExported +IncludePath +IndependantSubProductStock +InfosWorkflowCP +InitAccountancy +InputDetail +Int +InterDateCreation +InterDuration +InterId +InterLine +InterLineDate +InterLineDesc +InterLineDuration +InterLineId +InterNote +InterStatus +InternalWarehouse +InterventionCardsAndInterventionLines +IntoAccount +IntracommReportAbout +IntracommReportDownload +IntracommReportNumber +IntracommReportPeriod +IntracommReportTypeDeclaration +IntracommunityVATNumber +InventoryDate +InventoryFlushed +InventoryForASpecificProduct +InventoryForASpecificWarehouse +InvoiceAutoValidate +InvoiceDateCreation +InvoiceDeleted +InvoiceDepositAsk +InvoiceDiscount +InvoiceID +InvoiceLabel +InvoiceLine +InvoiceLinesToDispatch +InvoiceNotChecked +InvoiceNote +InvoicePaidCompletely +InvoicePaidCompletelyHelp +InvoiceProFormaAsk +InvoiceProFormaDesc +InvoiceReplacementShort +InvoiceSituationLast +InvoiceStandardShort +InvoiceStatus +InvoiceValidatedInDolibarrFromPos +IsAnAnswer +IsNotADraft +IsNotAnAnswer +ItemsCount +JSOnPaimentBill +JobCard +JobLabel +JournalFinancial +JournalLabel +JuridicalStatus200 +KeepDefaultValuesDeb +KeepDefaultValuesMamp +KeepDefaultValuesProxmox +KeepDefaultValuesWamp +KeepEmptyForAsap +KnowledgeManagementAbout +KnowledgeManagementAboutPage +KnowledgeManagementSetup +KnowledgemanagementsCategoriesArea +LDAPFieldSkype +LDAPFieldSkypeExample +LEAVE_OTHER +LEAVE_PAID +LEAVE_PAID_FR +LEAVE_SICK +LOAN_ACCOUNTING_ACCOUNT_CAPITAL +LOAN_ACCOUNTING_ACCOUNT_INSURANCE +LOAN_ACCOUNTING_ACCOUNT_INTEREST +LT1 +LT1Customer +LT1CustomerES +LT1CustomerIN +LT1ES +LT1GC +LT1IN +LT1Paid +LT1PaidES +LT1PaidIN +LT1Payment +LT1PaymentES +LT1Payments +LT1PaymentsES +LT1ReportByCustomers +LT1ReportByCustomersES +LT1ReportByMonth +LT1ReportByQuarters +LT1ReportByQuartersES +LT1Summary +LT1SummaryES +LT1SummaryIN +LT1Supplier +LT1SupplierES +LT1SupplierIN +LT1Type +LT2 +LT2Customer +LT2CustomerES +LT2CustomerIN +LT2ES +LT2IN +LT2Paid +LT2PaidES +LT2PaidIN +LT2Payment +LT2PaymentES +LT2Payments +LT2PaymentsES +LT2ReportByCustomers +LT2ReportByCustomersES +LT2ReportByMonth +LT2ReportByQuarters +LT2ReportByQuartersES +LT2Summary +LT2SummaryES +LT2SummaryIN +LT2Supplier +LT2SupplierES +LT2SupplierIN +LT2Type +LabelContrib +LabelPaymentMode +LabelRIB +Language_en_US_es_MX_etc +LastBills +LastCheckBacklink +LastMembersModified +LastOrders +LastPA +LastPasswordChangeDate +LastResult +LatestProjects +LatestSupplierTemplateInvoices +LatestTemplateInvoices +LawApplicationPart1 +LawApplicationPart2 +LawApplicationPart3 +LawApplicationPart4 +Lead +LeadOrProject +LeadTimeForWarning +LeaveId +LeaveRequestCreationBlockedBecauseBalanceIsNegative +LengthUnitcm +LengthUnitdm +LengthUnitm +LengthUnitmm +LengthUnits +Library +License +LieuWareHouse +Limit +LimitedLiabilityCompanyCapital +Limits +LineAlreadyDispatched +LineBuyPriceHT +LineDescription +LineDiscount +LineID +LineLabel +LineQty +LineTotalHT +LineTotalTTC +LineTotalVAT +LineUnitPrice +LineVATRate +LinkToAContract +LinkToContract +LinkToExpedition +LinkToGoldMember +LinkToIntervention +LinkToInvoice +LinkToMo +LinkToOrder +LinkToParentMenu +LinkToProposal +LinkToSupplierInvoice +LinkToSupplierOrder +LinkToSupplierProposal +LinkToTemplateInvoice +LinkToTicket +LinkedFichinter +LinkedOrder +ListActionsAssociatedProject +ListBankTransactions +ListContractAssociatedProject +ListCurrencyRate +ListDonationsAssociatedProject +ListExpenseReportsAssociatedProject +ListFichinterAssociatedProject +ListInventory +ListInvoicesAssociatedProject +ListKnowledgeRecord +ListLoanAssociatedProject +ListMOAssociatedProject +ListMouvementStockProject +ListOfAvailableAPIs +ListOfCandidatures +ListOfContracts +ListOfCustomers +ListOfEMailings +ListOfEmployees +ListOfEvents +ListOfFees +ListOfInterventions +ListOfInventories +ListOfNotificationsPerUser +ListOfNotificationsPerUserOrContact +ListOfOrders +ListOfPartnerships +ListOfPositionsToBeFilled +ListOfPreviousSituationInvoices +ListOfProductsWithoutAccountingAccount +ListOfProposals +ListOfProspects +ListOfSms +ListOfSubscriptions +ListOfSupplierOrders +ListOfSuppliers +ListOfThirdParties +ListOfTrips +ListOfWarehouses +ListOrdersAssociatedProject +ListPredefinedInvoicesAssociatedProject +ListProposalsAssociatedProject +ListSalariesAssociatedProject +ListShippingAssociatedProject +ListSocialContributionAssociatedProject +ListSupplierInvoicesAssociatedProject +ListSupplierOrdersAssociatedProject +ListSupplierProposalsAssociatedProject +ListToApprove +ListVariousPaymentsAssociatedProject +ListWarehouseAssociatedProject +LoadContactFromEmailOrCreate +LocalID +LocalTax1IsNotUsed +LocalTax1IsNotUsedDesc +LocalTax1IsNotUsedDescES +LocalTax1IsNotUsedES +LocalTax1IsNotUsedExample +LocalTax1IsNotUsedExampleES +LocalTax1IsUsed +LocalTax1IsUsedDesc +LocalTax1IsUsedDescES +LocalTax1IsUsedExample +LocalTax1IsUsedExampleES +LocalTax1ManagementES +LocalTax2IsNotUsed +LocalTax2IsNotUsedDesc +LocalTax2IsNotUsedDescES +LocalTax2IsNotUsedES +LocalTax2IsNotUsedExample +LocalTax2IsNotUsedExampleES +LocalTax2IsUsed +LocalTax2IsUsedDesc +LocalTax2IsUsedDescES +LocalTax2IsUsedExample +LocalTax2IsUsedExampleES +LocalTax2ManagementES +LoginEmail +LoginOrEmail +LogoDesc +LogoSquarredDesc +LogsLinesNumber +MAIN_DOCUMENTS_WITH_PICTURE_WIDTH +MOAndLines +MOChild +MODIFYInDolibarr +MRPDescription +MRP_MO_CANCELInDolibarr +MRP_MO_DELETEInDolibarr +MRP_MO_PRODUCEDInDolibarr +MRP_MO_UNVALIDATEInDolibarr +MRP_MO_VALIDATEInDolibarr +Machine +MailboxTargetDirectory +MailingModuleDescContactsByCategory +MailingModuleDescContactsByCompanyCategory +MailingModuleDescContactsByFunction +MailingModuleDescContactsWithThirdpartyFilter +MailingModuleDescDolibarrUsers +MailingModuleDescEmailsFromFile +MailingModuleDescEmailsFromUser +MailingModuleDescThirdPartiesByCategories +MailingStatusDraft +MailingStatusReadAndUnsubscribe +MailingStatusSentCompletely +MailingStatusSentPartialy +MailingStatusValidated +MainAccountForSubscriptionPaymentNotDefined +MainAccountForVatPaymentNotDefined +MainDefaultWarehouseUser +MainDefaultWarehouseUserDesc +MakeLocalDatabaseDump +MakeLocalDatabaseDumpShort +MakeSendLocalDatabaseDump +ManagePartnership +ManualTokenGeneration +Manufactured +Manufacturing +MarkAsRead +MaxEmailCollectPerCollect +Mb +MeasuringUnitTypeDesc +MegaBytes +MemberFirstname +MemberHasNoCategory +MemberIsInCategories +MemberLastname +MemberRef +MemberStatusActive +MemberTypeId +MemberTypeLabel +MembersAndSubscriptions +MembersCategoryShort +MembersHome +MentionCategoryOfOperations0 +MentionCategoryOfOperations1 +MentionCategoryOfOperations2 +MenuAWStats +MenuAccountancyValidationMovements +MenuAddedSuccessfuly +MenuAgendaGoogle +MenuBookcalIndex +MenuCheques +MenuChequesReceipts +MenuDirectPrinting +MenuDoneActions +MenuDoneMyActions +MenuECM +MenuKnowledgeRecord +MenuKnowledgeRecordShort +MenuLoanAccounts +MenuMembers +MenuResourceIndex +MenuSpecialExpenses +MenuTaxAndDividends +MenuTicketMyAssign +MenuTicketMyAssignNonClosed +MenuToDoActions +MenuToDoMyActions +MergingPDFTool +MessageSuccessfullyAdded +MinPriceHT +MinPriceTTC +MoChildsDeleted +ModeRCUR +ModelModulesProduct +Modelcsv_normal +ModifiedById +ModifiedByLogin +ModifyMarginRates +Module0Desc +Module0Name +Module10000Desc +Module10000Name +Module100Name +Module105Desc +Module105Name +Module10Name +Module1120Desc +Module1120Name +Module1200Desc +Module1200Name +Module1520Desc +Module1520Name +Module1780Desc +Module1780Name +Module1Desc +Module1Name +Module20000Desc +Module20000Name +Module2000Desc +Module2000Name +Module200Desc +Module200Name +Module20Desc +Module20Name +Module210Desc +Module210Name +Module2200Desc +Module2200Name +Module22Desc +Module22Name +Module2300Desc +Module23Desc +Module23Name +Module2400Desc +Module240Desc +Module240Name +Module2430Desc +Module2430Name +Module2500Desc +Module2500Name +Module250Desc +Module250Name +Module25Desc +Module2600Desc +Module2600Name +Module2610Desc +Module2610Name +Module2660Desc +Module2660Name +Module2700Desc +Module2700Name +Module27130Desc +Module27130Name +Module2800Desc +Module2900Desc +Module2900Name +Module2Desc +Module2Name +Module30Desc +Module310Desc +Module3200Desc +Module3200Name +Module320Desc +Module320Name +Module3300Desc +Module3300Name +Module330Desc +Module330Name +Module3400Desc +Module3400Name +Module39000Desc +Module39000Name +Module40000Desc +Module40000Name +Module4000Desc +Module4000Name +Module400Desc +Module400Name +Module40Desc +Module4100Desc +Module4100Name +Module410Desc +Module410Name +Module42Desc +Module42Name +Module43Desc +Module43Name +Module49Desc +Module49Name +Module50000Desc +Module50000Name +Module5000Desc +Module5000Name +Module500Desc +Module500Name +Module50100Desc +Module50100Name +Module50150Desc +Module50150Name +Module50200Desc +Module50200Name +Module50300Desc +Module50300Name +Module50400Desc +Module50400Name +Module50Desc +Module50Name +Module510Desc +Module510Name +Module51Desc +Module51Name +Module520Desc +Module520Name +Module52Desc +Module52Name +Module53Desc +Module53Name +Module54000Desc +Module54000Name +Module54Desc +Module54Name +Module55000Desc +Module55000Name +Module55Desc +Module55Name +Module56000Desc +Module56Desc +Module56Name +Module57Desc +Module57Name +Module58Desc +Module59000Desc +Module59000Name +Module60000Desc +Module60000Name +Module6000Desc +Module6000Name +Module600Desc +Module600Long +Module60Desc +Module60Name +Module610Desc +Module62000Desc +Module62000Name +Module63000Desc +Module63000Name +Module64000Desc +Module650Desc +Module650Name +Module66000Desc +Module66000Name +Module660Desc +Module660Name +Module68000Desc +Module68000Name +Module700Desc +Module700Name +Module70Desc +Module70Name +Module75Desc +Module75Name +Module770Desc +Module770Name +Module80Desc +Module85Desc +Module94160Name +ModuleAssetsDesc +ModuleAssetsName +ModuleBookCalDesc +ModuleBookCalName +ModuleBuilderDescbuildpackage +ModuleBuilderDescdescription +ModuleBuilderDeschooks +ModuleBuilderDescmenus +ModuleBuilderDescobjects +ModuleBuilderDescpermissions +ModuleBuilderDescspecifications +ModuleBuilderDesctriggers +ModuleBuilderDescwidgets +ModuleBuilderNotAllowed +ModuleCompanyCodeCustomerAquarium +ModuleCompanyCodeCustomerDigitaria +ModuleCompanyCodeDigitaria +ModuleCompanyCodePanicum +ModuleCompanyCodeSupplierAquarium +ModuleCompanyCodeSupplierDigitaria +ModuleEventOrganizationName +ModuleFamilyExperimental +ModuleInitialized +ModuleKnowledgeManagementDesc +ModulePartnershipName +ModuleReceiptPrinterMustBeEnabled +ModuleRecruitmentDesc +ModuleRecruitmentName +ModuleWebhookDesc +ModuleWebhookName +ModuleZapierForDolibarrDesc +ModuleZapierForDolibarrName +MonthOfDay +MotifCP +MovementId +Mrp +MultiCompanySetup +MultiCurrency +MultiCurrencySetup +MulticurrencyCurrency +MulticurrencySubPrice +MulticurrencyUsed +MutltiCurrencyAutoUpdateCurrencies +MyContainerTitle +MyProjects +MySqlExportParameters +MyTimeSpent +MyWebsitePages +NOT_AUTHOR +NameOrCompany +NameSlashCompany +NbCheque +NbOfGenerationDoneShort +NbOfInvoiceToWithdrawWithInfo +NbOfLines +NbOfObjects +NbOfPayments +NbOfQtyInOrders +NbOfQtyInProposals +NbOfSms +NbOfUniqueSms +NbOfUsers +NbOfVoters +NbOperatorsRequired +NbUseDaysCPShortInMonth +NbVotes +NeedBusinessTravels +NeedMoreInformation +NeedMoreInformationShort +NetToBePaid +NewAccountingJournal +NewAsset +NewAvailabilities +NewCalendar +NewCheckReceipt +NewGroupCreated +NewPayboxPaymentFailed +NewPayboxPaymentReceived +NewPayment +NewProductAttribute +NewProductAttributeValue +NewProductCombinations +NewSell +NewSms +NewSoldeCP +NewStripePaymentFailed +NewStripePaymentReceived +NewSupplier +NewUserPassword +NewWorkstation +NextDateToExecutionShort +NextDateToIntervention +NoAccount +NoArticle +NoArticlesFoundForTheCategory +NoCLIFile +NoContactDefined +NoContactDefinedForThirdParty +NoDefaultPrinterDefined +NoDraftBills +NoError +NoIntervention +NoLimit +NoLogForThisTicket +NoModueToManageStockIncrease +NoOtherDraftBills +NoProductFound +NoProposal +NoRSH +NoRSHHelp +NoRecordedUsers +NoResults +NoTicketsFound +NoTrigger +NoTripsToExportCSV +NoVAT +NoneOrSeveral +NotActiveModCP +NotAllExportedMovementsCouldBeRecordedAsExported +NotCompatible +NotImportedFields +NotMatch +NotRead +NotUsedFields +NotUsedForThisCustomer +NotUsedForThisVendor +NoteSomeFeaturesAreDisabled +NothingProcessed +Notify_ACTION_CREATE +Notify_BILL_CANCEL +Notify_BILL_PAYED +Notify_BILL_SENTBYMAIL +Notify_BILL_SUPPLIER_CANCELED +Notify_BILL_SUPPLIER_PAYED +Notify_BILL_SUPPLIER_SENTBYMAIL +Notify_BILL_SUPPLIER_VALIDATE +Notify_BILL_UNVALIDATE +Notify_BILL_VALIDATE +Notify_COMPANY_CREATE +Notify_COMPANY_SENTBYMAIL +Notify_CONTRACT_VALIDATE +Notify_EXPENSE_REPORT_APPROVE +Notify_EXPENSE_REPORT_VALIDATE +Notify_FICHINTER_ADD_CONTACT +Notify_FICHINTER_CLOSE +Notify_FICHINTER_SENTBYMAIL +Notify_FICHINTER_VALIDATE +Notify_HOLIDAY_APPROVE +Notify_HOLIDAY_VALIDATE +Notify_MEMBER_DELETE +Notify_MEMBER_MODIFY +Notify_MEMBER_RESILIATE +Notify_MEMBER_SUBSCRIPTION +Notify_MEMBER_VALIDATE +Notify_ORDER_CLOSE +Notify_ORDER_SENTBYMAIL +Notify_ORDER_SUPPLIER_APPROVE +Notify_ORDER_SUPPLIER_REFUSE +Notify_ORDER_SUPPLIER_SENTBYMAIL +Notify_ORDER_SUPPLIER_SUBMIT +Notify_ORDER_SUPPLIER_VALIDATE +Notify_ORDER_VALIDATE +Notify_PROJECT_CREATE +Notify_PROPAL_CLOSE_REFUSED +Notify_PROPAL_CLOSE_SIGNED +Notify_PROPAL_SENTBYMAIL +Notify_PROPAL_VALIDATE +Notify_SHIPPING_SENTBYMAIL +Notify_SHIPPING_VALIDATE +Notify_TASK_CREATE +Notify_TASK_DELETE +Notify_TASK_MODIFY +Notify_TICKET_SENTBYMAIL +Notify_WITHDRAW_CREDIT +Notify_WITHDRAW_EMIT +Notify_WITHDRAW_TRANSMIT +NumberOf +NumberOfUnits +NumberOfUnitsMos +NumeroNationalEmetter +OAUTH_GITHUB_ID +OAUTH_GITHUB_NAME +OAUTH_GITHUB_SECRET +OAUTH_GOOGLE_ID +OAUTH_GOOGLE_NAME +OAUTH_GOOGLE_SECRET +OAUTH_STRIPE_LIVE_ID +OAUTH_STRIPE_LIVE_NAME +OAUTH_STRIPE_TEST_ID +OAUTH_STRIPE_TEST_NAME +ONLINE_PAYMENT_CSS_URL +ONLINE_PAYMENT_WAREHOUSE +ORDER_SUPPLIER_DELETEInDolibarr +Of +OnHold +OneLinePerPeriod +OneLinePerTask +OneLinePerTimeSpentLine +OneLinePerUser +OnlineHelp +OnlyActiveElementsAreExposed +OnlyNonValid +OnlyOpenedAccount +OnlyProdsInStock +OpenAnyMovement +OpenEtablishment +OpenFiscalYear +OpenInternal +OpenVerb +OpenedProjectsByThirdparties +OpeningBalance +OppStatusLOST +OppStatusNEGO +OppStatusPENDING +OppStatusPROPO +OppStatusPROSP +OppStatusQUAL +OppStatusWON +OpportunitiesStatusForProjects +OptionModeProductBuyExportDesc +OptionModeProductBuyIntraDesc +OptionVatInfoModuleComptabilite +OrProductsWithCategories +OrderByDateAsc +OrderByDateDesc +OrderByEMail +OrderByFax +OrderByMail +OrderByPhone +OrderByWWW +OrderCreation +OrderDateShort +OrderDeleted +OrderId +OrderLine +OrderShowDetail +OrdersInProcess +OrdersOpened +OrganizationEvenLabelName +OrganizationEventBoothRequestWasReceived +OrganizationEventBulkMailToAttendees +OrganizationEventBulkMailToSpeakers +OrganizationEventConfRequestWasReceived +OrganizationEventLinkToThirdParty +OriginEmail +OtherCountriesCustomersReport +OtherReceptionsForSameOrder +OutOfEurope +OutOfOrder +OutOfProject +PAIDInDolibarr +PASSWORDInDolibarr +PAYBOX_PAYONLINE_SENDEMAIL +PAYPAL_API_SANDBOX +PDFCrevetteDescription +PDFCrevetteSituationInvoiceLine +PDFCrevetteSituationInvoiceLineDecompte +PDFCrevetteSituationInvoiceTitle +PDFCrevetteSituationNumber +PDFEdisonDescription +PDF_USE_1A +PL_HIGH +PL_LOW +PL_MEDIUM +PL_NONE +PL_UNKNOWN +POSModule +POSTerminal +PRINTGCP_AUTHLINK +PRINTGCP_INFO +PRINTGCP_TOKEN_ACCESS +PRINTIPP_HOST +PRINTIPP_PASSWORD +PRINTIPP_PORT +PRINTIPP_USER +PRODUCT_CREATEInDolibarr +PRODUCT_DELETEInDolibarr +PRODUCT_MODIFYInDolibarr +PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE +PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help +PROJECT_CREATEInDolibarr +PROJECT_DELETEInDolibarr +PROJECT_MODIFYInDolibarr +PROPOSAL_PDF_HIDE_PAYMENTMODE +PROPOSAL_PDF_HIDE_PAYMENTTERM +PageContent +Param +ParentCategoryID +ParentCategoryLabel +ParentLine +ParentPageId +ParentProductOfVariant +ParentProductsNumber +PartnershipAbout +PartnershipAboutPage +PartnershipAccepted +PartnershipAlreadyExist +PartnershipCanceled +PartnershipCheckBacklink +PartnershipDedicatedToThisThirdParty +PartnershipDescription +PartnershipDescriptionLong +PartnershipDraft +PartnershipManagedFor +PartnershipRefused +PassEncoding +PassedInOpenStatus +PassedInShippedStatus +PasswordChangeRequest +PasswordChangeRequestSent +Paste +PaymentBack +PaymentByChequeOrderedToShort +PaymentCondition10D +PaymentCondition10DENDMONTH +PaymentCondition14D +PaymentCondition14DENDMONTH +PaymentCondition30D +PaymentCondition30DENDMONTH +PaymentCondition60D +PaymentCondition60DENDMONTH +PaymentConditionDEP30PCTDEL +PaymentConditionPT_5050 +PaymentConditionPT_DELIVERY +PaymentConditionPT_ORDER +PaymentConditionRECEP +PaymentConditionShort10D +PaymentConditionShort10DENDMONTH +PaymentConditionShort14D +PaymentConditionShort14DENDMONTH +PaymentConditionShort30D +PaymentConditionShort30DENDMONTH +PaymentConditionShort60D +PaymentConditionShort60DENDMONTH +PaymentConditionShortDEP30PCTDEL +PaymentConditionShortPT_5050 +PaymentConditionShortPT_DELIVERY +PaymentConditionShortPT_ORDER +PaymentConditionShortRECEP +PaymentConferenceAttendee +PaymentId +PaymentModeShort +PaymentNote +PaymentNumber +PaymentRef +PaymentRule +PaymentSupplierInvoice +PaymentTermsCustomer +PaymentTermsSupplier +PaymentTypeDC +PaymentTypeFAC +PaymentTypeLIQ +PaymentTypePP +PaymentTypePRE +PaymentTypeShortCB +PaymentTypeShortCHQ +PaymentTypeShortFAC +PaymentTypeShortPRE +PaymentTypeShortTIP +PaymentTypeShortTRA +PaymentTypeShortVAD +PaymentTypeShortVIR +PaymentTypeTIP +PaymentTypeTRA +PaymentTypeVAD +PaymentTypeVIR +PaypalImportPayment +PaypalOrCBDoPayment +PermanentLeftSearchForm +Permission10001 +Permission10002 +Permission10003 +Permission10005 +Permission1001 +Permission1002 +Permission1003 +Permission1004 +Permission1005 +Permission101 +Permission1011 +Permission1012 +Permission1014 +Permission1015 +Permission1016 +Permission102 +Permission104 +Permission105 +Permission106 +Permission109 +Permission11 +Permission1101 +Permission1102 +Permission1104 +Permission1109 +Permission111 +Permission112 +Permission1121 +Permission1122 +Permission1123 +Permission1124 +Permission1125 +Permission1126 +Permission113 +Permission114 +Permission115 +Permission116 +Permission117 +Permission1181 +Permission1182 +Permission1183 +Permission1184 +Permission1185 +Permission1186 +Permission1187 +Permission1188 +Permission1189 +Permission1191 +Permission12 +Permission1201 +Permission1202 +Permission121 +Permission122 +Permission1231 +Permission1232 +Permission1233 +Permission1234 +Permission1235 +Permission1236 +Permission1237 +Permission125 +Permission1251 +Permission126 +Permission13 +Permission130 +Permission1321 +Permission1322 +Permission14 +Permission141 +Permission142 +Permission1421 +Permission144 +Permission145 +Permission146 +Permission147 +Permission15 +Permission151 +Permission152 +Permission1521 +Permission1522 +Permission153 +Permission154 +Permission16 +Permission161 +Permission162 +Permission163 +Permission164 +Permission165 +Permission167 +Permission171 +Permission172 +Permission173 +Permission174 +Permission178 +Permission180 +Permission181 +Permission182 +Permission183 +Permission184 +Permission185 +Permission186 +Permission187 +Permission188 +Permission19 +Permission192 +Permission193 +Permission194 +Permission20001 +Permission20002 +Permission20003 +Permission20004 +Permission20005 +Permission20006 +Permission20007 +Permission202 +Permission203 +Permission204 +Permission205 +Permission206 +Permission21 +Permission211 +Permission212 +Permission213 +Permission214 +Permission215 +Permission22 +Permission221 +Permission222 +Permission223 +Permission229 +Permission23001 +Permission23002 +Permission23003 +Permission23004 +Permission23101 +Permission23102 +Permission23103 +Permission23104 +Permission237 +Permission238 +Permission239 +Permission24 +Permission2401 +Permission2402 +Permission2403 +Permission241 +Permission2411 +Permission2412 +Permission2413 +Permission2414 +Permission242 +Permission243 +Permission244 +Permission25 +Permission2501 +Permission2502 +Permission2503 +Permission251 +Permission2515 +Permission252 +Permission253 +Permission254 +Permission255 +Permission256 +Permission26 +Permission2610 +Permission262 +Permission263 +Permission27 +Permission271 +Permission272 +Permission273 +Permission28 +Permission2801 +Permission2802 +Permission281 +Permission282 +Permission283 +Permission286 +Permission291 +Permission292 +Permission293 +Permission301 +Permission304 +Permission305 +Permission31 +Permission311 +Permission312 +Permission32 +Permission3200 +Permission33 +Permission3301 +Permission331 +Permission332 +Permission333 +Permission34 +Permission341 +Permission342 +Permission343 +Permission344 +Permission351 +Permission352 +Permission353 +Permission354 +Permission358 +Permission36 +Permission38 +Permission39 +Permission40001 +Permission40002 +Permission40003 +Permission4001 +Permission4002 +Permission4003 +Permission401 +Permission402 +Permission4021 +Permission4022 +Permission4023 +Permission4025 +Permission4028 +Permission403 +Permission4031 +Permission4032 +Permission4033 +Permission404 +Permission41 +Permission42 +Permission430 +Permission44 +Permission45 +Permission50101 +Permission50151 +Permission50152 +Permission50153 +Permission50201 +Permission50202 +Permission50330 +Permission50331 +Permission50332 +Permission50401 +Permission50411 +Permission50412 +Permission50414 +Permission50415 +Permission50418 +Permission50420 +Permission50430 +Permission50440 +Permission51001 +Permission51002 +Permission51003 +Permission51005 +Permission511 +Permission512 +Permission514 +Permission517 +Permission519 +Permission520 +Permission522 +Permission524 +Permission525 +Permission527 +Permission531 +Permission532 +Permission533 +Permission534 +Permission536 +Permission538 +Permission54001 +Permission55001 +Permission55002 +Permission56001 +Permission56002 +Permission56003 +Permission56004 +Permission56005 +Permission56006 +Permission561 +Permission562 +Permission563 +Permission564 +Permission59001 +Permission59002 +Permission59003 +Permission601 +Permission602 +Permission609 +Permission61 +Permission611 +Permission612 +Permission613 +Permission62 +Permission63001 +Permission63002 +Permission63003 +Permission63004 +Permission64 +Permission64001 +Permission650 +Permission651 +Permission652 +Permission660 +Permission661 +Permission662 +Permission67 +Permission67000 +Permission68 +Permission68001 +Permission68002 +Permission68004 +Permission69 +Permission70 +Permission701 +Permission702 +Permission703 +Permission71 +Permission72 +Permission74 +Permission75 +Permission76 +Permission771 +Permission772 +Permission773 +Permission775 +Permission776 +Permission777 +Permission778 +Permission779 +Permission78 +Permission79 +Permission81 +Permission82 +Permission84 +Permission85 +Permission86 +Permission87 +Permission88 +Permission89 +Permission91 +Permission92 +Permission93 +Permission94 +Permission941601 +Permission941602 +Permission941603 +Permission941604 +Permission941605 +Permission941606 +Permission95 +PermissionAdvanced251 +PermissionAdvanced253 +PhoneNumber +PhpWebLink +PointOfSale +PointOfSaleShort +PopuCom +PopuProp +PossibleLanguages +PostgreSqlExportParameters +PredefinedGroups +PredefinedInvoices +PredefinedMailContentContract +PrepareSms +PrettyLittleSentence +PrevSoldeCP +PreviewSms +PriceFormatInCurrentLanguage +PriceLevelLabels +PriceQtyMinHT +PriceQtyMinHTCurrency +PriceU +PrintGCPDesc +PrintIPPDesc +PrintMethod +PrintTestDescprintgcp +PrintTestDescprintipp +PrintingDriverDescprintgcp +PrintingDriverDescprintipp +ProductBOMHelp +ProductBarcodeDoesNotExist +ProductBatchDoesNotExist +ProductCombination +ProductCombinationGenerator +ProductCombinationGeneratorWarning +ProductDescriptionTranslated +ProductDoesNotExist +ProductFound +ProductHasNoCategory +ProductId +ProductIsInCategories +ProductLabelTranslated +ProductNoteTranslated +ProductQtyInReceptionAlreadySent +ProductQtyInSuppliersReceptionAlreadyRecevied +ProductService +ProductSheet +ProductStockWarehouse +ProductVolume +ProductWeight +ProductsMultiPrice +ProductsOnPurchaseOnly +ProductsOnSaleOnly +ProductsOnSellAndOnBuy +ProductsOrServiceMultiPrice +ProductsOrServicesTranslations +ProductsPipeServices +ProductsPricePerCustomer +ProfId10 +ProfId10FR +ProfId10Short +ProfId10ShortFR +ProfId1ShortCM +ProfId1ShortFR +ProfId2ShortCM +ProfId2ShortFR +ProfId3ShortCM +ProfId3ShortFR +ProfId4ShortCM +ProfId4ShortFR +ProfId5ShortCM +ProfId5ShortFR +ProfId6ShortCM +ProfId6ShortFR +ProfId7Short +ProfId7ShortFR +ProfId8Short +ProfId8ShortFR +ProfId9Short +ProfId9ShortFR +ProformaBill +ProjectCreatedByEmailCollector +ProjectHasNoCategory +ProjectId +ProjectOpenedProjectByOppStatus +ProjectRef +ProjectStatus +ProjectsAndTasksLines +ProjectsCategoriesShort +Properties +Property +ProposalCard +ProposalDeleted +ProposalLine +ProposalLines +ProposalShort +ProposalsAndProposalsLines +ProposedRemuneration +ProspectStatus +ProtectAndEncryptPdfFiles +ProtectAndEncryptPdfFilesDesc +PublicMemberCard +PublicMemberList +PurchaseOrderLines +PurchasedAmount +PurgeDeleteTemporaryFiles +ReConciliedBy +Read +RealURL +RealValue +ReasonDecline +ReasonDeclineOrCancel +ReceiptPrinter +ReceiptPrinterMethodDescription +ReceiptPrinterProfileDesc +ReceiptPrinterTemplateDesc +ReceivedPayments +ReceptionDescription +ReceptionLine +ReceptionsAndReceivingForSameOrder +RecordEvent +RecordMovement +RecordedQty +RecruitmentAbout +RecruitmentAboutPage +RecurringInvoice +RecurringInvoiceSource +RecurringInvoices +RecurringInvoicesJob +RecurringSupplierInvoices +RecurringSupplierInvoicesJob +Redo +Reductions +ReductionsShort +RefBill +RefOrderSupplier +RefOrderSupplierShort +RefSalary +RefSupplierShort +RefTaskParent +RegenerateMissingFiles +RegionStateOrigin +RegistrationAndPaymentWereAlreadyRecorder +RegistrationDate +RegulateStock +RegulatedOn +RegulatedQty +RelatedBill +RelatedBills +RelatedCommercialProposals +RelatedCustomerInvoices +RelatedObjects +RelatedRecurringCustomerInvoices +RelatedSupplierInvoices +RelatedTickets +RelativeDiscount +RemainderToTakeMulticurrency +RemoteControlSupport +RemoveAll +RepeatEvent +Repeatable +RepeatableSupplierInvoicesList +Repeatables +Replenishments +ReportByCustomers +ReportThirdParty +RequestedRemuneration +RequireAtLeastXDigits +RequireAtLeastXString +RequireXDigitsMax +RequiredField +ResetSms +ResourceNotAssignedToTheTask +ResourcePageIndex +ResourceTypeCode +ResponsibleOfRecruitement +Rest +RestOfEurope +RestartSelling +RuleForWarehouse +RulesCATotalSaleJournal +RulesPurchaseTurnoverTotalPurchaseJournal +Run +SALARIES_ACCOUNTING_ACCOUNT_CHARGE +SALARIES_ACCOUNTING_ACCOUNT_PAYMENT +SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc +SEPAMandate +SERVICE_BOOTH_LOCATION +SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION +SMSSentTo +STRIPE_CGI_URL_V2 +STRIPE_PAYONLINE_SENDEMAIL +SalariesAndPayments +SalariesPaymentsOf +SalaryInvoice +SaleLocal +SaleOrderLines +SaleRepresentativeFirstname +SaleRepresentativeLastname +SaleRepresentativeLogin +SalesRepresentativeMargins +SameCountryCustomersWithVAT +SaveAndNew +SaveAs +SaveQtyFirst +SavingAccounts +SearchACustomerInvoice +SearchASupplierInvoice +SearchOf +SearchProduct +SearchRequest +SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry +SeeInMarkerPlace +SeeOfficalSupport +SeeSubstitutionVars +SeeTicket +SeeVATReportInDueDebtMode +SeeVATReportInInputOutputMode +Select2MoreCharactersMore +SelectCategory +SelectFournisseur +SelectImportFields +SelectTaskToAssign +Selectformat +SellFinished +SellingMinPriceTTC +SellingPriceHT +SellingPriceTTC +SendAgreement +SendAgreementText +SendAskByMail +SendAskRef +SendBillByMail +SendBillRef +SendContractRef +SendEmailsReminders +SendEmailsRemindersOnInvoiceDueDate +SendInterventionByMail +SendInterventionRef +SendNewPasswordLink +SendOrderByMail +SendOrderRef +SendPaymentReceipt +SendProjectRef +SendPropalByMail +SendPropalRef +SendReceptionByEMail +SendReceptionRef +SendRemindByMail +SendReminderBillByMail +SendReminderBillRef +SendReminderForExpiredSubscription +SendReminderForExpiredSubscriptionTitle +SendRequestCP +SendRequestCollectiveCP +SendShippingByEMail +SendTo +Sending +SendingEmailOnAutoSubscription +SendingEmailOnCancelation +SendingEmailOnMemberValidation +SendingEmailOnNewSubscription +SendingEmailOnPartnershipAccepted +SendingEmailOnPartnershipCanceled +SendingEmailOnPartnershipRefused +SendingEmailOnPartnershipWillSoonBeCanceled +SendingReminderActionComm +SendingReminderForExpiredSubscription +SendingsAbility +SentBy +SentToSuppliers +SentXXXmessages +SerialNumberAlreadyInUse +ServiceSheet +ServicesOnPurchaseOnly +ServicesOnSaleOnly +ServicesOnSellAndOnBuy +SetLinkToAnotherThirdParty +SetRef +SetToDisabled +SetToEnabled +SetWebsiteOnlineBefore +SetupDescription3 +SetupDescription4 +SetupPayBoxToHavePaymentCreatedAutomatically +SetupShort +SetupStripeToHavePaymentCreatedAutomatically +ShipProduct +ShipmentBackToDraftInDolibarr +ShipmentClassifyClosedInDolibarr +ShipmentValidatedInDolibarr +ShippableOrderIconInList +ShoppingCart +Shortname +ShowAllFingerPrintsErrorsMightBeTooLong +ShowAllFingerPrintsMightBeTooLong +ShowCustomer +ShowCustomerPreview +ShowDiscount +ShowFiscalYear +ShowListTicketWithTrackId +ShowLoanPayment +ShowMyTasksOnly +ShowOpeningBalance +ShowProjectLabel +ShowProspect +ShowReception +ShowResource +ShowSalaryPayment +ShowSms +ShowStock +ShowSubscription +ShowSupplierPreview +ShowTempMassFilesArea +ShowTypeCard +ShowUnpaidAll +ShowUnpaidLateOnly +ShowWithdraw +SignSociete_rib +SignatureSociete_ribRef +SituationAmount +SituationDeduction +SituationTotalRayToRest +SizeUnitdm +SizeUnitfoot +SizeUnitm +SizeUnits +SkillList +Skin +Skype +SmsCard +SmsMessage +SmsNoPossibleRecipientFound +SmsRecipient +SmsRecipients +SmsResult +SmsStatusApproved +SmsStatusDraft +SmsStatusError +SmsStatusNotSent +SmsStatusSent +SmsStatusSentCompletely +SmsStatusSentPartialy +SmsStatusValidated +SmsTargets +SmsTestMessage +SmsTitle +SmsTopic +SocialNetworkSetup +SocialNetworksFacebookURL +SocialNetworksGithubURL +SocialNetworksInstagramURL +SocialNetworksLinkedinURL +SocialNetworksTwitterURL +SocialNetworksYoutubeURL +Societe_ribSigned +SoldAmount +SolvedClosed +SourceInvoiceId +SourceRequired +Speaker +SpecialCharActivation +SpecialCode +StandingOrderPayment +StandingOrderToProcess +StandingOrdersPayment +StartUpload +StateCode +StateId +StateOrigin +StatusAtInstall +StatusDebitCredit +StatusOrderApproved +StatusOrderApprovedShort +StatusOrderOnProcessShort +StatusOrderOnProcessWithValidation +StatusOrderProcessedShort +StatusOrderReceivedAllShort +StatusOrderReceivedPartially +StatusOrderReceivedPartiallyShort +StatusOrderRefused +StatusOrderRefusedShort +StatusReceptionCanceled +StatusReceptionDraft +StatusReceptionProcessed +StatusReceptionValidated +StatusReceptionValidatedReceived +StatusReceptionValidatedToReceive +StatusSendingCanceled +StatusSendingCanceledShort +StatusSendingDraft +StatusSendingProcessed +StatusSendingValidated +StatusSupplierOrderApproved +StatusSupplierOrderCanceledShort +StatusSupplierOrderDelivered +StatusSupplierOrderDeliveredShort +StatusSupplierOrderDraft +StatusSupplierOrderOnProcess +StatusSupplierOrderOnProcessWithValidation +StatusSupplierOrderProcessed +StatusSupplierOrderProcessedShort +StatusSupplierOrderReceivedAllShort +StatusSupplierOrderReceivedPartially +StatusSupplierOrderRefusedShort +StatusSupplierOrderSent +StatusSupplierOrderSentShort +StatusSupplierOrderToBill +StatusSupplierOrderToBillShort +StatusSupplierOrderToProcessShort +StatusSupplierOrderValidatedShort +Statut +StatutCP +StockDecreaseForPointOfSaleDisabledbyBatch +StockDetailPerBatch +StockLimitShort +StockStransferDecrementedCancel +StockStransferIncrementedShort +StockStransferIncrementedShortCancel +StockToBuy +StockTransferSetup +StocksWithBatch +String +String1Line +StripeAccount +StripeGateways +StripeID +StripeImportPayment +StripeOrCBDoPayment +StripePaymentModes +SubCatOf +SubProduct +SubjectNotIn +SubmitTranslation +SubmitTranslationENUS +SubscriptionId +SubscriptionRecorded +SubscriptionReminderEmail +SuggestedForTicketsInGroup +SummarySystem +SupervisorNotFound +SupplierCard +SupplierCodeShort +SupplierIBAN +SupplierInvoiceGeneratedFromTemplate +SupplierInvoiceLines +SupplierInvoicePayment +SupplierProposalCard +SupplierProposalDate +SupplierProposalRefFourn +SupplierProposalShort +SupplierProposalsDraft +SupplierReputation +SuppliersCategoryShort +SuppliersPrices +SuppliersPricesOfProductsOrServices +SurfaceUnitcm2 +SurfaceUnitdm2 +SurfaceUnitfoot2 +SurfaceUnitinch2 +SurfaceUnitm2 +SurfaceUnitmm2 +SurfaceUnits +System +SystemInfo +SystemInfoDesc +SystemTools +SystemToolsArea +TE_ADMIN +TE_GROUP +TE_MEDIUM +TE_OTHER +TE_PRIVATE +TE_RETAIL +TE_SMALL +TE_STARTUP +TE_UNKNOWN +TE_WHOLE +TF_BUS +TF_CAR +TF_ESSENCE +TF_HOTEL +TF_LUNCH +TF_METRO +TF_OTHER +TF_PEAGE +TF_TAXI +TF_TRAIN +TF_TRIP +THMEstimatedHelp +THMMachineEstimated +THMMachineEstimatedHelp +THMOperatorEstimated +THMOperatorEstimatedHelp +TICKET_CLOSEInDolibarr +TICKET_CREATEInDolibarr +TICKET_DELETEInDolibarr +TICKET_MODIFYInDolibarr +TMenuAgenda +TMenuMRP +TMenuProducts +TMenuServices +TMenuTools +TOKEN_DELETE +TabLetteringCustomer +TabLetteringSupplier +TagCheckMail +TagMailtoEmail +TagSignature +TagUnsubscribe +TakeposConnectorMethodDescription +TakeposConnectorNecesary +TakeposNeedsPayment +TaskAssignedToEnterTime +TaskDateEnd +TaskDateStart +TaskDescription +TaskId +TaskProgressSummary +TaskTimeDate +TaskTimeNote +TaskTimeSpent +TaskTimeUser +TasksHistoryForThisContact +Tb +TeleFax +TeraBytes +Terminate +TerreNumRefModelError +TestConnection +TestLoginToAPI +TestSms +TextLong +TextLongNLines +TheoricalQty +TheoricalValue +ThirdPartyAccount +ThirdPartyBankCode +ThirdPartyBookCalHelp +ThirdPartyCreatedByEmailCollector +ThirdPartyCustomersStats +ThirdPartyProspectsStats +ThirdpartiesHome +ThisIsContentOfSubscriptionReminderEmail +ThisIsContentOfYourCard +ThisIsContentOfYourMembershipRequestWasReceived +ThisIsContentOfYourMembershipWasValidated +ThisIsContentOfYourSubscriptionWasRecorded +ThisIsInformationOnDocumentToSignSociete_rib +ThisScreenAllowsYouToSignDocFromSociete_rib +TicketAssignedCustomerBody +TicketAssignedCustomerEmail +TicketCategoryShortOTHER +TicketChangeCategory +TicketChangeSeverity +TicketChangeType +TicketCloseEmailBodyAdmin +TicketCloseEmailBodyCustomer +TicketCloseEmailBodyInfosTrackUrlCustomer +TicketCloseEmailSubjectAdmin +TicketCloseEmailSubjectCustomer +TicketCreatedByEmailCollector +TicketDictCategory +TicketDictResolution +TicketDictSeverity +TicketDictType +TicketInitialMessageModified +TicketLogAssignedTo +TicketLogClosedBy +TicketLogPropertyChanged +TicketLogReopen +TicketLogStatusChanged +TicketMailExchanges +TicketMessageMailIntroAutoNewPublicMessage +TicketNewEmailBodyCustomer +TicketNewEmailSubjectCustomer +TicketNotNotifyTiersAtCreate +TicketNotificationEmailSubject +TicketNotificationLogMessage +TicketNotificationNumberEmailSent +TicketParamMail +TicketParamModule +TicketParamPublicInterface +TicketParams +TicketPleaseSelectAContract +TicketSetupPage +TicketSeverityShortBLOCKING +TicketSeverityShortHIGH +TicketSeverityShortLOW +TicketSeverityShortNORMAL +TicketTimeToRead +TicketTypeShortCOM +TicketTypeShortHELP +TicketTypeShortISSUE +TicketTypeShortOTHER +TicketTypeShortPROBLEM +TicketTypeShortPROJET +TicketTypeShortREQUEST +TicketViewAllTickets +TicketViewNonClosedOnly +TicketsActivatePublicInterfaceHelp +TicketsCategoriesArea +TicketsDisableEmail +TicketsHome +TicketsLimitViewAssignedOnly +TicketsLimitViewAssignedOnlyHelp +TicketsLogEnableEmail +TicketsLogEnableEmailHelp +TimeSpentBy +TimeSpentForIntervention +TimeSpentInvoiced +TimeType +TitleNumberOfActivatedModules +ToBillSeveralOrderSelectCustomer +ToBuildBackupFileClickHere +ToConciliate +ToDate +ToDispatch +ToLocation +ToProcess +ToStart +ToTest +ToUseAGenericEmail +TokenMustHaveBeenCreated +Tomorrow +TooMuchCombinationsWarning +ToolkitForDevelopers +TotalHTforthispage +TotalLT1ES +TotalLT1IN +TotalLT2ES +TotalLT2IN +TotalNumberOfActivatedModules +TotalSituationInvoice +TotalTTCToYourCredit +TotalTicket +TotalVATIN +TrackableSecurityEvents +TransKey +TranslatedDescription +TranslatedLabel +TranslatedNote +TranslationSetup +TranslationUncomplete +TriggerCodeInfo +TriggerCodes +TripId +TurnoverCollectedbyVatrate +TypeContact_commande_external_BILLING +TypeContact_commande_external_CUSTOMER +TypeContact_commande_external_SHIPPING +TypeContact_commande_internal_SALESREPFOLL +TypeContact_commande_internal_SHIPPING +TypeContact_contrat_external_BILLING +TypeContact_contrat_external_CUSTOMER +TypeContact_contrat_external_SALESREPSIGN +TypeContact_facture_external_BILLING +TypeContact_facture_external_SERVICE +TypeContact_facture_external_SHIPPING +TypeContact_facture_internal_SALESREPFOLL +TypeContact_fichinter_external_CUSTOMER +TypeContact_invoice_supplier_external_BILLING +TypeContact_invoice_supplier_external_SERVICE +TypeContact_invoice_supplier_external_SHIPPING +TypeContact_invoice_supplier_internal_SALESREPFOLL +TypeContact_order_supplier_external_BILLING +TypeContact_order_supplier_external_CUSTOMER +TypeContact_order_supplier_external_SHIPPING +TypeContact_order_supplier_internal_SALESREPFOLL +TypeContact_order_supplier_internal_SHIPPING +TypeContact_project_external_PROJECTCONTRIBUTOR +TypeContact_project_external_PROJECTLEADER +TypeContact_project_internal_PROJECTCONTRIBUTOR +TypeContact_project_internal_PROJECTLEADER +TypeContact_project_task_external_TASKCONTRIBUTOR +TypeContact_project_task_external_TASKEXECUTIVE +TypeContact_project_task_internal_TASKCONTRIBUTOR +TypeContact_project_task_internal_TASKEXECUTIVE +TypeContact_propal_external_BILLING +TypeContact_propal_external_CUSTOMER +TypeContact_propal_external_SHIPPING +TypeContact_propal_internal_SALESREPFOLL +TypeContact_stocktransfer_internal_STDEST +TypeContact_stocktransfer_internal_STFROM +TypeContact_stocktransfer_internal_STRESP +TypeContact_supplier_proposal_external_BILLING +TypeContact_supplier_proposal_external_SERVICE +TypeContact_supplier_proposal_external_SHIPPING +TypeContact_ticket_external_CONTRIBUTOR +TypeContact_ticket_external_SUPPORTCLI +TypeContact_ticket_internal_CONTRIBUTOR +TypeContact_ticket_internal_SUPPORTTEC +TypeContrib +TypeOfLeaveCode +TypeOfLeaveId +TypeOfLeaveLabel +TypeOfLineServiceOrProduct +Unanswered +Uncheck +Under +Undo +UnitCharges +UnitPriceTTC +UnknownAccountForThirdpartyBlocking +Unlettering +Unread +UpdateByScaningLot +UpdateByScaningProductBarcode +UpdateConfCPOK +UpdateRate +UploadFileDragDropSuccess +UrlToCheck +UsBillingContactAsIncoiveRecipientIfExist +UsageBillTimeShort +UsageOpportunity +UsageOrganizeEvent +UsageTasks +UseCredit +UseCustomerContactAsPropalRecipientIfExist +UseDebugBar +UseDiscount +UseDocFolder +UseFormatFileEmailToTarget +UseFormatInputEmailToTarget +UsePercentageVariations +UsePreviewTabs +UseTextBetween5And70Chars +UsedByInvoice +UserAccountancyCode +UserApproval +UserApproval2 +UserAuthor +UserCP +UserCard +UserClosing +UserClosingService +UserClosingShort +UserCreationShort +UserDeleted +UserEnabled +UserEnabledDisabled +UserForApprovalFirstname +UserForApprovalID +UserForApprovalLastname +UserForApprovalLogin +UserHideExternal +UserHideNonEmployee +UserID +UserLogged +UserLoginFailed +UserLogoff +UserMargins +UserModification +UserModificationShort +UserNeedPermissionToEditStockToUsePos +UserPersonalEmail +UserPersonalMobile +UserRank +UserRights +UserSetup +UserStartingService +UserUpdateCP +UserValidation +UserValidationShort +UsersHome +VALIDATEInDolibarr +VATBalance +VATDue +VATIN +VATINs +VATNPR +VATReportBuildWithOptionDefinedInModule +VATReportByCustomers +VATReportByCustomersInInputOutputMode +VATReportByPeriods +VATReportByQuartersInInputOutputMode +VATs +ValidFrom +ValidSms +ValidUntil +ValidateAndClose +ValidateInvoice +ValidateOrderFirstBeforeReception +ValidateReply +ValidatedById +ValidatedByLogin +ValidatedProjects +ValidatedWaitingApproval +ValueOfMeansLossForProductProduced +VarAmount +VariantLabelExample +VariantRefExample +VariousPaymentId +VariousPaymentLabel +Vendor +VendorEmail +VendorFirstname +VendorLastname +ViewAccountList +ViewSiteInNewTab +ViewSubAccountList +ViewWebsiteInProduction +VirementOrder +VirtualStockAtDateDesc +VisibleEverywhere +VisibleNowhere +VolumeUnitcm3 +VolumeUnitdm3 +VolumeUnitfoot3 +VolumeUnitgallon +VolumeUnitinch3 +VolumeUnitlitre +VolumeUnitm3 +VolumeUnitmm3 +VolumeUnitounce +VolumeUnits +VueBySubAccountAccounting +WEBSITE_CSS_URL +WEBSITE_PAGEURL +Waiting +WarehouseId +WarehouseRef +WarehouseUsage +WarehousesAndProducts +WarehousesAndProductsBatchDetail +WarningBillExist +WarningCloseAlways +WarningFailedToAddFileIntoDatabaseIndex +WarningInstallationMayBecomeNotCompliantWithLaw +WarningNoSmsAdded +WarningNoteModuleInvoiceForFrenchLaw +WarningNoteModulePOSForFrenchLaw +Warnings +WatermarkOnDraftSupplierProposal +WebhookSetup +Webpage +WebsiteId +WebsiteTypeLabel +WeightUnitg +WeightUnitkg +WeightUnitmg +WeightUnitounce +WeightUnitpound +WeightUnits +WeightUnitton +WelcomeOnOnlineSignaturePageSociete_rib +WidthUnits +WithBankUsingBANBIC +WithBankUsingRIB +WithDolTrackingID +WithDolTrackingIDInMsgId +WithdrawRequestAmount +WithdrawRequestErrorNilAmount +WithdrawalCantBeCreditedTwice +WithdrawalFile +WithdrawalPayment +WithoutDolTrackingID +WithoutDolTrackingIDInMsgId +WorkPlace +Workflow +WorkstationArea +WorkstationCreate +WorkstationList +WorkstationSetup +WorkstationType +WorkstationsDescription +YearInvoice +Yesterday +YouAreNotContactOfProject +YouCanEditHtmlSourceckeditor +YouCanEditPHPTZ +YouCanLinkArticleToATicketCategory +YouCantShipThis +YouMayFindYourInvoiceInThisEmail +YouTryInstallDisabledByDirLock +YouUseLastStableVersion +YouWillBeRedirectedOnPayBox +YouWillBeRedirectedOnStripe +YourCandidature +YourCandidatureAnswerMessage +YourEMail +YourMembershipRequestWasReceived +YourMembershipWasCanceled +YourMembershipWasValidated +YourOrganizationEventBoothRequestWasReceived +YourOrganizationEventConfRequestWasReceived +YourPartnershipAcceptedContent +YourPartnershipAcceptedTopic +YourPartnershipCanceledContent +YourPartnershipCanceledTopic +YourPartnershipRefusedContent +YourPartnershipRefusedTopic +YourPartnershipWillSoonBeCanceledContent +YourPartnershipWillSoonBeCanceledTopic +YourPasswordHasBeenReset +YourSEPAMandate +YourSubscriptionWasRecorded +ZapierAbout +ZapierDescription +ZapierForDolibarrSetup +accessType +activityindex +addEventToUserCP +byEX_DAY +byEX_EXP +byEX_MON +byEX_YEA +categories +commercialindex +contractindex +datapolicySetup +davDescription +day +deplacement +descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE +descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER +descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER +descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER +descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL +descWORKFLOW_ORDER_AUTOCREATE_INVOICE +descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL +descWORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL +descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION +descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED +descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING +descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED +descWORKFLOW_PROPAL_AUTOCREATE_INVOICE +descWORKFLOW_PROPAL_AUTOCREATE_ORDER +descWORKFLOW_RECEPTION_CLASSIFY_BILLED_INVOICE +descWORKFLOW_RECEPTION_CLASSIFY_CLOSED_INVOICE +descWORKFLOW_SHIPPING_CLASSIFY_BILLED_INVOICE +descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE +descWORKFLOW_TICKET_CLOSE_INTERVENTION +descWORKFLOW_TICKET_CREATE_INTERVENTION +descWORKFLOW_TICKET_LINK_CONTRACT +descWORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS +donationindex +errorRateDelete +expensereportindex +g +gram +hour +hrmindex +interventionindex +inventoryChangePMPPermission +inventoryConfirmCreate +inventoryCreate +inventoryCreateDelete +inventoryCreatePermission +inventoryDeleteLine +inventoryDeletePermission +inventoryDraft +inventoryEdit +inventoryErrorQtyAdd +inventoryListEmpty +inventoryListTitle +inventoryMvtStock +inventoryOfWarehouse +inventoryOnDate +inventoryReadPermission +inventorySelectWarehouse +inventorySetup +inventoryTitle +inventoryValidate +inventoryValidatePermission +inventoryWarningProductAlreadyExists +inventoryWritePermission +invoiceindex +kg +kilogram +l +liter +lm +logBILL_DELETE +logBILL_PAYED +logBILL_SENTBYMAIL +logBILL_UNPAYED +logBILL_VALIDATE +logCASHCONTROL_VALIDATE +logDOC_DOWNLOAD +logDOC_PREVIEW +logDONATION_PAYMENT_CREATE +logDONATION_PAYMENT_DELETE +logDON_DELETE +logDON_MODIFY +logDON_VALIDATE +logMEMBER_SUBSCRIPTION_CREATE +logMEMBER_SUBSCRIPTION_DELETE +logMEMBER_SUBSCRIPTION_MODIFY +logMODULE_RESET +logMODULE_SET +logPAYMENT_ADD_TO_BANK +logPAYMENT_CUSTOMER_CREATE +logPAYMENT_CUSTOMER_DELETE +logPAYMENT_VARIOUS_CREATE +logPAYMENT_VARIOUS_DELETE +logPAYMENT_VARIOUS_MODIFY +loginPassword +m +m2 +m3 +mailingindex +margin +meter +modify +mrpindex +newLT1Payment +newLT1PaymentES +newLT2Payment +newLT2PaymentES +nolimitbyEX_DAY +nolimitbyEX_EXP +nolimitbyEX_MON +nolimitbyEX_YEA +notiftofixedemail +notiftouser +notiftouserandtofixedemail +oauthService +oauthToken +opensurveyindex +ordersindex +orderssuppliersindex +p +printPlannedWarehouse +productindex +projectsindex +proposalindex +rate +receptionindex +recruitment +s +se +second +sendingindex +set +specialexpensesindex +stockindex +supplier_proposalDESC +suppliersproposalsindex +with + +# Seem to be global settings +AI_CONFIGURATIONS_PROMPT +WEBPORTAL_BANNER_BACKGROUND +WEBPORTAL_BANNER_BACKGROUND_IS_DARK +WEBPORTAL_INVOICE_LIST_ACCESS +WEBPORTAL_LOGIN_BACKGROUND +WEBPORTAL_LOGIN_LOGO_URL +WEBPORTAL_MEMBER_CARD_ACCESS +WEBPORTAL_MENU_LOGO_URL +WEBPORTAL_ORDER_LIST_ACCESS +WEBPORTAL_PARTNERSHIP_CARD_ACCESS +WEBPORTAL_PRIMARY_COLOR +WEBPORTAL_PROPAL_LIST_ACCESS +WEBPORTAL_TITLE +WEBPORTAL_USER_LOGGED + + +# +# The following exceptions are added to have Continuous Integrations pass. +# They may not be valid exceptions - this list needs to be cleaned +# +ANONYMISER_AT +AiCustomPrompt +DATAPOLICYSUBSITUTION +DATAPOLICY_PORTABILITE_CONFIRMATION +DATAPOLICY_PORTABILITE_TITLE +DisplayGrandTotalInList +EditWithEditor +ElementId +ElementType +ErrorABatchShouldNotContainsSpaces +ImageGeneration +ModelTemplate +ModuleWebPortalDesc +ModuleWebPortalName +Reports +SendEmailsRemindersOnSupplierInvoiceDueDate +TXTLINKDATAPOLICYACCEPT +TXTLINKDATAPOLICYREFUSE +Transparency +WEBPORTAL_MENU_LOGO_URLTooltip +WEBPORTAL_SECONDARY_COLOR +WebPortalDescription +WebPortalInvoiceListNothing +WebPortalOrderListNothing +WebPortalPropalListNothing +WebPortalSetup +WebPortalSetupPage +XSubsriptionErrors +YouCanChooseAModelForYouMailContent +YouCanMakeSomeInstructionForEmail diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst new file mode 100644 index 00000000000..21b8f270427 --- /dev/null +++ b/dev/translation/ignore_translation_keys.lst @@ -0,0 +1,1173 @@ +# File with translation keys that are ignored for +# reporting issues (where used). +# Two parts (ignored by the tools): +# - First part: +# Keys that are in the translation files, and commented +# in the code - so potentially useful in the future. +# - Second part: +# Keys that are used in the code and missing in translation +# files. These should be fixed but are ignored for now +# so that continuous integration does not complain about it +# in order to detect newly introduced issues with the keys. +# +# ██████╗ █████╗ ██████╗ ████████╗ ██╗ +# ██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝███║ +# ██████╔╝███████║██████╔╝ ██║ ╚██║ +# ██╔═══╝ ██╔══██║██╔══██╗ ██║ ██║ +# ██║ ██║ ██║██║ ██║ ██║ ██║ +# ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ +# Keys that are in the translation files, and commented +# in the code - so potentially useful in the future. +ActivateModule +AddDispatchBatchLine +AddNewNotification +AssignUser +BankAccountsAndGateways +Binding +ChartGenerated +CloneMainAttributes +CloseRefusedBecauseOneServiceActive +CollapseBatchDetailHelp +CustomersOrdersRunning +DelayToRequestCP +DescFinanceJournal +DetailLevel +DiscountNone +ErrorFieldAccountNotDefinedForInvoiceLine +EveryDay +FieldsTitle +FileIntegrityIsOkButFilesWereAdded +FirstUseDate +FollowingLinksArePublic +HelpWithAI +HidePassword +IPP_Device +InstallChoiceRecommanded +IsInPackage +MailNoChangePossible +ModuleBuilderDesc2 +ModulesMarketPlaceDesc +MoveField +MyContacts +NbOfActiveNotifications +NbOfTargetedContacts +PreviewMailing +Processing +PropalStatusClosedShort +PublicAttendeeSubscriptionPage +ResetBarcodeForAllRecords +ResourcesLinkedToElement +SetupDescription5 +ShowSending +SomethingMakeInstallFromWebNotPossible2 +StatusMotif0 +StatusOrderProcessed +SuppliersOrdersRunning +TasksOnOpenedProject +ThirdPartyCustomersWithIdProf12 +TicketPublicInfoCreateTicket +TitreRequestCP +UseAsciiDocFormat +ViewPageInNewTab +YourTicketSuccessfullySaved +# +# ██████╗ █████╗ ██████╗ ████████╗██████╗ +# ██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝╚════██╗ +# ██████╔╝███████║██████╔╝ ██║ █████╔╝ +# ██╔═══╝ ██╔══██║██╔══██╗ ██║ ██╔═══╝ +# ██║ ██║ ██║██║ ██║ ██║ ███████╗ +# ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ +# Keys that are used in the code and missing in translation +# files. These should be fixed but are ignored for now +# so that continuous integration does not complain about it +# in order to detect newly introduced issues with the keys. +# +........ +AADE_WEBSERVICE_KEY +AADE_WEBSERVICE_USER +APCCacheInstalledButDisabled +APCInstalled +API +Accept +AccountancyErrorMismatchLetteringCode +AccountingAccount +AccountingCode +AccountingJournalType +ActionAC_ +ActionAC_ALL_ +AddSite +AddSupplier +AddTicketIntoCategory +Adherent +AdherentNotLinkedToThirdParty +AdvTgtUse +Agents +AllEntities +AllFilesDidAlreadyExist +AlreadyInV7 +AmountOfOrders +AmountOfOrdersHT +AmountOfProposals +AmountOfProposalsHT +AmountOfReceptions +AmountOfReceptionsByMonthHT +AmountOfShipments +AmountOfShipmentsByMonthHT +AmountOfTickets +AmountOfTicketsByMonthHT +AmountOfinterventions +AmountOfinterventionsByMonthHT +AnObjectWithThisClassNameAlreadyExists +Anciennete +AnnualByAccountDueDebtMode +AnnualByAccountInputOutputMode +Anonymous +AnotherField +Applications +Articles +AssetErrorFetchMaxDepreciationDateForMode +AssetInAccountNotDefined +AuthorityDidntReconizeFingerprintConformity +AuthorityReconizeFingerprintConformity +Auto +AutoGenerateDoc +AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation +Automatic +AvailabilityType +BAN +BI +BOMs +Back +Bad value for email, email lwas not verified by Google +Bad value for returned userinfo[aud] +Bad value for returned userinfo[exp]. Token expired. +Bad value for returned userinfo[iss] +BadNumberOfLinesMustHaveAtLeastOneLinePlusTitle +BadParameterWhenCallingCreateOfBlockedLog +BadPaymentMethod +BadStatusOfObject +BadValueForParameterClientOrSupplier +BankColorizeMovementName +Banque +Barcode +BarcodeDesc +BarcodeStickersMask +BatchInformationNotfound +BillOfMaterialsLine +BlockLogNeedAmountsValue +BlockLogNeedElement +BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote +BlockedLogAuthorityUrl +BlockedLogSetup +BookCalArea +BookCalSystem +Bookings +BoxTitleLast +BoxTitleLatest +BoxTitleLatestModifiedMyObjects +ByDefault +Bzip2 +CLI +CSS +Cache +CalcModeLT +CalculatedFromProductsToConsume +CancelReception +Candidatures +CantBeNullOrPositive +CantConvertToReducAnInvoiceOfThisType +CardFichinter +CardProduct +CashDeskBankAccountForStripeTerminal +Channel +Charset +Cheque +ChequeBankUpdateSucceeded +ChequeMakeUpdateSucceeded +Child of +ClassNotFound +Clear +ClickToDial +Clients +Clone +CloneAffectation +CloneChanges +CloneFile +CloneProgression +CloneTimes +Close Done +Close2 +CloseShipment +CodeTooltipHelp +Column +Combination +CompanyPaymentMode +ComptaFiles +ConferenceOrBoothAttendeeExtraFields +Confirm Delete Dictionnary +Confirm Delete Menu +Confirm Delete Right +ConfirmActionAvailabilities +ConfirmActionMyObject +ConfirmActionTarget +ConfirmCloneMyObject +ConfirmCloneTask +ConfirmCloseShipment +ConfirmCreateAdherent +ConfirmDeleteAdherent +ConfirmDeleteIndividual +ConfirmDeleteReport +ConfirmDeleteWebsiteAccount +ConfirmReoponAsk +ConnectingToStripeTerminal +Constant +ContactAddress +ContactDefault_ +ContactSuperAdminForChange +ContactUs +Container +Contrats +Control +Convert +Core +Count +CreateFichInter +CreateRemoteOrder +CreateRepeatableIntervention +Created +CronCannotLoadLib +Crypted +Current +CustomX +CustomY +DATAPOLICYReturn +DateInvalid +DatePaymentForDepositReceived +Datee +Dateo +Dates +Datet +DecimalSeparator +Declared +Decline +DefaultCashPOSLabel +Delays_ +DeleteAdherent +DeleteAnIndividual +DeleteAsset +DeleteAssetModel +DeleteAvailabilities +DeleteCalendar +DeleteConferenceOrBooth +DeleteEvaluation +DeleteInventory +DeleteJob +DeleteKnowledgeRecord +DeleteLoan +DeleteMyObject +DeleteOldFiles +DeletePosition +DeleteReception +DeleteRecruitmentCandidature +DeleteRecruitmentJobPosition +DeleteReport +DeleteTarget +DeleteWebsiteAccount +DemandReasonType +Demo +Desc +Detail +Details +Development +Dictionaries +DictionaryEmpty +DictionaryNameUpdated +Directory +DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND +Document +Documentation +Dolibarr +Dolibarr constant MAIN_SERVER_TZ +DolibarrPassword +Down +DraftMyObjects +DragDrop +DuplicateRecord +DynamicPrice +ECMAreaDesc2 +ECMDocsByProducts +ECMSectionAutoDesc +ECMSectionManualDesc +EMail +EMails +EcmFiles +EditAdherent +EditAdherentAddress +EditRelativeDiscounts +EmailcollectorAction +EmailcollectorFilter +EmailingTargetSelector +Empty +End +EnterAnIP +EnterNameOfDictionnaryToDeleteDesc +EntityNameNotDefined +Entries +ErrSCAAuthentication +Error sql +ErrorADiscountThatHasBeenRemovedIsIncluded +ErrorAccountancyCodeOnBankAccountNotDefined +ErrorAccountancyCodeOnThirdPartyNotDefined +ErrorBackToDraft +ErrorBadEmail +ErrorBadInvoice +ErrorBadParameterCat +ErrorBadParameterQty +ErrorBadPhone +ErrorBadSocialNetworkValue +ErrorBadStatus +ErrorBadValue +ErrorBadValueForBatch +ErrorBadValueForDate +ErrorCanNotDeleteDir +ErrorCantSplitAUsedDiscount +ErrorChartOfAccountSystemNotSelected +ErrorCheckVersionIsDefined +ErrorCreateUserSkill +ErrorDB +ErrorDateEndLowerThanDateStart +ErrorDoNotProvideAccountsIfNullAmount +ErrorDuplicateEmalingSelector +ErrorDuplicateWidget +ErrorEmailInvalid +ErrorEmptyNameDic +ErrorFailToCreateZip +ErrorFailToOpenFile +ErrorFaildToOpenFile +ErrorFailedToAddUserAsContact +ErrorFailedToConnect +ErrorFailedToCopyProposal +ErrorFailedToDeleteFile +ErrorFailedToFindSomeFiles +ErrorFailedToGetListOfNotificationsToSend +ErrorFailedToLoadBankAccount +ErrorFailedToLoadDiscount +ErrorFailedToSetNewPassword +ErrorFaviconMustBeASquaredImage +ErrorFileNameInvalid +ErrorImportOfChartLimitedToCurrentChart +ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT +ErrorMailFromRequired +ErrorNegativeValueNotAllowed +ErrorNoAccountingModuleEnabled +ErrorNoPhoneDefinedForThisUser +ErrorNoUrl +ErrorNoValueForLinkType +ErrorNoValueForSelectListType +ErrorNumberingModuleNotSetup +ErrorObjectMustHaveStatusClosedToBeReOpened +ErrorObjectMustHaveStatusValidToBeCanceled +ErrorObjectNoSupportedByFunction +ErrorOccurredReviseAndRetry +ErrorOnlyOrderNotDraftCanBeSentInMassAction +ErrorOnlyProposalNotDraftCanBeSentInMassAction +ErrorParamMustBeAnUrl +ErrorPriceExpression +ErrorProductIdIsMandatory +ErrorSetupOfCountryMustBeDone +ErrorSomeFilesCouldNotBeDeleted +ErrorStripeAccountNotDefined +ErrorTechnicalError +ErrorThirdPartyIdIsMandatory +ErrorTicketIsNotValid +ErrorTitreAlreadyExists +ErrorUpdatingUsersCP +ErrorUserFetch +ErrorValueMustBeInteger +ErrorValueTooHigh +ErrorVerif +ErrorWarehouseRequiredIntoReceptionLine +ErrorWebServicesFieldsRequired +Error_BOM_ADDON_NotDefined +Error_COMPANY_ADDON_PDF_NotDefined +Error_FICHEINTER_ADDON_NotDefined +Error_HOLIDAY_ADDON_NotDefined +Error_MRP_MO_ADDON_NotDefined +Error_RECEPTION_ADDON_NUMBER_NotDefined +ErrorloadUserOnSendingMail +EstimatedWeight +Evaluation +Evaluationdet +Evaluations +EventFee +EventIntoASerie +EventOrganizationArea +EventParticipant +ExampleOnlyForATBEDEITNLESCustomers +ExampleOnlyForBECustomers +ExampleOnlyForDECustomers +ExampleOnlyForKlarnaCustomers +ExampleOnlyForNLCustomers +Expedition +Experimental +Expired +Extension +ExtraLanguageHasWrongValue +Extrafieldcomputed +FRST +FTP +Failed +FailedToCloseProject +FailedToDefinGraph +FailedToExecutCommandJob +FailedToGetCostPrice +FailedToOpenFile +FailedToReadFile +FailedToSetPaid +FailedToSetToCancel +FailedToUncompressFile +FailedToUpdatePrice +FailedtoSetToApprove +FailedtoSetToDeny +FeatureNotAvailableWithThisDatabaseDriver +FieldNotFoundInObject +FieldsEdit +FieldsInsert +FieldsLinked +FieldsView +File encoding +FileDidAlreadyExist +FileIsNotCorrect +Filename +FilteredFrom +FiscalYear +Flashy +ForceEmailFrom +ForcedByGlobalSetup +Form for public lead registration has not been enabled +Free +FreeLegalTextOnReceptions +FrequencyPer_ +FromPublicEmail +Function_getNextValue_InModuleNotWorking +Gantt +GeneratePDF +GeoIPLibVersion +Get +GetCompanyParentsError +GlobalGroup +GlobalVariableUpdaterHelp +GlobalVariableUpdaterHelpFormat +GlobalVariableUpdaterType +GoOnTokenProviderToDeleteToken +GoSourceInvoice +Gzip +H +HTTPBasicPassword +HelpAbandonProductReturned +HideVersionLink +HolidayStarted +Hook +Hooks +IBANNotDefined +ID +IPP_COLOR_ +IconFieldSelector +Id +Image +ImpossibleToRetrieveUser +ImpossibleUpdateCat +Inactive +Inf +IntracommReport +IntracommReportDeleted +Introduction +JS +Job +JobPositionApplications +JournalNum +KO +Key +Keywords +LDAP +LDAP setup for groups not defined inside Dolibarr +LDAP setup for members not defined inside Dolibarr +LDAP setup for members types not defined inside Dolibarr +LDAP setup for users not defined inside Dolibarr +LT +LabelName +LabelPaperSize +Language_ +Languages +LdapUacf_ +Level +Lifetime +LinkedElementsInvalidDeleted +LinkedToAConcialitedTransaction +ListOfAttendeesPerConference +ListOfBookmark +ListTicketsLinkToContract +Load +LocalTaxReport +Locale +Lot +MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING +MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET +MEDIA_IPP_ +MO +MRP +MYDATA_AADE_KEY +MYDATA_AADE_USER +Mailman +MainAccountForRevenueStampSaleNotDefined +Manual +Map +Max +MaxRunReached +Maximum +Measuringtype_durationDesc +MemberAllowchangeOfType +MemberTypeCard +MembersListOfTiers +MenuAddedSuccesfuly +Message +MigrationBankTransfertsToUpdate +MigrationContractsEmptyCreationDatesUpdateSuccess +Millisecond +Minimum +Mo +Mode +Modifier +Module/Application +ModuleCompanyCode +ModuleCompanyCodeCustomer +ModuleCompanyCodeSupplier +ModuleNotEnabled +ModuleTriggeringThisWarning +Modulebuilder +ModulebuilderSetup +MonthShort +MonthVeryShort +Morphy +Movement +MultiCompanyMode +Multicompanies +MulticurrencyPaidBack +MulticurrencyRemainderToPayBack +MustBeAdminToDeleteOtherAdmin +MyFilter +MyModule +MyModuleArea +MyModuleBoxDescription +MyModuleMassAction +MyModuleSetup +MyModuleSetupPage +MyModuleTab +MyObject +MyObjects +NA +NPR +NPR counterpart +Name of the new third party. In the meantime we check if it already exists... +Nb +NbOfDonations +NbOfIntervention +NbOfOrder +NbOfSendingsByMonth +NbOfTicket +NeedRefresh +NetMeasure +Network +NewAdherent +NewAdherentAddress +NewDeposit +NewEMailTemplate +NewLead +NewPartnershipForm +NewProperty +NoActiveEstablishmentDefined +NoAddMember +NoAuthorityURLDefined +NoBankAccountFound +NoCurrencyRateSelected +NoEntriesToShow +NoEstablishmentFound +NoMail +NoModuleFound +NoOperations +NoPasswordGenerationRuleConfigured +NoReader +NoRecordedUnpaidInvoices +NoRecordfound +NoRecords +NoRecordsToDisplay +NoSenderEmailDefined +NoShippingMethodDefined +NoStripe +NoSurvey +NoTitle +NoType +NoTypeOfPagePleaseEditDictionary +NoURL +No_record_on_multicurrency_rate +NobodyHasPermissionToValidateExpenseReport +NotARecurringInterventionalTemplate +NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated +NotEnoughForAllOrders +NotFound +NotUsed +NotUserRightToView +Note: The function password_hash does not exist on your PHP +Note: The function password_hash exists on your PHP +Notification +Notify_ +Num +NumberOfCopy +NumberOfDonationsByMonth +NumberOfOrders +NumberOfProposals +Numeric +OK +Object +Objects +Offline +Ok +Omit sub-projects +Online +OnlineSignature +OnlyAdminUsersCanDisableAdminUsers +OnlyTerminal1IsAvailableForCashDeskModule +OpenSurvey +Operation +Operations +OppStatus +OrderSource +PARTNERSHIP_NEWFORM_PAYONLINE +PAYBOX_CGI_URL_V1 +PAYBOX_IBS_DEVISE +PAYPAL_API_EXPRESS +PDFStandardHrmEvaluation +PHP +PHP_OS +POS +PaperFormat +Parent +PasswordEncryption +PasswordLength +Path +PayBox +PayLoan +PayPal +Payement +PaymentBeingProcessed +PaymentCondition +PaymentConditionShort +PaymentDonation +PaymentHigherThanReminderToPaySupplier +PaymentSalary +PaymentSendToStripeTerminal +PaymentType +PaymentTypeShort +PaymentValidated +Paypal +Pending +PendingCreditTransferToComplete +PendingCreditTransferToCompleteShort +PendingDirectDebitToComplete +PendingDirectDebitToCompleteShort +PermissionAdvanced +Picto +PlanStripe +Poll +Posts +PredefinedInterventional +PrevRangeToThisRange +PreviousFingerprint +Print +PrintDriver +PrintModule +PrintUserConfDesc +PrinterId +PrinterIdEmpty +PrinterLocation +PrinterNameEmpty +PrinterParameterEmpty +Printers +Printing +ProductCodeDesc +ProductFournisseurPrice +ProductLot +ProductNotDefined +ProductReturned +Production +ProfId +Profile +Programs +Progression +ProjectNbProject +ProjectNbTask +Property %s not found in the class. The class was probably not generated by modulebuilder. +Proposer +Provider +Proxy +Pwd +QR +Question +RECUR +RSS +RateIndirect +Re-Open +Rechercher +ReconciledBy +RecordNotFound +RecruitmentJobPosition +Recurrence +RefAlreadyExists +Referer +Refuse +RegistrationAndPaymentWereAlreadyRecorded +Reinit +Rejection +RemoteOrderRef +RemotePriceMismatch +RemoteUserBadCredentials +RemoteUserMissingAssociatedSoc +RemoteUserNotPermission +RemoveDuplicates +Repair +Replace +Replaced +Reply +Request +RequireValidPhone +RequireValue +RequiredIfProduct +RequiredIfService +Resource +ResourceTypeShort +ResponseNonOK +Results +Retry +Reverse +RobotEmail +Roles +Rowid +RulesPurchaseTurnoverCollectedOfExpenseAccounts +SID +SOAPError +SPIP +SQL +SQLSort +STATE_ +STATE_IPP_ +STRIPE_APPLICATION_FEE_PLATFORM +STRIPE_BANCONTACT +STRIPE_GIROPAY +STRIPE_IDEAL +STRIPE_KLARNA +STRIPE_SOFORT +ST_ +SaveFailed +Saved +Script +SeeWikiPage +ServiceCodeDesc +Session +SetContract +SetModel +SetReceptionMethod +SetRefExt +SetRefusedAndClose +SetSendingMethod +SetTransDate +SetVATReverseCharge +SetWarehouse +Setting +SetupNotComplete +SetupNotError +SeveralEvents +ShipmentIncrementStockOnDelete +Shipping +ShowAsset +ShowAssetModel +ShowAvailabilities +ShowBill +ShowBillOfMaterials +ShowBillOfMaterialsLine +ShowCalendar +ShowCompanyPaymentMode +ShowConferenceOrBooth +ShowConferenceOrBoothAttendee +ShowCronJob +ShowEmailCollector +ShowEmailcollectorAction +ShowEmailcollectorFilter +ShowEvaluation +ShowEvaluationdet +ShowFichinter +ShowInterventionModel +ShowInventory +ShowJob +ShowKnowledgeRecord +ShowMo +ShowMyObject +ShowPartnership +ShowPayment +ShowPosition +ShowProductAttribute +ShowProductFournisseurPrice +ShowProductOrService +ShowProposal +ShowRecruitmentCandidature +ShowRecruitmentJobPosition +ShowSearchFields +ShowSkill +ShowSkillRank +ShowSkilldet +ShowStockTransfer +ShowStockTransferLine +ShowTarget +ShowTimeSpent +ShowWorkstation +Showing +SignatureKO +SignatureOK +Siren +Situation +SizeUnit +SkillCreated +SkillRank +SmsTestSubstitutionReplacedByGenericValues +SomeShipmentExists +SourceType +Split +SplitAllQuantity +Standard +StatsOnDonationsOnlyValidated +StatusProspect +Stock Total +Stock total +StockTransferLine +Stripe +StripeAutoSubscription +StripeBalance +StripeConnect +StripeConnectPay +StripeCustomer +Sub-projects +SubscriptionStripe +Success +Sumup +SumupAffiliate +SumupAppId +Supervisor +SupplierDepositsAreNotIncluded +SupplierMissingRef +Synchronize +Syslog +TLS/STARTTLS +TLSv1 +TLSv1.2 +TYPE_ +Tabs +Tag +TakePOS +TargetType +Targets +TasksToDo +Taxes +Template +TemplateIdEmpty +TemplateNameEmpty +Templates +TestPrinterTemplate +TestTemplateToPrinter +Theme +Thirdparty +ThirdpartyHasNoDefaultBanAccount +ThisIsInformationOnDocumentToSign +ThisScreenAllowsYouToSignDocFrom +TicketCategoryShort +TicketMessageMailNewText +TicketSeverityShort +TicketTypeShort +TimeOnly +Timezone +ToGetBack +ToPay +ToReopon +Token +Tooltip +TooltipEditAndRevertStockMovement +TotalEntries +Transaction +TranslationOfKey +Triggers +Trip +TripForPaid +TripForValid +TripPaid +TurnoverReport +TypeContact_ +TypeToFilter +UTF8 +Unix +UnknownError +Unlink +Up +UpdateContact +UpdateGroup +UpdateMemberType +UpdateUser +UpgradeHasBeenUnlocked +Url +Use of API for currency update is disabled by option MULTICURRENCY_DISABLE_SYNC_CURRENCYLAYER +UserRemovedFromGroup +UserSetInGroup +VCard +Vacant +ValidateAndSign +ValidationDateNotDefinedEvenIfReceptionValidated +ValueFromBom +Variable +Variant +Vote +WTOf +WaitAccountNotDefined +Warning: you will delete all menus linked to this one. +WarningFieldsMustContains +WarningPostActionErrorAfterPayment +WarningUserDifferentContactSocid +WebDAV +WebServiceKey +WebServiceURL +Website +WebsiteMustBeSameThanClonedPageIfTranslation +Weighted +WelcomeOnOnlineSignaturePage +WidgetDisabledAsModuleDisabled +Widgets +Windows +WorkingBoard +Workload +WrongAmount +XDebug +XXX +XmlCorrupted +Y +ZeroMeansEveryYear +Zstd +_blank +accountancy_error_modelnotfound +bytes +card +card3DS +checkMargins +copy_of_ +csv +customer +desc +diff_after_tomorrow +diff_before_yesterday +diff_now +diff_tomorrow +diff_yesterday +errorUpdateSkilldet +errors +iDEAL +log +minimum +multicurrency_code_already_added +noExtrafields +period_end_date +period_interval +period_recurrences +period_start_date +point +productlot +refunded +save +seconds +sepadebit +showInputBorder +skill +supplier +test01 +test02 +test03 +test04 +test05 +test06 +title1 +title2 +title3 +txt +unit +words +xcache.cacher +xcache.coverager +xcache.optimizer +xcache.stat +xxx + + +# Confirmed, will be used in the future +# (When used, remove from this list) + +AudioText +MenuResourceAdd +SendShippingRef +TextGeneration +VideoGeneration + +##################################################################### +##################################################################### +## The following list is added only to make Continuous Integration +## pass - this list needs to be cleaned up +##################################################################### +##################################################################### +AddService +AnHelpMessage +Analytic +AnalyticLabel +BankId +Bcc +Birthdate +Candidature +ClientCollation +Collation +Config +Confirmed +Creation +CronLib +CronModuleNotEnabledInThisEntity +DateInitialBalance +Dimension +Don +ECM +EmptyMessageNotAllowedError +ErrorBarcodeNotFoundForProductWarehouse +ErrorCodeScannedIsBothProductAndSerial +ErrorInputRequired +ErrorLDAPFunctionsAreDisabledOnThisPHP +ErrorUpdating +Exceptions +Extra +Facture +FailedToConnectToSFTPAfterSSHAuthentication +FailedToLogin +First +GroupCreate +GroupUpdate +INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION +INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION +INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID +INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT +INVOICE_USE_RETAINED_WARRANTY +INVOICE_USE_SITUATION +INVOICE_USE_SITUATION_CREDIT_NOTE +ImpossibleToContactAuthority +InputValueIsNotAnNumber +InterDate +Inventory Code +InvoiceReplace +ItemID +JobApplications +JobPosition +Journal +Label Movement +Labels +Last +LedgerAccount +LocalTax1IsNotUsedExample +LocalTax1IsUsedExample +LocalTax2IsNotUsedExample +LocalTax2IsUsedExample +Logs +MAIN_IMAP_USE_PHPIMAPDesc +MYMODULE_CATEGORY_ID_XXX +MYMODULE_MYPARAM1 +MYMODULE_MYPARAM10 +MYMODULE_MYPARAM2 +MYMODULE_MYPARAM3 +MYMODULE_MYPARAM4 +MYMODULE_MYPARAM5 +MYMODULE_MYPARAM6 +MYMODULE_MYPARAM7 +MYMODULE_MYPARAM8 +MYMODULE_MYPARAM9 +ManufacturingOrders +MemberCreate +MemberTypeCreate +MemberTypeUpdate +Messages +MoDate +MultiCompany +MyWidget +NO_PARAM_JUST_TEXT +NewSection +NoPreviousBillForCustomer +Normal +NotSelected +Null +Obsolete +Off +On +Open +PDF 1.7 +PDF/A-1b +PDF/A-3b +PartnershipSentByEMail +PdfTitle +Privileges +ProcessingError +PurchaseOrder +PurchaseOrders +ReceptionSentByEMail +ReceptionValidated +Recruited +Ref. Product +RefNewContract +Societe +Stable +Suggested +TaskModifieddInDolibarr +TicketMessageMailSignatureText +TicketSetupPage +Tiers +Timeline +TotalDiscount +TotalHTBeforeDiscount +Transfer +TryAnotherConnectionMode +UndefinedKey +UnknownType +UpdateMember +UserCreate +UserDiscarded +UserUpdate +Variables +Vat +VirtualHost +WEBPORTAL_ROOT_URL +WEBPORTAL_USER_LOGGED2 +XSubsriptionError +centimes +email +id +leftmenu +message +multicurrency_buyPriceInCurrency +multicurrency_modifyRateApplication +ref +sendEmailsReminder +smsing +societe +target +titre +type +url +Civility +IntracommReportList +PrintTestDesc +PrintingDriverDesc diff --git a/dev/translation/sanity_check_trans_missing_unused.sh b/dev/translation/sanity_check_trans_missing_unused.sh new file mode 100755 index 00000000000..459f59117a5 --- /dev/null +++ b/dev/translation/sanity_check_trans_missing_unused.sh @@ -0,0 +1,212 @@ +#!/bin/bash +# +# Find unused translations pretty fast... +# +# Principle: +# +# 1.Generate two files: +# - one for available translations keys, +# - one for expected keys. +# 2. Make the difference between the files. +# +# Find expected translation keys: +# 1. Find all occurrences that look like `->trans("` or `->trans('` +# with fast grep. +# 2. Split result to have only one '->trans(' on each line +# 3. Filter the text between the single or double quotes. +# +# Find available translation keys: +# 1. Get all strings before '=' token in the language files +# +# Notes: +# - Some side effects from translations on variables. +# - Some other minors side effects to be examined (#, %). +# +# Copyright (C) 2024 MDW + +LANG_DIR=htdocs/langs/en_US/ +MYDIR=$(dirname "$(realpath "$0")") +TMP=${TMP:=/tmp} # Most of the time defined on the system. +EXPECTED_FILE=${TMP}/expected_translations +AVAILABLE_FILE_NODEDUP=${TMP}/available_translations_no_dedup +AVAILABLE_FILE=${TMP}/available_translations +DUPLICATE_KEYS_FILE=${TMP}/duplicate_keys +DYNAMIC_KEYS_FILE=${TMP}/dynamic_keys +MISSING_AND_UNUSED_FILE=${TMP}/missing_and_unused +MISSING_FILE=${TMP}/missing +UNUSED_FILE=${TMP}/unused +EXPECTED_REGEX='(Country..|Language_.._..|MonthVeryShort\d\d|PaperFormat.*|ProfId\d(..)?|unit.*)' +DYNAMIC_KEYS_SRC_FILE=${MYDIR}/dynamic_translation_keys.lst +EXCLUDE_KEYS_SRC_FILE=${MYDIR}/ignore_translation_keys.lst +DUPLICATE_KEYS_SRC_FILE=${MYDIR}/duplicate_translation_keys.lst + +# Grep options that are reused (normal grep) +GREP_OPTS="" +GREP_OPTS="${GREP_OPTS} --exclude=htdocs/theme/common/fontawe*/" +GREP_OPTS="${GREP_OPTS} --exclude-dir=.cache --exclude-dir=.git" +GREP_OPTS="${GREP_OPTS} --exclude=*.phar --exclude=*.webp --exclude=*.z" +GREP_OPTS="${GREP_OPTS} --exclude=*.sw? --exclude=*.json" + +# Note: using 'git grep' to restrict to version controlled files +# and more flexible globbing. + +# TODO/to ignore: +# transnoentities(), transnoentitiesnoconv(), +# formSetup->newItem() + +exit_code=0 + +# Find all translations keys available in the language files (for the language) +grep --no-filename -r -oP -- '^([^#=]+?)(?=\s*=.*)' "${LANG_DIR}" \ + | grep -x -v -F -f "${EXCLUDE_KEYS_SRC_FILE}" \ + | sort > "${AVAILABLE_FILE_NODEDUP}" +sort -u \ + < "${AVAILABLE_FILE_NODEDUP}" \ + > "${AVAILABLE_FILE}" + + +# Combine strings found in sources with pre-determined dynamic string values. + +## Build some regex strings to match translations +# +EXTRACT_STR="" +JOIN_STR="" +for t in '->trans' '->transnoentities' '->transnoentitiesnoconv' 'formSetup->newItem' ; do + MATCH_STR="$MATCH_STR$JOIN_STR$t" + EXTRACT_STR="$EXTRACT_STR$JOIN_STR(?<=${t}\\([\"'])([^\"']+)(?=[\"']\$)" + JOIN_STR="|" +done + +{ + # Find static strings that are translated in the sources (comments stripped) + # shellcheck disable=2086 + # With std grep: `grep --no-filename -r ${GREP_OPTS} -- '->trans(' . ` + # Using git grep avoiding to look into unversioned files + # transnoentitiesnoconv + git grep -h -r -P -- "${MATCH_STR}\\(" ':*.php' ':*.html' \ + | sed 's@\(^#\|[^:]//\|/\*\|^\s*\*\).*@@' \ + | sed 's@)\|\(['"'"'"]\)\(,\)@\1\n@g' \ + | grep -aPo "$EXTRACT_STR(?=.$)" + + # "Append" the list of strings that are used in dynamic expressions. + # (Fixed list: needs to be updated if the dynamic strings evolve.) + cat "${DYNAMIC_KEYS_SRC_FILE}" +} \ + | grep -x -v -F -f "${EXCLUDE_KEYS_SRC_FILE}" \ + | sort -u \ + | grep -v -P '^(#|$)' \ + > "${EXPECTED_FILE}" + + +# shellcheck disable=2050 +if [ 0 = 1 ] ; then + # Find dynamic keys for call to trans. + # shellcheck disable=2086 + grep --no-filename ${GREP_OPTS} -r -- '->trans(' . \ + | tr ')' '\n' \ + | grep -- '->trans(' \ + | grep -v -P '(?<=->trans\(["'"'"'])([^"'"'"']*)(?=["'"'"'])' \ + | grep -Po '(?<=->trans\()(.*)' \ + | sort -u \ + > "${DYNAMIC_KEYS_FILE}" +fi + + +# Produce reports on STDOUT. +# Some output is already compatible with message extraction for github annotation (logToCs.py) +# # Produce reports on STDOUT. +# Some output is already compatible with message extraction for github annotation (logToCs.py) +# +diff "${AVAILABLE_FILE}" "${EXPECTED_FILE}" \ + | grep -E "^[<>]" \ + | grep -v -P "^< ${EXPECTED_REGEX}$" \ + | sort \ + > "${MISSING_AND_UNUSED_FILE}" + +if [ -s "${MISSING_AND_UNUSED_FILE}" ] ; then + echo "##[group]List Apparently Unused Translations (<) and Missing Translations (>)" + echo + echo "## :warning: Unused Translations may match ->trans(\$key.'SomeString')." + echo "## You can add such dynamic keys to $(basename "$DYNAMIC_KEYS_SRC_FILE")" + echo "## so that they are ignored for this report." + echo "## :warning: Unused Translations may be commented in the code" + echo "## You can add such 'disabled' keys to $(basename "$EXCLUDE_KEYS_SRC_FILE")" + echo "## so that they are ignored for this report." + echo + cat "${MISSING_AND_UNUSED_FILE}" + echo "##[endgroup]" + echo +fi + +sed -n 's@< \(.*\)@^\1\\s*=@p' \ + < "${MISSING_AND_UNUSED_FILE}" \ + > "${UNUSED_FILE}.grep" + +# Too many results, git grep is slow +#sed -n 's@> \(.*\)@trans.["'"'"']\1["'"'"'].@p' \ +# < "${MISSING_AND_UNUSED_FILE}" \ +# > "${MISSING_FILE}.grep" +# + +# Prepare file with exact matches for use with `git grep`, supposing " quotes +# +REPL_STR="" +for t in trans transnoentities transnoentitiesnoconv ; do + REPL_STR="${REPL_STR}\n->${t}(\"\\1\"," + REPL_STR="${REPL_STR}\n->${t}('\\1'," + REPL_STR="${REPL_STR}\n->${t}(\"\\1\")" + REPL_STR="${REPL_STR}\n->${t}('\\1')" +done + +sed -n 's@> \(.*\)'"@${REPL_STR}@p" \ + < "${MISSING_AND_UNUSED_FILE}" \ + | grep -v -E '^$' \ + > "${MISSING_FILE}.grep" + + + +if [ -s "${UNUSED_FILE}.grep" ] ; then + exit_code=1 + + # Report unused translation in recognizable format + git grep -n --column -r -f "${UNUSED_FILE}.grep" -- "${LANG_DIR}"'/*.lang' \ + | sort -t: -k 4 \ + | sed 's@^\([^:]*:[^:]*:[^:]*:\)\s*@\1 Not used, translated; @' +fi + +if [ -s "${MISSING_FILE}.grep" ] ; then + exit_code=1 + + # Report missing translation in recognizable format + git grep -n --column -r -F -f "${MISSING_FILE}.grep" -- ':*.php' ':*.html' \ + | sort -t: -k 4 \ + | sed 's@^\([^:]*:[^:]*:[^:]*:\)\s*@\1 Missing translation; @' +fi + + +diff "${AVAILABLE_FILE_NODEDUP}" "${AVAILABLE_FILE}" \ + | grep -Po '(?<=^\< )(.*)$' \ + | grep -x -v -F -f "${DUPLICATE_KEYS_SRC_FILE}" \ + | sed 's/.*/^\0=/' \ + > "${DUPLICATE_KEYS_FILE}" + +if [ -s "${DUPLICATE_KEYS_FILE}" ] ; then + exit_code=1 + echo + echo "##[group]List Duplicate Keys" + echo "## :warning:" + echo "## Duplicate keys may be expected across language files." + echo "## You may want to avoid them or they could be a copy/paste mistake." + echo "## You can add add valid duplicates to $(basename "$DUPLICATE_KEYS_SRC_FILE")" + echo "## so that they are ignored for this report." + cat "${DUPLICATE_KEYS_FILE}" + echo "##[endgroup]" + echo + + git grep -n -r -f "${DUPLICATE_KEYS_FILE}" -- "${LANG_DIR}"'/*.lang' \ + | sort -t: -k 3 \ + | sed 's@^\([^:]*:[^:]*:\)\s*@\1 Is/Has duplicate @' +fi + + +exit $exit_code diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 20d561ed752..567af5d4d10 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -67,7 +67,7 @@ if (!$user->hasRight('accounting', 'chartofaccount')) { } // Load variable for pagination -$limit = GETPOSTINT('limit', $conf->liste_limit); +$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 8dcbff61b8d..59a412fa3a4 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2014 Florian Henry + * 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 @@ -241,7 +242,7 @@ if ($action == 'create') { // Account parent print ''.$langs->trans("Accountparent").''; print ''; - print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200'); + print $formaccounting->select_account($object->account_parent, 'account_parent', 1, [], 0, 0, 'minwidth200'); print ''; // Chart of accounts type diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 465f2836122..0231856071a 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -2,6 +2,7 @@ /* Copyright (C) 2016 Jamal Elbaz * Copyright (C) 2017-2024 Alexandre Spangaro * Copyright (C) 2022 Laurent Destailleur + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -164,7 +165,7 @@ if (!empty($cat_id)) { if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { print img_picto($langs->trans("AccountingAccount"), 'accounting_account', 'class="pictofixedwith"'); - print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories")); + print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), 0, 0, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories")); print ' '; } } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 18d793fc43e..37f065d1c2e 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -1,6 +1,7 @@ * Copyright (C) 2011-2024 Alexandre Spangaro + * 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 @@ -201,9 +202,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd', 'alpha')) { + $newid = 0; + if ($tabrowid[$id]) { // Get free id for insert - $newid = 0; $sql = "SELECT MAX(".$db->sanitize($tabrowid[$id]).") newid FROM ".$db->sanitize($tabname[$id]); $result = $db->query($sql); if ($result) { @@ -304,16 +306,12 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } -if (GETPOST('actioncancel', 'alpha')) { - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} +// if (GETPOST('actioncancel', 'alpha')) { +// $_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition +// } if ($action == 'confirm_delete' && $confirm == 'yes') { // delete - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $rowidcol = "rowid"; $sql = "DELETE from ".$db->sanitize($tabname[$id])." WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -330,11 +328,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes') { // delete // activate if ($action == $acts[0]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $sql = ''; + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 1 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -342,19 +337,18 @@ if ($action == $acts[0]) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 1 WHERE code = '".$db->escape($code)."'"; } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + if ($sql) { + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } // disable if ($action == $acts[1]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $sql = ''; + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 0 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -362,19 +356,18 @@ if ($action == $acts[1]) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 0 WHERE code = '".$db->escape($code)."'"; } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + if ($sql) { + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } // favorite if ($action == 'activate_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $sql = ''; + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 1 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -382,19 +375,18 @@ if ($action == 'activate_favorite') { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 1 WHERE code = '".$db->escape($code)."'"; } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + if ($sql) { + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } // disable favorite if ($action == 'disable_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $sql = ''; + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 0 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -402,9 +394,11 @@ if ($action == 'disable_favorite') { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 0 WHERE code = '".$db->escape($code)."'"; } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + if ($sql) { + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 982448cebdd..60c52103254 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -6,6 +6,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,6 +52,10 @@ $list_account_main = array( 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', ); +if (isModEnabled('expensereport')) { + $list_account_main[] = 'ACCOUNTING_ACCOUNT_EXPENSEREPORT'; +} + $list_account = array(); $list_account[] = '---Product---'; @@ -239,7 +244,7 @@ foreach ($list_account_main as $key) { // Value print ''; // Do not force class=right, or it align also the content of the select box $key_value = getDolGlobalString($key); - print $formaccounting->select_account($key_value, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accountsmain'); + print $formaccounting->select_account($key_value, $key, 1, [], 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accountsmain'); print ''; print ''; } @@ -285,7 +290,7 @@ foreach ($list_account as $key) { print ''; // Value print ''; // Do not force class=right, or it align also the content of the select box - print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts'); + print $formaccounting->select_account(getDolGlobalString($key), $key, 1, [], 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts'); print ''; print ''; } @@ -300,7 +305,7 @@ print img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans('ACCOUNTI print ''; // Value print ''; // Do not force class=right, or it align also the content of the select box -print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT', 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts'); +print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT', 1, [], 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts'); print ''; print ''; @@ -327,7 +332,7 @@ print img_picto('', 'supplier_invoice', 'class="pictofixedwidth"') . $langs->tra print ''; // Value print ''; // Do not force class=right, or it align also the content of the select box -print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts'); +print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, [], 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts'); print ''; print ''; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 70eb459efda..447dcaab4c9 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -313,23 +313,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Label print ''; - print $form->editfieldkey("Label", 'label', $object->label, $object, 1, 'alpha:32'); + print $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'alpha:32'); print ''; - print $form->editfieldval("Label", 'label', $object->label, $object, 1, 'alpha:32'); + print $form->editfieldval("Label", 'label', $object->label, $object, 0, 'alpha:32'); print ""; // Date start print ''; - print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker'); + print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, 0, 'datepicker'); print ''; - print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker'); + print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, 0, 'datepicker'); print ''; // Date end print ''; - print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker'); + print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, 0, 'datepicker'); print ''; - print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker'); + print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, 0, 'datepicker'); print ''; // Status diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 748b55ed733..a5365331a6b 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -374,7 +374,7 @@ if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO')) { } print ''; -// Param a user $user->hasRights('accounting', 'chartofaccount') can access +// Param a user $user->hasRight('accounting', 'chartofaccount') can access foreach ($list as $key) { print ''; @@ -404,7 +404,7 @@ print ''; print ''.$langs->trans('BindingOptions').''; print "\n"; -// Param a user $user->hasRights('accounting', 'chartofaccount') can access +// Param a user $user->hasRight('accounting', 'chartofaccount') can access foreach ($list_binding as $key) { print ''; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 403819c7f4d..e8630ad3aa9 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,6 +82,12 @@ $search_onpurchase = GETPOST('search_onpurchase', 'alpha'); $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha'); $btn_changetype = GETPOST('changetype', 'alpha'); +// Show/hide child product variants +$show_childproducts = 0; +if (isModEnabled('variants')) { + $show_childproducts = GETPOST('search_show_childproducts'); +} + if (empty($accounting_product_mode)) { $accounting_product_mode = 'ACCOUNTANCY_SELL'; } @@ -179,6 +186,10 @@ if ($action == 'update') { if (!empty($chk_prod) && $massaction === 'changeaccount') { //$msg = '
' . $langs->trans("Processing") . '...
'; + $ok = 0; + $ko = 0; + $msg = ''; + $sql = ''; if (!empty($chk_prod) && in_array($accounting_product_mode, $accounting_product_modes)) { $accounting = new AccountingAccount($db); @@ -186,8 +197,6 @@ if ($action == 'update') { $arrayofdifferentselectedvalues = array(); $cpt = 0; - $ok = 0; - $ko = 0; foreach ($chk_prod as $productid) { $accounting_account_id = GETPOST('codeventil_'.$productid); @@ -201,7 +210,6 @@ if ($action == 'update') { $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'
'.$sql.'
'; $ko++; } else { - $sql = ''; if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql_exists = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_perentity"; $sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 58807c5bcd2..b27805ca1a7 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -2,7 +2,8 @@ /* Copyright (C) 2016 Olivier Geffroy * Copyright (C) 2016 Florian Henry * Copyright (C) 2016-2024 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -443,7 +444,7 @@ if ($action != 'export_csv') { print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder); // Hook fields - $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -472,11 +473,13 @@ if ($action != 'export_csv') { $sql .= " GROUP BY t.numero_compte"; $resql = $db->query($sql); - $nrows = $resql->num_rows; $opening_balances = array(); - for ($i = 0; $i < $nrows; $i++) { - $arr = $resql->fetch_array(); - $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance']; + if ($resql) { + $nrows = $resql->num_rows; + for ($i = 0; $i < $nrows; $i++) { + $arr = $resql->fetch_array(); + $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance']; + } } } @@ -547,7 +550,7 @@ if ($action != 'export_csv') { // Show first line of a break print ''; - print ''.$root_account_number.($root_account_description ? ' - '.$root_account_description : '').''; + print ''.$root_account_number.($root_account_description ? ' - '.$root_account_description : '').''; print ''; $displayed_account = $root_account_number; @@ -690,7 +693,7 @@ if ($action != 'export_csv') { $accountingResult = $object->accountingResult($search_date_start, $search_date_end); if ($accountingResult < 0) { - $accountingResultDebit = price(price2num(abs($accountingResult), 'MT')); + $accountingResultDebit = price(abs((float) price2num($accountingResult, 'MT'))); $accountingResultClassCSS = ' error'; } else { $accountingResultCredit = price(price2num($accountingResult, 'MT')); diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index e2f1e86008d..828f48ad003 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -95,33 +95,90 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { * Actions */ -if ($cancel) { - header("Location: ".DOL_URL_ROOT.'/accountancy/bookkeeping/list.php'); - exit; +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - -if ($action == "confirm_update") { - $error = 0; - - if (((float) $debit != 0.0) && ((float) $credit != 0.0)) { - $error++; - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $action = 'update'; - } - if (empty($accountingaccount_number) || $accountingaccount_number == '-1') { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); - $action = 'update'; +if (empty($reshook)) { + if ($cancel) { + header("Location: ".DOL_URL_ROOT.'/accountancy/bookkeeping/list.php'); + exit; } - if (!$error) { - $object = new BookKeeping($db); + if ($action == "confirm_update") { + $error = 0; - $result = $object->fetch($id, null, $mode); - if ($result < 0) { + if (((float) $debit != 0.0) && ((float) $credit != 0.0)) { $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } else { + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); + $action = 'update'; + } + if (empty($accountingaccount_number) || $accountingaccount_number == '-1') { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $action = 'update'; + } + + if (!$error) { + $object = new BookKeeping($db); + + $result = $object->fetch($id, null, $mode); + if ($result < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } else { + $object->numero_compte = $accountingaccount_number; + $object->subledger_account = $subledger_account; + $object->subledger_label = $subledger_label; + $object->label_compte = $accountingaccount_label; + $object->label_operation = $label_operation; + $object->debit = $debit; + $object->credit = $credit; + + if ((float) $debit != 0.0) { + $object->montant = $debit; // deprecated + $object->amount = $debit; + $object->sens = 'D'; + } + if ((float) $credit != 0.0) { + $object->montant = $credit; // deprecated + $object->amount = $credit; + $object->sens = 'C'; + } + + $result = $object->update($user, false, $mode); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + if ($mode != '_tmp') { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } + + $debit = 0; + $credit = 0; + + $action = ''; + } + } + } + } elseif ($action == "add") { + $error = 0; + + if (((float) $debit != 0.0) && ((float) $credit != 0.0)) { + $error++; + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); + $action = ''; + } + if (empty($accountingaccount_number) || $accountingaccount_number == '-1') { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $action = ''; + } + + if (!$error) { + $object = new BookKeeping($db); + $object->numero_compte = $accountingaccount_number; $object->subledger_account = $subledger_account; $object->subledger_label = $subledger_label; @@ -129,19 +186,28 @@ if ($action == "confirm_update") { $object->label_operation = $label_operation; $object->debit = $debit; $object->credit = $credit; + $object->doc_date = (string) GETPOST('doc_date', 'alpha'); + $object->doc_type = (string) GETPOST('doc_type', 'alpha'); + $object->piece_num = $piece_num; + $object->doc_ref = (string) GETPOST('doc_ref', 'alpha'); + $object->code_journal = $journal_code; + $object->journal_label = $journal_label; + $object->fk_doc = GETPOSTINT('fk_doc'); + $object->fk_docdet = GETPOSTINT('fk_docdet'); if ((float) $debit != 0.0) { $object->montant = $debit; // deprecated $object->amount = $debit; $object->sens = 'D'; } + if ((float) $credit != 0.0) { $object->montant = $credit; // deprecated $object->amount = $credit; $object->sens = 'C'; } - $result = $object->update($user, false, $mode); + $result = $object->createStd($user, false, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -155,113 +221,75 @@ if ($action == "confirm_update") { $action = ''; } } - } -} elseif ($action == "add") { - $error = 0; - - if (((float) $debit != 0.0) && ((float) $credit != 0.0)) { - $error++; - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $action = ''; - } - if (empty($accountingaccount_number) || $accountingaccount_number == '-1') { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); - $action = ''; - } - - if (!$error) { + } elseif ($action == "confirm_delete") { $object = new BookKeeping($db); - $object->numero_compte = $accountingaccount_number; - $object->subledger_account = $subledger_account; - $object->subledger_label = $subledger_label; - $object->label_compte = $accountingaccount_label; - $object->label_operation = $label_operation; - $object->debit = $debit; - $object->credit = $credit; - $object->doc_date = (string) GETPOST('doc_date', 'alpha'); - $object->doc_type = (string) GETPOST('doc_type', 'alpha'); - $object->piece_num = $piece_num; - $object->doc_ref = (string) GETPOST('doc_ref', 'alpha'); - $object->code_journal = $journal_code; - $object->journal_label = $journal_label; - $object->fk_doc = GETPOSTINT('fk_doc'); - $object->fk_docdet = GETPOSTINT('fk_docdet'); + $result = $object->fetch($id, null, $mode); + $piece_num = $object->piece_num; - if ((float) $debit != 0.0) { - $object->montant = $debit; // deprecated - $object->amount = $debit; - $object->sens = 'D'; - } - - if ((float) $credit != 0.0) { - $object->montant = $credit; // deprecated - $object->amount = $credit; - $object->sens = 'C'; - } - - $result = $object->createStd($user, false, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); + + $action = 'create'; } else { - if ($mode != '_tmp') { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + $result = $object->delete($user, 0, $mode); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); } + } + $action = ''; + } elseif ($action == "confirm_create") { + $error = 0; - $debit = 0; - $credit = 0; + $object = new BookKeeping($db); - $action = ''; + if (!$journal_code || $journal_code == '-1') { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); + $action = 'create'; + $error++; + } + if (!GETPOST('doc_ref', 'alpha')) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors'); + $action = 'create'; + $error++; + } + + if (!$error) { + $object->label_compte = ''; + $object->debit = 0; + $object->credit = 0; + $object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); + $object->doc_type = GETPOST('doc_type', 'alpha'); + $object->piece_num = GETPOSTINT('next_num_mvt'); + $object->doc_ref = GETPOST('doc_ref', 'alpha'); + $object->code_journal = $journal_code; + $object->journal_label = $journal_label; + $object->fk_doc = 0; + $object->fk_docdet = 0; + $object->montant = 0; // deprecated + $object->amount = 0; + + $result = $object->createStd($user, 0, $mode); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + + $action = 'create'; + } else { + $reshook = $hookmanager->executeHooks('afterCreateBookkeeping', $parameters, $object, $action); + + if ($mode != '_tmp') { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } + $action = ''; + $id = $object->id; + $piece_num = $object->piece_num; + } } } -} elseif ($action == "confirm_delete") { - $object = new BookKeeping($db); - $result = $object->fetch($id, null, $mode); - $piece_num = $object->piece_num; - - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - $result = $object->delete($user, false, $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - $action = ''; -} elseif ($action == "confirm_create") { - $error = 0; - - $object = new BookKeeping($db); - - if (!$journal_code || $journal_code == '-1') { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); - $action = 'create'; - $error++; - } - if (!GETPOST('doc_ref', 'alpha')) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors'); - $action = 'create'; - $error++; - } - - if (!$error) { - $object->label_compte = ''; - $object->debit = 0; - $object->credit = 0; - $object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); - $object->doc_type = GETPOST('doc_type', 'alpha'); - $object->piece_num = GETPOSTINT('next_num_mvt'); - $object->doc_ref = GETPOST('doc_ref', 'alpha'); - $object->code_journal = $journal_code; - $object->journal_label = $journal_label; - $object->fk_doc = 0; - $object->fk_docdet = 0; - $object->montant = 0; // deprecated - $object->amount = 0; - - $result = $object->createStd($user, 0, $mode); + if ($action == 'setdate') { + $datedoc = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); + $result = $object->updateByMvt($piece_num, 'doc_date', $db->idate($datedoc), $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -269,67 +297,50 @@ if ($action == "confirm_update") { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } $action = ''; - $id = $object->id; - $piece_num = $object->piece_num; + } + } + + if ($action == 'setjournal') { + $result = $object->updateByMvt($piece_num, 'code_journal', $journal_code, $mode); + $result = $object->updateByMvt($piece_num, 'journal_label', $journal_label, $mode); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + if ($mode != '_tmp') { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } + $action = ''; + } + } + + if ($action == 'setdocref') { + $refdoc = GETPOST('doc_ref', 'alpha'); + $result = $object->updateByMvt($piece_num, 'doc_ref', $refdoc, $mode); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + if ($mode != '_tmp') { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } + $action = ''; + } + } + + // Validate transaction + if ($action == 'valid') { + $result = $object->transformTransaction(0, $piece_num); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + header("Location: list.php?sortfield=t.piece_num&sortorder=asc"); + exit; } } } -if ($action == 'setdate') { - $datedoc = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); - $result = $object->updateByMvt($piece_num, 'doc_date', $db->idate($datedoc), $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - if ($mode != '_tmp') { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - } - $action = ''; - } -} - -if ($action == 'setjournal') { - $result = $object->updateByMvt($piece_num, 'code_journal', $journal_code, $mode); - $result = $object->updateByMvt($piece_num, 'journal_label', $journal_label, $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - if ($mode != '_tmp') { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - } - $action = ''; - } -} - -if ($action == 'setdocref') { - $refdoc = GETPOST('doc_ref', 'alpha'); - $result = $object->updateByMvt($piece_num, 'doc_ref', $refdoc, $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - if ($mode != '_tmp') { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - } - $action = ''; - } -} - -// Validate transaction -if ($action == 'valid') { - $result = $object->transformTransaction(0, $piece_num); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - header("Location: list.php?sortfield=t.piece_num&sortorder=asc"); - exit; - } -} - - /* * View */ - $form = new Form($db); $formaccounting = new FormAccounting($db); @@ -394,6 +405,7 @@ if ($action == 'create') { print ''; print ''; */ + $reshookAddLine = $hookmanager->executeHooks('bookkeepingAddLine', $parameters, $object, $action); print ''; @@ -404,6 +416,7 @@ if ($action == 'create') { print ''; } else { $object = new BookKeeping($db); + $result = $object->fetchPerMvt($piece_num, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -590,7 +603,7 @@ if ($action == 'create') { print '' . $langs->trans("Control") . ''; if ($object->doc_type == 'customer_invoice') { - $sqlmid = 'SELECT rowid as ref'; + $sqlmid = 'SELECT rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac"; $sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc); dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG); diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 16923e5ebbd..cb9e8ea09d4 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -50,48 +50,48 @@ $massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bookkeepinglist'; -$search_mvt_num = GETPOSTINT('search_mvt_num'); +$search_mvt_num = GETPOST('search_mvt_num', 'alpha'); $search_doc_type = GETPOST("search_doc_type", 'alpha'); $search_doc_ref = GETPOST("search_doc_ref", 'alpha'); -$search_date_startyear = GETPOSTINT('search_date_startyear'); -$search_date_startmonth = GETPOSTINT('search_date_startmonth'); -$search_date_startday = GETPOSTINT('search_date_startday'); -$search_date_endyear = GETPOSTINT('search_date_endyear'); -$search_date_endmonth = GETPOSTINT('search_date_endmonth'); -$search_date_endday = GETPOSTINT('search_date_endday'); +$search_date_startyear = GETPOSTINT('search_date_startyear'); +$search_date_startmonth = GETPOSTINT('search_date_startmonth'); +$search_date_startday = GETPOSTINT('search_date_startday'); +$search_date_endyear = GETPOSTINT('search_date_endyear'); +$search_date_endmonth = GETPOSTINT('search_date_endmonth'); +$search_date_endday = GETPOSTINT('search_date_endday'); $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_doc_date = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); -$search_date_creation_startyear = GETPOSTINT('search_date_creation_startyear'); -$search_date_creation_startmonth = GETPOSTINT('search_date_creation_startmonth'); -$search_date_creation_startday = GETPOSTINT('search_date_creation_startday'); -$search_date_creation_endyear = GETPOSTINT('search_date_creation_endyear'); -$search_date_creation_endmonth = GETPOSTINT('search_date_creation_endmonth'); -$search_date_creation_endday = GETPOSTINT('search_date_creation_endday'); +$search_date_creation_startyear = GETPOSTINT('search_date_creation_startyear'); +$search_date_creation_startmonth = GETPOSTINT('search_date_creation_startmonth'); +$search_date_creation_startday = GETPOSTINT('search_date_creation_startday'); +$search_date_creation_endyear = GETPOSTINT('search_date_creation_endyear'); +$search_date_creation_endmonth = GETPOSTINT('search_date_creation_endmonth'); +$search_date_creation_endday = GETPOSTINT('search_date_creation_endday'); $search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); $search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear); -$search_date_modification_startyear = GETPOSTINT('search_date_modification_startyear'); -$search_date_modification_startmonth = GETPOSTINT('search_date_modification_startmonth'); -$search_date_modification_startday = GETPOSTINT('search_date_modification_startday'); -$search_date_modification_endyear = GETPOSTINT('search_date_modification_endyear'); -$search_date_modification_endmonth = GETPOSTINT('search_date_modification_endmonth'); -$search_date_modification_endday = GETPOSTINT('search_date_modification_endday'); +$search_date_modification_startyear = GETPOSTINT('search_date_modification_startyear'); +$search_date_modification_startmonth = GETPOSTINT('search_date_modification_startmonth'); +$search_date_modification_startday = GETPOSTINT('search_date_modification_startday'); +$search_date_modification_endyear = GETPOSTINT('search_date_modification_endyear'); +$search_date_modification_endmonth = GETPOSTINT('search_date_modification_endmonth'); +$search_date_modification_endday = GETPOSTINT('search_date_modification_endday'); $search_date_modification_start = dol_mktime(0, 0, 0, $search_date_modification_startmonth, $search_date_modification_startday, $search_date_modification_startyear); $search_date_modification_end = dol_mktime(23, 59, 59, $search_date_modification_endmonth, $search_date_modification_endday, $search_date_modification_endyear); -$search_date_export_startyear = GETPOSTINT('search_date_export_startyear'); -$search_date_export_startmonth = GETPOSTINT('search_date_export_startmonth'); -$search_date_export_startday = GETPOSTINT('search_date_export_startday'); -$search_date_export_endyear = GETPOSTINT('search_date_export_endyear'); -$search_date_export_endmonth = GETPOSTINT('search_date_export_endmonth'); -$search_date_export_endday = GETPOSTINT('search_date_export_endday'); +$search_date_export_startyear = GETPOSTINT('search_date_export_startyear'); +$search_date_export_startmonth = GETPOSTINT('search_date_export_startmonth'); +$search_date_export_startday = GETPOSTINT('search_date_export_startday'); +$search_date_export_endyear = GETPOSTINT('search_date_export_endyear'); +$search_date_export_endmonth = GETPOSTINT('search_date_export_endmonth'); +$search_date_export_endday = GETPOSTINT('search_date_export_endday'); $search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear); $search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear); -$search_date_validation_startyear = GETPOSTINT('search_date_validation_startyear'); -$search_date_validation_startmonth = GETPOSTINT('search_date_validation_startmonth'); -$search_date_validation_startday = GETPOSTINT('search_date_validation_startday'); -$search_date_validation_endyear = GETPOSTINT('search_date_validation_endyear'); -$search_date_validation_endmonth = GETPOSTINT('search_date_validation_endmonth'); -$search_date_validation_endday = GETPOSTINT('search_date_validation_endday'); +$search_date_validation_startyear = GETPOSTINT('search_date_validation_startyear'); +$search_date_validation_startmonth = GETPOSTINT('search_date_validation_startmonth'); +$search_date_validation_startday = GETPOSTINT('search_date_validation_startday'); +$search_date_validation_endyear = GETPOSTINT('search_date_validation_endyear'); +$search_date_validation_endmonth = GETPOSTINT('search_date_validation_endmonth'); +$search_date_validation_endday = GETPOSTINT('search_date_validation_endday'); $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear); $search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear); $search_import_key = GETPOST("search_import_key", 'alpha'); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 7ac6bc27cea..a9931ab2ccb 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -53,7 +53,7 @@ $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bookkeepinglist'; // Search Parameters -$search_mvt_num = GETPOSTINT('search_mvt_num'); +$search_mvt_num = GETPOST('search_mvt_num', 'alpha'); $search_doc_type = GETPOST("search_doc_type", 'alpha'); $search_doc_ref = GETPOST("search_doc_ref", 'alpha'); $search_date_startyear = GETPOSTINT('search_date_startyear'); @@ -154,7 +154,7 @@ $hookmanager->initHooks(array('bookkeepinglist')); $formaccounting = new FormAccounting($db); $form = new Form($db); -if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOSTINT('page') == '' && !GETPOSTINT('noreset') && $user->hasRight('accounting', 'mouvements', 'export')) { +if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'alpha') == '' && !GETPOSTINT('noreset') && $user->hasRight('accounting', 'mouvements', 'export')) { if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) { $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index bb549a3bc6d..338ca12e5f0 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -52,29 +52,29 @@ if ($type == 'sub') { $context_default = 'bookkeepingbyaccountlist'; } $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default; -$search_date_startyear = GETPOSTINT('search_date_startyear'); -$search_date_startmonth = GETPOSTINT('search_date_startmonth'); -$search_date_startday = GETPOSTINT('search_date_startday'); -$search_date_endyear = GETPOSTINT('search_date_endyear'); -$search_date_endmonth = GETPOSTINT('search_date_endmonth'); -$search_date_endday = GETPOSTINT('search_date_endday'); +$search_date_startyear = GETPOSTINT('search_date_startyear'); +$search_date_startmonth = GETPOSTINT('search_date_startmonth'); +$search_date_startday = GETPOSTINT('search_date_startday'); +$search_date_endyear = GETPOSTINT('search_date_endyear'); +$search_date_endmonth = GETPOSTINT('search_date_endmonth'); +$search_date_endday = GETPOSTINT('search_date_endday'); $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_doc_date = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); -$search_date_export_startyear = GETPOSTINT('search_date_export_startyear'); -$search_date_export_startmonth = GETPOSTINT('search_date_export_startmonth'); -$search_date_export_startday = GETPOSTINT('search_date_export_startday'); -$search_date_export_endyear = GETPOSTINT('search_date_export_endyear'); -$search_date_export_endmonth = GETPOSTINT('search_date_export_endmonth'); -$search_date_export_endday = GETPOSTINT('search_date_export_endday'); +$search_date_export_startyear = GETPOSTINT('search_date_export_startyear'); +$search_date_export_startmonth = GETPOSTINT('search_date_export_startmonth'); +$search_date_export_startday = GETPOSTINT('search_date_export_startday'); +$search_date_export_endyear = GETPOSTINT('search_date_export_endyear'); +$search_date_export_endmonth = GETPOSTINT('search_date_export_endmonth'); +$search_date_export_endday = GETPOSTINT('search_date_export_endday'); $search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear); $search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear); -$search_date_validation_startyear = GETPOSTINT('search_date_validation_startyear'); -$search_date_validation_startmonth = GETPOSTINT('search_date_validation_startmonth'); -$search_date_validation_startday = GETPOSTINT('search_date_validation_startday'); -$search_date_validation_endyear = GETPOSTINT('search_date_validation_endyear'); -$search_date_validation_endmonth = GETPOSTINT('search_date_validation_endmonth'); -$search_date_validation_endday = GETPOSTINT('search_date_validation_endday'); +$search_date_validation_startyear = GETPOSTINT('search_date_validation_startyear'); +$search_date_validation_startmonth = GETPOSTINT('search_date_validation_startmonth'); +$search_date_validation_startday = GETPOSTINT('search_date_validation_startday'); +$search_date_validation_endyear = GETPOSTINT('search_date_validation_endyear'); +$search_date_validation_endmonth = GETPOSTINT('search_date_validation_endmonth'); +$search_date_validation_endday = GETPOSTINT('search_date_validation_endday'); $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear); $search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear); $search_import_key = GETPOST("search_import_key", 'alpha'); @@ -91,7 +91,7 @@ if ($search_accountancy_code_end == - 1) { } $search_doc_ref = GETPOST('search_doc_ref', 'alpha'); $search_label_operation = GETPOST('search_label_operation', 'alpha'); -$search_mvt_num = GETPOSTINT('search_mvt_num'); +$search_mvt_num = GETPOST('search_mvt_num', 'alpha'); $search_direction = GETPOST('search_direction', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_debit = GETPOST('search_debit', 'alpha'); diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 09586c12637..601cb02bd38 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -943,7 +943,7 @@ class AccountancyExport $tab['signe_montant'] = '+'; // The amount must be in centimes without decimal points. - $tab['montant'] = str_pad(abs(($line->debit - $line->credit) * 100), 12, '0', STR_PAD_LEFT); + $tab['montant'] = str_pad((string) abs(($line->debit - $line->credit) * 100), 12, '0', STR_PAD_LEFT); $tab['contrepartie'] = str_repeat(' ', 8); // Force date format : %d%m%y diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 90de07f928e..14afbbbe7d8 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -299,7 +299,7 @@ class AccountingJournal extends CommonObject $label_link .= ' - '.($nourl ? '' : '').$langs->transnoentities($this->label).($nourl ? '' : ''); } if ($withlabel == 2 && !empty($this->nature)) { - $key = $langs->trans("AccountingJournalType".strtoupper($this->nature)); + $key = $langs->trans("AccountingJournalType".$this->nature); $transferlabel = ($this->nature && $key != "AccountingJournalType".strtoupper($langs->trans($this->nature)) ? $key : $this->label); $label_link .= ' - '.($nourl ? '' : '').$transferlabel.($nourl ? '' : ''); } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6d47b7fe700..54baad28c40 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -721,16 +721,6 @@ class BookKeeping extends CommonObject if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element.$mode); - - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. - //if (! $notrigger) { - - // // Call triggers - // $result=$this->call_trigger('MYOBJECT_CREATE',$user); - // if ($result < 0) $error++; - // // End call triggers - //} } // Commit or rollback @@ -748,11 +738,10 @@ class BookKeeping extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * @param string $mode Mode - * - * @return int Return integer <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @param string $mode Mode ('' or 'tmp_') + * @return int Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = null, $mode = '') { @@ -1514,7 +1503,7 @@ class BookKeeping extends CommonObject * @param string $field Field * @param string $value Value * @param string $mode Mode ('' or _tmp') - * @return number Return integer <0 if KO, >0 if OK + * @return int Return integer <0 if KO, >0 if OK */ public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '') { @@ -1554,16 +1543,17 @@ class BookKeeping extends CommonObject * Delete object in database * * @param User $user User that deletes - * @param int $notrigger false=launch triggers after, true=disable triggers - * @param string $mode Mode + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @param string $mode Mode ('' or 'tmp_') * @return int Return integer <0 if KO, >0 if OK */ public function delete(User $user, $notrigger = 0, $mode = '') { global $langs; + dol_syslog(__METHOD__, LOG_DEBUG); - $result = $this->canModifyBookkeeping($this->id); + $result = $this->canModifyBookkeeping($this->id, $mode); if ($result < 0) { return -1; } elseif ($result == 0) { @@ -2065,6 +2055,7 @@ class BookKeeping extends CommonObject $error = 0; $sql_filter = $this->getCanModifyBookkeepingSQL(); + if (!isset($sql_filter)) { return -1; } @@ -2354,10 +2345,11 @@ class BookKeeping extends CommonObject $sql_list = array(); if (!empty($conf->cache['active_fiscal_period_cached']) && is_array($conf->cache['active_fiscal_period_cached'])) { foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) { - $sql_list[] = "('" . $this->db->idate($fiscal_period['date_start']) . "' <= {$alias}doc_date AND {$alias}doc_date <= '" . $this->db->idate($fiscal_period['date_end']) . "')"; + $sql_list[] = "('" . $this->db->idate($fiscal_period['date_start']) . "' <= ".$this->db->sanitize($alias)."doc_date AND ".$this->db->sanitize($alias)."doc_date <= '" . $this->db->idate($fiscal_period['date_end']) . "')"; } } - self::$can_modify_bookkeeping_sql_cached[$alias] = !empty($sql_list) ? ' AND (' . $this->db->sanitize(implode(' OR ', $sql_list), 1, 1, 1) . ')' : ''; + $sqlsanitized = implode(' OR ', $sql_list); + self::$can_modify_bookkeeping_sql_cached[$alias] = !empty($sql_list) ? " AND (".$sqlsanitized.")" : ""; } return self::$can_modify_bookkeeping_sql_cached[$alias]; @@ -2367,9 +2359,10 @@ class BookKeeping extends CommonObject * Is the bookkeeping can be modified or deleted ? * * @param int $id Bookkeeping ID + * @param string $mode Mode ('' or 'tmp_') * @return int Return integer <0 if KO, == 0 if No, == 1 if Yes */ - public function canModifyBookkeeping($id) + public function canModifyBookkeeping($id, $mode = '') { global $conf; @@ -2381,7 +2374,7 @@ class BookKeeping extends CommonObject } $bookkeeping = new BookKeeping($this->db); - $result = $bookkeeping->fetch($id); + $result = $bookkeeping->fetch($id, null, $mode); if ($result <= 0) { return $result; } @@ -2402,7 +2395,7 @@ class BookKeeping extends CommonObject } $bookkeeping = new BookKeeping($this->db); - $result = $bookkeeping->fetch($id); + $result = $bookkeeping->fetch($id, null, $mode); if ($result <= 0) { return $result; } diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 1226ae9d167..378c5a18778 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -161,7 +161,7 @@ $formaccounting = new FormAccounting($db); $title = $langs->trans('Closure'); -$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Cl.C3.B4ture_annuelle'; +$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Cl.C3.B4ture_annuelle'; llxHeader('', $title, $help_url); @@ -309,7 +309,7 @@ if (isset($current_fiscal_period)) { $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; $head[0][1] = $langs->trans("AccountancyClosureStep1"); $head[0][2] = 'step1'; - print dol_get_fiche_head($head, 'step1', '', -1, 'title_accountancy'); + print dol_get_fiche_head($head, 'step1', '', -1, ''); print '' . $langs->trans("AccountancyClosureStep1Desc") . '
'; @@ -334,7 +334,7 @@ if (isset($current_fiscal_period)) { print '' . $langs->trans("Year") . ''; } for ($i = 1; $i <= 12; $i++) { - print '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . ''; + print '' . $langs->trans('MonthShort' . str_pad((string) $i, 2, '0', STR_PAD_LEFT)) . ''; } print '' . $langs->trans("Total") . ''; print ''; @@ -355,12 +355,14 @@ if (isset($current_fiscal_period)) { print "\n"; print ''; + print '
'; + // Step 2 $head = array(); $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; $head[0][1] = $langs->trans("AccountancyClosureStep2"); $head[0][2] = 'step2'; - print dol_get_fiche_head($head, 'step2', '', -1, 'title_accountancy'); + print dol_get_fiche_head($head, 'step2', '', -1, ''); // print '' . $langs->trans("AccountancyClosureStep2Desc") . '
'; @@ -371,12 +373,14 @@ if (isset($current_fiscal_period)) { } print_barre_liste('', '', '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0); + print '
'; + // Step 3 $head = array(); $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; $head[0][1] = $langs->trans("AccountancyClosureStep3"); $head[0][2] = 'step3'; - print dol_get_fiche_head($head, 'step3', '', -1, 'title_accountancy'); + print dol_get_fiche_head($head, 'step3', '', -1, ''); // print '' . $langs->trans("AccountancyClosureStep3Desc") . '
'; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index c5bd8949880..ed0e1b771d7 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -234,17 +234,17 @@ if ($action == 'validatehistory') { $facture_static_det->desc = $objp->description; $accountingAccountArray = array( - 'dom'=>$objp->aarowid, - 'intra'=>$objp->aarowid_intra, - 'export'=>$objp->aarowid_export, - 'thirdparty' =>$objp->aarowid_thirdparty); + 'dom' => $objp->aarowid, + 'intra' => $objp->aarowid_intra, + 'export' => $objp->aarowid_export, + 'thirdparty' => $objp->aarowid_thirdparty); $code_sell_p_notset = ''; $code_sell_t_notset = ''; $suggestedid = 0; - $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer'); + $return = $accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer'); if (!is_array($return) && $return < 0) { setEventMessage($accountingAccount->error, 'errors'); } else { @@ -299,7 +299,7 @@ if ($action == 'validatehistory') { /* * View */ -$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; +$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; llxHeader('', $langs->trans("CustomersVentilation"), $help_url); @@ -347,7 +347,7 @@ for ($i = 1; $i <= 12; $i++) { $param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year']; print ''; } - print $langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)); + print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)); if (!empty($tmp['mday'])) { print ''; } @@ -362,7 +362,7 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((string) $j), "fd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).","; } $sql .= " SUM(fd.total_ht) as total"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; @@ -434,7 +434,7 @@ if ($resql) { // Add link to make binding if (!empty(price2num($row[$i]))) { print ''; - print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); + print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad((string) $cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); print ''; } print ''; @@ -484,7 +484,7 @@ for ($i = 1; $i <= 12; $i++) { $param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year']; print ''; } - print $langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)); + print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)); if (!empty($tmp['mday'])) { print ''; } @@ -499,7 +499,7 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).","; } $sql .= " SUM(fd.total_ht) as total"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; @@ -595,7 +595,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa if ($j > 12) { $j -= 12; } - print ''.$langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)).''; + print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).''; } print ''.$langs->trans("Total").''; @@ -605,7 +605,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).","; } $sql .= " SUM(fd.total_ht) as total"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; @@ -655,7 +655,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa if ($j > 12) { $j -= 12; } - print ''.$langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)).''; + print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).''; } print ''.$langs->trans("Total").''; @@ -670,17 +670,17 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa $sql .= " SUM(".$db->ifsql( "MONTH(f.datef) = ".((int) $j), " (".$db->ifsql( - "fd.total_ht < 0", - " (-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)))" - ).")", + "fd.total_ht < 0", + " (-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 - ).") AS month".str_pad((int) $j, 2, '0', STR_PAD_LEFT).","; + ).") AS month".str_pad((string) $j, 2, '0', STR_PAD_LEFT).","; } $sql .= " SUM(".$db->ifsql( "fd.total_ht < 0", " (-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)))" + " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))" ).") as total"; } else { $sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,"; @@ -697,7 +697,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa " (fd.total_ht - (fd.buy_price_ht * fd.qty))" ).")", 0 - ).") AS month".str_pad((int) $j, 2, '0', STR_PAD_LEFT).","; + ).") AS month".str_pad((string) $j, 2, '0', STR_PAD_LEFT).","; } $sql .= " SUM(".$db->ifsql( "fd.total_ht < 0", diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index f72ad2b3037..afe6465562f 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -177,7 +177,7 @@ if ($action == 'validatehistory') { /* * View */ -$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; +$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; llxHeader('', $langs->trans("ExpenseReportsVentilation"), $help_url); @@ -223,7 +223,7 @@ for ($i = 1; $i <= 12; $i++) { $param .= '&search_month='.$tmp['mon'].'&search_year='.$tmp['year']; print ''; } - print $langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)); + print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)); if (!empty($tmp['mday'])) { print ''; } @@ -238,7 +238,7 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(er.date_debut) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(er.date_debut) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).","; } $sql .= " SUM(erd.total_ht) as total"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; @@ -300,7 +300,7 @@ if ($resql) { // Add link to make binding if (!empty(price2num($row[$i]))) { print ''; - print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); + print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad((string) $cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); print ''; } print ''; @@ -338,7 +338,7 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - print ''.$langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)).''; + print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).''; } print ''.$langs->trans("Total").''; @@ -349,7 +349,7 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(er.date_debut) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(er.date_debut) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).","; } $sql .= " ROUND(SUM(erd.total_ht),2) as total"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; @@ -426,7 +426,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa if ($j > 12) { $j -= 12; } - print ''.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).''; + print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).''; } print ''.$langs->trans("Total").''; @@ -436,7 +436,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(er.date_create) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(er.date_create) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).","; } $sql .= " SUM(erd.total_ht) as total"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index db569da428c..10adfea0bc8 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -80,7 +80,7 @@ llxHeader('', $langs->trans("AccountancyArea"), $help_url); if (isModEnabled('accounting')) { $step = 0; - $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) + $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default. $showtutorial = ''; @@ -263,33 +263,6 @@ if (isModEnabled('accounting')) { print ''; print '
'; - - print '
'; - - /* - * Show boxes - */ - $boxlist = '
'; - - $boxlist .= '
'; - - $boxlist .= $resultboxes['boxlista']; - - $boxlist .= '
'; - - $boxlist .= '
'; - - $boxlist .= $resultboxes['boxlistb']; - - $boxlist .= '
'; - $boxlist .= "\n"; - - $boxlist .= '
'; - - - print $boxlist; - - print '
'; } elseif (isModEnabled('comptabilite')) { print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy'); @@ -300,6 +273,21 @@ if (isModEnabled('accounting')) { print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy'); } +/* + * Show boxes + */ +$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) +$boxlist = '
'; +$boxlist .= '
'; +$boxlist .= $resultboxes['boxlista']; +$boxlist .= '
'; +$boxlist .= '
'; +$boxlist .= $resultboxes['boxlistb']; +$boxlist .= '
'; +$boxlist .= "\n"; +$boxlist .= '
'; +print $boxlist; + // End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 9e6b39a9b00..d716ad9f3a0 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -221,6 +221,7 @@ if ($result) { $account_supplier = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', 'NotDefined'); // NotDefined is a reserved word $account_customer = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined'); // NotDefined is a reserved word $account_employee = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined'); // NotDefined is a reserved word + $account_expensereport = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT', 'NotDefined'); // NotDefined is a reserved word $account_pay_vat = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT', 'NotDefined'); // NotDefined is a reserved word $account_pay_donation = getDolGlobalString('DONATION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word $account_pay_subscription = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word @@ -625,6 +626,9 @@ if (!$error && $action == 'writebookkeeping') { $accountingaccountpayment = new AccountingAccount($db); $accountingaccountpayment->fetch(null, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true); + $accountingaccountexpensereport = new AccountingAccount($db); + $accountingaccountexpensereport->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_EXPENSEREPORT, true); + $accountingaccountsuspense = new AccountingAccount($db); $accountingaccountsuspense->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'), true); @@ -757,8 +761,8 @@ if (!$error && $action == 'writebookkeeping') { } elseif ($tabtype[$key] == 'payment_expensereport') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; - $bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'); - $bookkeeping->label_compte = $accountingaccountpayment->label; + $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'); + $bookkeeping->label_compte = $accountingaccountexpensereport->label; } elseif ($tabtype[$key] == 'payment_salary') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; @@ -1013,7 +1017,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } elseif ($tabtype[$key] == 'payment') { print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER').'"'.$sep; } elseif ($tabtype[$key] == 'payment_expensereport') { - print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep; + print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT').'"'.$sep; } elseif ($tabtype[$key] == 'payment_salary') { print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep; } else { @@ -1135,7 +1139,8 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1' - || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { + || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1' + || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSERERPORT') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSERERPORT') == '-1') { print($desc ? '' : '
').'
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); @@ -1294,7 +1299,7 @@ if (empty($action) || $action == 'view') { $account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); } if ($tabtype[$key] == 'payment_expensereport') { - $account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'); + $account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'); } if ($tabtype[$key] == 'payment_salary') { $account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 881070ad6fd..077f8f755b1 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -162,7 +162,7 @@ if ($result) { $num = $db->num_rows($result); // Variables - $account_salary = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined'); + $account_salary = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT', 'NotDefined'); $account_vat = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT', 'NotDefined'); $i = 0; @@ -247,7 +247,7 @@ if ($action == 'writebookkeeping' && !$error) { $error = 0; $accountingaccountexpense = new AccountingAccount($db); - $accountingaccountexpense->fetch(null, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true); + $accountingaccountexpense->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'), true); foreach ($taber as $key => $val) { // Loop on each expense report $errorforline = 0; @@ -279,7 +279,7 @@ if ($action == 'writebookkeeping' && !$error) { $bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; - $bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'); + $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'); $bookkeeping->label_compte = $accountingaccountexpense->label; $bookkeeping->label_operation = $tabuser[$key]['name']; @@ -590,7 +590,7 @@ if (empty($action) || $action == 'view') { } // Button to write into Ledger - if (!getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { + if (!getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') == '-1') { print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); @@ -602,7 +602,7 @@ if (empty($action) || $action == 'view') { if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') { print ''; } - if (!getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { + if (!getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') == '-1') { print ''; } else { if ($in_bookkeeping == 'notyet') { @@ -726,7 +726,7 @@ if (empty($action) || $action == 'view') { print "".$expensereportstatic->getNomUrl(1).""; // Account print ""; - $accountoshow = length_accountg(getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT')); + $accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT')); if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForUsersNotDefined").''; } else { diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 227c2f0f280..f5d30511ce0 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -6,7 +6,7 @@ * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2018 Eric Seigne * Copyright (C) 2024 MDW * @@ -367,7 +367,7 @@ SELECT fk_facture_fourn, COUNT(fd.rowid) as nb FROM - llx_facture_fourn_det as fd + " . MAIN_DB_PREFIX . "facture_fourn_det as fd WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0 diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index dea3d7b875a..ab8dfe60060 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -232,10 +232,10 @@ if ($action == 'validatehistory') { $facture_static_det->desc = $objp->description; $accountingAccountArray = array( - 'dom'=>$objp->aarowid, - 'intra'=>$objp->aarowid_intra, - 'export'=>$objp->aarowid_export, - 'thirdparty' =>$objp->aarowid_thirdparty); + 'dom' => $objp->aarowid, + 'intra' => $objp->aarowid_intra, + 'export' => $objp->aarowid_export, + 'thirdparty' => $objp->aarowid_thirdparty); $code_buy_p_notset = ''; $code_buy_t_notset = ''; @@ -243,7 +243,7 @@ if ($action == 'validatehistory') { $suggestedid = 0; $return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'supplier'); - if (!is_array($return) && $return<0) { + if (!is_array($return) && $return < 0) { setEventMessage($accountingAccount->error, 'errors'); } else { $suggestedid = $return['suggestedid']; @@ -297,7 +297,7 @@ if ($action == 'validatehistory') { /* * View */ -$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; +$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; llxHeader('', $langs->trans("SuppliersVentilation"), $help_url); @@ -340,7 +340,7 @@ for ($i = 1; $i <= 12; $i++) { $param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year']; print ''; } - print $langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)); + print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)); if (!empty($tmp['mday'])) { print ''; } @@ -355,7 +355,7 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).","; } $sql .= " SUM(ffd.total_ht) as total"; $sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd"; @@ -422,7 +422,7 @@ if ($resql) { // Add link to make binding if (!empty(price2num($row[$i]))) { print ''; - print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); + print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad((string) $cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); print ''; } print ''; @@ -472,7 +472,7 @@ for ($i = 1; $i <= 12; $i++) { $param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year']; print ''; } - print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)); + print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)); if (!empty($tmp['mday'])) { print ''; } @@ -487,7 +487,7 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).","; } $sql .= " SUM(ffd.total_ht) as total"; $sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd"; @@ -571,7 +571,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa if ($j > 12) { $j -= 12; } - print ''.$langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)).''; + print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).''; } print ''.$langs->trans("Total").''; @@ -581,7 +581,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).","; } $sql .= " SUM(ffd.total_ht) as total"; $sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd"; diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index 9853dd08bf1..5d5269892bd 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -24,7 +24,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } $code = getDolGlobalString('MAIN_INFO_ACCOUNTANT_CODE'); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index d18ba0c335d..d4b06aa2b1f 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -148,7 +148,7 @@ abstract class ActionsAdherentCardCommon // Town $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); - if (dol_strlen(trim($this->object->country_id)) == 0) { + if ($this->object->country_id == 0) { $this->object->country_id = $objsoc->country_id; } @@ -168,7 +168,7 @@ abstract class ActionsAdherentCardCommon } // Physical or Moral - $selectarray = array('0'=>$langs->trans("Physical"), '1'=>$langs->trans("Moral")); + $selectarray = array('0' => $langs->trans("Physical"), '1' => $langs->trans("Moral")); $this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0); } diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php index 419b32f3c34..582d2eb2499 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php @@ -19,7 +19,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } ?> diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php index 9056ff201e4..88631d23a40 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php @@ -19,7 +19,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php index 1ad9e4ff3d4..6417e6a32b2 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php @@ -19,7 +19,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index e8575c36337..051e398512b 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -593,7 +593,7 @@ if (empty($reshook)) { $rowid = $object->id; $id = $object->id; - $backtopage = preg_replace('/__ID__/', $id, $backtopage); + $backtopage = preg_replace('/__ID__/', (string) $id, $backtopage); } else { $db->rollback(); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b5f319bb70c..f71fa705c3f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -316,7 +316,7 @@ class Adherent extends CommonObject /** - * @var array|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}> 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,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}> 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), @@ -560,12 +560,13 @@ class Adherent extends CommonObject * Return translated label by the nature of a adherent (physical or moral) * * @param string $morphy Nature of the adherent (physical or moral) - * @param int $addbadge Add badge (1=Full label, 2=First letters only) + * @param int<0,2> $addbadge Add badge (1=Full label, 2=First letters only) * @return string Label */ public function getmorphylib($morphy = '', $addbadge = 0) { global $langs; + $s = ''; // Clean var if (!$morphy) { @@ -573,7 +574,6 @@ class Adherent extends CommonObject } if ($addbadge) { - $s = ''; $labeltoshowm = $langs->trans("Moral"); $labeltoshowp = $langs->trans("Physical"); if ($morphy == 'phy') { diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index f99b20f86d5..612f408edd9 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -3,6 +3,7 @@ * Copyright (c) 2005-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2023 Waël Almoman + * 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 @@ -168,15 +169,15 @@ class AdherentStats extends Stats /** * Return count of member by status group by adh type, total and average * - * @param int $numberYears Number of years to scan (0 = all) - * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member type + * @param int $numberYears Number of years to scan (0 = all) + * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member type */ public function countMembersByTypeAndStatus($numberYears = 0) { global $user; $now = dol_now(); - $endYear = date('Y'); + $endYear = (int) date('Y'); $startYear = $endYear - $numberYears; $sql = "SELECT t.rowid as fk_adherent_type, t.libelle as label"; @@ -224,7 +225,7 @@ class AdherentStats extends Stats 'members_resiliated' => (int) $objp->members_resiliated ); $totalrow = 0; - foreach ($MembersCountArray[$objp->fk_adherent_type] as $key=>$nb) { + foreach ($MembersCountArray[$objp->fk_adherent_type] as $key => $nb) { if ($key != 'label') { $totalrow += $nb; $totalstatus[$key] += $nb; @@ -244,16 +245,17 @@ class AdherentStats extends Stats /** * Return count of member by status group by adh type, total and average * - * @param int $numberYears Number of years to scan (0 = all) - * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag + * @param int $numberYears Number of years to scan (0 = all) + * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag */ public function countMembersByTagAndStatus($numberYears = 0) { global $user; $now = dol_now(); - $endYear = date('Y'); + $endYear = (int) date('Y'); $startYear = $endYear - $numberYears; + $MembersCountArray = []; $sql = "SELECT c.rowid as fk_categorie, c.label as label"; $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft"; @@ -282,7 +284,6 @@ class AdherentStats extends Stats if ($result) { $num = $this->db->num_rows($result); $i = 0; - $MembersCountArray = []; $totalstatus = array( 'label' => 'Total', 'members_draft' => 0, @@ -304,7 +305,7 @@ class AdherentStats extends Stats 'members_resiliated' => (int) $objp->members_resiliated ); $totalrow = 0; - foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) { + foreach ($MembersCountArray[$objp->fk_categorie] as $key => $nb) { if ($key != 'label') { $totalrow += $nb; $totalstatus[$key] += $nb; diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index c268ac3ab6e..04acc243570 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -104,7 +104,7 @@ class Subscription extends CommonObject public $fk_bank; /** - * @var array|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}> 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,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}> 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), @@ -187,6 +187,32 @@ class Subscription extends CommonObject $this->fk_type = $type; } + if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) { // To use new linkedObjectsIds instead of old linked_objects + $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds + } + + // Add object linked + if (!$error && $this->id && !empty($this->linked_objects) && is_array($this->linked_objects)) { + foreach ($this->linked_objects as $origin => $tmp_origin_id) { + if (is_array($tmp_origin_id)) { // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) + foreach ($tmp_origin_id as $origin_id) { + $ret = $this->add_object_linked($origin, $origin_id); + if (!$ret) { + $this->error = $this->db->lasterror(); + $error++; + } + } + } else { // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + $origin_id = $tmp_origin_id; + $ret = $this->add_object_linked($origin, $origin_id); + if (!$ret) { + $this->error = $this->db->lasterror(); + $error++; + } + } + } + } + if (!$error && !$notrigger) { $this->context = array('member' => $member); // Call triggers diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index e8d85f21c76..47bded0df29 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -6,6 +6,7 @@ * Copyright (C) 2014-2016 Juanjo Menent * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2021-2023 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -203,6 +204,7 @@ foreach ($object->fields as $key => $val) { } } $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan //var_dump($arrayfields);exit; // Security check diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index 5582c60e30f..62a3a08aa49 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -21,7 +21,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } echo "\n"; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index df36f5c95da..1be94641271 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -145,7 +145,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) { $object->note_public = trim($comment); $object->note_private = ''; $object->mail_valid = trim($mail_valid); - $object->vote = (int) $vote; + $object->vote = $vote; // $vote is already int // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); @@ -201,7 +201,7 @@ if ($action == 'update' && $user->hasRight('adherent', 'configurer')) { $object->note_public = trim($comment); $object->note_private = ''; $object->mail_valid = trim($mail_valid); - $object->vote = (bool) trim($vote); + $object->vote = $vote; // $vote is already int. // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); diff --git a/htdocs/adherents/vcard.php b/htdocs/adherents/vcard.php index cd39e578045..56f82a7665d 100644 --- a/htdocs/adherents/vcard.php +++ b/htdocs/adherents/vcard.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2020-2021 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,6 +99,7 @@ $v->setPhoneNumber($object->fax, "TYPE=WORK;FAX"); $country = $object->country_code ? $object->country : ''; $v->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK;POSTAL"); +// @phan-suppress-next-line PhanDeprecatedFunction (setLabel is the old method, new is setAddress) $v->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK"); $v->setEmail($object->email); diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index ce994385f80..3f21267b451 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2021 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,7 +156,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) { // Save nb of agenda if (!$error) { - $res = dolibarr_set_const($db, 'AGENDA_EXT_NB', trim(GETPOSTINT('AGENDA_EXT_NB')), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, 'AGENDA_EXT_NB', GETPOSTINT('AGENDA_EXT_NB'), 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d895854ab2c..da9b0271b15 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -13,6 +13,7 @@ * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2019-2022 Frédéric France * Copyright (C) 2020-2022 Open-Dsi + * Copyright (C) 2024 Charlene Benke * * 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 @@ -2130,6 +2131,11 @@ if ($id > 0) { $canbemodified = 1; } + if ($tabname[$id] == "c_product_nature" && in_array($obj->code, array(0, 1))) { + $canbedisabled = 0; + $canbemodified = 0; + $iserasable = 0; + } // Build Url. The table is id=, the id of line is rowid= $rowidcol = empty($tabrowid[$id]) ? 'rowid' : $tabrowid[$id]; // If rowidcol not defined diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 983a93a9c02..839125a8da3 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -102,44 +102,9 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { - $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); - - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/eventorganization/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele; - break; - } - } - - if ($classname !== '') { - require_once $file; - - $module = new $classname($db); - - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; - } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); - } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey)."_ADDON"; dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); @@ -150,7 +115,7 @@ if ($action == 'updateMask') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (getDolGlobalString($constforval) == "$value") { @@ -160,7 +125,7 @@ if ($action == 'updateMask') { } }/* elseif ($action == 'setdoc') { // Set or unset default model - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { @@ -176,7 +141,7 @@ if ($action == 'updateMask') { } } } elseif ($action == 'unsetdoc') { - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; dolibarr_del_const($db, $constforval, $conf->entity); diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 4d1b5cc3bed..5d3228ae23a 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -347,7 +347,7 @@ $db->close(); function _isInBoxList($idrss, array $boxlist) { foreach ($boxlist as $box) { - if ($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false) { + if ($box->boxcode === "lastrssinfos" && strpos($box->note, (string) $idrss) !== false) { return true; } } diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index df883799b2b..c55622f1a11 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -66,6 +66,16 @@ $setupnotempty = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); +$moduledir = 'hrm'; +$myTmpObjects = array(); +// TODO Scan list of objects to fill this array +$myTmpObjects['evaluation'] = array('label' => 'Evaluation', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'Evaluation'); + +$tmpobjectkey = GETPOST('object', 'aZ09'); +if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) { + accessforbidden('Bad value for object. Hack attempt ?'); +} + /* * Actions @@ -107,11 +117,11 @@ if ($action == 'update') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { +} elseif ($action == 'specimen' && $tmpobjectkey) { $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - $tmpobject = new $tmpobjectkey($db); + $className = $myTmpObjects[$tmpobjectkey]['class']; + $tmpobject = new $className($db); $tmpobject->initAsSpecimen(); // Search template files @@ -144,7 +154,6 @@ if ($action == 'update') { } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'HRMTEST_'.strtoupper($tmpobjectkey)."_ADDON"; dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); @@ -155,7 +164,6 @@ if ($action == 'update') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (getDolGlobalString($constforval) == "$value") { @@ -165,7 +173,6 @@ if ($action == 'update') { } } elseif ($action == 'setdoc') { // Set or unset default model - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { @@ -181,7 +188,6 @@ if ($action == 'update') { } } } elseif ($action == 'unsetdoc') { - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; dolibarr_del_const($db, $constforval, $conf->entity); @@ -209,9 +215,6 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); $head = hrmAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "hrm"); -$moduledir = 'hrm'; -$myTmpObjects = array(); -$myTmpObjects['evaluation'] = array('label' => 'Evaluation', 'includerefgeneration' => 1, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey != $type) { @@ -291,6 +294,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $nameofclass = ucfirst($myTmpObjectKey); $mytmpinstance = new $nameofclass($db); + '@phan-var-force Evaluation $mytmpinstance'; $mytmpinstance->initAsSpecimen(); // Info diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index 1f79f506c89..ef80a03cbcb 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -1,7 +1,7 @@ - * Copyright (C) 2021 SuperAdmin - * Copyright (C) 2024 MDW +/* Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ global $langs, $user; // Libraries require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/lib/knowledgemanagement.lib.php"; +require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/class/knowledgerecord.class.php"; // Translations $langs->loadLangs(array("admin", "knowledgemanagement")); @@ -46,7 +47,7 @@ $scandir = GETPOST('scan_dir', 'alpha'); $type = 'knowledgemanagement'; $arrayofparameters = array( - 'KNOWLEDGEMANAGEMENT_MYPARAM1' => array('type' => 'string', 'css' => 'minwidth500' ,'enabled' => 0), + //'KNOWLEDGEMANAGEMENT_MYPARAM1' => array('type' => 'string', 'css' => 'minwidth500' ,'enabled' => 0), //'KNOWLEDGEMANAGEMENT_MYPARAM2'=>array('type'=>'textarea','enabled'=>1), //'KNOWLEDGEMANAGEMENT_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), //'KNOWLEDGEMANAGEMENT_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1), @@ -62,6 +63,20 @@ if (!$user->admin) { accessforbidden(); } +if (!getDolGlobalString('KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON')) { + $conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON = 'mod_knowledgerecord_standard'; +} + +$moduledir = 'knowledgemanagement'; +$myTmpObjects = array(); +// TODO Scan list of objects to fill this array +$myTmpObjects['knowledgemanagement'] = array('label' => 'KnowledgeManagement', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'KnowledgeRecord'); + +$tmpobjectkey = GETPOST('object', 'aZ09'); +if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) { + accessforbidden('Bad value for object. Hack attempt ?'); +} + /* * Actions @@ -71,10 +86,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { $maskconst = GETPOST('maskconst', 'aZ09'); - $maskorder = GETPOST('maskorder', 'alpha'); + $maskdata = GETPOST('maskKnowledgeRecord', 'alpha'); if ($maskconst && preg_match('/_MASK$/', $maskconst)) { - $res = dolibarr_set_const($db, $maskconst, $maskorder, 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, $maskconst, $maskdata, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } @@ -85,29 +100,29 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { +} elseif ($action == 'specimen' && $tmpobjectkey) { $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - $tmpobject = new $tmpobjectkey($db); + $className = $myTmpObjects[$tmpobjectkey]['class']; + $tmpobject = new $className($db); $tmpobject->initAsSpecimen(); // Search template files $file = ''; - $classname = ''; + $className = ''; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $classname = "pdf_".$modele; + $className = "pdf_".$modele; break; } } - if ($classname !== '') { + if ($className !== '') { require_once $file; - $module = new $classname($db); + $module = new $className($db); if ($module->write_file($tmpobject, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); @@ -122,7 +137,6 @@ if ($action == 'updateMask') { } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey)."_ADDON"; dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); @@ -133,7 +147,7 @@ if ($action == 'updateMask') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (getDolGlobalString($constforval) == "$value") { @@ -143,7 +157,6 @@ if ($action == 'updateMask') { } } elseif ($action == 'setdoc') { // Set or unset default model - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { @@ -159,7 +172,6 @@ if ($action == 'updateMask') { } } } elseif ($action == 'unsetdoc') { - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; dolibarr_del_const($db, $constforval, $conf->entity); @@ -332,16 +344,8 @@ if ($action == 'edit') { } -$moduledir = 'knowledgemanagement'; -$myTmpObjects = array(); -$myTmpObjects['MyObject'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); - - foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } - if ($myTmpObjectArray['includerefgeneration']) { + if (!empty($myTmpObjectArray['includerefgeneration'])) { /* * Orders Numbering model */ @@ -367,7 +371,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $handle = opendir($dir); if (is_resource($handle)) { while (($file = readdir($handle)) !== false) { - if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') { + if (strpos($file, 'mod_'.strtolower($myTmpObjectArray['class']).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); require_once $dir.'/'.$file.'.php'; @@ -403,17 +407,18 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print ''."\n"; print ''; - $constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON'; + $constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectArray['class']).'_ADDON'; if (getDolGlobalString($constforvar) == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } print ''; - $mytmpinstance = new $myTmpObjectKey($db); + $className = $myTmpObjectArray['class']; + $mytmpinstance = new $className($db); $mytmpinstance->initAsSpecimen(); // Info @@ -448,7 +453,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print "
\n"; } - if ($myTmpObjectArray['includedocgeneration']) { + if (!empty($myTmpObjectArray['includedocgeneration'])) { /* * Document templates generators */ @@ -507,10 +512,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); + $className = substr($file, 0, dol_strlen($file) - 12); require_once $dir.'/'.$file; - $module = new $classname($db); + $module = new $className($db); $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index ae1f8bf67d1..546427463da 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -681,7 +681,7 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu // Confirm deletion of record if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid).'&code='.urlencode($code).'&id='.((int) $id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid).'&id='.((int) $id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); } @@ -1101,7 +1101,7 @@ if ($num) { } print "\n"; - print ''; + print ''; print ''; $fieldsforcontent = array('topic', 'email_from','joinfiles', 'content'); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 893523f22da..435fb37e1f6 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1318,7 +1318,7 @@ if ($mode == 'deploy') { print ' '; - print ''; + print ''; if (getDolGlobalString('MAIN_UPLOAD_DOC')) { if ($user->admin) { diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index aa0a6a97852..43e29dfb535 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -181,7 +181,7 @@ print $langs->trans("NotificationsDescUser").'
'; if (isModEnabled("societe")) { print $langs->trans("NotificationsDescContact").'
'; } -print $langs->trans("NotificationsDescGlobal").'
'; +print $langs->trans("NotificationsDescGlobal").' - '.$langs->trans("YouAreHere").'
'; print ''; print '
'; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 9ba965e6bfc..fe6ad2cf8d3 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -160,253 +160,255 @@ if ($mode == 'setup' && $user->admin) { $oauthstateanticsrf = bin2hex(random_bytes(128 / 8)); // $list is defined into oauth.lib.php to the list of supporter OAuth providers. - foreach ($listinsetup as $key) { - $supported = 0; - $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME - $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array); - $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array); - if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { - $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); - $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); - } else { - $keybeforeprovider = $keyforsupportedoauth2array; - $keyforprovider = ''; - } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); - $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; + if (!empty($listinsetup)) { + foreach ($listinsetup as $key) { + $supported = 0; + $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME + $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array); + if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { + $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); + } else { + $keybeforeprovider = $keyforsupportedoauth2array; + $keyforprovider = ''; + } + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; - $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : '')); + $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : '')); - $shortscope = ''; - if (getDolGlobalString($key[4])) { - $shortscope = getDolGlobalString($key[4]); - } - $state = $shortscope; // TODO USe a better state + $shortscope = ''; + if (getDolGlobalString($key[4])) { + $shortscope = getDolGlobalString($key[4]); + } + $state = $shortscope; // TODO USe a better state - // Define $urltorenew, $urltodelete, $urltocheckperms - if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') { - // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). - // We pass this param list in to 'state' because we need it before and after the redirect. + // Define $urltorenew, $urltodelete, $urltocheckperms + if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') { + // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). + // We pass this param list in to 'state' because we need it before and after the redirect. - // Note: github does not accept csrf key inside the state parameter (only known values) - $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($shortscope).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltocheckperms = 'https://github.com/settings/applications/'; - } elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') { - // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). - // List of scopes for Google are here: https://developers.google.com/identity/protocols/oauth2/scopes - // We pass this key list into the param 'state' because we need it before and after the redirect. - $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltocheckperms = 'https://security.google.com/settings/security/permissions'; - } elseif (!empty($supportedoauth2array[$keyforsupportedoauth2array]['returnurl'])) { - $urltorenew = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltodelete = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltocheckperms = ''; - } else { - $urltorenew = ''; - $urltodelete = ''; - $urltocheckperms = ''; - } + // Note: github does not accept csrf key inside the state parameter (only known values) + $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($shortscope).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltocheckperms = 'https://github.com/settings/applications/'; + } elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') { + // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). + // List of scopes for Google are here: https://developers.google.com/identity/protocols/oauth2/scopes + // We pass this key list into the param 'state' because we need it before and after the redirect. + $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltocheckperms = 'https://security.google.com/settings/security/permissions'; + } elseif (!empty($supportedoauth2array[$keyforsupportedoauth2array]['returnurl'])) { + $urltorenew = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltodelete = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltocheckperms = ''; + } else { + $urltorenew = ''; + $urltodelete = ''; + $urltocheckperms = ''; + } - if ($urltorenew) { - $urltorenew .= '&keyforprovider='.urlencode($keyforprovider); - } - if ($urltodelete) { - $urltodelete .= '&keyforprovider='.urlencode($keyforprovider); - } + if ($urltorenew) { + $urltorenew .= '&keyforprovider='.urlencode($keyforprovider); + } + if ($urltodelete) { + $urltodelete .= '&keyforprovider='.urlencode($keyforprovider); + } - // Show value of token - $tokenobj = null; - // Token - require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; - // Dolibarr storage - $storage = new DoliStorage($db, $conf, $keyforprovider); - try { - // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' - print ''."\n"; - $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); - //print $storage->token.'
'; - //print $tokenobj->getExtraParams()['id_token'].'
'; - //print $tokenobj->getAccessToken().'
'; - } catch (Exception $e) { - // Return an error if token not found - //print $e->getMessage(); - } + // Show value of token + $tokenobj = null; + // Token + require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; + // Dolibarr storage + $storage = new DoliStorage($db, $conf, $keyforprovider); + try { + // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' + print ''."\n"; + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + //print $storage->token.'
'; + //print $tokenobj->getExtraParams()['id_token'].'
'; + //print $tokenobj->getAccessToken().'
'; + } catch (Exception $e) { + // Return an error if token not found + //print $e->getMessage(); + } - // Set other properties - $refreshtoken = false; - $expiredat = ''; + // Set other properties + $refreshtoken = false; + $expiredat = ''; - $expire = false; - // Is token expired or will token expire in the next 30 seconds - if (is_object($tokenobj)) { - $expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30)); - } - if ($key[1] != '' && $key[2] != '') { + $expire = false; + // Is token expired or will token expire in the next 30 seconds if (is_object($tokenobj)) { - $refreshtoken = $tokenobj->getRefreshToken(); + $expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30)); + } + if ($key[1] != '' && $key[2] != '') { + if (is_object($tokenobj)) { + $refreshtoken = $tokenobj->getRefreshToken(); - $endoflife = $tokenobj->getEndOfLife(); - if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES) { - $expiredat = $langs->trans("Never"); - } elseif ($endoflife == $tokenobj::EOL_UNKNOWN) { - $expiredat = $langs->trans("Unknown"); - } else { - $expiredat = dol_print_date($endoflife, "dayhour", 'tzuserrel'); + $endoflife = $tokenobj->getEndOfLife(); + if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES) { + $expiredat = $langs->trans("Never"); + } elseif ($endoflife == $tokenobj::EOL_UNKNOWN) { + $expiredat = $langs->trans("Unknown"); + } else { + $expiredat = dol_print_date($endoflife, "dayhour", 'tzuserrel'); + } } } - } - $submit_enabled = 0; + $submit_enabled = 0; - print '
'; - print ''; - print ''; + print ''; + print ''; + print ''; - print '
'; - print ''."\n"; + print '
'; + print '
'."\n"; - // Api Name - $label = $langs->trans($keyforsupportedoauth2array); - print ''; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - print ''; - //var_dump($key); - print $langs->trans("OAuthIDSecret").''; - print ''; - print ''; - print ''."\n"; - - // Scopes - print ''; - print ''; - print ''; - - print ''; - print ''; - //var_dump($key); - print $langs->trans("IsTokenGenerated"); - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print "\n"; + + print ''; + print ''; + //var_dump($key); + print $langs->trans("OAuthIDSecret").''; + print ''; + print ''; + print ''."\n"; + + // Scopes + print ''; + print ''; + print ''; + + print ''; + print ''; + //var_dump($key); + print $langs->trans("IsTokenGenerated"); + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + //var_dump($key); + print $langs->trans("Token").''; + print ''; + print ''."\n"; + + if (is_object($tokenobj)) { + // Token refresh + print ''; + print ''; + //var_dump($key); + print $langs->trans("TOKEN_REFRESH"); + print ''; + print ''; + print ''; + + // Token expired + print ''; + print ''; + //var_dump($key); + print $langs->trans("TOKEN_EXPIRED"); + print ''; + print ''; + print ''; + + // Token expired at + print ''; + print ''; + //var_dump($key); + print $langs->trans("TOKEN_EXPIRE_AT"); + print ''; + print ''; + print ''; + } + + print '
'; - print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"'); - if ($label == $keyforsupportedoauth2array) { - print $supportedoauth2array[$keyforsupportedoauth2array]['name']; - } else { - print $label; - } - if ($keyforprovider) { - print ' ('.$keyforprovider.')'; - } else { - print ' ('.$langs->trans("NoName").')'; - } - print '
'; - print ''.$langs->trans("SeePreviousTab").''; - print ''; - print '
'.$langs->trans("Scopes").''; - $currentscopes = getDolGlobalString($key[4]); - print $currentscopes; - print '
'; - if (is_object($tokenobj)) { - print $form->textwithpicto(yn(1), $langs->trans("HasAccessToken").' : '.dol_print_date($storage->date_modification, 'dayhour').' state='.dol_escape_htmltag($storage->state)); - } else { - print ''.$langs->trans("NoAccessToken").''; - } - print ''; - // Links to delete/checks token - if (is_object($tokenobj)) { - //test on $storage->hasAccessToken($OAUTH_SERVICENAME) ? - if ($urltodelete) { - print ''.$langs->trans('DeleteAccess').'
'; + // Api Name + $label = $langs->trans($keyforsupportedoauth2array); + print '
'; + print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"'); + if ($label == $keyforsupportedoauth2array) { + print $supportedoauth2array[$keyforsupportedoauth2array]['name']; } else { - print ''.$langs->trans('GoOnTokenProviderToDeleteToken').'
'; + print $label; } - } - // Request remote token - if ($urltorenew) { - print ''.$langs->trans('GetAccess').''; - print $form->textwithpicto('', $langs->trans('RequestAccess')); + if ($keyforprovider) { + print ' ('.$keyforprovider.')'; + } else { + print ' ('.$langs->trans("NoName").')'; + } + print '
'; + print ''.$langs->trans("SeePreviousTab").''; + print ''; + print '
'.$langs->trans("Scopes").''; + $currentscopes = getDolGlobalString($key[4]); + print $currentscopes; + print '
'; + if (is_object($tokenobj)) { + print $form->textwithpicto(yn(1), $langs->trans("HasAccessToken").' : '.dol_print_date($storage->date_modification, 'dayhour').' state='.dol_escape_htmltag($storage->state)); + } else { + print ''.$langs->trans("NoAccessToken").''; + } + print ''; + // Links to delete/checks token + if (is_object($tokenobj)) { + //test on $storage->hasAccessToken($OAUTH_SERVICENAME) ? + if ($urltodelete) { + print ''.$langs->trans('DeleteAccess').'
'; + } else { + print ''.$langs->trans('GoOnTokenProviderToDeleteToken').'
'; + } + } + // Request remote token + if ($urltorenew) { + print ''.$langs->trans('GetAccess').''; + print $form->textwithpicto('', $langs->trans('RequestAccess')); + print '
'; + } + // Check remote access + if ($urltocheckperms) { + print '
'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': '.$urltocheckperms.''; + } + print '
'; + + if (is_object($tokenobj)) { + $tokentoshow = $tokenobj->getAccessToken(); + print ''.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'
'; + //print 'Refresh: '.$tokenobj->getRefreshToken().'
'; + //print 'EndOfLife: '.$tokenobj->getEndOfLife().'
'; + //var_dump($tokenobj->getExtraParams()); + /*print '
Extra:
';*/ + } + print '
'; + print ''.showValueWithClipboardCPButton($refreshtoken, 1, dol_trunc($refreshtoken, 32)).''; + print '
'; + print yn($expire); + print '
'; + print $expiredat; + print '
'; + print '
'; + + if (!empty($driver)) { + if ($submit_enabled) { + print $form->buttonsSaveCancel("Modify", ''); + } + } + + print '
'; print '
'; } - // Check remote access - if ($urltocheckperms) { - print '
'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': '.$urltocheckperms.''; - } - print ''; - print ''; - - print ''; - print ''; - //var_dump($key); - print $langs->trans("Token").''; - print ''; - - if (is_object($tokenobj)) { - $tokentoshow = $tokenobj->getAccessToken(); - print ''.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'
'; - //print 'Refresh: '.$tokenobj->getRefreshToken().'
'; - //print 'EndOfLife: '.$tokenobj->getEndOfLife().'
'; - //var_dump($tokenobj->getExtraParams()); - /*print '
Extra:
';*/ - } - print ''; - print ''."\n"; - - if (is_object($tokenobj)) { - // Token refresh - print ''; - print ''; - //var_dump($key); - print $langs->trans("TOKEN_REFRESH"); - print ''; - print ''; - print ''.showValueWithClipboardCPButton($refreshtoken, 1, dol_trunc($refreshtoken, 32)).''; - print ''; - print ''; - - // Token expired - print ''; - print ''; - //var_dump($key); - print $langs->trans("TOKEN_EXPIRED"); - print ''; - print ''; - print yn($expire); - print ''; - print ''; - - // Token expired at - print ''; - print ''; - //var_dump($key); - print $langs->trans("TOKEN_EXPIRE_AT"); - print ''; - print ''; - print $expiredat; - print ''; - print ''; - } - - print ''; - print '
'; - - if (!empty($driver)) { - if ($submit_enabled) { - print $form->buttonsSaveCancel("Modify", ''); - } - } - - print ''; - print '
'; } } diff --git a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php b/htdocs/admin/receptiondet_batch_extrafields.php similarity index 94% rename from htdocs/admin/commande_fournisseur_dispatch_extrafields.php rename to htdocs/admin/receptiondet_batch_extrafields.php index 277d61e1b2f..ea98618dda0 100644 --- a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php +++ b/htdocs/admin/receptiondet_batch_extrafields.php @@ -25,7 +25,7 @@ */ /** - * \file htdocs/admin/commande_fournisseur_dispatch_extrafields.php + * \file htdocs/admin/receptiondet_batch.php * \ingroup reception * \brief Page to setup extra fields of reception */ @@ -56,7 +56,7 @@ foreach ($tmptype2label as $key => $val) { $action = GETPOST('action', 'aZ09'); $attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'commande_fournisseur_dispatch'; //Must be the $table_element of the class that manage extrafield +$elementtype = 'receptiondet_batch'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index a9c87ca61a3..14ea98ccc00 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -90,31 +90,31 @@ print ''; if (preg_match('/^fr_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("France")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("CountryFR")).''; print '
  • '; } if (preg_match('/^el_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Greece")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("CountryGR")).''; print '
  • '; } if (preg_match('/^es_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Spain")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("CountryES")).''; print '
  • '; } if (preg_match('/^it_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Italy")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("CountryIT")).''; print '
  • '; } if (preg_match('/^de_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("CountryDE")).''; print '
  • '; }*/ print '
  • '; diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index e122150571b..14121aebab8 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -39,6 +39,7 @@ if (!$user->admin) { accessforbidden(); } +$table = GETPOST('table', 'aZ09'); $action = GETPOST('action', 'aZ09'); @@ -46,16 +47,20 @@ $action = GETPOST('action', 'aZ09'); * Actions */ -if ($action == 'convert') { - $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB"; +if ($action == 'convert') { // Convert engine into innodb + $sql = "ALTER TABLE ".$db->sanitize($table)." ENGINE=INNODB"; $db->query($sql); } if ($action == 'convertutf8') { - $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + $sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + $db->query($sql); +} +if ($action == 'convertutf8mb4') { + $sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"; $db->query($sql); } if ($action == 'convertdynamic') { - $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ROW_FORMAT=DYNAMIC;"; + $sql = "ALTER TABLE ".$db->sanitize($table)." ROW_FORMAT=DYNAMIC;"; $db->query($sql); } @@ -160,16 +165,24 @@ if (!$base) { print '
    '.$langs->trans("Convert").' Dynamic'; } print ''; - print ''.$obj->Rows.''; - print ''.$obj->Avg_row_length.''; - print ''.$obj->Data_length.''; - print ''.$obj->Max_data_length.''; - print ''.$obj->Index_length.''; - print ''.$obj->Auto_increment.''; - print ''.$obj->Check_time.''; - print ''.$obj->Collation; - if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci")))) { - print '
    '.$langs->trans("Convert").' UTF8'; + print ''.$obj->Rows.''; + print ''.$obj->Avg_row_length.''; + print ''.$obj->Data_length.''; + print ''.$obj->Max_data_length.''; + print ''.$obj->Index_length.''; + print ''.$obj->Auto_increment.''; + print ''.$obj->Check_time.''; + print ''.$obj->Collation; + // Link to convert collation + if (isset($obj->Collation)) { + print '
    '.$langs->trans("ConvertInto"); + if (!in_array($obj->Collation, array("utf8_unicode_ci"))) { + print ' utf8'; + } + if (!in_array($obj->Collation, array("utf8mb4_unicode_ci"))) { + print ' utf8mb4'; + } + print ''; } print ''; print ''; diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index 1f95458a8b2..01e1c5f28b6 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier + * 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 @@ -53,6 +54,7 @@ print ''.$langs->trans("DatabaseServer").''.$langs->trans("DatabasePort").''.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).''."\n"; print ''.$langs->trans("DatabaseName").''.$conf->db->name.''."\n"; print ''.$langs->trans("DriverType").''.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').''."\n"; +// @phan-suppress-next-line PhanTypeSuspiciousStringExpression (user is defined in the stdClass) print ''.$langs->trans("User").''.$conf->db->user.''."\n"; print ''.$langs->trans("Password").''.preg_replace('/./i', '*', $dolibarr_main_db_pass).''."\n"; print ''.$langs->trans("DBStoringCharset").''.$db->getDefaultCharacterSetDatabase().''."\n"; diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index c7e7c5baa5e..2cec477994f 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -33,7 +33,57 @@ if (!$user->admin) { accessforbidden(); } -$table = GETPOST('table', 'alpha'); +$table = GETPOST('table', 'aZ09'); +$field = GETPOST('field', 'aZ09'); +$action = GETPOST('action', 'aZ09'); + + +/* + * Actions + */ + +if ($action == 'convertutf8') { + $sql = "SHOW FULL COLUMNS IN ".$db->sanitize($table); + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $db->fetch_row($resql); + if ($row[0] == $field) { + $sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." CHARACTER SET utf8"; // We must not sanitize the $row[1] + $db->query($sql); + + $sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." COLLATE utf8_unicode_ci"; // We must not sanitize the $row[1] + $db->query($sql); + + break; + } + } + } +} +if ($action == 'convertutf8mb4') { + $sql = "SHOW FULL COLUMNS IN ".$db->sanitize($table); + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $db->fetch_row($resql); + if ($row[0] == $field) { + $sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." CHARACTER SET utf8mb4"; // We must not sanitize the $row[1] + $db->query($sql); + + $sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." COLLATE utf8mb4_unicode_ci"; // We must not sanitize the $row[1] + $db->query($sql); + + break; + } + } + } +} /* @@ -48,7 +98,7 @@ print load_fiche_titre($langs->trans("Table")." ".$table, '', 'title_setup'); // Define request to get table description $base = 0; if (preg_match('/mysql/i', $conf->db->type)) { - $sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'"; + $sql = "SHOW TABLE STATUS LIKE '".$db->escape($db->escapeforlike($table))."'"; $base = 1; } elseif ($conf->db->type == 'pgsql') { $sql = "SELECT conname,contype FROM pg_constraint"; @@ -99,7 +149,7 @@ if (!$base) { print ''; // $sql = "DESCRIBE ".$table; - $sql = "SHOW FULL COLUMNS IN ".$db->escape($table); + $sql = "SHOW FULL COLUMNS IN ".$db->sanitize($table); $resql = $db->query($sql); if ($resql) { @@ -109,12 +159,46 @@ if (!$base) { $row = $db->fetch_row($resql); print ''; + // field print "".$row[0].""; + // type - print "".$row[1].""; + print ""; + $proptype = $row[1]; + $pictoType = ''; + $matches = array(); + if (preg_match('/^varchar/', $proptype, $matches)) { + $pictoType = 'varchar'; + } elseif (strpos($proptype, 'int') === 0 || strpos($proptype, 'tinyint') === 0 || strpos($proptype, 'bigint') === 0) { + $pictoType = 'int'; + } elseif (strpos($proptype, 'timestamp') === 0) { + $pictoType = 'datetime'; + } elseif (strpos($proptype, 'real') === 0) { + $pictoType = 'double'; + } + print(!empty($pictoType) ? getPictoForType($pictoType) : getPictoForType($proptype)).''.dol_escape_htmltag($proptype).''; + print ""; + // collation - print "".$row[2].""; + print "".(empty($row[2]) ? ' ' : $row[2]); + + // Link to convert collation + if (isset($row[2])) { + print '
    '.$langs->trans("ConvertInto"); + if (!in_array($row[2], array("utf8_unicode_ci"))) { + print ' utf8'; + } + if (!in_array($row[2], array("utf8mb4_unicode_ci"))) { + print ' utf8mb4'; + } + print ''; + } else { + print '
     '; + } + + print ""; + // null print "".$row[3].""; // key diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 89912dd030e..349a0ead610 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -311,7 +311,7 @@ print ''; if ($sortfield == "name" && $sortorder == "asc") { usort( $moduleList, - /** @return bool */ + /** @return int */ function (stdClass $a, stdClass $b) { return strcasecmp($a->name, $b->name); } @@ -319,7 +319,7 @@ if ($sortfield == "name" && $sortorder == "asc") { } elseif ($sortfield == "name" && $sortorder == "desc") { usort( $moduleList, - /** @return bool */ + /** @return int */ static function (stdClass $a, stdClass $b) { return strcasecmp($b->name, $a->name); } @@ -327,7 +327,7 @@ if ($sortfield == "name" && $sortorder == "asc") { } elseif ($sortfield == "version" && $sortorder == "asc") { usort( $moduleList, - /** @return bool */ + /** @return int */ static function (stdClass $a, stdClass $b) { return strcasecmp($a->version, $b->version); } @@ -335,7 +335,7 @@ if ($sortfield == "name" && $sortorder == "asc") { } elseif ($sortfield == "version" && $sortorder == "desc") { usort( $moduleList, - /** @return bool */ + /** @return int */ static function (stdClass $a, stdClass $b) { return strcasecmp($b->version, $a->version); } diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 307f4e3a579..fa6547f2eb0 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -51,14 +51,15 @@ if ($mode == 'searchkey') { $transvalue = GETPOST('transvalue', 'restricthtml'); } - +// 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 == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -248,7 +249,7 @@ if ($transvalue) { } -print '
    entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">'; +print ''; if (isset($optioncss) && $optioncss != '') { print ''; } @@ -400,12 +401,12 @@ if ($mode == 'overwrite') { print ''; - print ''.$obj->lang.''."\n"; + print ''.dol_escape_htmltag($obj->lang).''."\n"; print ''; if ($action == 'edit' && $obj->rowid == GETPOSTINT('rowid')) { print ''; } else { - print $obj->transkey; + print dol_escape_htmltag($obj->transkey); } print ''."\n"; @@ -420,7 +421,7 @@ if ($mode == 'overwrite') { print ''; } else { //print $obj->transkey.' '.$langsenfileonly->tab_translate[$obj->transkey]; - $titleforvalue = $langs->trans("Translation").' en_US for key '.$obj->transkey.':
    '.($langsenfileonly->tab_translate[$obj->transkey] ? $langsenfileonly->trans($obj->transkey) : ''.$langs->trans("None").''); + $titleforvalue = $langs->trans("Translation").' en_US for key '.$obj->transkey.':
    '.(!empty($langsenfileonly->tab_translate[$obj->transkey]) ? $langsenfileonly->trans($obj->transkey) : ''.$langs->trans("None").''); /*if ($obj->lang != 'en_US') { $titleforvalue .= '
    '.$langs->trans("Translation").' '.$obj->lang.' '...; }*/ @@ -437,9 +438,9 @@ if ($mode == 'overwrite') { print '   '; print ''; } else { - print ''.img_edit().''; + print ''.img_edit().''; print '   '; - print ''.img_delete().''; + print ''.img_delete().''; } print ''; @@ -565,7 +566,7 @@ if ($mode == 'searchkey') { if ($i <= $offset) { continue; } - if ($i > ($offset + $limit)) { + if ($limit && $i > ($offset + $limit)) { break; } print ''.$langcode.''.$key.''; diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index 4758220503d..a0ef3ee897c 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -90,44 +90,9 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { - $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); - - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/webhook/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); - break; - } - } - - if ($classname !== '') { - require_once $file; - - $module = new $classname($db); - - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=webhook-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; - } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); - } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey)."_ADDON"; dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); @@ -138,7 +103,7 @@ if ($action == 'updateMask') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (getDolGlobalString($constforval) == "$value") { @@ -148,7 +113,7 @@ if ($action == 'updateMask') { } } elseif ($action == 'setdoc') { // Set or unset default model - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { @@ -164,7 +129,7 @@ if ($action == 'updateMask') { } } } elseif ($action == 'unsetdoc') { - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; dolibarr_del_const($db, $constforval, $conf->entity); @@ -375,269 +340,6 @@ if ($action == 'edit') { } -$moduledir = 'webhook'; -$myTmpObjects = array(); -$myTmpObjects['MyObject'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); - - -foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } - if ($myTmpObjectArray['includerefgeneration']) { - /* - * Orders Numbering model - */ - $setupnotempty++; - - print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''."\n"; - - clearstatcache(); - - foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/".$moduledir); - - if (is_dir($dir)) { - $handle = opendir($dir); - if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { - if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') { - $file = substr($file, 0, dol_strlen($file) - 4); - - require_once $dir.'/'.$file.'.php'; - - $module = new $file($db); - - // Show modules according to features level - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { - continue; - } - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { - continue; - } - - if ($module->isEnabled()) { - dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php'); - - print ''; - - // Show example of numbering model - print ''."\n"; - - print ''; - - $mytmpinstance = new $myTmpObjectKey($db); - $mytmpinstance->initAsSpecimen(); - - // Info - $htmltooltip = ''; - $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
    '; - - $nextval = $module->getNextValue($mytmpinstance); - if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval - $htmltooltip .= ''.$langs->trans("NextValue").': '; - if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { - $nextval = $langs->trans($nextval); - } - $htmltooltip .= $nextval.'
    '; - } else { - $htmltooltip .= $langs->trans($module->error).'
    '; - } - } - - print ''; - - print "\n"; - } - } - } - closedir($handle); - } - } - } - print "
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
    '.$module->name."\n"; - print $module->info($langs); - print ''; - $tmp = $module->getExample(); - if (preg_match('/^Error/', $tmp)) { - $langs->load("errors"); - print '
    '.$langs->trans($tmp).'
    '; - } elseif ($tmp == 'NotConfigured') { - print $langs->trans($tmp); - } else { - print $tmp; - } - print '
    '; - $constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON'; - if (getDolGlobalString($constforvar) == $file) { - print img_picto($langs->trans("Activated"), 'switch_on'); - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); - print '

    \n"; - } - - if ($myTmpObjectArray['includedocgeneration']) { - /* - * Document templates generators - */ - $setupnotempty++; - $type = strtolower($myTmpObjectKey); - - print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', ''); - - // Load array def with activated templates - $def = array(); - $sql = "SELECT nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; - $sql .= " WHERE type = '".$db->escape($type)."'"; - $sql .= " AND entity = ".$conf->entity; - $resql = $db->query($sql); - if ($resql) { - $i = 0; - $num_rows = $db->num_rows($resql); - while ($i < $num_rows) { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; - } - } else { - dol_print_error($db); - } - - print "\n"; - print "\n"; - print ''; - print ''; - print '\n"; - print '\n"; - print ''; - print ''; - print "\n"; - - clearstatcache(); - - foreach ($dirmodels as $reldir) { - foreach (array('', '/doc') as $valdir) { - $realpath = $reldir."core/modules/".$moduledir.$valdir; - $dir = dol_buildpath($realpath); - - if (is_dir($dir)) { - $handle = opendir($dir); - if (is_resource($handle)) { - $filelist = array(); - while (($file = readdir($handle)) !== false) { - $filelist[] = $file; - } - closedir($handle); - arsort($filelist); - - foreach ($filelist as $file) { - if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); - - require_once $dir.'/'.$file; - $module = new $classname($db); - - $modulequalified = 1; - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { - $modulequalified = 0; - } - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { - $modulequalified = 0; - } - - if ($modulequalified) { - print ''; - - // Active - if (in_array($name, $def)) { - print ''; - } else { - print '"; - } - - // Default - print ''; - - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip .= '
    '.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); - if ($module->type == 'pdf') { - $htmltooltip .= '
    '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - } - $htmltooltip .= '
    '.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; - - $htmltooltip .= '

    '.$langs->trans("FeaturesSupported").':'; - $htmltooltip .= '
    '.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - $htmltooltip .= '
    '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); - - print ''; - - // Preview - print ''; - - print "\n"; - } - } - } - } - } - } - } - } - - print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
    '; - print(empty($module->name) ? $name : $module->name); - print "\n"; - if (method_exists($module, 'info')) { - print $module->info($langs); - } else { - print $module->description; - } - print ''."\n"; - print ''; - print img_picto($langs->trans("Enabled"), 'switch_on'); - print ''; - print ''."\n"; - print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; - print "'; - $constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON'; - if (getDolGlobalString($constforvar) == $name) { - //print img_picto($langs->trans("Default"), 'on'); - // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset - print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; - } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; - } - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); - print ''; - if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'pdf').''; - } else { - print img_object($langs->trans("PreviewNotAvailable"), 'generic'); - } - print '
    '; - } -} - if (empty($setupnotempty)) { print '
    '.$langs->trans("NothingToSetup"); } diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 2e28dc8a6f9..d68b7c054ef 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -158,7 +158,7 @@ $workflowcodes = array( 'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array( 'family' => 'classify_shipping', 'position' => 90, - 'enabled' => isModEnabled("expedition") && isModEnabled("facture"), + 'enabled' => isModEnabled("shipping") && isModEnabled("invoice"), 'picto' => 'shipment', 'deprecated' => 1 ), @@ -217,10 +217,10 @@ $workflowcodes = array_filter( $workflowcodes, /** * @param array{enabled:int<0,1>} $var - * @return int<0,1> + * @return bool */ static function ($var) { - return $var['enabled']; + return (bool) $var['enabled']; } ); diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index 78084737c6e..11d0b08e7f3 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -51,6 +51,15 @@ if (!$user->admin) { accessforbidden(); } +$moduledir = 'workstation'; +$myTmpObjects = array(); +$myTmpObjects['workstation'] = array('label' => 'Workstation', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'Workstation'); + +$tmpobjectkey = GETPOST('object', 'aZ09'); +if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) { + accessforbidden('Bad value for object. Hack attempt ?'); +} + /* * Actions @@ -77,9 +86,9 @@ if ($action == 'updateMask') { } } elseif ($action == 'specimen') { $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - $tmpobject = new $tmpobjectkey($db); + $nameofclass = ucfirst($tmpobjectkey); + $tmpobject = new $nameofclass($db); $tmpobject->initAsSpecimen(); // Search template files @@ -114,8 +123,6 @@ if ($action == 'updateMask') { // Activate a model $ret = addDocumentModel($value, $type, $label, $scandir); } elseif ($action == 'del') { - $tmpobjectkey = GETPOST('object'); - $ret = delDocumentModel($value, $type); if ($ret > 0) { $constforval = strtoupper($tmpobjectkey).'_ADDON_PDF'; @@ -125,7 +132,6 @@ if ($action == 'updateMask') { } } elseif ($action == 'setdoc') { // Set default model - $tmpobjectkey = GETPOST('object'); $constforval = strtoupper($tmpobjectkey).'_ADDON_PDF'; if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { // The constant that was read before the new set @@ -141,7 +147,6 @@ if ($action == 'updateMask') { } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated // by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); $constforval = 'WORKSTATION_'.strtoupper($tmpobjectkey)."_ADDON"; dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); } @@ -219,11 +224,6 @@ if ($action == 'edit') { } -$moduledir = 'workstation'; -$myTmpObjects = array(); -$myTmpObjects['workstation'] = array('includerefgeneration' => 1, 'includedocgeneration' => 0); - - foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey == 'MyObject') { continue; diff --git a/htdocs/ai/admin/custom_prompt.php b/htdocs/ai/admin/custom_prompt.php index 628b3adf568..83506888d74 100644 --- a/htdocs/ai/admin/custom_prompt.php +++ b/htdocs/ai/admin/custom_prompt.php @@ -159,10 +159,10 @@ if ($action == 'confirm_deleteproperty' && GETPOST('confirm') == 'yes') { $res = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity); if ($res) { header("Location: ".$_SERVER['PHP_SELF']); - setEventMessages($langs->trans("SetupDeleted"), null, 'mesgs'); + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); exit; } else { - setEventMessages($langs->trans("ErrorDeleting"), null, 'errors'); + setEventMessages($langs->trans("NoRecordDeleted"), null, 'errors'); } } } @@ -207,7 +207,7 @@ if ($action == 'deleteproperty') { } if ($action == 'edit') { - $out .= ''; + $out = ''; $out .= ''; $out .= ''; diff --git a/htdocs/ai/admin/setup.php b/htdocs/ai/admin/setup.php index 9459b501b84..e74f3c3b5d9 100644 --- a/htdocs/ai/admin/setup.php +++ b/htdocs/ai/admin/setup.php @@ -88,103 +88,6 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -if ($action == 'updateMask') { - $maskconst = GETPOST('maskconst', 'aZ09'); - $maskvalue = GETPOST('maskvalue', 'alpha'); - - if ($maskconst && preg_match('/_MASK$/', $maskconst)) { - $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } - - if (!$error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} elseif ($action == 'specimen') { - $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); - - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/ai/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); - break; - } - } - - if ($classname !== '') { - require_once $file; - - $module = new $classname($db); - - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bookcal-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; - } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); - } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } -} elseif ($action == 'setmod') { - // TODO Check if numbering module chosen can be activated by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); - if (!empty($tmpobjectkey)) { - $constforval = 'Ai_'.strtoupper($tmpobjectkey)."_ADDON"; - dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); - } -} elseif ($action == 'set') { - // Activate a model - $ret = addDocumentModel($value, $type, $label, $scandir); -} elseif ($action == 'del') { - $ret = delDocumentModel($value, $type); - if ($ret > 0) { - $tmpobjectkey = GETPOST('object'); - if (!empty($tmpobjectkey)) { - $constforval = 'Ai_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if (getDolGlobalString($constforval) == "$value") { - dolibarr_del_const($db, $constforval, $conf->entity); - } - } - } -} elseif ($action == 'setdoc') { - // Set or unset default model - $tmpobjectkey = GETPOST('object'); - if (!empty($tmpobjectkey)) { - $constforval = 'Ai_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { - // The constant that was read before the new set - // We therefore requires a variable to have a coherent view - $conf->global->$constforval = $value; - } - - // We disable/enable the document template (into llx_document_model table) - $ret = delDocumentModel($value, $type); - if ($ret > 0) { - $ret = addDocumentModel($value, $type, $label, $scandir); - } - } -} elseif ($action == 'unsetdoc') { - $tmpobjectkey = GETPOST('object'); - if (!empty($tmpobjectkey)) { - $constforval = 'Ai_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - dolibarr_del_const($db, $constforval, $conf->entity); - } -} - $action = 'edit'; @@ -208,9 +111,6 @@ print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); $head = aiAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "fa-microchip"); -// Setup page goes here -//echo ''.$langs->trans("AiSetupPage").'

    '; - if ($action == 'edit') { print $formSetup->generateOutput(true); diff --git a/htdocs/ai/ajax/generate_content.php b/htdocs/ai/ajax/generate_content.php index 11aaa3e787b..ad854743b20 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -68,12 +68,12 @@ $format = empty($jsonData['instructions']) ? '' : $jsonData['instructions']; $generatedContent = $ai->generateContent($instructions, 'auto', $function, $format); if (is_array($generatedContent) && $generatedContent['error']) { - // client errors - if ($generatedContent['code'] >= 400) { - print "Error : " . $generatedContent['message']; - print '
    '.$langs->trans('Check Config of Module').''; - } elseif ($generatedContent['code'] == 429) { + // Output error + if (!empty($generatedContent['code']) && $generatedContent['code'] == 429) { print "Quota or allowed period exceeded. Retry Later !"; + } elseif ($generatedContent['code'] >= 400) { + print "Error : " . $generatedContent['message']; + print '
    '.$langs->trans('ErrorGoToModuleSetup').''; } else { print "Error returned by API call: " . $generatedContent['message']; } diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index 68002b62bb8..7b46636c411 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -28,6 +28,7 @@ class Ai * @var DoliDB $db Database object */ protected $db; + /** * @var string $apiEndpoint */ @@ -131,9 +132,12 @@ class Ai 'Authorization: Bearer ' . $this->apiKey, 'Content-Type: application/json' ]); - $response = getURLContent($this->apiEndpoint, 'POST', $payload, $headers); + $response = getURLContent($this->apiEndpoint, 'POST', $payload, 1, $headers); - if ($response['http_code'] != 200) { + if (empty($response['http_code'])) { + throw new Exception('API request failed. No http received'); + } + if (!empty($response['http_code']) && $response['http_code'] != 200) { throw new Exception('API request failed with status code ' . $response['http_code']); } // Decode JSON response @@ -149,7 +153,17 @@ class Ai return $generatedEmailContent; } catch (Exception $e) { - return array('error' => true, 'message' => $e->getMessage()); + $errormessage = $e->getMessage(); + if (!empty($response['content'])) { + $decodedResponse = json_decode($response['content'], true); + + // With OpenAI, error is into an object error into the content + if (!empty($decodedResponse['error']['message'])) { + $errormessage .= ' - '.$decodedResponse['error']['message']; + } + } + + return array('error' => true, 'message' => $errormessage, 'code' => (empty($response['http_code']) ? 0 : $response['http_code']), 'curl_error_no' => (empty($response['curl_error_no']) ? $response['curl_error_no'] : '')); } } } diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 2c222dd5c08..385360608eb 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -497,7 +497,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'expensereport') { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; - if (!DolibarrApiAccess::$user->hasRight('expensereport', 'read') && !DolibarrApiAccess::$user->hasRights('expensereport', 'read')) { + if (!DolibarrApiAccess::$user->hasRight('expensereport', 'read') && !DolibarrApiAccess::$user->hasRight('expensereport', 'read')) { throw new RestException(403); } diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index cd8c4d3efb9..77f337743fc 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +50,7 @@ class Login * Login * * Request the API token for a couple username / password. - * WARNING: You should NEVER use this API, like you should never use the similare API that uses the POST method. This will expose your password. + * WARNING: You should NEVER use this API, like you should never use the similar API that uses the POST method. This will expose your password. * To use the APIs, you should instead set an API token to the user you want to allow to use API (This API token called DOLAPIKEY can be found/set on the user page) and use this token as credential for any API call. * From the API explorer, you can enter directly the "DOLAPIKEY" into the field at the top right of the page to get access to any allowed APIs. * @@ -73,7 +74,7 @@ class Login * Login * * Request the API token for a couple username / password. - * WARNING: You should NEVER use this API, like you should never use the similare API that uses the POST method. This will expose your password. + * WARNING: You should NEVER use this API, like you should never use the similar API that uses the POST method. This will expose your password. * To use the APIs, you should instead set an API token to the user you want to allow to use API (This API token called DOLAPIKEY can be found/set on the user page) and use this token as credential for any API call. * From the API explorer, you can enter directly the "DOLAPIKEY" into the field at the top right of the page to get access to any allowed APIs. * diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 40e37464e90..0016c5e82e5 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -64,6 +64,15 @@ $setupnotempty = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); +$moduledir = 'asset'; +$myTmpObjects = array(); +$myTmpObjects['asset'] = array('label' => 'Asset', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'Asset'); + +$tmpobjectkey = GETPOST('object', 'aZ09'); +if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) { + accessforbidden('Bad value for object. Hack attempt ?'); +} + /* * Actions @@ -87,11 +96,11 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { +} elseif ($action == 'specimen' && $tmpobjectkey) { $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - $tmpobject = new $tmpobjectkey($db); + $className = $myTmpObjects[$tmpobjectkey]['class']; + $tmpobject = new $className($db); $tmpobject->initAsSpecimen(); // Search template files @@ -124,7 +133,6 @@ if ($action == 'updateMask') { } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'ASSET_'.strtoupper($tmpobjectkey)."_ADDON"; dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); @@ -135,7 +143,6 @@ if ($action == 'updateMask') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'ASSET_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (getDolGlobalString($constforval) == "$value") { @@ -145,7 +152,6 @@ if ($action == 'updateMask') { } } elseif ($action == 'setdoc') { // Set or unset default model - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'ASSET_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { @@ -161,7 +167,6 @@ if ($action == 'updateMask') { } } } elseif ($action == 'unsetdoc') { - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'ASSET_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; dolibarr_del_const($db, $constforval, $conf->entity); @@ -194,15 +199,7 @@ print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "asse echo ''.$langs->trans("AssetSetupPage").''; -$moduledir = 'asset'; -$myTmpObjects = array(); -$myTmpObjects['Asset'] = array('includerefgeneration' => 1, 'includedocgeneration' => 0); - - foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { /* * Assets Numbering model @@ -275,7 +272,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print ''; - $mytmpinstance = new $myTmpObjectKey($db); + $className = $myTmpObjectArray['class']; + $mytmpinstance = new $className($db); $mytmpinstance->initAsSpecimen(); // Info diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 3d62ba4c91a..ed7a57e3af5 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -94,7 +94,7 @@ class Asset extends CommonObject */ /** - * @var array|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}> 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,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}> 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"), @@ -1548,7 +1548,7 @@ class Asset extends CommonObject $dir = dol_buildpath($reldir."core/modules/asset/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index 0aa62c55919..dac2d1ad194 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -65,7 +65,7 @@ class AssetDepreciationOptions extends CommonObject */ /** - * @var array|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}> 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,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}> 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 8576e5ee37e..51243277071 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -100,7 +100,7 @@ class AssetModel extends CommonObject */ /** - * @var array|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}> 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,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}> 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/tpl/accountancy_codes_edit.tpl.php b/htdocs/asset/tpl/accountancy_codes_edit.tpl.php index 93a261c442a..d0bd4f0c468 100644 --- a/htdocs/asset/tpl/accountancy_codes_edit.tpl.php +++ b/htdocs/asset/tpl/accountancy_codes_edit.tpl.php @@ -27,7 +27,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (!is_object($form)) { diff --git a/htdocs/asset/tpl/accountancy_codes_view.tpl.php b/htdocs/asset/tpl/accountancy_codes_view.tpl.php index 16c333b8c6b..b48f642c4c2 100644 --- a/htdocs/asset/tpl/accountancy_codes_view.tpl.php +++ b/htdocs/asset/tpl/accountancy_codes_view.tpl.php @@ -28,7 +28,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (!is_object($form)) { diff --git a/htdocs/asset/tpl/depreciation_options_edit.tpl.php b/htdocs/asset/tpl/depreciation_options_edit.tpl.php index ea55ab5999a..2741da86c2b 100644 --- a/htdocs/asset/tpl/depreciation_options_edit.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_edit.tpl.php @@ -27,7 +27,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (!is_object($form)) { diff --git a/htdocs/asset/tpl/depreciation_options_view.tpl.php b/htdocs/asset/tpl/depreciation_options_view.tpl.php index d7350801020..c801d74505e 100644 --- a/htdocs/asset/tpl/depreciation_options_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_view.tpl.php @@ -28,7 +28,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (!is_object($form)) { diff --git a/htdocs/asset/tpl/depreciation_view.tpl.php b/htdocs/asset/tpl/depreciation_view.tpl.php index 2660fbbaee7..424d989665f 100644 --- a/htdocs/asset/tpl/depreciation_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_view.tpl.php @@ -27,7 +27,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (!is_object($form)) { diff --git a/htdocs/asset/tpl/linkedobjectblock.tpl.php b/htdocs/asset/tpl/linkedobjectblock.tpl.php index 7dddd8cbeb1..0e8d62a6921 100644 --- a/htdocs/asset/tpl/linkedobjectblock.tpl.php +++ b/htdocs/asset/tpl/linkedobjectblock.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } print "\n"; diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index f81f081f9a3..865d2754981 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -182,7 +182,7 @@ if (!empty($number)) { $errno = 0; $errstr = 0; $strCallerId = "Dolibarr caller $found <".strtolower($number).">"; - $oSocket = @fsockopen($strHost, $port, $errno, $errstr, 10); + $oSocket = @fsockopen($strHost, (int) $port, $errno, $errstr, 10); if (!$oSocket) { print ''."\n"; $txt = "Failed to execute fsockopen($strHost, $port, \$errno, \$errstr, 10)
    \n"; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 1aa3f31ddae..6de866029f7 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -111,7 +111,7 @@ class BOM extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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",), @@ -580,7 +580,7 @@ class BOM extends CommonObject * * @param int $fk_product Id of product * @param float $qty Quantity - * @param int $qty_frozen Frozen quantity + * @param int<0,1> $qty_frozen If the qty is Frozen * @param int $disable_stock_change Disable stock change on using in MO * @param float $efficiency Efficiency in MO * @param int $position Position of BOM-Line in BOM-Lines @@ -689,7 +689,7 @@ class BOM extends CommonObject * * @param int $rowid Id of line to update * @param float $qty Quantity - * @param int $qty_frozen Frozen quantity + * @param float $qty_frozen Frozen quantity * @param int $disable_stock_change Disable stock change on using in MO * @param float $efficiency Efficiency in MO * @param int $position Position of BOM-Line in BOM-Lines @@ -875,7 +875,7 @@ class BOM extends CommonObject $dir = dol_buildpath($reldir."core/modules/bom/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { @@ -1404,7 +1404,7 @@ class BOM extends CommonObject * BOM costs calculation based on cost_price or pmp of each BOM line. * Set the property ->total_cost and ->unit_cost of BOM. * - * @return int Return integer <0 if KO, >0 if OK + * @return int|string Return integer <0 if KO, >0 if OK, or printable error result from hook */ public function calculateCosts() { @@ -1531,8 +1531,8 @@ class BOM extends CommonObject /** * Get Net needs by product * - * @param array $TNetNeeds Array of ChildBom and infos linked to - * @param int $qty qty needed + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param float $qty qty needed * @return void */ public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) @@ -1557,7 +1557,7 @@ class BOM extends CommonObject * Get Net needs Tree by product or bom * * @param array $TNetNeeds Array of ChildBom and infos linked to - * @param int $qty qty needed + * @param float $qty qty needed * @param int $level level of recursivity * @return void */ @@ -1714,7 +1714,7 @@ class BOMLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,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}> 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",), @@ -1763,7 +1763,7 @@ class BOMLine extends CommonObjectLine public $qty; /** - * @var int qty frozen + * @var float qty frozen */ public $qty_frozen; diff --git a/htdocs/bom/tpl/linkedobjectblock.tpl.php b/htdocs/bom/tpl/linkedobjectblock.tpl.php index 082936be50a..3ededc6bffa 100644 --- a/htdocs/bom/tpl/linkedobjectblock.tpl.php +++ b/htdocs/bom/tpl/linkedobjectblock.tpl.php @@ -21,7 +21,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } print "\n"; diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 5535f3dbf5a..2d456007c73 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"; // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } '@phan-var-force CommonObject $this diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index b2b8d94bc51..303e735a498 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -36,7 +36,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } '@phan-var-force CommonObject $this diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 179bec8f474..38da2d0077c 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -41,7 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } '@phan-var-force CommonObject $this diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index 1b445686550..5d8a19b9d42 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -71,37 +71,6 @@ $formSetup = new FormSetup($db); // Setup conf BOOKCAL_PUBLIC_INTERFACE_TOPIC $item = $formSetup->newItem('BOOKCAL_PUBLIC_INTERFACE_TOPIC'); $item->defaultFieldValue = 'MyBigCompany public interface for Bookcal'; -/*// Setup conf BOOKCAL_MYPARAM8 -$item = $formSetup->newItem('BOOKCAL_MYPARAM8'); -$TField = array( - 'test01' => $langs->trans('test01'), - 'test02' => $langs->trans('test02'), - 'test03' => $langs->trans('test03'), - 'test04' => $langs->trans('test04'), - 'test05' => $langs->trans('test05'), - 'test06' => $langs->trans('test06'), -); -$item->setAsMultiSelect($TField); -$item->helpText = $langs->transnoentities('BOOKCAL_MYPARAM8'); - - -// Setup conf BOOKCAL_MYPARAM9 -$formSetup->newItem('BOOKCAL_MYPARAM9')->setAsSelect($TField); - - -// Setup conf BOOKCAL_MYPARAM10 -$item = $formSetup->newItem('BOOKCAL_MYPARAM10'); -$item->setAsColor(); -$item->defaultFieldValue = '#FF0000'; -$item->nameText = $item->getNameText().' more html text '; -$item->fieldInputOverride = ''; -$item->helpText = $langs->transnoentities('AnHelpMessage');*/ -//$item->fieldValue = ''; -//$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text -//$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too -//$item->fieldInputOverride = false; // set this var to override field input -//$item->fieldOutputOverride = false; // set this var to override field output - $setupnotempty = + count($formSetup->items); @@ -136,44 +105,9 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { - $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); - - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/bookcal/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); - break; - } - } - - if ($classname !== '') { - require_once $file; - - $module = new $classname($db); - - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bookcal-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; - } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); - } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey)."_ADDON"; dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); @@ -184,7 +118,7 @@ if ($action == 'updateMask') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (getDolGlobalString($constforval) == "$value") { @@ -194,7 +128,7 @@ if ($action == 'updateMask') { } } elseif ($action == 'setdoc') { // Set or unset default model - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { @@ -210,7 +144,7 @@ if ($action == 'updateMask') { } } } elseif ($action == 'unsetdoc') { - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); if (!empty($tmpobjectkey)) { $constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; dolibarr_del_const($db, $constforval, $conf->entity); @@ -242,7 +176,6 @@ print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "fa-c // Setup page goes here //echo ''.$langs->trans("BookCalSetupPage").'

    '; - if ($action == 'edit') { print $formSetup->generateOutput(true); print '
    '; diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php index 8845a16723b..bc62dd76842 100644 --- a/htdocs/bookcal/availabilities_card.php +++ b/htdocs/bookcal/availabilities_card.php @@ -105,6 +105,10 @@ if (!$permissiontoread) { } + + + + /* * Actions */ @@ -132,8 +136,39 @@ if (empty($reshook)) { $triggermodname = 'BOOKCAL_AVAILABILITIES_MODIFY'; // Name of trigger action code to execute when we modify record - // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen - include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + + $startday = GETPOST('startday', 'int'); + $startmonth = GETPOST('startmonth', 'int'); + $startyear = GETPOST('startyear', 'int'); + $starthour = GETPOST('startHour', 'int'); + + $dateStartTimestamp = dol_mktime($starthour, 0, 0, $startmonth, $startday, $startyear); + + $endday = GETPOST('endday', 'int'); + $endmonth = GETPOST('endmonth', 'int'); + $endyear = GETPOST('endyear', 'int'); + $endhour = GETPOST('endHour', 'int'); + + + $dateEndTimestamp = dol_mktime($endhour, 0, 0, $endmonth, $endday, $endyear); + + // check hours + if ($starthour > $endhour) { + if ($dateStartTimestamp === $dateEndTimestamp) { + $error++; + setEventMessages($langs->trans("ErrorEndTimeMustBeGreaterThanStartTime"), null, 'errors'); + } + } + + // check date + if ($dateStartTimestamp > $dateEndTimestamp) { + $error++; + setEventMessages($langs->trans("ErrorIncoherentDates"), null, 'errors'); + } + + + // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; // Actions when linking object each other include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; @@ -202,10 +237,13 @@ if ($action == 'create') { } print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Availabilities")), '', 'object_'.$object->picto); - print ''; print ''; - print ''; + if ($error != 0) { + print ''; + } else { + print ''; + } if ($backtopage) { print ''; } diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index 66ca4625151..6a4553e15f2 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -112,7 +112,7 @@ class Availabilities extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -529,7 +529,7 @@ class Availabilities extends CommonObject if (!empty($num)) { // Validate $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " SET ref = '".$this->db->escape($num)."',"; + $sql .= " SET label = '".$this->db->escape($num)."',"; $sql .= " status = ".self::STATUS_VALIDATED; if (!empty($this->fields['date_validation'])) { $sql .= ", date_validation = '".$this->db->idate($now)."'"; @@ -975,7 +975,7 @@ class Availabilities extends CommonObject $dir = dol_buildpath($reldir."core/modules/bookcal/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index 539ef39e5ed..d64aad6791c 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -112,7 +112,7 @@ class Calendar extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -964,7 +964,7 @@ class Calendar extends CommonObject $dir = dol_buildpath($reldir."core/modules/bookcal/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f65789c855c..f2c76c270a3 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -256,7 +256,7 @@ class Categorie extends CommonObject public $type; /** - * @var array Categories table in memory + * @var array Categories table in memory */ public $cats = array(); @@ -271,7 +271,7 @@ class Categorie extends CommonObject public $childs = array(); /** - * @var array multilangs + * @var array{string,array{label:string,description:string,note?:string}} multilangs */ public $multilangs; @@ -970,7 +970,7 @@ class Categorie extends CommonObject * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @return array|int Array of categories, 0 if no cat, -1 on error + * @return int<-1,0>|array,visible:int,ref_ext:string,multilangs?:array{string,array{label:string,description:string,note?:string}}}> Array of categories, 0 if no cat, -1 on error */ public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { @@ -1139,7 +1139,7 @@ class Categorie extends CommonObject * - string (categories ids separated by comma) * - array (list of categories ids) * @param int $include [=0] Removed or 1=Keep only - * @return array|int Array of categories. this->cats and this->motherof are set, -1 on error + * @return int<-1,-1>|array Array of categories. this->cats and this->motherof are set, -1 on error */ public function get_full_arbo($type, $markafterid = 0, $include = 0) { @@ -1222,9 +1222,10 @@ class Categorie extends CommonObject $keyfilter2 = '_'.$keyfiltercatid.'$'; $keyfilter3 = '^'.$keyfiltercatid.'_'; $keyfilter4 = '_'.$keyfiltercatid.'_'; - foreach ($this->cats as $key => $val) { - $test = (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) - || preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])); + foreach (array_keys($this->cats) as $key) { + $fullpath = (string) $this->cats[$key]['fullpath']; + $test = (preg_match('/'.$keyfilter1.'/', $fullpath) || preg_match('/'.$keyfilter2.'/', $fullpath) + || preg_match('/'.$keyfilter3.'/', $fullpath) || preg_match('/'.$keyfilter4.'/', $fullpath)); if (($test && !$include) || (!$test && $include)) { unset($this->cats[$key]); @@ -1245,7 +1246,7 @@ class Categorie extends CommonObject * * @param int $id_categ id_categ entry to update * @param int $protection Deep counter to avoid infinite loop - * @return int Return integer <0 if KO, >0 if OK + * @return int<-1,1> Return integer <0 if KO, >0 if OK * @see get_full_arbo() */ private function buildPathFromId($id_categ, $protection = 1000) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 1e27f3d54f8..9b688ac3d3e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -172,7 +172,7 @@ if (empty($reshook) && (GETPOST('removedassigned') || GETPOST('removedassigned') $idtoremove = GETPOST('removedassigned'); if (!empty($_SESSION['assignedtouser'])) { - $tmpassigneduserids = json_decode($_SESSION['assignedtouser'], 1); + $tmpassigneduserids = json_decode($_SESSION['assignedtouser'], true); } else { $tmpassigneduserids = array(); } @@ -199,7 +199,7 @@ if (empty($reshook) && (GETPOST('removedassignedresource') || GETPOST('removedas $idtoremove = GETPOST('removedassignedresource'); if (!empty($_SESSION['assignedtoresource'])) { - $tmpassignedresourceids = json_decode($_SESSION['assignedtoresource'], 1); + $tmpassignedresourceids = json_decode($_SESSION['assignedtoresource'], true); } else { $tmpassignedresourceids = array(); } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index db8eadee618..09e73b188f8 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -308,7 +308,7 @@ class ActionComm extends CommonObject public $icalname; /** - * @var string Ical color + * @var int<0,3> Ical color */ public $icalcolor; @@ -1393,7 +1393,7 @@ class ActionComm extends CommonObject * * @param User $user Object user * @param int $load_state_board Load indicator array this->nb - * @return WorkboardResponse|int Return integer <0 if KO, WorkboardResponse if OK + * @return WorkboardResponse|int<-1,1> Return integer <0 if KO, WorkboardResponse if OK */ public function load_board($user, $load_state_board = 0) { @@ -1462,7 +1462,7 @@ class ActionComm extends CommonObject } $this->db->free($resql); - if (empty($load_state_board)) { + if (empty($load_state_board) && $response instanceof WorkboardResponse) { return $response; } else { return 1; diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 1c8dd2b5b95..711e890e02d 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -76,7 +76,7 @@ class ActionCommReminder extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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 258539a8cd8..94f52cc4849 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,6 +95,7 @@ class ICal $this->file = $file; $file_text = ''; + //$tmpresult = getURLContent($file, 'GET', '', 1, [], ['http', 'https'], 2, 0); // To test with any URL $tmpresult = getURLContent($file, 'GET'); if ($tmpresult['http_code'] != 200) { $file_text = null; @@ -158,7 +160,7 @@ class ICal } // read FILE text - if (is_null($this->file_text)) { + if (empty($this->file_text)) { $this->file_text = $this->read_file($uri); if ($usecachefile && !is_null($this->file_text)) { @@ -219,7 +221,7 @@ class ICal $type = "VCALENDAR"; break; - // Manage VALARM that are inside a VEVENT to avoid fields of VALARM to overwrites fields of VEVENT + // Manage VALARM that are inside a VEVENT to avoid fields of VALARM to overwrites fields of VEVENT case "BEGIN:VALARM": $insidealarm = 1; break; @@ -378,6 +380,7 @@ class ICal $ntime = 0; // TIME LIMITED EVENT + $date = array(); if (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})([0-9]{0,2})/', $ical_date, $date)) { $ntime = dol_mktime($date[4], $date[5], $date[6], $date[2], $date[3], $date[1], true); } @@ -391,24 +394,25 @@ class ICal /** * Return unix date from iCal date format * - * @param string $key Key - * @param string $value Value - * @return array + * @param string $key Key. Example: 'DTSTART', 'DTSTART;TZID=US-Eastern' + * @param string $value Value. Example: '19970714T133000', '19970714T173000Z', '19970714T133000' + * @return array{0:string,1:int}|array{0:string,1:array} */ public function ical_dt_date($key, $value) { // phpcs:enable $return_value = array(); - $value = $this->ical_date_to_unix($value); // Analyse TZID $temp = explode(";", $key); - if (empty($temp[1])) { // not TZID - $value = str_replace('T', '', $value); + if (empty($temp[1])) { // not TZID in key + $value = $this->ical_date_to_unix($value); return array($key, $value); } + $value = str_replace('T', '', $value); + $key = $temp[0]; $temp = explode("=", $temp[1]); $return_value[$temp[0]] = $temp[1]; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 92bd8159976..37d2c7054c1 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -319,10 +319,10 @@ if (empty($mode) || $mode == 'show_month') { $next_year = $next['year']; $next_month = $next['month']; - $max_day_in_prev_month = date("t", dol_mktime(12, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month - $max_day_in_month = date("t", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')); // Nb of days in next month + $max_day_in_prev_month = (int) date("t", dol_mktime(12, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month + $max_day_in_month = (int) date("t", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')); // Nb of days in next month // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) - $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday + $tmpday = - (int) date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1); if ($tmpday >= 1) { $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. @@ -550,7 +550,11 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' //$param='month='.$monthshown.'&year='.$year; $hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); + $urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; + $urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction); } // Define the legend/list of calendard to show @@ -658,7 +662,9 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on $default = ''; } - $s .= '
     
    '; + $tooltip = $langs->trans("Cache").' '.round($DELAYFORCACHE / 60).'mn'; + + $s .= '
     
    '; } } @@ -1173,7 +1179,7 @@ if ($user->hasRight("holiday", "read")) { // Complete $eventarray with external import Ical if (count($listofextcals)) { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/ical.class.php'; - foreach ($listofextcals as $extcal) { + foreach ($listofextcals as $key => $extcal) { $url = $extcal['src']; // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics $namecal = $extcal['name']; $offsettz = $extcal['offsettz']; @@ -1185,6 +1191,11 @@ if (count($listofextcals)) { $ical = new ICal(); $ical->parse($url, $pathforcachefile, $DELAYFORCACHE); + if ($ical->error) { + // Save error message for extcal + $listofextcals[$key]['error'] = $ical->error; + $s .= '
    '.$listofextcals[$key]['name'].': '.$ical->error.''; + } // After this $ical->cal['VEVENT'] contains array of events, $ical->cal['DAYLIGHT'] contains daylight info, $ical->cal['STANDARD'] contains non daylight info, ... //var_dump($ical->cal); exit; @@ -1458,7 +1469,6 @@ if (count($listofextcals)) { } } - // Complete $eventarray with events coming from external module $parameters = array(); $object = null; @@ -1489,7 +1499,7 @@ if (is_readable($color_file)) { include $color_file; } if (!is_array($theme_datacolor)) { - $theme_datacolor = array(array(120, 130, 150), array(200, 160, 180), array(190, 190, 220)); + $theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(80, 166, 90), array(190, 190, 100), array(91, 115, 247), array(140, 140, 220), array(190, 120, 120), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); } $massactionbutton = ''; @@ -1727,8 +1737,8 @@ if (empty($mode) || $mode == 'show_month') { // View by month $maxnbofchar = 80; $tmp = explode('-', getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS')); - $minhour = round($tmp[0], 0); - $maxhour = round($tmp[1], 0); + $minhour = round((float) $tmp[0], 0); + $maxhour = round((float) $tmp[1], 0); if ($minhour > 23) { $minhour = 23; } @@ -1789,7 +1799,7 @@ $db->close(); * @param int $showinfo Add extended information (used by day and week view) * @param int $minheight Minimum height for each event. 60px by default. * @param int $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button" - * @param array $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal + * @param array{}|array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int}} $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal * @return void */ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array()) @@ -1800,6 +1810,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; global $hookmanager; + '@phan-var-force array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int},3:array{0:int,1:int,2:int}} $theme_datacolor + @phan-var-force User[] $cacheusers + @phan-var-force array> $colorindexused'; + if ($conf->use_javascript_ajax) { // Enable the "Show more button..." $conf->global->MAIN_JS_SWITCH_AGENDA = 1; } @@ -1811,10 +1825,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print "\n"; $curtime = dol_mktime(0, 0, 0, $month, $day, $year); - $urltoshow = DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year.$newparam; + $urltoshow = DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&day='.str_pad((string) $day, 2, "0", STR_PAD_LEFT).'&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$year.$newparam; $urltocreate = ''; if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { - $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year; + $newparam .= '&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$year; $hourminsec = '100000'; $urltocreate = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $year, $month, $day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); } @@ -1950,7 +1964,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } } //print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'
    '; - // Define color + // Define color // @suppress-next-line PhanPluginPrintfIncompatibleArgumentType $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); } $cssclass = $cssclass.' eventday_'.$ymd; @@ -2160,7 +2174,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $event->libelle = $titletoshow; // deprecatd // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user. $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : ''); - $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle inline-block', '', 0, 0); + $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...' $event->label = $savlabel; $event->libelle = $savlabel; } @@ -2266,7 +2280,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else { print ''.img_picto("all", "1downarrow_selected.png").' ...'; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index eff2e4b3708..3abd25ae840 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -177,6 +177,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); if ($user->socid && $socid) { @@ -722,18 +723,15 @@ if (empty($reshook)) { $tmpforcreatebutton = dol_getdate(dol_now(), true); -$newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; - -//$param='month='.$monthshown.'&year='.$year; -$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation +$newparam = '&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; -$url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; +$url .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->hasRight('agenda', 'allactions', 'create')); -$param .= '&mode='.$mode; +$param .= '&mode='.urlencode($mode); print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, is_numeric($nbtotalofrecords) ? -1 * $nbtotalofrecords : $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode); diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 7bb071f036c..990c9af705f 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -480,9 +480,11 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; - //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); + $urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; + $urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction); } print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.''.$newcardbutton, '', $limit, 1, 0, 1, $viewmode); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index c191a6c35be..97098383652 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -129,8 +129,8 @@ if ($dateselect > 0) { $tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS') ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); -$begin_h = GETPOSTINT('begin_h') != '' ? GETPOSTINT('begin_h') : ($tmparray[0] != '' ? $tmparray[0] : 9); -$end_h = GETPOSTINT('end_h') ? GETPOSTINT('end_h') : ($tmparray[1] != '' ? $tmparray[1] : 18); +$begin_h = GETPOSTISSET('begin_h') ? GETPOSTINT('begin_h') : ($tmparray[0] != '' ? $tmparray[0] : 9); +$end_h = GETPOSTISSET('end_h') ? GETPOSTINT('end_h') : ($tmparray[1] != '' ? $tmparray[1] : 18); if ($begin_h < 0 || $begin_h > 23) { $begin_h = 9; } @@ -144,8 +144,8 @@ if ($end_h <= $begin_h) { $tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS') ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); -$begin_d = GETPOSTINT('begin_d') ? GETPOSTINT('begin_d') : ($tmparray[0] != '' ? $tmparray[0] : 1); -$end_d = GETPOSTINT('end_d') ? GETPOSTINT('end_d') : ($tmparray[1] != '' ? $tmparray[1] : 5); +$begin_d = GETPOSTISSET('begin_d') ? GETPOSTINT('begin_d') : ($tmparray[0] != '' ? $tmparray[0] : 1); +$end_d = GETPOSTISSET('end_d') ? GETPOSTINT('end_d') : ($tmparray[1] != '' ? $tmparray[1] : 5); if ($begin_d < 1 || $begin_d > 7) { $begin_d = 1; } @@ -496,9 +496,11 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' $newparam .= '&end_d='.urlencode($end_d); } - //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); + $urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; + $urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction); } $num = ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 216ec9bbdd8..d2c8e169342 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -411,7 +411,7 @@ if (empty($reshook)) { if (getDolGlobalString('MAILING_DELAY')) { dol_syslog("Wait a delay of MAILING_DELAY=".((float) $conf->global->MAILING_DELAY)); - usleep((float) $conf->global->MAILING_DELAY * 1000000); + usleep((int) ((float) $conf->global->MAILING_DELAY * 1000000)); } //test if CHECK READ change statut prospect contact @@ -895,10 +895,10 @@ if ($action == 'create') { '; } if ($formmail->withfckeditor) { - $out .= $formmail->getModelEmailTemplate(); + $out .= $formmail->getModelEmailTemplate('bodyemail'); } if ($formmail->withaiprompt && isModEnabled('ai')) { - $out .= $formmail->getSectionForAIPrompt(); + $out .= $formmail->getSectionForAIPrompt('', 'bodyemail'); } print $out; print ''; @@ -1491,6 +1491,7 @@ if ($action == 'create') { print ''; // List of files $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0); + $out = ''; // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript $out .= ''."\n"; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 6d3048b8e65..444a2c97a66 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -17,6 +17,7 @@ * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Lenin Rivas * Copyright (C) 2023 William Mead + * 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 @@ -1200,7 +1201,7 @@ if (empty($reshook)) { } $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', (string) $prod->tva_tx)); // Set unit price to use if (!empty($price_ht) || (string) $price_ht === '0') { diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index aa1e3d0e980..546d40d052d 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2022 ATM Consulting * Copyright (C) 2022 OpenDSI + * 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 @@ -410,6 +411,7 @@ class Proposals extends DolibarrApi } $errors = []; + $updateRes = 0; $this->db->begin(); foreach ($request_data as $TData) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2950d5d2248..04b4a6e99b2 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -308,7 +308,7 @@ class Propal extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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), @@ -413,8 +413,8 @@ class Propal extends CommonObject * $this->thirdparty should be loaded * * @param int $idproduct Product Id to add - * @param int $qty Quantity - * @param int $remise_percent Discount effected on Product + * @param float $qty Quantity + * @param float $remise_percent Discount effected on Product * @return int Return integer <0 if KO, >0 if OK * * TODO Replace calls to this function by generation object Ligne @@ -554,7 +554,7 @@ class Propal extends CommonObject * @param string $desc Description of line * @param float $pu_ht Unit price * @param float $qty Quantity - * @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') + * @param float|string $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') * @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) * @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) * @param int $fk_product Product/Service ID predefined @@ -612,7 +612,7 @@ class Propal extends CommonObject $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' } $txlocaltax1 = price2num($txlocaltax1); @@ -805,7 +805,7 @@ class Propal extends CommonObject * @param float $pu Unit price (HT or TTC depending on price_base_type) * @param float $qty Quantity * @param float $remise_percent Discount on line - * @param float $txtva VAT Rate (Can be '1.23' or '1.23 (ABC)') + * @param float|string $txtva VAT Rate (Can be '1.23' or '1.23 (ABC)') * @param float $txlocaltax1 Local tax 1 rate * @param float $txlocaltax2 Local tax 2 rate * @param string $desc Description @@ -840,7 +840,7 @@ class Propal extends CommonObject $qty = price2num($qty); $pu = price2num($pu); $pu_ht_devise = price2num($pu_ht_devise); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } $txlocaltax1 = price2num($txlocaltax1); @@ -2461,136 +2461,6 @@ class Propal extends CommonObject return -1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Set an overall discount on the proposal - * - * @param User $user Object user that modify - * @param double $remise Amount discount - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int Return integer <0 if ko, >0 if ok - * @deprecated remise_percent is a deprecated field for object parent - */ - /* - public function set_remise_percent($user, $remise, $notrigger = 0) - { - // phpcs:enable - $remise = trim($remise) ?trim($remise) : 0; - - if ($user->hasRight('propal', 'creer')) { - $remise = price2num($remise, 2); - - $error = 0; - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET remise_percent = ".((float) $remise); - $sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".self::STATUS_DRAFT; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $this->errors[] = $this->db->error(); - $error++; - } - - if (!$error) { - $this->oldcopy = clone $this; - $this->remise_percent = $remise; - $this->update_price(1); - } - - if (!$notrigger && empty($error)) { - // Call trigger - $result = $this->call_trigger('PROPAL_MODIFY', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - - if (!$error) { - $this->db->commit(); - return 1; - } else { - foreach ($this->errors as $errmsg) { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } - } - - return -1; - } - */ - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Set an absolute overall discount on the proposal - * - * @param User $user Object user that modify - * @param double $remise Amount discount - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int Return integer <0 if ko, >0 if ok - */ - /* - public function set_remise_absolue($user, $remise, $notrigger = 0) - { - // phpcs:enable - if (empty($remise)) { - $remise = 0; - } - $remise = price2num($remise); - - if ($user->hasRight('propal', 'creer')) { - $error = 0; - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET remise_absolue = ".((float) $remise); - $sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".self::STATUS_DRAFT; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $this->errors[] = $this->db->error(); - $error++; - } - - if (!$error) { - $this->oldcopy = clone $this; - $this->update_price(1); - } - - if (!$notrigger && empty($error)) { - // Call trigger - $result = $this->call_trigger('PROPAL_MODIFY', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - - if (!$error) { - $this->db->commit(); - return 1; - } else { - foreach ($this->errors as $errmsg) { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } - } - - return -1; - } - */ - /** * Reopen the commercial proposal @@ -3745,7 +3615,7 @@ class Propal extends CommonObject $dir = dol_buildpath($reldir."core/modules/propale/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if (!$mybool) { @@ -4658,10 +4528,8 @@ class PropaleLigne extends CommonObjectLine } $sql .= ", fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null"); $sql .= ", buy_price_ht=".price2num($this->pa_ht); - if (strlen($this->special_code)) { - $sql .= ", special_code=".$this->special_code; - } - $sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null"); + $sql .= ", special_code=".((int) $this->special_code); + $sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? (int) $this->fk_parent_line : "null"); if (!empty($this->rang)) { $sql .= ", rang=".((int) $this->rang); } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 911d866b671..26e2ba473ff 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -2313,8 +2313,8 @@ while ($i < $imaxinloop) { } // Note public if (!empty($arrayfields['p.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); + print ''; + print dolPrintHTML($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2322,8 +2322,8 @@ while ($i < $imaxinloop) { } // Note private if (!empty($arrayfields['p.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); + print ''; + print dolPrintHTML($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index b81a31e1891..05692d23ae0 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -26,7 +26,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f918d886795..eb3b5fd0fa5 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Benjamin Falière + * 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 @@ -782,6 +783,7 @@ if (empty($reshook)) { $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); $price_min = $price_min_ttc = 0; + $tva_npr = 0; // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit @@ -892,7 +894,7 @@ if (empty($reshook)) { } $tmpvat = (float) price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = (float) price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $tmpprodvat = (float) price2num(preg_replace('/\s*\(.*\)/', '', (string) $prod->tva_tx)); // Set unit price to use if (!empty($price_ht) || $price_ht === '0') { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8d67611ad20..291ead61cd3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -297,7 +297,7 @@ class Commande extends CommonOrder // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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), @@ -416,7 +416,7 @@ class Commande extends CommonOrder $dir = dol_buildpath($reldir."core/modules/commande/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { @@ -1008,7 +1008,7 @@ class Commande extends CommonOrder // Complete vat rate with code $vatrate = $line->tva_tx; - if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) { + if ($line->vat_src_code && !preg_match('/\(.*\)/', (string) $vatrate)) { $vatrate .= ' ('.$line->vat_src_code.')'; } @@ -1543,7 +1543,7 @@ class Commande extends CommonOrder $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); $pa_ht = (float) price2num($pa_ht); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' } $txlocaltax1 = price2num($txlocaltax1); @@ -2424,7 +2424,7 @@ class Commande extends CommonOrder /** * Applique une remise relative * - * @deprecated + * @deprecated Use setDiscount() instead. * @see setDiscount() * @param User $user User qui positionne la remise * @param float $remise Discount (percent) @@ -2435,6 +2435,7 @@ class Commande extends CommonOrder { // phpcs:enable dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE); + // @phan-suppress-next-line PhanDeprecatedFunction return $this->setDiscount($user, $remise, $notrigger); } @@ -2442,14 +2443,13 @@ class Commande extends CommonOrder * Set a percentage discount * * @param User $user User setting the discount - * @param float $remise Discount (percent) - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int Return integer <0 if KO, >0 if OK - * @deprecated remise_percent is a deprecated field for object parent + * @param float|string $remise Discount (percent) + * @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int<-1,1> Return integer <0 if KO, >0 if OK */ public function setDiscount($user, $remise, $notrigger = 0) { - $remise = trim($remise) ? trim($remise) : 0; + $remise = trim((string) $remise) ? trim((string) $remise) : 0; if ($user->hasRight('commande', 'creer')) { $error = 0; @@ -3138,7 +3138,7 @@ class Commande extends CommonOrder $pu = price2num($pu); $pa_ht = (float) price2num($pa_ht); $pu_ht_devise = price2num($pu_ht_devise); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } $txlocaltax1 = (float) price2num($txlocaltax1); @@ -4381,20 +4381,20 @@ class OrderLine extends CommonOrderLine $error = 0; - if (empty($this->id) && !empty($this->rowid)) { // For backward compatibility + if (empty($this->id) && !empty($this->rowid)) { // For backward compatibility $this->id = $this->rowid; } // check if order line is not in a shipment line before deleting - $sqlCheckShipmentLine = "SELECT"; + $sqlCheckShipmentLine = "SELECT"; $sqlCheckShipmentLine .= " ed.rowid"; - $sqlCheckShipmentLine .= " FROM ".MAIN_DB_PREFIX."expeditiondet ed"; - $sqlCheckShipmentLine .= " WHERE ed.fk_origin_line = ".((int) $this->id); + $sqlCheckShipmentLine .= " FROM " . MAIN_DB_PREFIX . "expeditiondet ed"; + $sqlCheckShipmentLine .= " WHERE ed.fk_origin_line = " . ((int) $this->id); $resqlCheckShipmentLine = $this->db->query($sqlCheckShipmentLine); if (!$resqlCheckShipmentLine) { $error++; - $this->error = $this->db->lasterror(); + $this->error = $this->db->lasterror(); $this->errors[] = $this->error; } else { $langs->load('errors'); @@ -4402,56 +4402,58 @@ class OrderLine extends CommonOrderLine if ($num > 0) { $error++; $objCheckShipmentLine = $this->db->fetch_object($resqlCheckShipmentLine); - $this->error = $langs->trans('ErrorRecordAlreadyExists').' : '.$langs->trans('ShipmentLine').' '.$objCheckShipmentLine->rowid; + $this->error = $langs->trans('ErrorRecordAlreadyExists') . ' : ' . $langs->trans('ShipmentLine') . ' ' . $objCheckShipmentLine->rowid; $this->errors[] = $this->error; } $this->db->free($resqlCheckShipmentLine); } if ($error) { - dol_syslog(__METHOD__.'Error ; '.$this->error, LOG_ERR); + dol_syslog(__METHOD__ . 'Error ; ' . $this->error, LOG_ERR); return -1; } $this->db->begin(); - $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid = ".((int) $this->id); - - dol_syslog("OrderLine::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('LINEORDER_DELETE', $user); - if ($result < 0) { - $error++; - } - // End call triggers + if (!$notrigger) { + // Call trigger + $result = $this->call_trigger('LINEORDER_DELETE', $user); + if ($result < 0) { + $error++; } - - // Remove extrafields - if (!$error) { - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); - } - } - - if (!$error) { - $this->db->commit(); - return 1; - } - - foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } else { - $this->error = $this->db->lasterror(); - return -1; + // End call triggers } + + if (!$error) { + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . "commandedet WHERE rowid = " . ((int) $this->id); + + dol_syslog("OrderLine::delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $this->error = $this->db->lasterror(); + $error++; + } + } + + // Remove extrafields + if (!$error) { + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR); + } + } + + if (!$error) { + $this->db->commit(); + return 1; + } + + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; } /** diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index e01cc02b357..22703534d89 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -227,6 +227,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Security check @@ -2614,8 +2615,8 @@ while ($i < $imaxinloop) { // Note public if (!empty($arrayfields['c.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); + print ''; + print dolPrintHTML($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2624,8 +2625,8 @@ while ($i < $imaxinloop) { // Note private if (!empty($arrayfields['c.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); + print ''; + print dolPrintHTML($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 2adbd25a7d0..d9435aea40f 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -12,6 +12,7 @@ * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2018-2023 Charlene Benke * Copyright (C) 2021-2023 Anthony Berton + * 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 @@ -230,6 +231,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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')) { $search_sale = $user->id; @@ -1107,7 +1109,7 @@ if ($resql) { // Payment term if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { print ''; - $form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1); + print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1); print ''; } // Payment mode @@ -1294,6 +1296,7 @@ if ($resql) { // Détail commande if (!empty($arrayfields['rowid']['checked'])) { print_liste_field_titre($arrayfields['rowid']['label'], $_SERVER["PHP_SELF"], 'rowid', '', $param, '', $sortfield, $sortorder); + '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan } if (!empty($arrayfields['pr.ref']['checked'])) { print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 2ced0e73a63..4d37b71e10e 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } print "\n"; diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index bb4b30474b7..05351d41713 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -5,6 +5,7 @@ * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2022-2024 Alexandre Spangaro + * 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 @@ -96,15 +97,15 @@ if (!$sortorder) { $arrayfields = array( - 'type'=>array('label'=>"Type", 'checked'=>1), - 'date'=>array('label'=>"Date", 'checked'=>1), - 'date_due'=>array('label'=>"DateDue", 'checked'=>1), - 'ref'=>array('label'=>"Ref", 'checked'=>1), - 'documents'=>array('label'=>"Documents", 'checked'=>1), - 'paid'=>array('label'=>"Paid", 'checked'=>1), - 'total_ht'=>array('label'=>"TotalHT", 'checked'=>1), - 'total_ttc'=>array('label'=>"TotalTTC", 'checked'=>1), - 'total_vat'=>array('label'=>"TotalVAT", 'checked'=>1), + 'type' => array('label' => "Type", 'checked' => 1), + 'date' => array('label' => "Date", 'checked' => 1), + 'date_due' => array('label' => "DateDue", 'checked' => 1), + 'ref' => array('label' => "Ref", 'checked' => 1), + 'documents' => array('label' => "Documents", 'checked' => 1), + 'paid' => array('label' => "Paid", 'checked' => 1), + 'total_ht' => array('label' => "TotalHT", 'checked' => 1), + 'total_ttc' => array('label' => "TotalTTC", 'checked' => 1), + 'total_vat' => array('label' => "TotalVAT", 'checked' => 1), //... ); @@ -135,14 +136,14 @@ if (empty($entity)) { $error = 0; $listofchoices = array( - 'selectinvoices'=>array('label'=>'Invoices', 'picto'=>'bill', 'lang'=>'bills', 'enabled' => isModEnabled('invoice'), 'perms' => $user->hasRight('facture', 'lire')), - 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'picto'=>'supplier_invoice', 'lang'=>'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => $user->hasRight('fournisseur', 'facture', 'lire')), - 'selectexpensereports'=>array('label'=>'ExpenseReports', 'picto'=>'expensereport', 'lang'=>'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => $user->hasRight('expensereport', 'lire')), - 'selectdonations'=>array('label'=>'Donations', 'picto'=>'donation', 'lang'=>'donation', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('don', 'lire')), - 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'picto'=>'bill', 'enabled' => isModEnabled('tax'), 'perms' => $user->hasRight('tax', 'charges', 'lire')), - 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'picto'=>'salary', 'lang'=>'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => $user->hasRight('salaries', 'read')), - 'selectvariouspayment'=>array('label'=>'VariousPayment', 'picto'=>'payment', 'enabled' => isModEnabled('bank'), 'perms' => $user->hasRight('banque', 'lire')), - 'selectloanspayment'=>array('label'=>'PaymentLoan','picto'=>'loan', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('loan', 'read')), + 'selectinvoices' => array('label' => 'Invoices', 'picto' => 'bill', 'lang' => 'bills', 'enabled' => isModEnabled('invoice'), 'perms' => $user->hasRight('facture', 'lire')), + 'selectsupplierinvoices' => array('label' => 'BillsSuppliers', 'picto' => 'supplier_invoice', 'lang' => 'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => $user->hasRight('fournisseur', 'facture', 'lire')), + 'selectexpensereports' => array('label' => 'ExpenseReports', 'picto' => 'expensereport', 'lang' => 'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => $user->hasRight('expensereport', 'lire')), + 'selectdonations' => array('label' => 'Donations', 'picto' => 'donation', 'lang' => 'donation', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('don', 'lire')), + 'selectsocialcontributions' => array('label' => 'SocialContributions', 'picto' => 'bill', 'enabled' => isModEnabled('tax'), 'perms' => $user->hasRight('tax', 'charges', 'lire')), + 'selectpaymentsofsalaries' => array('label' => 'SalariesPayments', 'picto' => 'salary', 'lang' => 'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => $user->hasRight('salaries', 'read')), + 'selectvariouspayment' => array('label' => 'VariousPayment', 'picto' => 'payment', 'enabled' => isModEnabled('bank'), 'perms' => $user->hasRight('banque', 'lire')), + 'selectloanspayment' => array('label' => 'PaymentLoan','picto' => 'loan', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('loan', 'read')), ); @@ -157,6 +158,9 @@ $listofchoices = array( //if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $filesarray = array(); + +'@phan-var-force array $filesarray'; + $result = false; if (($action == 'searchfiles' || $action == 'dl')) { if (empty($date_start)) { @@ -411,6 +415,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { $nofile['link'] = ''; $nofile['name'] = ''; + $filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile; } else { foreach ($files as $key => $file) { @@ -446,8 +451,8 @@ if (($action == 'searchfiles' || $action == 'dl')) { } $filesarray[$file['item'].'_'.$file['id']]['files'][] = array( 'link' => $link.urlencode($file['name']), - 'name'=>$file['name'], - 'ref'=>$file['ref'], + 'name' => $file['name'], + 'ref' => $file['ref'], 'fullname' => $file['fullname'], 'relpath' => '/'.$file['name'], 'relpathnamelang' => $langs->trans($file['item']).'/'.$file['name'], @@ -522,7 +527,7 @@ if ($result && $action == "dl" && !$error) { $zipname .= '_'.$project->ref; } } - $zipname .='_export.zip'; + $zipname .= '_export.zip'; dol_delete_file($zipname); @@ -689,6 +694,7 @@ if (!empty($date_start) && !empty($date_stop)) { } $TData = dol_sort_array($filesarray, $sortfield, $sortorder); + '@phan-var-force array $TData'; $filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip'; diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 5978fcc75b8..ff8260fce9d 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013-2023 Charlene BENKE + * 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 @@ -205,7 +206,7 @@ for ($mois = 1; $mois < 13; $mois++) { print "".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B").""; for ($annee = $year_start; $annee <= $year_end; $annee++) { - $case = sprintf("%04s-%02s", $annee, $mois); + $case = sprintf("%04d-%02d", $annee, $mois); print ' '; if (isset($decaiss[$case]) && $decaiss[$case] > 0) { diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index e93a87cc37f..01c70f04c57 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -84,7 +85,7 @@ if ($result) { print "rowid\">$objp->label"; print ''.$objp->nombre.''; print ''.price(abs($objp->somme)).""; - print ''.price(abs(price2num($objp->somme / $objp->nombre, 'MT'))).""; + print ''.price(price2num(abs($objp->somme / $objp->nombre), 'MT')).""; print ""; $i++; $total += abs($objp->somme); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index d6680d09e8e..25b52d8fc1c 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -8,6 +8,7 @@ * Copyright (C) 2016 Marcos García * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2022 Charlene Benke + * 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 @@ -221,8 +222,8 @@ if (empty($reshook)) { $db->commit(); - $urltogo = $backtopage ? str_replace('__ID__', $object->id, $backtopage) : $backurlforlist; - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation + $urltogo = $backtopage ? str_replace('__ID__', (string) $object->id, $backtopage) : $backurlforlist; + $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect project after a New on another form object creation if (empty($noback)) { header("Location: " . $urltogo); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 94d4b4247b1..1dd17795fcc 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -93,8 +93,10 @@ class Account extends CommonObject public $bank; /** - * Status + * Status closed + * * @var int + * @deprecated Duplicate field. We already have the field $this->status */ public $clos = self::STATUS_OPEN; @@ -200,13 +202,6 @@ class Account extends CommonObject */ public $type_lib = array(); - /** - * Array listing all the potential status of an account. - * Defined in __construct - * @var array array: int of the status => translated label of the status - */ - public $status = array(); - /** * Accountancy code * @var string @@ -312,7 +307,7 @@ class Account extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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), @@ -387,17 +382,17 @@ class Account extends CommonObject $this->db = $db; - $this->solde = 0; + $this->balance = 0; $this->type_lib = array( - self::TYPE_SAVINGS => $langs->trans("BankType0"), - self::TYPE_CURRENT => $langs->trans("BankType1"), - self::TYPE_CASH => $langs->trans("BankType2"), + self::TYPE_SAVINGS => $langs->transnoentitiesnoconv("BankType0"), + self::TYPE_CURRENT => $langs->transnoentitiesnoconv("BankType1"), + self::TYPE_CASH => $langs->transnoentitiesnoconv("BankType2"), ); - $this->status = array( - self::STATUS_OPEN => $langs->trans("StatusAccountOpened"), - self::STATUS_CLOSED => $langs->trans("StatusAccountClosed") + $this->labelStatus = array( + self::STATUS_OPEN => $langs->transnoentitiesnoconv("StatusAccountOpened"), + self::STATUS_CLOSED => $langs->transnoentitiesnoconv("StatusAccountClosed") ); } @@ -2744,41 +2739,6 @@ class AccountLine extends CommonObjectLine public function LibStatut($status, $mode = 0) { // phpcs:enable - //global $langs; - - //$langs->load('companies'); - /* - if ($mode == 0) - { - if ($status==0) return $langs->trans("ActivityCeased"); - if ($status==1) return $langs->trans("InActivity"); - } - if ($mode == 1) - { - if ($status==0) return $langs->trans("ActivityCeased"); - if ($status==1) return $langs->trans("InActivity"); - } - if ($mode == 2) - { - if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); - if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); - } - if ($mode == 3) - { - if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); - if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); - } - if ($mode == 4) - { - if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); - if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); - } - if ($mode == 5) - { - if ($status==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); - if ($status==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); - }*/ - return ''; } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 6e3a2f28c67..7bb567f1536 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -198,7 +198,7 @@ class PaymentVarious extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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 diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 480c36cd07e..76a3f8e2abd 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2020 Tobias Sekan + * 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 @@ -125,6 +126,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 $permissiontoadd = $user->hasRight('banque', 'modifier'); $permissiontodelete = $user->hasRight('banque', 'configurer'); diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 8a2aa9178f7..d41e3c2e4a6 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018 Frédéric France * Copyright (C) 2020 Tobias Sekan + * 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 @@ -172,6 +173,7 @@ $arrayfields = array( ); $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Security check $socid = GETPOSTINT("socid"); diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 3502f31d822..1515b0c5322 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -10,6 +10,7 @@ * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017-2018 Frédéric France * Copyright (C) 2023 Nick Fragoulis + * 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 @@ -542,7 +543,7 @@ if (empty($reshook)) { //$tva_npr = $datapriceofproduct['tva_npr']; $tmpvat = (float) price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', (string) $prod->tva_tx)); // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? if (!empty($price_ht)) { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7296c3dd820..69c113e86d7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -400,7 +400,7 @@ if (empty($reshook)) { $action = ''; } else { $tmpvatratetoshow = explode('_', $vatrate); - $tmpvatratetoshow[0] = round($tmpvatratetoshow[0], 2); + $tmpvatratetoshow[0] = round((float) $tmpvatratetoshow[0], 2); if ($tmpvatratetoshow[0] != 0) { $langs->load("errors"); @@ -476,7 +476,7 @@ if (empty($reshook)) { $object->date = $newdate; $new_date_lim_reglement = $object->calculate_date_lim_reglement(); - if ($new_date_lim_reglement > $old_date_lim_reglement) { + if ($new_date_lim_reglement) { $object->date_lim_reglement = $new_date_lim_reglement; } if ($object->date_lim_reglement < $object->date) { @@ -517,7 +517,7 @@ if (empty($reshook)) { if (!$error) { $old_date_lim_reglement = $object->date_lim_reglement; $new_date_lim_reglement = $object->calculate_date_lim_reglement(); - if ($new_date_lim_reglement > $old_date_lim_reglement) { + if ($new_date_lim_reglement) { $object->date_lim_reglement = $new_date_lim_reglement; } if ($object->date_lim_reglement < $object->date) { @@ -959,12 +959,12 @@ if (empty($reshook)) { } if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) { foreach ($amount_ht as $tva_tx => $xxx) { - $discount->amount_ht = abs($amount_ht[$tva_tx]); - $discount->amount_tva = abs($amount_tva[$tva_tx]); - $discount->amount_ttc = abs($amount_ttc[$tva_tx]); - $discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]); - $discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]); - $discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]); + $discount->amount_ht = abs((float) $amount_ht[$tva_tx]); + $discount->amount_tva = abs((float) $amount_tva[$tva_tx]); + $discount->amount_ttc = abs((float) $amount_ttc[$tva_tx]); + $discount->multicurrency_amount_ht = abs((float) $multicurrency_amount_ht[$tva_tx]); + $discount->multicurrency_amount_tva = abs((float) $multicurrency_amount_tva[$tva_tx]); + $discount->multicurrency_amount_ttc = abs((float) $multicurrency_amount_ttc[$tva_tx]); // Clean vat code $reg = array(); @@ -1573,6 +1573,7 @@ if (empty($reshook)) { $TTotalByTva[$line->tva_tx] += $line->total_ttc; } + $amount_ttc_diff = 0.; foreach ($TTotalByTva as $tva => &$total) { $coef = $total / $srcobject->total_ttc; // Calc coef $am = $amount * $coef; @@ -2246,7 +2247,7 @@ if (empty($reshook)) { //$tva_tx = $datapriceofproduct['tva_tx']; //$tva_npr = $datapriceofproduct['tva_npr']; $tmpvat = (float) price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', (string) $prod->tva_tx)); // Set unit price to use // TODO We should not have this @@ -3523,11 +3524,15 @@ if ($action == 'create') { setRadioForTypeOfInvoice(); }); function setRadioForTypeOfInvoice() { - console.log("Change radio"); + console.log("Change radio for type of invoice"); if (jQuery("#radio_deposit").prop("checked") && (jQuery("#typedeposit").val() == \'amount\' || jQuery("#typedeposit").val() == \'variable\')) { + jQuery("#checkforselects").prop("disabled", true); + jQuery("#checkforselects").prop("checked", false); jQuery(".checkforselect").prop("disabled", true); jQuery(".checkforselect").prop("checked", false); } else { + jQuery("#checkforselects").prop("disabled", false); + jQuery("#checkforselects").prop("checked", true); jQuery(".checkforselect").prop("disabled", false); jQuery(".checkforselect").prop("checked", true); } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index bb7a8ab2ace..1ed0209e4b0 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -172,7 +172,7 @@ class FactureRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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), @@ -359,7 +359,7 @@ class FactureRec extends CommonInvoice } $tva_tx = $facsrc->lines[$i]->tva_tx; - if (!empty($facsrc->lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) { + if (!empty($facsrc->lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) { $tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')'; } @@ -894,9 +894,9 @@ class FactureRec extends CommonInvoice // Clean vat code $reg = array(); $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) { + if (preg_match('/\((.*)\)/', (string) $txtva, $reg)) { $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + $txtva = preg_replace('/\s*\(.*\)/', '', (string) $txtva); // Remove code from vatrate. } @@ -1110,7 +1110,7 @@ class FactureRec extends CommonInvoice $pu_ht = price2num($pu_ht); $pu_ttc = price2num($pu_ttc); $pu_ht_devise = price2num($pu_ht_devise); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } $txlocaltax1 = price2num($txlocaltax1); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 55c89240fa8..8f5c63a86f0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -291,7 +291,7 @@ class Facture extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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), @@ -818,7 +818,7 @@ class Facture extends CommonInvoice // Complete vat rate with code $vatrate = $newinvoiceline->tva_tx; - if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) { + if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', (string) $vatrate)) { $vatrate .= ' ('.$newinvoiceline->vat_src_code.')'; } @@ -900,7 +900,7 @@ class Facture extends CommonInvoice // Complete vat rate with code $vatrate = $line->tva_tx; - if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) { + if ($line->vat_src_code && !preg_match('/\(.*\)/', (string) $vatrate)) { $vatrate .= ' ('.$line->vat_src_code.')'; } @@ -2450,7 +2450,7 @@ class Facture extends CommonInvoice $this->type = self::TYPE_STANDARD; } if (isset($this->subtype)) { - $this->subtype = (int) trim($this->subtype); + $this->subtype = (int) trim((string) $this->subtype); } if (isset($this->ref)) { $this->ref = trim($this->ref); @@ -3859,7 +3859,7 @@ class Facture extends CommonInvoice $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); $pa_ht = price2num($pa_ht); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } $txlocaltax1 = price2num($txlocaltax1); @@ -3945,7 +3945,7 @@ class Facture extends CommonInvoice $this->line->desc = $desc; $this->line->ref_ext = $ref_ext; - $this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative + $this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs((float) $qty) : $qty); // For credit note, quantity is always positive and unit price negative $this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise $this->line->vat_src_code = $vat_src_code; @@ -4119,7 +4119,7 @@ class Facture extends CommonInvoice $pu = price2num($pu); $pu_ht_devise = price2num($pu_ht_devise); $pa_ht = price2num($pa_ht); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } $txlocaltax1 = (float) price2num($txlocaltax1); @@ -4206,7 +4206,7 @@ class Facture extends CommonInvoice $this->line->label = $label; $this->line->desc = $desc; $this->line->ref_ext = $ref_ext; - $this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative + $this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs((float) $qty) : $qty); // For credit note, quantity is always positive and unit price negative $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; @@ -4414,6 +4414,7 @@ class Facture extends CommonInvoice { // phpcs:enable dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE); + // @phan-suppress-next-line PhanDeprecatedFunction return $this->setDiscount($user, $remise, $notrigger); } @@ -4424,7 +4425,6 @@ class Facture extends CommonInvoice * @param float $remise Discount * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int Return integer <0 if KO, >0 if OK - * @deprecated remise_percent is a deprecated field for object parent */ public function setDiscount($user, $remise, $notrigger = 0) { @@ -4609,7 +4609,7 @@ class Facture extends CommonInvoice // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = ((bool) include_once $dir.$file) || $mybool; } } @@ -4624,7 +4624,7 @@ class Facture extends CommonInvoice // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } } diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 13a119e35b5..0c5526d0ae9 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -9,6 +9,7 @@ * Copyright (C) 2015-2021 Alexandre Spangaro * Copyright (C) 2016 Meziane Sof * Copyright (C) 2023 William Mead + * 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 @@ -91,7 +92,7 @@ $search_date_when_endmonth = GETPOSTINT('search_date_when_endmonth'); $search_date_when_endyear = GETPOSTINT('search_date_when_endyear'); $search_date_when_start = dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear); // Use tzserver $search_date_when_end = dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear); -$search_recurring = GETPOSTINT('search_recurring'); +$search_recurring = GETPOST('search_recurring', 'intcomma'); $search_frequency = GETPOST('search_frequency', 'alpha'); $search_unit_frequency = GETPOST('search_unit_frequency', 'alpha'); $search_nb_gen_done = GETPOST('search_nb_gen_done', 'alpha'); @@ -161,6 +162,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 ($socid > 0) { $tmpthirdparty = new Societe($db); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 13995e6cc0b..63cee7e8709 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -293,6 +293,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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')) { $search_sale = $user->id; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 09ca6cdef05..ea6f8d6c4a1 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } print "\n"; diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index d888d1fd5d7..bd8fa94cf19 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 57748c27950..59fae4217d6 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -9,7 +9,8 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2020 Josep Lluís Amador - * Copyright (C) 2021-2023 Frédéric France + * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2024 Rafael San José * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -137,7 +138,7 @@ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) { $sql .= ", s.rowid as socid"; $sql .= ", s.code_client, s.code_compta, s.email"; $sql .= ", cc.rowid as country_id, cc.code as country_code"; - $sql .= ", (SELECT SUM(pf.amount) FROM llx_paiement_facture as pf WHERE pf.fk_facture = f.rowid) as am"; + $sql .= ", (SELECT SUM(pf.amount) FROM ".$db->prefix()."paiement_facture as pf WHERE pf.fk_facture = f.rowid) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays"; @@ -283,7 +284,7 @@ if ((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO $sql .= ", s.nom as name"; $sql .= ", s.rowid as socid"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.email"; - $sql .= ", (SELECT SUM(pf.amount) FROM llx_paiementfourn_facturefourn as pf WHERE pf.fk_facturefourn = ff.rowid) as am"; + $sql .= ", (SELECT SUM(pf.amount) FROM ".$db->prefix()."paiementfourn_facturefourn as pf WHERE pf.fk_facturefourn = ff.rowid) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql .= " WHERE s.rowid = ff.fk_soc"; $sql .= " AND ff.entity IN (".getEntity('facture_fourn').")"; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 579890f9b38..e49c317a53e 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -534,7 +535,7 @@ class Localtax extends CommonObject dol_print_error($this->db); } - $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs((float) $this->amount), '', '', $user); // Update fk_bank into llx_localtax so we know the line of localtax used to generate the bank entry. if ($bank_line_id > 0) { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index f7a2026903d..14984794eab 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -12,6 +12,7 @@ * Copyright (C) 2023 Lenin Rivas * Copyright (C) 2023 Sylvain Legrand * Copyright (C) 2023 William Mead + * 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 @@ -125,7 +126,7 @@ if (empty($reshook)) { $amountsresttopay[$cursorfacid] = price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement()); if ($amounts[$cursorfacid]) { // Check amount - if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid]))) { + if ($amounts[$cursorfacid] && (abs((float) $amounts[$cursorfacid]) > abs((float) $amountsresttopay[$cursorfacid]))) { $addwarning = 1; $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay"); } @@ -152,7 +153,7 @@ if (empty($reshook)) { $multicurrency_amountsresttopay[$cursorfacid] = price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1)); if ($multicurrency_amounts[$cursorfacid]) { // Check amount - if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid]))) { + if ($multicurrency_amounts[$cursorfacid] && (abs((float) $multicurrency_amounts[$cursorfacid]) > abs((float) $multicurrency_amountsresttopay[$cursorfacid]))) { $addwarning = 1; $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay"); } @@ -234,7 +235,7 @@ if (empty($reshook)) { $tmpinvoice->fetch($key); if ($tmpinvoice->type == Facture::TYPE_CREDIT_NOTE) { $newvalue = price2num($value, 'MT'); - $amounts[$key] = - abs($newvalue); + $amounts[$key] = - abs((float) $newvalue); } $multicurrency_code[$key] = $tmpinvoice->multicurrency_code; $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx; @@ -245,7 +246,7 @@ if (empty($reshook)) { $tmpinvoice->fetch($key); if ($tmpinvoice->type == Facture::TYPE_CREDIT_NOTE) { $newvalue = price2num($value, 'MT'); - $multicurrency_amounts[$key] = - abs($newvalue); + $multicurrency_amounts[$key] = - abs((float) $newvalue); } $multicurrency_code[$key] = $tmpinvoice->multicurrency_code; $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx; @@ -820,8 +821,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Warning print ''; //print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."
    "; - if (!empty($amounts[$invoice->id]) && (abs($amounts[$invoice->id]) > abs($amountsresttopay[$invoice->id])) - || !empty($multicurrency_amounts[$invoice->id]) && (abs($multicurrency_amounts[$invoice->id]) > abs($multicurrency_amountsresttopay[$invoice->id]))) { + if (!empty($amounts[$invoice->id]) && (abs((float) $amounts[$invoice->id]) > abs((float) $amountsresttopay[$invoice->id])) + || !empty($multicurrency_amounts[$invoice->id]) && (abs((float) $multicurrency_amounts[$invoice->id]) > abs((float) $multicurrency_amountsresttopay[$invoice->id]))) { print ' '.img_warning($langs->trans("PaymentHigherThanReminderToPay")); } print ''; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 2be5b322d69..71496b46c6f 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -5,6 +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 * * 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 @@ -423,7 +424,7 @@ class RemiseCheque extends CommonObject // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } @@ -438,7 +439,7 @@ class RemiseCheque extends CommonObject // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 7243c91f3c3..c639acd036e 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2014 Alexandre Spangaro * Copyright (C) 2016 Juanjo Menent + * 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 @@ -99,6 +100,7 @@ $arrayfields = array( 'bc.statut' => array('label' => "Status", 'checked' => 1, 'position' => 70) ); $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('chequelist')); diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 0594855dce2..921ecddab78 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -13,6 +13,7 @@ * Copyright (C) 2021 OpenDsi * Copyright (C) 2023 Joachim Kueter * Copyright (C) 2023 Sylvain Legrand + * 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 @@ -68,12 +69,12 @@ class Paiement extends CommonObject public $socid; /** - * @var int + * @var int|string */ public $datepaye; /** - * @var int same than $datepaye + * @var int|string same than $datepaye */ public $date; @@ -847,7 +848,7 @@ class Paiement extends CommonObject // Add link to the Direct Debit if invoice refused ('InvoiceRefused') in bank_url if (!$error && $label == '(InvoiceRefused)') { - $result=$acc->add_url_line( + $result = $acc->add_url_line( $bank_line_id, $this->id_prelevement, DOL_URL_ROOT.'/compta/prelevement/card.php?id=', @@ -1182,7 +1183,7 @@ class Paiement extends CommonObject // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } @@ -1197,7 +1198,7 @@ class Paiement extends CommonObject // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } } @@ -1352,7 +1353,7 @@ class Paiement extends CommonObject $result .= $linkend; global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 12c2ec797d8..2ae8ee73d74 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -9,6 +9,7 @@ * Copyright (C) 2018-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2020 Tobias Sekan + * 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 @@ -110,6 +111,7 @@ $arrayfields = array( 'p.statut' => array('label' => "Status", 'checked' => 1, 'position' => 90, 'enabled' => (getDolGlobalString('BILL_ADD_PAYMENT_VALIDATION'))), ); $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('paymentlist')); diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 0094a541cf6..31b4daceabf 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2018 Frédéric France + * Copyright (C) 2016-2024 Frédéric France * Copyright (C) 2022 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -85,7 +85,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { $other_chid = substr($key, 7); - $amounts[$other_chid] = price2num(GETPOST($key)); + $amounts[$other_chid] = (float) price2num(GETPOST($key)); } } diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php index 3b98f540a22..ecb946e6686 100644 --- a/htdocs/compta/paiement_vat.php +++ b/htdocs/compta/paiement_vat.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2021 Frédéric France + * Copyright (C) 2016-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -80,7 +80,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { $other_chid = substr($key, 7); - $amounts[$other_chid] = price2num(GETPOST($key)); + $amounts[$other_chid] = (float) price2num(GETPOST($key)); } } @@ -253,6 +253,7 @@ if ($action == 'create') { $total = 0; $totalrecu = 0; + $total_ttc = 0.; while ($i < $num) { $objp = $tva; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index c9f2401513b..b8a9f045c4d 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -460,7 +460,7 @@ if ($id > 0 || $ref) { if ($salaryBonPl) { $sql = "SELECT pl.rowid, pl.statut, pl.amount, pl.fk_user,"; $sql .= " u.rowid as socid, u.login as name"; - $sql .= " FROM llx_prelevement_lignes as pl"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb"; $sql .= ", ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index a58cb34a0b5..6a4b07b0156 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 JC Prieto * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,6 +84,9 @@ class BonPrelevement extends CommonObject public $factures = array(); + /** + * @var array + */ public $methodes_trans = array(); public $invoice_in_error = array(); @@ -145,7 +149,7 @@ class BonPrelevement extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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,), @@ -171,6 +175,9 @@ class BonPrelevement extends CommonObject public $credite; public $note; public $date_trans; + /** + * @var int Current transport method, index to $methodes_trans + */ public $method_trans; public $fk_user_trans; public $date_credit; @@ -666,7 +673,7 @@ class BonPrelevement extends CommonObject * * @param User $user Id of user * @param int $date Date of action - * @param string $method Method of transmission to bank (0=Internet, 1=Api...) + * @param int $method Method of transmission to bank (0=Internet, 1=Api...) * @return int >0 if OK, <0 if KO */ public function set_infotrans($user, $date, $method) @@ -2134,9 +2141,9 @@ class BonPrelevement extends CommonObject * @param string $row_cb pl.code_banque AS cb, Not used for SEPA * @param string $row_cg pl.code_guichet AS cg, Not used for SEPA * @param string $row_cc pl.number AS cc, Not used for SEPA - * @param string $row_somme pl.amount AS somme, + * @param float $row_somme pl.amount AS somme, * @param string $row_ref Invoice ref (f.ref) or Salary ref - * @param string $row_idfac p.fk_facture AS idfac or p.fk_facture_fourn or p.fk_salary, + * @param int $row_idfac p.fk_facture AS idfac or p.fk_facture_fourn or p.fk_salary, * @param string $row_iban rib.iban_prefix AS iban, * @param string $row_bic rib.bic AS bic, * @param string $row_datec rib.datec, @@ -2172,7 +2179,7 @@ class BonPrelevement extends CommonObject // Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum) $XML_DEBITOR .= ' '.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_DEBITOR .= ' '.$CrLf; - $XML_DEBITOR .= ' '.round($row_somme, 2).''.$CrLf; + $XML_DEBITOR .= ' '.round((float) $row_somme, 2).''.$CrLf; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$Rum.''.$CrLf; @@ -2237,7 +2244,7 @@ class BonPrelevement extends CommonObject $XML_CREDITOR .= ' ' . $CrLf; } $XML_CREDITOR .= ' '.$CrLf; - $XML_CREDITOR .= ' '.round($row_somme, 2).''.$CrLf; + $XML_CREDITOR .= ' '.round((float) $row_somme, 2).''.$CrLf; $XML_CREDITOR .= ' '.$CrLf; /* $XML_CREDITOR .= ' '.$CrLf; diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 4422ff3da33..0829b4cc8ec 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -356,6 +356,11 @@ while ($i < min($num, $limit)) { $i++; } +// If no record found +if ($num == 0) { + print ''.$langs->trans("NoRecordFound").''; +} + print ""; print "
  • "; print "
    "; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 1fe40efa05e..1dc1fd3d76d 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -274,10 +274,10 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; + $param = "&id=".((int) $id); if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } - $param = "&id=".urlencode((string) ($id)); // Lines of title fields print ''; @@ -325,10 +325,14 @@ if ($resql) { while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); - if ($salaryBonPl) { + $itemurl = ''; + $partyurl = ''; + if ($salaryBonPl && ($salarytmp instanceof Salary) && ($user instanceof User)) { $salarytmp->fetch($obj->salaryid); $usertmp->fetch($obj->userid); - } else { + $itemurl = $salarytmp->getNomUrl(1); + $partyurl = $usertmp->getNomUrl(1); + } elseif ($invoicetmp instanceof Facture && $invoicetmpsupplier instanceof FactureFournisseur) { if ($obj->type == 'bank-transfer') { $invoicetmp = $invoicetmpsupplier; } else { @@ -337,22 +341,24 @@ if ($resql) { $invoicetmp->fetch($obj->facid); $thirdpartytmp->fetch($obj->socid); + $itemurl = $invoicetmp->getNomUrl(1); + $partyurl = $thirdpartytmp->getNomUrl(1); } print ''; print ''; - print($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); + print $itemurl; print "\n"; - if ($object->type == 'bank-transfer' && !$salaryBonPl) { + if ($object->type == 'bank-transfer' && !$salaryBonPl && $invoicetmp instanceof Facture) { print ''; print dol_escape_htmltag($invoicetmp->ref_supplier); print "\n"; } print ''; - print($salaryBonPl ? $usertmp->getNomUrl(-1) : $thirdpartytmp->getNomUrl(1)); + print $partyurl; print "\n"; // Amount of invoice diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 21fa04cc931..daa017a0130 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -3,6 +3,7 @@ * Copyright (C) 2016-2022 Alexandre Spangaro * Copyright (C) 2018-2020 Laurent Destailleur * Copyright (C) 2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -260,12 +261,12 @@ print ''.$langs->trans("PreviousPeriod").''; print ''.$langs->trans("SelectedPeriod").''; foreach ($months as $k => $v) { if (($k + 1) >= $date_startmonth && $k < $date_endmonth) { - print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k + 1))).''; + print ''.$langs->trans('MonthShort'.sprintf("%02d", ($k + 1))).''; } } foreach ($months as $k => $v) { if (($k + 1) < $date_startmonth) { - print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k + 1))).''; + print ''.$langs->trans('MonthShort'.sprintf("%02d", ($k + 1))).''; } } print ''; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index b08bcacfc9a..d91ce98999e 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -406,8 +406,8 @@ class ChargeSociales extends CommonObject /** * Calculate amount remaining to pay by year * - * @param int $year Year - * @return number + * @param int $year Year + * @return int|float Returns -1 when error (Note: could be mistaken with an amount) */ public function solde($year = 0) { diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 2a724f56d42..c6a7b6c437f 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,12 +83,19 @@ class PaymentSocialContribution extends CommonObject public $bank_line; /** - * @deprecated + * @deprecated Use $amount instead. * @see $amount + * @var float|int */ public $total; + /** + * @var float|int + */ public $amount; // Total amount of payment + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -97,7 +105,7 @@ class PaymentSocialContribution extends CommonObject /** * @var string - * @deprecated + * @deprecated Use $num_payment instead * @see $num_payment */ public $num_paiement; @@ -178,7 +186,7 @@ class PaymentSocialContribution extends CommonObject $this->fk_charge = (int) $this->fk_charge; } if (isset($this->amount)) { - $this->amount = trim($this->amount); + $this->amount = (float) $this->amount; } if (isset($this->fk_typepaiement)) { $this->fk_typepaiement = (int) $this->fk_typepaiement; @@ -201,11 +209,11 @@ class PaymentSocialContribution extends CommonObject $totalamount = 0; foreach ($this->amounts as $key => $value) { // How payment is dispatch - $newvalue = price2num($value, 'MT'); + $newvalue = (float) price2num($value, 'MT'); $this->amounts[$key] = $newvalue; $totalamount += $newvalue; } - $totalamount = price2num($totalamount); + $totalamount = (float) price2num($totalamount); // Check parameters if ($totalamount == 0) { @@ -232,7 +240,7 @@ class PaymentSocialContribution extends CommonObject foreach ($this->amounts as $key => $amount) { $contribid = $key; if (is_numeric($amount) && $amount != 0) { - $amount = price2num($amount); + $amount = (float) price2num($amount); // If we want to closed paid invoices if ($closepaidcontrib) { @@ -243,8 +251,8 @@ class PaymentSocialContribution extends CommonObject $creditnotes = 0; //$deposits=$contrib->getSumDepositsUsed(); $deposits = 0; - $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT'); - $remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT'); + $alreadypayed = (float) price2num($paiement + $creditnotes + $deposits, 'MT'); + $remaintopay = (float) price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT'); if ($remaintopay == 0) { $result = $contrib->setPaid($user); } else { @@ -318,8 +326,10 @@ class PaymentSocialContribution extends CommonObject $this->tms = $this->db->jdate($obj->tms); $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; + $this->total = $obj->amount; $this->fk_typepaiement = $obj->fk_typepaiement; $this->num_payment = $obj->num_payment; + $this->num_paiement = $obj->num_payment; $this->note_private = $obj->note; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; @@ -359,7 +369,7 @@ class PaymentSocialContribution extends CommonObject $this->fk_charge = (int) $this->fk_charge; } if (isset($this->amount)) { - $this->amount = trim($this->amount); + $this->amount = (float) $this->amount; } if (isset($this->fk_typepaiement)) { $this->fk_typepaiement = (int) $this->fk_typepaiement; @@ -577,7 +587,7 @@ class PaymentSocialContribution extends CommonObject $acc = new Account($this->db); $acc->fetch($accountid); - $total = $this->total; + $total = $this->amount; if ($mode == 'payment_sc') { $total = -$total; } diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 5f07abd308a..d31e12f575b 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -7,6 +7,7 @@ * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2021-2023 Alexandre Spangaro + * 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 @@ -114,6 +115,7 @@ if (isModEnabled("bank")) { } $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('sclist')); diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 85906cd2c12..8269058cf69 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -159,8 +159,8 @@ foreach ($listofparams as $param) { llxHeader('', $langs->trans("TurnoverReport"), '', '', 0, 0, '', '', $morequerystring); -$exportlink=""; -$namelink=""; +$exportlink = ""; +$namelink = ""; //print load_fiche_titre($langs->trans("VAT"),""); //$fsearch.='
    '; @@ -304,7 +304,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($j > 12) { $j -= 12; } - print ''.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).''; + print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).''; $i++; } print ''.$langs->trans("TotalHT").''; @@ -314,7 +314,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " fd.product_type AS product_type,"; $sql .= " cc.code, cc.label AS country,"; for ($i = 1; $i <= 12; $i++) { - $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$i, "fd.total_ht", "0").") AS month".str_pad($i, 2, "0", STR_PAD_LEFT).","; + $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$i, "fd.total_ht", "0").") AS month".str_pad((string) $i, 2, "0", STR_PAD_LEFT).","; } $sql .= " SUM(fd.total_ht) as total"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; @@ -354,7 +354,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($j > 12) { $j -= 12; } - $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); + $monthj = 'month'.str_pad((string) $j, 2, '0', STR_PAD_LEFT); print ''.price($obj->$monthj).''; $totalpermonth[$j] = (empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j]) + $obj->$monthj; } @@ -373,7 +373,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($j > 12) { $j -= 12; } - $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); + $monthj = 'month'.str_pad((string) $j, 2, '0', STR_PAD_LEFT); print ''.price((empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j])).''; } print ''.price((empty($totalpermonth['total']) ? 0 : $totalpermonth['total'])).''; @@ -391,7 +391,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($j > 12) { $j -= 12; } - print ''.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).''; + print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).''; $i++; } print ''.$langs->trans("TotalHT").''; @@ -401,7 +401,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql2 .= " ffd.product_type AS product_type,"; $sql2 .= " cc.code, cc.label AS country,"; for ($i = 1; $i <= 12; $i++) { - $sql2 .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$i, "ffd.total_ht", "0").") AS month".str_pad($i, 2, "0", STR_PAD_LEFT).","; + $sql2 .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$i, "ffd.total_ht", "0").") AS month".str_pad((string) $i, 2, "0", STR_PAD_LEFT).","; } $sql2 .= " SUM(ffd.total_ht) as total"; $sql2 .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd"; @@ -441,7 +441,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($j > 12) { $j -= 12; } - $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); + $monthj = 'month'.str_pad((string) $j, 2, '0', STR_PAD_LEFT); print ''.price($obj->$monthj).''; $totalpermonth[$j] = (empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j]) + $obj->$monthj; } @@ -460,7 +460,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($j > 12) { $j -= 12; } - $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); + $monthj = 'month'.str_pad((string) $j, 2, '0', STR_PAD_LEFT); print ''.price(empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j]).''; } print ''.price(empty($totalpermonth['total']) ? 0 : $totalpermonth['total']).''; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 696965f0d30..b1ff1585bc6 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2015-2023 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -179,7 +179,7 @@ if (empty($reshook)) { $object->datev = $datev; $object->datep = $datep; - $amount = price2num(GETPOST("amount", 'alpha')); + $amount = (float) price2num(GETPOST("amount", 'alpha')); if ($refund == 1) { $amount = price2num(-1 * $amount); } diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index dce5f09a3a6..886d4968a15 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,12 +59,20 @@ class PaymentVAT extends CommonObject public $datep = ''; /** - * @deprecated + * @deprecated Use $amount instead * @see $amount + * @var float|int */ public $total; + /** + * @var float|int + */ public $amount; // Total amount of payment + + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -73,7 +82,7 @@ class PaymentVAT extends CommonObject /** * @var string - * @deprecated + * @deprecated Use $num_payment instead * @see $num_payment */ public $num_paiement; @@ -178,7 +187,7 @@ class PaymentVAT extends CommonObject $this->fk_tva = (int) $this->fk_tva; } if (isset($this->amount)) { - $this->amount = trim($this->amount); + $this->amount = (float) $this->amount; } if (isset($this->fk_typepaiement)) { $this->fk_typepaiement = (int) $this->fk_typepaiement; @@ -204,11 +213,11 @@ class PaymentVAT extends CommonObject $totalamount = 0; foreach ($this->amounts as $key => $value) { // How payment is dispatch - $newvalue = price2num($value, 'MT'); + $newvalue = (float) price2num($value, 'MT'); $this->amounts[$key] = $newvalue; $totalamount += $newvalue; } - $totalamount = price2num($totalamount); + // $totalamount = price2num($totalamount); // Check parameters if ($totalamount == 0) { @@ -235,7 +244,7 @@ class PaymentVAT extends CommonObject foreach ($this->amounts as $key => $amount) { $contribid = $key; if (is_numeric($amount) && $amount != 0) { - $amount = price2num($amount); + $amount = (float) price2num($amount); // If we want to closed paid invoices if ($closepaidvat) { @@ -246,8 +255,8 @@ class PaymentVAT extends CommonObject $creditnotes = 0; //$deposits=$contrib->getSumDepositsUsed(); $deposits = 0; - $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT'); - $remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT'); + $alreadypayed = (float) price2num($paiement + $creditnotes + $deposits, 'MT'); + $remaintopay = (float) price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT'); if ($remaintopay == 0) { $result = $contrib->setPaid($user); } else { @@ -363,7 +372,7 @@ class PaymentVAT extends CommonObject $this->fk_tva = (int) $this->fk_tva; } if (isset($this->amount)) { - $this->amount = trim($this->amount); + $this->amount = (float) $this->amount; } if (isset($this->fk_typepaiement)) { $this->fk_typepaiement = (int) $this->fk_typepaiement; @@ -537,12 +546,12 @@ class PaymentVAT extends CommonObject $this->fk_tva = 0; $this->datec = dol_now(); $this->tms = dol_now(); - $this->datep = ''; - $this->amount = ''; + $this->datep = dol_now(); + $this->amount = 100; $this->fk_typepaiement = 0; - $this->num_payment = ''; - $this->note_private = ''; - $this->note_public = ''; + $this->num_payment = '123456'; + $this->note_private = 'Private note'; + $this->note_public = 'Public note'; $this->fk_bank = 0; $this->fk_user_creat = 0; $this->fk_user_modif = 0; @@ -576,7 +585,7 @@ class PaymentVAT extends CommonObject $acc = new Account($this->db); $acc->fetch($accountid); - $total = $this->total; + $total = $this->amount; if ($mode == 'payment_vat') { $total = -$total; } diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 9b6081e6d7f..113f3970e76 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2018 Philippe Grand * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -661,9 +662,9 @@ class Tva extends CommonObject } if ($this->amount > 0) { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), $this->num_payment, '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs((float) $this->amount), $this->num_payment, '', $user); } else { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs($this->amount), $this->num_payment, '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs((float) $this->amount), $this->num_payment, '', $user); } // Update fk_bank into llx_tva. So we know vat line used to generate bank transaction diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 573c3d50289..68e84da8be2 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -5,6 +5,7 @@ * Copyright (C) 2011-2019 Alexandre Spangaro * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,6 +96,7 @@ if (isModEnabled("bank")) { } $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('salestaxeslist')); diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index d0ca5f7142e..4d8c4f8fadd 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -130,8 +130,8 @@ $dolibarr_main_db_user=''; // dolibarr_main_db_pass // ===================== // This parameter contains password used to read and write into Dolibarr database. -// If content is 'crypted:...', the password is encrypted/decrypted with dol_encode/dol_decode. -// If content is 'dolcrypt:...', the password is encrypted/decrypted with dolEncrypt/dolDecrypt. +// If content is 'crypted:...', the password is encrypted/decrypted with dol_encode/dol_decode. +// If content is 'dolcrypt:...', the password is encrypted/decrypted with dolEncrypt/dolDecrypt. // // Examples: // $dolibarr_main_db_pass='myadminpass'; @@ -160,6 +160,7 @@ $dolibarr_main_db_type=''; // Default value: depends on database driver // Examples: // dolibarr_main_db_character_set='utf8'; +// dolibarr_main_db_character_set='utf8mb4'; // $dolibarr_main_db_character_set='utf8'; @@ -455,5 +456,3 @@ $dolibarr_cron_allow_cli='0'; //############################## // External modules //############################## - - diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index f20a5c170a4..7aac94c5ba6 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +157,7 @@ abstract class ActionsContactCardCommon // Town $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); - if (dol_strlen(trim($this->object->country_id)) == 0) { + if (dol_strlen(trim((string) $this->object->country_id)) == 0) { $this->object->country_id = $objsoc->country_id; } @@ -176,7 +177,7 @@ abstract class ActionsContactCardCommon } // Public or private - $selectarray = array('0'=>$langs->trans("ContactPublic"), '1'=>$langs->trans("ContactPrivate")); + $selectarray = array('0' => $langs->trans("ContactPublic"), '1' => $langs->trans("ContactPrivate")); $this->tpl['select_visibility'] = $form->selectarray('priv', $selectarray, $this->object->priv, 0); } diff --git a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php index bc8ff9ebcf4..42f31475c00 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } ?> diff --git a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php index cf193e25274..f1bea679d32 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php index 1a66208288f..ab7f560ec47 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index a7b38cc85c7..28e39259101 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -11,6 +11,7 @@ * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2019 Josep Lluís Amador * Copyright (C) 2020 Open-Dsi + * 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 @@ -52,7 +53,8 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'users', 'other', 'commercial')); -$mesg = ''; $error = 0; $errors = array(); +$error = 0; +$errors = array(); // Get parameters $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); @@ -112,7 +114,7 @@ $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'ro * Actions */ -$parameters = array('id'=>$id, 'objcanvas'=>$objcanvas); +$parameters = array('id' => $id, 'objcanvas' => $objcanvas); $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'); @@ -305,7 +307,7 @@ if (empty($reshook)) { if (empty($error) && $id > 0) { $db->commit(); if (!empty($backtopage)) { - $url = str_replace('__ID__', $id, $backtopage); + $url = str_replace('__ID__', (string) $id, $backtopage); } else { $url = 'card.php?id='.$id; } @@ -860,7 +862,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Visibility print ''; - $selectarray = array('0'=>$langs->trans("ContactPublic"), '1'=>$langs->trans("ContactPrivate")); + $selectarray = array('0' => $langs->trans("ContactPublic"), '1' => $langs->trans("ContactPrivate")); print $form->selectarray('priv', $selectarray, (GETPOST("priv", 'alpha') ? GETPOST("priv", 'alpha') : $object->priv), 0); print ''; @@ -1138,7 +1140,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Visibility print ''; - $selectarray = array('0'=>$langs->trans("ContactPublic"), '1'=>$langs->trans("ContactPrivate")); + $selectarray = array('0' => $langs->trans("ContactPublic"), '1' => $langs->trans("ContactPrivate")); print $form->selectarray('priv', $selectarray, $object->priv, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150'); print ''; @@ -1192,7 +1194,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Other attributes - $parameters = array('colspan' => ' colspan="3"', 'cols'=> '3', 'colspanvalue'=> '3'); + $parameters = array('colspan' => ' colspan="3"', 'cols' => '3', 'colspanvalue' => '3'); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; $object->load_ref_elements(); @@ -1451,7 +1453,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Other attributes - $parameters = array('socid'=>$socid); + $parameters = array('socid' => $socid); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; $object->load_ref_elements(); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 1c800456b76..080cc4d5f95 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -98,7 +98,7 @@ class Contact extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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'), @@ -1298,6 +1298,18 @@ class Contact extends CommonObject } } + if (!$error) { + // Remove Notifications + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def WHERE fk_contact = ".((int) $this->id); + dol_syslog(__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->error .= $this->db->lasterror(); + $errorflag = -1; + } + } + if (!$error) { // Remove category $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople = ".((int) $this->id); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index d391b2e8d4b..c7058f80d68 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -12,6 +12,7 @@ * Copyright (C) 2019 Frédéric France * Copyright (C) 2019 Josep Lluís Amador * Copyright (C) 2020 Open-Dsi + * 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 @@ -268,6 +269,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan if (($id > 0 || !empty($ref)) && $action != 'add') { diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index a8434eff2d9..08e8e248d7e 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020 Tobias Sekan + * 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 @@ -67,6 +68,7 @@ $v->setPhoneNumber($contact->fax, "TYPE=WORK;FAX"); $country = $contact->country_code ? $contact->country : ''; $v->setAddress("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK;POSTAL"); +// @phan-suppress-next-line PhanDeprecatedFunction setLabel applies the old method, setAddress is the new method. $v->setLabel("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK"); $v->setEmail($contact->email); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 4d411b5a2b9..5877525b7fe 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -546,7 +546,7 @@ if (empty($reshook)) { } $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', (string) $prod->tva_tx)); // Set unit price to use if (!empty($price_ht) || $price_ht === '0') { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 232084addce..c3e5001b2af 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -184,6 +184,12 @@ class Contrat extends CommonObject */ public $date_contrat; + /** + * Status of the contract (0=NoSignature, 1=SignedBySender, 2=SignedByReceiver, 9=SignedByAll) + * @var int + */ + public $signed_status = 0; + public $commercial_signature_id; public $fk_commercial_signature; public $commercial_suivi_id; @@ -243,7 +249,7 @@ class Contrat extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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), @@ -255,6 +261,7 @@ class Contrat extends CommonObject 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 40), 'date_contrat' => array('type' => 'datetime', 'label' => 'Date contrat', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 50, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 9 => 'SignedAll')), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 70), 'fk_projet' => array('type' => 'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'visible' => -1, 'position' => 75), 'fk_commercial_signature' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'SaleRepresentative Signature', 'enabled' => 1, 'visible' => -1, 'position' => 80), @@ -275,6 +282,25 @@ class Contrat extends CommonObject const STATUS_VALIDATED = 1; const STATUS_CLOSED = 2; + /* + * No signature + */ + const STATUS_NO_SIGNATURE = 0; + + /* + * Signed by sender + */ + const STATUS_SIGNED_SENDER = 1; + + /* + * Signed by receiver + */ + const STATUS_SIGNED_RECEIVER = 2; + + /* + * Signed by all + */ + const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) /** @@ -311,7 +337,7 @@ class Contrat extends CommonObject $dir = dol_buildpath($reldir."core/modules/contract/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if (!$mybool) { @@ -1462,7 +1488,7 @@ class Contrat extends CommonObject * * @param string $desc Description of line * @param float $pu_ht Unit price net - * @param int $qty Quantity + * @param float $qty Quantity * @param float $txtva Vat rate * @param float $txlocaltax1 Local tax 1 rate * @param float $txlocaltax2 Local tax 2 rate @@ -1502,9 +1528,9 @@ class Contrat extends CommonObject // Clean vat code $reg = array(); $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) { + if (preg_match('/\((.*)\)/', (string) $txtva, $reg)) { $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + $txtva = preg_replace('/\s*\(.*\)/', '', (string) $txtva); // Remove code into vatrate. } $txtva = price2num($txtva); $txlocaltax1 = price2num($txlocaltax1); @@ -1657,7 +1683,7 @@ class Contrat extends CommonObject $contractline->id = $contractlineid; $result = $contractline->insertExtraFields(); if ($result < 0) { - $this->error[] = $contractline->error; + $this->errors[] = $contractline->error; $error++; } } @@ -1695,7 +1721,7 @@ class Contrat extends CommonObject * @param int $rowid Id de la ligne de facture * @param string $desc Description de la ligne * @param float $pu Prix unitaire - * @param int $qty Quantite + * @param float $qty Quantite * @param float $remise_percent Percentage discount of the line * @param int $date_start Date de debut prevue * @param int $date_end Date de fin prevue @@ -1720,7 +1746,7 @@ class Contrat extends CommonObject $error = 0; // Clean parameters - $qty = trim($qty); + $qty = trim((string) $qty); $desc = trim($desc); $desc = trim($desc); $price = price2num($pu); @@ -1851,7 +1877,7 @@ class Contrat extends CommonObject $result = $contractline->insertExtraFields(); if ($result < 0) { - $this->error[] = $contractline->error; + $this->errors[] = $contractline->error; $error++; } } @@ -2953,6 +2979,22 @@ class Contrat extends CommonObject $return .= ''; return $return; } + + // @Todo getLibSignedStatus, LibSignedStatus + + /** + * Set signed status + * + * @param User $user Object user that modify + * @param int $status Newsigned status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers + * @param string $triggercode Trigger code to use + * @return int 0 < if KO, > 0 if OK + */ + public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, $triggercode = ''): int + { + return $this->setSignedStatusCommon($user, $status, $notrigger, $triggercode); + } } @@ -3106,7 +3148,7 @@ class ContratLigne extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int,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}> 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), @@ -3431,11 +3473,11 @@ class ContratLigne extends CommonObjectLine $this->label = trim($this->label); $this->description = trim($this->description); $this->vat_src_code = trim($this->vat_src_code); - $this->tva_tx = trim($this->tva_tx); + $this->tva_tx = trim((string) $this->tva_tx); $this->localtax1_tx = trim($this->localtax1_tx); $this->localtax2_tx = trim($this->localtax2_tx); - $this->qty = trim($this->qty); - $this->remise_percent = trim($this->remise_percent); + $this->qty = trim((string) $this->qty); + $this->remise_percent = trim((string) $this->remise_percent); $this->fk_remise_except = (int) $this->fk_remise_except; $this->subprice = price2num($this->subprice); $this->price_ht = price2num($this->price_ht); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index a9c49bbeaab..43c7b8da85b 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -9,6 +9,7 @@ * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2019 Nicolas Zabouri * Copyright (C) 2021 Alexandre Spangaro + * 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 @@ -194,6 +195,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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')) { $search_sale = $user->id; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index a2542669485..c61e72867f2 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -7,6 +7,7 @@ * Copyright (C) 2018 Frédéric France * Copyright (C) 2019 Juanjo Menent * Copyright (C) 2023-2024 William Mead + * 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 @@ -139,6 +140,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 $permissiontoread = $user->hasRight('contrat', 'lire'); $permissiontoadd = $user->hasRight('contrat', 'creer'); diff --git a/htdocs/contrat/ticket.php b/htdocs/contrat/ticket.php index 7c7cce00982..a4b37e28f71 100644 --- a/htdocs/contrat/ticket.php +++ b/htdocs/contrat/ticket.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2012-2023 Charlene BENKE + * 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 @@ -37,10 +38,10 @@ require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; $langs->loadLangs(array('companies', 'contracts', 'tickets')); -$socid=GETPOSTINT('socid'); -$id=GETPOSTINT('id'); -$ref=GETPOST('ref', 'alpha'); -$action=GETPOST('action', 'alpha'); +$socid = GETPOSTINT('socid'); +$id = GETPOSTINT('id'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'alpha'); if ($id == '' && $ref == '') { dol_print_error(null, 'Bad parameter'); @@ -48,12 +49,12 @@ if ($id == '' && $ref == '') { } // Security check -$socid=0; +$socid = 0; if ($user->socid > 0) { - $socid=$user->socid; + $socid = $user->socid; } -$result=restrictedArea($user, 'contrat', $id); +$result = restrictedArea($user, 'contrat', $id); /* @@ -63,25 +64,25 @@ $result=restrictedArea($user, 'contrat', $id); llxHeader("", $langs->trans("Tickets"), "Contrat"); $form = new Form($db); -$userstatic=new User($db); +$userstatic = new User($db); -$object= new Contrat($db); -$result=$object->fetch($id, $ref); -$ret=$object->fetch_thirdparty(); +$object = new Contrat($db); +$result = $object->fetch($id, $ref); +$ret = $object->fetch_thirdparty(); $head = contract_prepare_head($object); -dol_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract'); +dol_get_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract'); $linkback = ''; -$linkback.= $langs->trans("BackToList").''; +$linkback .= $langs->trans("BackToList").''; -$morehtmlref=''; -$morehtmlref.=$object->ref; +$morehtmlref = ''; +$morehtmlref .= $object->ref; -$morehtmlref.='
    '; +$morehtmlref .= '
    '; // Ref customer -$morehtmlref.=$form->editfieldkey( +$morehtmlref .= $form->editfieldkey( "RefCustomer", 'ref_customer', $object->ref_customer, @@ -92,7 +93,7 @@ $morehtmlref.=$form->editfieldkey( 0, 1 ); -$morehtmlref.=$form->editfieldval( +$morehtmlref .= $form->editfieldval( "RefCustomer", 'ref_customer', $object->ref_customer, @@ -106,8 +107,8 @@ $morehtmlref.=$form->editfieldval( 1 ); // Ref supplier -$morehtmlref.='
    '; -$morehtmlref.=$form->editfieldkey( +$morehtmlref .= '
    '; +$morehtmlref .= $form->editfieldkey( "RefSupplier", 'ref_supplier', $object->ref_supplier, @@ -118,7 +119,7 @@ $morehtmlref.=$form->editfieldkey( 0, 1 ); -$morehtmlref.=$form->editfieldval( +$morehtmlref .= $form->editfieldval( "RefSupplier", 'ref_supplier', $object->ref_supplier, @@ -132,25 +133,25 @@ $morehtmlref.=$form->editfieldval( 1 ); // Thirdparty -$morehtmlref.='
    '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); +$morehtmlref .= '
    '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $langs->load("projects"); - $morehtmlref.='
    '.$langs->trans('Project') . ' : '; + $morehtmlref .= '
    '.$langs->trans('Project') . ' : '; if (! empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; } else { - $morehtmlref.=''; + $morehtmlref .= ''; } } -$morehtmlref.='
    '; +$morehtmlref .= '
    '; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref); @@ -161,7 +162,7 @@ print '
    '; * Referrers types */ -$title=$langs->trans("ListTicketsLinkToContract"); +$title = $langs->trans("ListTicketsLinkToContract"); print ''; print ''; diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index 86c7abfb7f2..0aaf9e98993 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -19,7 +19,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index ab0186f9e2f..64857afa535 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -195,7 +196,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { } $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation + $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect project after a New on another form object creation $db->commit(); @@ -233,7 +234,7 @@ if ($action == 'update' && !empty($permissiontoadd)) { continue; } } else { - if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type']) && $object->fields[$key]['type']!=='checkbox') { + if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type']) && $object->fields[$key]['type'] !== 'checkbox') { continue; // The field was not submitted to be saved } } @@ -334,8 +335,8 @@ if ($action == 'update' && !empty($permissiontoadd)) { $result = $object->update($user); if ($result > 0) { $action = 'view'; - $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation + $urltogo = $backtopage ? str_replace('__ID__', (string) $result, $backtopage) : $backurlforlist; + $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect project after a New on another form object creation if ($urltogo && empty($noback)) { header("Location: " . $urltogo); exit; diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index affca98a90d..61b31bfb5fd 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -172,19 +172,19 @@ if ($action == 'add') { //In sellist we have only one line and it can have come to do SQL expression if ($type == 'sellist' || $type == 'chkbxlst') { foreach ($parameters_array as $param_ligne) { - $params['options'] = array($parameters=>null); + $params['options'] = array($parameters => null); } } else { // Else it's separated key/value and coma list foreach ($parameters_array as $param_ligne) { - if (strpos($param_ligne, ',')!==false) { + if (strpos($param_ligne, ',') !== false) { list($key, $value) = explode(',', $param_ligne); if (!array_key_exists('options', $params)) { $params['options'] = array(); } } else { - $key=$param_ligne; - $value=null; + $key = $param_ligne; + $value = null; } $params['options'][$key] = $value; } @@ -345,7 +345,7 @@ if ($action == 'update') { //In sellist we have only one line and it can have come to do SQL expression if ($type == 'sellist' || $type == 'chkbxlst') { foreach ($parameters_array as $param_ligne) { - $params['options'] = array($parameters=>null); + $params['options'] = array($parameters => null); } } else { //Else it's separated key/value and coma list @@ -447,7 +447,7 @@ if ($action == 'encrypt') { if ($extrafields->attributes[$elementtype]['entityid'][$attributekey] == $conf->entity || empty($extrafields->attributes[$elementtype]['entityid'][$attributekey])) { dol_syslog("Loop on each extafields of table ".$arrayofelement['table_element']); - $sql .= "SELECT te.rowid, te.".$attributekey; + $sql = "SELECT te.rowid, te.".$attributekey; $sql .= " FROM ".MAIN_DB_PREFIX.$arrayofelement['table_element']." as t, ".MAIN_DB_PREFIX.$arrayofelement['table_element'].'_extrafields as te'; $sql .= " WHERE te.fk_object = t.rowid"; $sql .= " AND te.".$attributekey." NOT LIKE 'dolcrypt:%'"; @@ -462,7 +462,7 @@ if ($action == 'encrypt') { $resql = $db->query($sql); if ($resql) { $num_rows = $db->num_rows($resql); - $i=0; + $i = 0; while ($i < $num_rows) { $objtmp = $db->fetch_object($resql); $id = $objtmp->rowid; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 382cb71fca4..94f77a2111c 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1082,6 +1082,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' if ($objecttmp->element == 'societe') { /** @var Societe $objecttmp */ + '@phan-var-force Societe $objecttmp'; // TODO Change signature of delete for Societe $result = $objecttmp->delete($objecttmp->id, $user, 1); } else { diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 2a5dc287f2b..58a877cca75 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * Copyright (C) 2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -29,6 +30,10 @@ // $triggersendname must be set (can be '') // $actiontypecode can be set // $object and $uobject may be defined +' +@phan-var-force Societe $mysoc +@phan-var-force CommonObject $object +'; /* * Add file in email form @@ -357,7 +362,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $substitutionarray['__EMAIL__'] = $sendto; $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; - $parameters = array('mode'=>'formemail'); + $parameters = array('mode' => 'formemail'); complete_substitutions_array($substitutionarray, $langs, $object, $parameters); $subject = make_substitutions($subject, $substitutionarray); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 3fbd13840c2..45104b2ba27 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Pierre Morin * Copyright (C) 2013 Marcos García + * 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 @@ -182,7 +183,7 @@ if (!empty($websitekey)) { $param .= '&website='.urlencode($websitekey); } if (!empty($pageid)) { - $param .= '&pageid='.urlencode($pageid); + $param .= '&pageid='.((int) $pageid); } @@ -321,7 +322,7 @@ if ($type == 'directory') { $param .= '&website='.urlencode(GETPOST('website', 'alpha')); } if (!preg_match('/pageid=/', $param)) { - $param .= '&pageid='.urlencode((string) (GETPOSTINT('pageid'))); + $param .= '&pageid='.GETPOSTINT('pageid'); } //if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid); } diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 680e46a244c..8161f22d703 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -218,6 +219,7 @@ if (empty($conf->use_javascript_ajax) || getDolGlobalString('MAIN_ECM_DISABLE_JS // We removed all expanded sections that are child of the closed section $oldexpandedsectionarray = $expandedsectionarray; $expandedsectionarray = array(); // Reset + // @phan-suppress-next-line PhanEmptyForeachBody foreach ($oldexpandedsectionarray as $sectioncursor) { // TODO is_in_subtree(fulltree,sectionparent,sectionchild) does nox exists. Enable or remove this... //if ($sectioncursor && ! is_in_subtree($sqltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor; diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 698cd6504a2..7e5a746a8d1 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -158,7 +158,6 @@ class box_external_rss extends ModeleBoxes $title = preg_replace("/([[:alnum:]])\?([[:alnum:]])/", "\\1'\\2", $title); // Manage issue of quotes improperly (de)coded in utf-8 $title = preg_replace("/^\s+/", "", $title); // Remove leading whitespace - $this->info_box_contents["$href"] = "$title"; $tooltip = $title; $description = !empty($item['description']) ? $item['description'] : ''; diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 4cb0e49ff9d..c0e08d06ba5 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Frederic France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,7 +74,7 @@ class box_factures extends ModeleBoxes $text = $langs->trans("BoxTitleLast".(getDolGlobalString('MAIN_LASTBOX_ON_OBJECT_DATE') ? "" : "Modified")."CustomerBills", $max); $this->info_box_head = array( 'text' => $text, - 'limit'=> dol_strlen($text) + 'limit' => dol_strlen($text) ); if ($user->hasRight('facture', 'lire')) { @@ -159,13 +160,14 @@ class box_factures extends ModeleBoxes $late = ''; if ($facturestatic->hasDelay()) { + // @phan-suppress-next-line PhanPluginPrintfVariableFormatString $late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day', 'tzuserrel'))); } $this->info_box_contents[$line][] = array( 'td' => 'class="nowraponall"', 'text' => $facturestatic->getNomUrl(1), - 'text2'=> $late, + 'text2' => $late, 'asis' => 1, ); @@ -196,7 +198,7 @@ class box_factures extends ModeleBoxes if ($num == 0) { $this->info_box_contents[$line][0] = array( 'td' => 'class="center"', - 'text'=> ''.$langs->trans("NoRecordedInvoices").'', + 'text' => ''.$langs->trans("NoRecordedInvoices").'', ); } @@ -204,7 +206,7 @@ class box_factures extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( 'td' => '', - 'maxlength'=>500, + 'maxlength' => 500, 'text' => ($this->db->error().' sql='.$sql), ); } diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index f45d1ca689f..93ce9fab6da 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Frederic France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -149,13 +150,14 @@ class box_factures_fourn extends ModeleBoxes $late = ''; if ($facturestatic->hasDelay()) { + // @phan-suppress-next-line PhanPluginPrintfVariableFormatString $late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day', 'tzuserrel'))); } $this->info_box_contents[$line][] = array( 'td' => 'class="nowraponall"', 'text' => $facturestatic->getNomUrl(1), - 'text2'=> $late, + 'text2' => $late, 'asis' => 1, ); @@ -193,7 +195,7 @@ class box_factures_fourn extends ModeleBoxes if ($num == 0) { $this->info_box_contents[$line][0] = array( 'td' => 'class="center"', - 'text'=> ''.$langs->trans("NoModifiedSupplierBills").'', + 'text' => ''.$langs->trans("NoModifiedSupplierBills").'', ); } @@ -201,7 +203,7 @@ class box_factures_fourn extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( 'td' => '', - 'maxlength'=>500, + 'maxlength' => 500, 'text' => ($this->db->error().' sql='.$sql), ); } diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index fab76f18fc8..777cea5a2ed 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Frederic France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -158,6 +159,7 @@ class box_factures_fourn_imp extends ModeleBoxes $late = ''; if ($facturestatic->hasDelay()) { + // @phan-suppress-next-line PhanPluginPrintfVariableFormatString $late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day', 'tzuserrel'))); } @@ -166,7 +168,7 @@ class box_factures_fourn_imp extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="nowraponall"', 'text' => $facturestatic->getNomUrl(1), - 'text2'=> $late, + 'text2' => $late, 'asis' => 1, ); @@ -201,7 +203,7 @@ class box_factures_fourn_imp extends ModeleBoxes if ($num == 0) { $this->info_box_contents[$line][0] = array( 'td' => 'class="center"', - 'text'=> ''.$langs->trans("NoUnpaidSupplierBills").'', + 'text' => ''.$langs->trans("NoUnpaidSupplierBills").'', ); } @@ -238,7 +240,7 @@ class box_factures_fourn_imp extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( 'td' => '', - 'maxlength'=>500, + 'maxlength' => 500, 'text' => ($this->db->error().' sql='.$sql), ); } diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index b0b2659fd69..c256dbbcc72 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2019 Frederic France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,7 +76,7 @@ class box_factures_imp extends ModeleBoxes $langs->load("bills"); $textHead = $langs->trans("BoxTitleOldestUnpaidCustomerBills"); - $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $this->max), 'limit'=> dol_strlen($textHead)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $this->max), 'limit' => dol_strlen($textHead)); if ($user->hasRight('facture', 'lire')) { $sql1 = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.code_client, s.client"; @@ -171,13 +172,14 @@ class box_factures_imp extends ModeleBoxes $late = ''; if ($facturestatic->hasDelay()) { + // @phan-suppress-next-line PhanPluginPrintfVariableFormatString $late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day', 'tzuserrel'))); } $this->info_box_contents[$line][] = array( 'td' => 'class="nowraponall"', 'text' => $facturestatic->getNomUrl(1), - 'text2'=> $late, + 'text2' => $late, 'asis' => 1, ); @@ -212,7 +214,7 @@ class box_factures_imp extends ModeleBoxes if ($num == 0) { $this->info_box_contents[$line][0] = array( 'td' => 'class="center"', - 'text'=> ''.$langs->trans("NoUnpaidCustomerBills").'' + 'text' => ''.$langs->trans("NoUnpaidCustomerBills").'' ); } @@ -249,7 +251,7 @@ class box_factures_imp extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( 'td' => '', - 'maxlength'=>500, + 'maxlength' => 500, 'text' => ($this->db->error().' sql='.$sql), ); } diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 3ada87e0a10..3d5a5bb8760 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -194,12 +194,12 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo /** * Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function) * - * @param array $head Array with properties of box title - * @param array> $contents Array with properties of box lines + * @param array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title + * @param array> $contents Array with properties of box lines * @param int $nooutput No print, only return string * @return string */ - public function showBox($head = null, $contents = null, $nooutput = 0) + public function showBox($head, $contents, $nooutput = 0) { global $langs, $user, $conf; @@ -231,7 +231,6 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo $out .= "\n\n"; $out .= '
    '."\n"; - if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) { $out .= '
    '."\n"; } @@ -295,8 +294,8 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo // Show box lines if ($nblines) { // Loop on each record - for ($i = 0, $n = $nblines; $i < $n; $i++) { - if (isset($contents[$i])) { + foreach (array_keys($contents) as $i) { + if (isset($contents[$i]) && is_array($contents[$i])) { // TR if (isset($contents[$i][0]['tr'])) { $out .= ''; @@ -306,7 +305,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo // Loop on each TD $nbcolthisline = count($contents[$i]); - for ($j = 0; $j < $nbcolthisline; $j++) { + foreach (array_keys($contents[$i]) as $j) { // Define tdparam $tdparam = ''; if (!empty($contents[$i][$j]['td'])) { @@ -417,7 +416,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo * Return list of widget. Function used by admin page htdoc/admin/widget. * List is sorted by widget filename so by priority to run. * - * @param array $forcedirwidget null=All default directories. This parameter is used by modulebuilder module only. + * @param ?string[] $forcedirwidget null=All default directories. This parameter is used by modulebuilder module only. * @return array Array list of widget */ public static function getWidgetsList($forcedirwidget = null) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 91e7d127486..9d73998e151 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -34,6 +34,7 @@ use OAuth\Common\Storage\DoliStorage; use OAuth\Common\Consumer\Credentials; + /** * Class to send emails (with attachments or not) * Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid,$moreinheader,$sendcontext,$replyto); @@ -81,19 +82,20 @@ class CMailFile */ public $errors = array(); - public $smtps; // Contains SMTPs object (if this method is used) - public $phpmailer; // Contains PHPMailer object (if this method is used) + + /** + * @var SMTPS (if this method is used) + */ + public $smtps; + /** + * @var Swift_Mailer (if the method is used) + */ + public $mailer; /** * @var Swift_SmtpTransport */ public $transport; - - /** - * @var Swift_Mailer - */ - public $mailer; - /** * @var Swift_Plugins_Loggers_ArrayLogger */ @@ -108,9 +110,13 @@ class CMailFile //! Defined background directly in body tag public $bodyCSS; + /** + * @var string Message-ID of the email to send (generated) + */ public $msgid; public $headers; public $message; + /** * @var array fullfilenames list (full path of filename on file system) */ @@ -287,7 +293,7 @@ class CMailFile // This convert an embedded file with src="data:image... into a cid link + attached file $resultImageData = $this->findHtmlImagesIsSrcData($upload_dir_tmp); if ($resultImageData < 0) { - dol_syslog("CMailFile::CMailfile: Error on findHtmlImagesInSrcData"); + dol_syslog("CMailFile::CMailfile: Error on findHtmlImagesInSrcData code=".$resultImageData." upload_dir_tmp=".$upload_dir_tmp); $this->error = 'ErrorInAddAttachementsImageBaseOnMedia'; return; } @@ -525,7 +531,7 @@ class CMailFile $this->buildCSS(); } $msg = $this->html; - $msg = $this->checkIfHTML($msg); + $msg = $this->checkIfHTML($msg); // This add a header and a body including custom CSS to the HTML content } // Replace . alone on a new line with .. to avoid to have SMTP interpret this as end of message @@ -579,12 +585,15 @@ class CMailFile //$this->message = new Swift_SignedMessage(); // Adding a trackid header to a message $headers = $this->message->getHeaders(); + $headers->addTextHeader('X-Dolibarr-TRACKID', $this->trackid.'@'.$host); $this->msgid = time().'.swiftmailer-dolibarr-'.$this->trackid.'@'.$host; $headerID = $this->msgid; $msgid = $headers->get('Message-ID'); $msgid->setId($headerID); - $headers->addIdHeader('References', $headerID); + + // Add 'References:' header + //$headers->addIdHeader('References', $headerID); if (!empty($moreinheader)) { $moreinheaderarray = preg_split('/[\r\n]+/', $moreinheader); @@ -663,7 +672,7 @@ class CMailFile $this->buildCSS(); } $msg = $this->html; - $msg = $this->checkIfHTML($msg); + $msg = $this->checkIfHTML($msg); // This add a header and a body including custom CSS to the HTML content } if ($this->atleastoneimage) { @@ -727,11 +736,12 @@ class CMailFile } } - /** * Send mail that was prepared by constructor. * - * @return int|bool|string True if mail sent, false otherwise. Negative int if error in hook. String if incorrect send mode. + * @return bool True if mail sent, false otherwise. Negative int if error in hook. String if incorrect send mode. + * + * @phan-suppress PhanTypeMismatchReturnNullable False positif by phan for unclear reason. */ public function sendfile() { @@ -1536,7 +1546,7 @@ class CMailFile // References is kept in response and Message-ID is returned into In-Reply-To: $this->msgid = time().'.phpmail-dolibarr-'.$trackid.'@'.$host; $out .= 'Message-ID: <'.$this->msgid.">".$this->eol2; // Uppercase seems replaced by phpmail - $out .= 'References: <'.$this->msgid.">".$this->eol2; + //$out .= 'References: <'.$this->msgid.">".$this->eol2; $out .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host.$this->eol2; } else { $this->msgid = time().'.phpmail@'.$host; @@ -1626,7 +1636,7 @@ class CMailFile $strContentAltText = trim(wordwrap($strContentAltText, 75, !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA') ? "\r\n" : "\n")); // Check if html header already in message, if not complete the message - $strContent = $this->checkIfHTML($strContent); + $strContent = $this->checkIfHTML($strContent); // This add a header and a body including custom CSS to the HTML content } // Make RFC2045 Compliant, split lines @@ -1971,9 +1981,16 @@ class CMailFile { global $conf; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + // Build the array of image extensions $extensions = array_keys($this->image_types); + if (empty($images_dir)) { + //$images_dir = $conf->admin->dir_output.'/temp/'.uniqid('cmailfile'); + $images_dir = $conf->admin->dir_output.'/temp/cmailfile'; + } + if ($images_dir && !dol_is_dir($images_dir)) { dol_mkdir($images_dir, DOL_DATA_ROOT); } @@ -1996,7 +2013,7 @@ class CMailFile if (!empty($matches) && !empty($matches[1])) { if (empty($images_dir)) { // No temp directory provided, so we are not able to support conversion of data:image into physical images. - $this->error = 'NoTempDirProvidedInCMailConstructorSoCantConvertDataImgOnDisk'; + $this->errors[] = 'NoTempDirProvidedInCMailConstructorSoCantConvertDataImgOnDisk'; return -1; } @@ -2018,7 +2035,7 @@ class CMailFile dolChmod($destfiletmp); } else { $this->errors[] = "Failed to open file '".$destfiletmp."' for write"; - return -1; + return -2; } } diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 4e34d9a284f..e602896e82f 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -69,6 +69,9 @@ class CSMSFile public $priority; public $class; public $message; + /** + * @var bool + */ public $nostop; public $socid; @@ -242,7 +245,7 @@ class CSMSFile fwrite($fp, "Priority: ".$this->priority."\n"); fwrite($fp, "Class: ".$this->class."\n"); fwrite($fp, "Deferred: ".$this->deferred."\n"); - fwrite($fp, "DisableStop: ".$this->nostop."\n"); + fwrite($fp, "DisableStop: ".((string) (int) $this->nostop)."\n"); fwrite($fp, "DeliveryReceipt: ".$this->deliveryreceipt."\n"); fwrite($fp, "Message:\n".$this->message); diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index f5c38a55820..df06707fe5b 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -137,11 +138,11 @@ class AntiVir $command = getDolGlobalString('MAIN_ANTIVIRUS_COMMAND'); $param = getDolGlobalString('MAIN_ANTIVIRUS_PARAM'); - $param = preg_replace('/%maxreclevel/', $maxreclevel, $param); - $param = preg_replace('/%maxfiles/', $maxfiles, $param); - $param = preg_replace('/%maxratio/', $maxratio, $param); - $param = preg_replace('/%bz2archivememlim/', $bz2archivememlim, $param); - $param = preg_replace('/%maxfilesize/', $maxfilesize, $param); + $param = preg_replace('/%maxreclevel/', (string) $maxreclevel, $param); + $param = preg_replace('/%maxfiles/', (string) $maxfiles, $param); + $param = preg_replace('/%maxratio/', (string) $maxratio, $param); + $param = preg_replace('/%bz2archivememlim/', (string) $bz2archivememlim, $param); + $param = preg_replace('/%maxfilesize/', (string) $maxfilesize, $param); $param = preg_replace('/%file/', trim($file), $param); if (!preg_match('/%file/', getDolGlobalString('MAIN_ANTIVIRUS_PARAM'))) { diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 2acb44310aa..f60f5c44183 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -239,7 +240,7 @@ class Comment extends CommonObject // Clean parameters if (isset($this->fk_element)) { - $this->fk_project = (int) trim($this->fk_element); + $this->fk_project = (int) trim((string) $this->fk_element); } if (isset($this->description)) { $this->description = trim($this->description); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 251442a9b72..ab8c695c143 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1044,13 +1044,13 @@ abstract class CommonDocGenerator /** * Rect pdf * - * @param TCPDF $pdf Object PDF - * @param float $x Abscissa of first point - * @param float $y Ordinate of first point - * @param float $l ?? - * @param float $h ?? - * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title - * @param int $hidebottom Hide bottom + * @param TCPDI|TCPDF $pdf Pdf object + * @param float $x Abscissa of first point + * @param float $y Ordinate of first point + * @param float $l ?? + * @param float $h ?? + * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title + * @param int $hidebottom Hide bottom * @return void */ public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) @@ -1248,7 +1248,7 @@ abstract class CommonDocGenerator /** * print standard column content * - * @param TCPDF $pdf pdf object + * @param TCPDI|TCPDF $pdf Pdf object * @param float $curY current Y position * @param string $colKey the column key * @param string $columnText column text @@ -1291,7 +1291,7 @@ abstract class CommonDocGenerator /** * print description column content * - * @param TCPDF $pdf pdf object + * @param TCPDI|TCPDF $pdf Pdf object * @param float $curY current Y position * @param string $colKey the column key * @param object $object CommonObject @@ -1600,12 +1600,12 @@ abstract class CommonDocGenerator /** * Print standard column content * - * @param TCPDI $pdf Pdf object - * @param float $tab_top Tab top position - * @param float $tab_height Default tab height - * @param Translate $outputlangs Output language - * @param int $hidetop Hide top - * @return float Height of col tab titles + * @param TCPDI|TCPDF $pdf Pdf object + * @param float $tab_top Tab top position + * @param float $tab_height Default tab height + * @param Translate $outputlangs Output language + * @param int $hidetop Hide top + * @return float Height of col tab titles */ public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0) { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index fcdc114110e..680e15fccfb 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -437,13 +437,17 @@ abstract class CommonInvoice extends CommonObject /** * Return list of payments * + * @see $error Empty string '' if no error. + * * @param string $filtertype 1 to filter on type of payment == 'PRE' * @param int $multicurrency Return multicurrency_amount instead of amount - * @return array Array with list of payments + * @return array Array with list of payments */ public function getListOfPayments($filtertype = '', $multicurrency = 0) { $retarray = array(); + // By default no error, list can be empty. + $this->error = ''; $table = 'paiement_facture'; $table2 = 'paiement'; @@ -1904,8 +1908,8 @@ abstract class CommonInvoiceLine extends CommonObjectLine public $vat_src_code; /** - * VAT % - * @var float + * VAT % Vat rate can be like "21.30 (CODE)" + * @var string|float */ public $tva_tx; diff --git a/htdocs/core/class/commonnumrefgenerator.class.php b/htdocs/core/class/commonnumrefgenerator.class.php index 60104d09cd7..264a5417771 100644 --- a/htdocs/core/class/commonnumrefgenerator.class.php +++ b/htdocs/core/class/commonnumrefgenerator.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,7 +89,7 @@ abstract class CommonNumRefGenerator * * @param Translate $langs Object langs * @return string Model name - * @deprecated + * @deprecated Use getName() instead * @see getName() */ public function getNom($langs) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 44de1d12109..41a9a69114d 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,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}> 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,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}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -226,13 +226,13 @@ abstract class CommonObject /** * @var Project The related project object - * @deprecated - * @see project + * @deprecated Use $project instead + * @see $project */ public $projet; /** - * @deprecated + * @deprecated Use $fk_project instead * @see $fk_project */ public $fk_projet; @@ -274,13 +274,13 @@ abstract class CommonObject public $origin_id; /** - * @var Object Origin object. This is set by fetch_origin() from this->origin and this->origin_id. + * @var ?CommonObject Origin object. This is set by fetch_origin() from this->origin and this->origin_id. */ public $origin_object; /** - * @var string|CommonObject Sometime the type of the originating object ('commande', 'facture', ...), sometime the object (like onh MouvementStock) - * @deprecated Use now $origin_type and $origin_id; + * @var CommonObject|string|null Sometimes the type of the originating object ('commande', 'facture', ...), sometimes the object (as with MouvementStock) + * @deprecated Use now $origin_type and $origin_id; * @see fetch_origin() */ public $origin; @@ -322,7 +322,7 @@ abstract class CommonObject /** * @var int The object's status. Use status instead. - * @deprecated + * @deprecated Use $status instead * @see setStatut() */ public $statut; @@ -369,7 +369,7 @@ abstract class CommonObject /** * var int State ID - * @deprecated Use state_id. We can remove this property when the field 'fk_departement' have been renamed into 'state_id' in all tables + * @deprecated Use $state_id. We can remove this property when the field 'fk_departement' have been renamed into 'state_id' in all tables */ public $fk_departement; @@ -447,7 +447,7 @@ abstract class CommonObject /** * @var int Payment terms ID - * @deprecated Kept for compatibility + * @deprecated Use $cond_reglement_id instead - Kept for compatibility * @see cond_reglement_id; */ public $cond_reglement; @@ -730,13 +730,13 @@ abstract class CommonObject public $specimen = 0; /** - * @var int Id of contact to send object (used by the trigger of module Agenda) + * @var int[] Id of contacts to send objects (mails, etc.) */ public $sendtoid; /** * @var float Amount already paid from getSommePaiement() (used to show correct status) - * @deprecated Duplicate of $totalpaid + * @deprecated Use $totalpaid instead */ public $alreadypaid; /** @@ -786,14 +786,14 @@ abstract class CommonObject public $extraparams = array(); /** - * @var array List of child tables. To test if we can delete object. + * @var string[]|array List of child tables. To test if we can delete object. */ protected $childtables = array(); /** * @var string[] List of child tables. To know object to delete on cascade. - * If name is like '@ClassName:FilePathClass:ParentFkFieldName', it will - * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object. + * If name is like '@ClassName:FilePathClass:ParentFkFieldName', it will + * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object. */ protected $childtablesoncascade = array(); @@ -3864,7 +3864,7 @@ abstract class CommonObject $diff = price2num($total_tva_by_vats[$obj->vatrate] - $tmpvat, 'MT', 1); //print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."
    \n"; if ($diff) { - if (abs($diff) > (10 * pow(10, -1 * getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)))) { + if (abs((float) $diff) > (10 * pow(10, -1 * getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)))) { // If error is more than 10 times the accuracy of rounding. This should not happen. $errmsg = 'A rounding difference was detected into TOTAL but is too high to be corrected. Some data in your lines may be corrupted. Try to edit each line manually to fix this before restarting.'; dol_syslog($errmsg, LOG_WARNING); @@ -4205,98 +4205,20 @@ abstract class CommonObject if (!empty($this->linkedObjectsIds)) { $tmparray = $this->linkedObjectsIds; foreach ($tmparray as $objecttype => $objectids) { // $objecttype is a module name ('facture', 'mymodule', ...) or a module name with a suffix ('project_task', 'mymodule_myobj', ...) - // Parse element/subelement (ex: project_task, cabinetmed_consultation, ...) - $module = $element = $subelement = $objecttype; - $regs = array(); - if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' - && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { - $module = $element = $regs[1]; - $subelement = $regs[2]; - } + $element_properties = getElementProperties($objecttype); + $element = $element_properties['element']; + $classPath = $element_properties['classpath']; + $classFile = $element_properties['classfile']; + $className = $element_properties['classname']; + $module = $element_properties['module']; - $classpath = $element.'/class'; - // To work with non standard classpath or module name - if ($objecttype == 'facture') { - $classpath = 'compta/facture/class'; - } elseif ($objecttype == 'facturerec') { - $classpath = 'compta/facture/class'; - $module = 'facture'; - } elseif ($objecttype == 'propal') { - $classpath = 'comm/propal/class'; - } elseif ($objecttype == 'supplier_proposal') { - $classpath = 'supplier_proposal/class'; - } elseif ($objecttype == 'shipping') { - $classpath = 'expedition/class'; - $subelement = 'expedition'; - $module = 'expedition'; - } elseif ($objecttype == 'delivery') { - $classpath = 'delivery/class'; - $subelement = 'delivery'; - $module = 'shipping'; - } elseif ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') { - $classpath = 'fourn/class'; - $module = 'fournisseur'; - } elseif ($objecttype == 'fichinter') { - $classpath = 'fichinter/class'; - $subelement = 'fichinter'; - $module = 'ficheinter'; - } elseif ($objecttype == 'subscription') { - $classpath = 'adherents/class'; - $module = 'adherent'; - } elseif ($objecttype == 'contact') { - $module = 'societe'; - } - // Set classfile - $classfile = strtolower($subelement); - $classname = ucfirst($subelement); - - if ($objecttype == 'order') { - $classfile = 'commande'; - $classname = 'Commande'; - } elseif ($objecttype == 'invoice_supplier') { - $classfile = 'fournisseur.facture'; - $classname = 'FactureFournisseur'; - } elseif ($objecttype == 'order_supplier') { - $classfile = 'fournisseur.commande'; - $classname = 'CommandeFournisseur'; - } elseif ($objecttype == 'supplier_proposal') { - $classfile = 'supplier_proposal'; - $classname = 'SupplierProposal'; - } elseif ($objecttype == 'facturerec') { - $classfile = 'facture-rec'; - $classname = 'FactureRec'; - } elseif ($objecttype == 'subscription') { - $classfile = 'subscription'; - $classname = 'Subscription'; - } elseif ($objecttype == 'project' || $objecttype == 'projet') { - $classpath = 'projet/class'; - $classfile = 'project'; - $classname = 'Project'; - } elseif ($objecttype == 'conferenceorboothattendee') { - $classpath = 'eventorganization/class'; - $classfile = 'conferenceorboothattendee'; - $classname = 'ConferenceOrBoothAttendee'; - $module = 'eventorganization'; - } elseif ($objecttype == 'conferenceorbooth') { - $classpath = 'eventorganization/class'; - $classfile = 'conferenceorbooth'; - $classname = 'ConferenceOrBooth'; - $module = 'eventorganization'; - } elseif ($objecttype == 'mo') { - $classpath = 'mrp/class'; - $classfile = 'mo'; - $classname = 'Mo'; - $module = 'mrp'; - } - - // Here $module, $classfile and $classname are set, we can use them. + // Here $module, $classFile and $className are set, we can use them. if (isModEnabled($module) && (($element != $this->element) || $alsosametype)) { if ($loadalsoobjects && (is_numeric($loadalsoobjects) || ($loadalsoobjects === $objecttype))) { - dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); - //print '/'.$classpath.'/'.$classfile.'.class.php '.class_exists($classname); - if (class_exists($classname)) { + dol_include_once('/'.$classPath.'/'.$classFile.'.class.php'); + if (class_exists($className)) { foreach ($objectids as $i => $objectid) { // $i is rowid into llx_element_element - $object = new $classname($this->db); + $object = new $className($this->db); $ret = $object->fetch($objectid); if ($ret >= 0) { $this->linkedObjects[$objecttype][$i] = $object; @@ -4607,7 +4529,7 @@ abstract class CommonObject if ($elementTable == 'expensereport') { $fieldstatus = "fk_statut"; } - if ($elementTable == 'commande_fournisseur_dispatch') { + if ($elementTable == 'receptiondet_batch') { $fieldstatus = "status"; } if ($elementTable == 'prelevement_bons') { @@ -5580,7 +5502,7 @@ abstract class CommonObject * Delete a link to resource line * * @param int $rowid Id of resource line to delete - * @param int $element element name (for trigger) TODO: use $this->element into commonobject class + * @param string $element element name (for trigger) TODO: use $this->element into commonobject class * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ @@ -5724,7 +5646,7 @@ abstract class CommonObject $filefound = dol_sanitizePathName($filefound); // If generator was found - global $db; // Required to solve a conception default making an include of some code that uses $db instead of $this->db just after. + global $db; // Required to solve a conception error making an include of some code that uses $db instead of $this->db just after. require_once $filefound; @@ -7347,7 +7269,7 @@ abstract class CommonObject if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); - $out = $doleditor->Create(1, '', true, '', '', '', $morecss); + $out = (string) $doleditor->Create(1, '', true, '', '', '', $morecss); } else { $out = ''; } @@ -7355,7 +7277,7 @@ abstract class CommonObject if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, isModEnabled('fckeditor') && $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%'); - $out = $doleditor->Create(1, '', true, '', '', $moreparam, $morecss); + $out = (string) $doleditor->Create(1, '', true, '', '', $moreparam, $morecss); } else { $out = ''; } @@ -7491,7 +7413,7 @@ abstract class CommonObject // current object id can be use into filter if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) { - $InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]); + $InfoFieldList[4] = str_replace('$ID$', (string) $objectid, $InfoFieldList[4]); } else { $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); } @@ -7670,7 +7592,7 @@ abstract class CommonObject // current object id can be use into filter if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) { - $InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]); + $InfoFieldList[4] = str_replace('$ID$', (string) $objectid, $InfoFieldList[4]); } else { $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); } @@ -8955,7 +8877,7 @@ abstract class CommonObject /** * Returns the rights used for this class * - * @return int|stdClass Object of permission for the module + * @return null|int|stdClass Object of permission for the module */ public function getRights() { @@ -10213,7 +10135,7 @@ abstract class CommonObject } } else { $error++; - $this->errors[] = "You defined a cascade delete on an object $childObject but there is no method deleteByParentField for it"; + $this->errors[] = "You defined a cascade delete on an object $className/$this->id but there is no method deleteByParentField for it"; break; } } else { @@ -10467,6 +10389,55 @@ abstract class CommonObject } } + /** + * Set to a signed status + * + * @param User $user Object user that modify + * @param int $status New status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @param string $triggercode Trigger code to use + * @return int Return integer <0 if KO, >0 if OK + */ + public function setSignedStatusCommon($user, $status, $notrigger = 0, $triggercode = '') + { + $error = 0; + + $this->db->begin(); + + $statusfield = 'signed_status'; + + $sql = "UPDATE ".$this->db->prefix().$this->table_element; + $sql .= " SET ".$statusfield." = ".((int) $status); + $sql .= " WHERE rowid = ".((int) $this->id); + + if ($this->db->query($sql)) { + if (!$error) { + $this->oldcopy = clone $this; + } + + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger($triggercode, $user); + if ($result < 0) { + $error++; + } + } + + if (!$error) { + $this->status = $status; + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + return -1; + } + } else { + $this->error = $this->db->error(); + $this->db->rollback(); + return -1; + } + } + /** * Initialise object with example values diff --git a/htdocs/core/class/cregion.class.php b/htdocs/core/class/cregion.class.php index 358935bb2a9..c27f68bd9e1 100644 --- a/htdocs/core/class/cregion.class.php +++ b/htdocs/core/class/cregion.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2007-2011 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -109,7 +110,7 @@ class Cregion extends CommonDict $sql .= "cheflieu,"; $sql .= "active"; $sql .= ") VALUES ("; - $sql .= " ".(!isset($this->rowid) ? 'NULL' : (int) $this->rowid).","; + $sql .= " ".(!isset($this->id) ? 'NULL' : (int) $this->id).","; $sql .= " ".(!isset($this->code_region) ? 'NULL' : (int) $this->code_region).","; $sql .= " ".(!isset($this->fk_pays) ? 'NULL' : (int) $this->fk_pays).","; $sql .= " ".(!isset($this->name) ? 'NULL' : "'".$this->db->escape($this->name)."'").","; @@ -149,11 +150,11 @@ class Cregion extends CommonDict * Load object in memory from database * * @param int $id Id object - * @param string $code_region Code + * @param int $code_region Code * @param int $fk_pays Country Id * @return int >0 if OK, 0 if not found, <0 if KO */ - public function fetch($id, $code_region = '', $fk_pays = 0) + public function fetch($id, $code_region = 0, $fk_pays = 0) { $sql = "SELECT"; $sql .= " t.rowid,"; @@ -166,9 +167,9 @@ class Cregion extends CommonDict if ($id) { $sql .= " WHERE t.rowid = ".((int) $id); } elseif ($code_region) { - $sql .= " WHERE t.code_region = '".$this->db->escape(strtoupper($code_region))."'"; + $sql .= " WHERE t.code_region = ".((int) $code_region); } elseif ($fk_pays) { - $sql .= " WHERE t.fk_pays = '".$this->db->escape(strtoupper($fk_pays))."'"; + $sql .= " WHERE t.fk_pays = ".((int) $fk_pays); } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -179,8 +180,8 @@ class Cregion extends CommonDict if ($obj) { $this->id = $obj->rowid; - $this->code_region = $obj->code_region; - $this->fk_pays = $obj->fk_pays; + $this->code_region = (int) $obj->code_region; + $this->fk_pays = (int) $obj->fk_pays; $this->name = $obj->nom; $this->cheflieu = $obj->cheflieu; $this->active = $obj->active; @@ -233,8 +234,8 @@ class Cregion extends CommonDict // Update request $sql = "UPDATE ".$this->db->prefix()."c_regions SET"; - $sql .= " code_region=".(isset($this->code_region) ? "'".$this->db->escape($this->code_region)."'" : "null").","; - $sql .= " fk_pays=".(isset($this->fk_pays) ? "'".$this->db->escape($this->fk_pays)."'" : "null").","; + $sql .= " code_region=".(isset($this->code_region) ? ((int) $this->code_region) : "null").","; + $sql .= " fk_pays=".(isset($this->fk_pays) ? ((int) $this->fk_pays) : "null").","; $sql .= " nom=".(isset($this->name) ? "'".$this->db->escape($this->name)."'" : "null").","; $sql .= " cheflieu=".(isset($this->cheflieu) ? "'".$this->db->escape($this->cheflieu)."'" : "null").","; $sql .= " active=".(isset($this->active) ? $this->active : "null"); diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index 9a47a8843e8..0b54bd8fb79 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -87,7 +87,7 @@ class DefaultValues extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 215d9a9e0e0..4ad3cda07c3 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -50,11 +50,11 @@ class DolGraph public $cssprefix = ''; // To add into css styles /** - * @var int|string Width of graph. It can be a numeric for pixels or a string like '100%' + * @var int|string Width of graph. It can be a numeric for pixels or a string like '100%' or "100px' */ public $width = 380; /** - * @var int Height of graph + * @var int|string Height of graph. It can be a numeric for pixels or a string like '100%' or "100px' */ public $height = 200; @@ -242,7 +242,7 @@ class DolGraph /** * Set width * - * @param int|string $w Width (Example: 320 or '100%') + * @param int|string $w Width (Example: 320 or '100%' or '10px') * @return void */ public function SetWidth($w) @@ -441,7 +441,7 @@ class DolGraph /** * Set height * - * @param int $h Height + * @param int|string $h Height int or '90%' or '10px' * @return void */ public function SetHeight($h) @@ -1159,12 +1159,12 @@ class DolGraph if (count($this->data) > 20) { $dolxaxisvertical = 'dol-xaxis-vertical'; } - // No height for the pie grah + // No height for the pie graph $cssfordiv = 'dolgraphchart'; if (isset($this->type[$firstlot])) { $cssfordiv .= ' dolgraphchar' . $this->type[$firstlot]; } - $this->stringtoshow .= '
    '."\n"; + $this->stringtoshow .= '
    '."\n"; $this->stringtoshow .= '
    '."\n"; $this->stringtoshow .= ''."\n"; + } else { + $ret = ''; } return $ret; } @@ -979,8 +981,8 @@ function getSocialNetworkSharingLinks() /** * Return HTML content to add structured data for an article, news or Blog Post. * - * @param Object $object Object - * @return string HTML img content or '' if no image found + * @param Object $object Object + * @return int HTML img content or '' if no image found * @see getImagePublicURLOfObject() */ function getNbOfImagePublicURLOfObject($object) diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index a0150d403c8..34d1c8059ab 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,14 +20,14 @@ /** * \file htdocs/core/lib/ws.lib.php * \ingroup webservices - * \brief Set of function for manipulating web services + * \brief Set of functions for manipulating web services */ /** * Check authentication array and set error, errorcode, errorlabel * - * @param array $authentication Array with authentication information ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>) + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array with authentication information ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>) * @param int $error Number of errors * @param string $errorcode Error string code * @param string $errorlabel Error string label diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index 42467f123bf..a831b268a13 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -3,6 +3,7 @@ * Copyright (C) 2007-2015 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2022 Harry Winner Kamdem + * 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 @@ -145,7 +146,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes global $mc; if (!isset($mc)) { - !isModEnabled('multicompany'); // Global not available, disable $conf->multicompany->enabled for safety + unset($conf->multicompany->enabled); // Global not available, disable $conf->multicompany->enabled for safety } else { $ret = $mc->checkRight($obj->rowid, $entitytotest); if ($ret < 0) { diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 593f050d4c7..fde4d4128f9 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -1,6 +1,7 @@ * Copyright (C) 2008-2021 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -247,7 +248,9 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) */ dol_syslog("functions_ldap::check_user_password_ldap Authentication KO failed to connect to LDAP for '".$usertotest."'", LOG_NOTICE); if (is_resource($ldap->connection) || is_object($ldap->connection)) { // If connection ok but bind ko + // @phan-suppress-next-line PhanTypeMismatchArgumentInternal Expects LDAP\Connection, not 'resource' $ldap->ldapErrorCode = ldap_errno($ldap->connection); + // @phan-suppress-next-line PhanTypeMismatchArgumentInternal Expects LDAP\Connection, not 'resource' $ldap->ldapErrorText = ldap_error($ldap->connection); dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText); } diff --git a/htdocs/core/login/functions_openid_connect.php b/htdocs/core/login/functions_openid_connect.php index 8e494bd96f0..d9eda8088ed 100644 --- a/htdocs/core/login/functions_openid_connect.php +++ b/htdocs/core/login/functions_openid_connect.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +33,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; * @param string $usertotest Login * @param string $passwordtotest Password * @param int $entitytotest Number of instance (always 1 if module multicompany not enabled) - * @return string Login if OK, '' if KO + * @return string|false Login if OK, false if KO */ function check_user_password_openid_connect($usertotest, $passwordtotest, $entitytotest) { diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index e661fb3db4c..d177030b841 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -18,7 +18,7 @@ insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, left insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 16__+MAX_llx_menu__, 'bom|mrp', 'isModEnabled("bom") || isModEnabled("mrp")', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'TMenuMRP', -1, 'mrp', '$user->hasRight("bom","read") || $user->hasRight("mrp","read")', '', 0, 31, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 7__+MAX_llx_menu__, 'projet', 'isModEnabled("project")', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->hasRight("projet","lire")', '', 2, 32, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', 'isModEnabled("propal") || isModEnabled("commande") || isModEnabled("supplier_order") || isModEnabled("contrat") || isModEnabled("ficheinter")', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->hasRight("societe","lire") || $user->hasRight("societe","contact","lire")', '', 2, 40, __ENTITY__, ''); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("facture") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->hasRight("facture","lire") || $user->hasRight("don","lire") || $user->hasRight("tax","charges","lire") || $user->hasRight("salaries","read") || $user->hasRight("loan","read") || $user->hasRight("banque","lire") || $user->hasRight("fournisseur","facture","lire") || $user->hasRight("supplier_invoice","read")', '', 2, 50, __ENTITY__, ''); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("invoice") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->hasRight("facture","lire") || $user->hasRight("don","lire") || $user->hasRight("tax","charges","lire") || $user->hasRight("salaries","read") || $user->hasRight("loan","read") || $user->hasRight("banque","lire") || $user->hasRight("fournisseur","facture","lire") || $user->hasRight("supplier_invoice","read")', '', 2, 50, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 14__+MAX_llx_menu__, 'banque|prelevement', 'isModEnabled("banque") || isModEnabled("prelevement")', __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->hasRight("banque","lire") || $user->hasRight("prelevement","bons","lire")', '', 0, 52, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 9__+MAX_llx_menu__, 'comptabilite|accounting|asset', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("asset")', __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->hasRight("compta","resultat","lire") || $user->hasRight("accounting","mouvements","lire") || $user->hasRight("asset","read")', '', 2, 54, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 8__+MAX_llx_menu__, '', '', __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__, ''); @@ -231,23 +231,23 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("supplier_invoice")', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__); -- Billing - Customer invoice -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'billing', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?mainmenu=billing&action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'billing', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?mainmenu=billing&action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_draft&search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_notpaid&search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_paid&search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_canceled&search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_draft&search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_notpaid&search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_paid&search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills_canceled&search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/invoicetemplate_list.php?mainmenu=billing&leftmenu=customers_bills', 'ListOfTemplates', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/invoicetemplate_list.php?mainmenu=billing&leftmenu=customers_bills', 'ListOfTemplates', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', 'customers_bills_payment', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?mainmenu=billing&leftmenu=customers_bills_payment', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', 'customers_bills_reports', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?mainmenu=billing&leftmenu=customers_bills_reports', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("facture")', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', 'customers_bills_payment', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?mainmenu=billing&leftmenu=customers_bills_payment', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', 'customers_bills_reports', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?mainmenu=billing&leftmenu=customers_bills_reports', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("invoice")', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); -- Billing - Orders to bill -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("commande")', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?mainmenu=billing&leftmenu=orders&search_status=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("order")', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?mainmenu=billing&leftmenu=orders&search_status=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); -- Donations insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("don")', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'billing', 'donations', 6__+MAX_llx_menu__, '/don/index.php?mainmenu=billing&leftmenu=donations', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__); @@ -316,9 +316,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__); -- Binding -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("facture") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("facture") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("facture") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("supplier_invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier', 'SuppliersVentilation', 1, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("supplier_invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("accounting") && isModEnabled("supplier_invoice") && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->hasRight("accounting","bind","write")', '', 0, 7, __ENTITY__); @@ -379,9 +379,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("asset") && $leftmenu=="asset"', __HANDLER__, 'left', 3006__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy', 'MenuListTypeAssets', 3, 'assets', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->hasRight("asset","model_advance","read"):$user->hasRight("asset","read"))', '', 0, 25, __ENTITY__); -- Check deposit -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("banque") && (isModEnabled("facture") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->hasRight("banque","lire")', '', 2, 9, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("banque") && (isModEnabled("facture") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?mainmenu=bank&leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->hasRight("banque","lire")', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("banque") && (isModEnabled("facture") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1713__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/list.php?mainmenu=bank&leftmenu=checks', 'List', 1, 'bills', '$user->hasRight("banque","lire")', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("bank") && (isModEnabled("invoice") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->hasRight("banque","lire")', '', 2, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("bank") && (isModEnabled("invoice") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?mainmenu=bank&leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->hasRight("banque","lire")', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled("bank") && (isModEnabled("invoice") || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1713__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/list.php?mainmenu=bank&leftmenu=checks', 'List', 1, 'bills', '$user->hasRight("banque","lire")', '', 2, 1, __ENTITY__); -- PaymentByDirectDebit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("prelevement")', __HANDLER__, 'left', 2500__+MAX_llx_menu__, 'accountancy', 'withdraw', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?mainmenu=bank&leftmenu=withdraw', 'PaymentByDirectDebit', 0, 'withdrawals', '$user->hasRight("prelevement","bons","lire")', '', 2, 9, __ENTITY__); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 8509416d4fc..c12fbc08c45 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * @param DoliDB $db Database handler * @param string $atarget Target (Example: '' or '_top') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout 1=Disable output (Initialise &$menu only). * @param string $mode 'top', 'topnb', 'left', 'jmobile' @@ -92,6 +92,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined. if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($newTabMenu[$i]['url'])) { + // @phan-suppress-next-line PhanTypeSuspiciousStringExpression $param .= ($param ? '&' : '').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; } if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($newTabMenu[$i]['url'])) { @@ -309,9 +310,9 @@ function print_end_menu_array_auguria() * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) * * @param DoliDB $db Database handler - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) - * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) + * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' @@ -514,6 +515,10 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t // array_multisort($position, $array1_sort_order, $menu_array); } + // Phan has a hard time tracking the type, for instance because it get hookmanager->results + // Force the typing at this point to get useful analysis below: + '@phan-var-force array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string,level:int}> $menu_array'; + // Show menu $invert = !getDolGlobalString('MAIN_MENU_INVERT') ? "" : "invert"; if (empty($noout)) { @@ -521,7 +526,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t $blockvmenuopened = false; $lastlevel0 = ''; $num = count($menu_array); - for ($i = 0; $i < $num; $i++) { // Loop on each menu entry + foreach (array_keys($menu_array) as $i) { // Loop on each menu entry (foreach better for static analysis) $showmenu = true; if (getDolGlobalString('MAIN_MENU_HIDE_UNAUTHORIZED') && empty($menu_array[$i]['enabled'])) { $showmenu = false; diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index e749f7f54fd..ebdef15b063 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -286,6 +286,7 @@ class MenuManager $disabled = " vsmenudisabled"; } + // @phan-suppress-next-line PhanParamSuspiciousOrder print str_pad('', $val2['level'] + 1); print '
    '."\n"; print ''."\n"; @@ -339,7 +342,7 @@ if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { $std_soc = new Societe($db); $action_search = 'query'; - $parameters = array('advtarget'=>1); + $parameters = array('advtarget' => 1); if (!empty($advTarget->id)) { $parameters = array('array_query' => $advTarget->filtervalue); } diff --git a/htdocs/core/tpl/bloc_comment.tpl.php b/htdocs/core/tpl/bloc_comment.tpl.php index a868bb61879..8506d42dd7b 100644 --- a/htdocs/core/tpl/bloc_comment.tpl.php +++ b/htdocs/core/tpl/bloc_comment.tpl.php @@ -3,7 +3,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } // Require diff --git a/htdocs/core/tpl/bloc_showhide.tpl.php b/htdocs/core/tpl/bloc_showhide.tpl.php index 267c56e42a7..8af7c7665db 100644 --- a/htdocs/core/tpl/bloc_showhide.tpl.php +++ b/htdocs/core/tpl/bloc_showhide.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($blocname)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } $hide = true; // Hide by default diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index aac09eb8462..42c7cd957fc 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -32,7 +32,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } $fileparams = array(); diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index e17510485ba..92f48272aee 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -25,7 +25,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } ?> diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php index 00610c0add8..fea9afd80dc 100644 --- a/htdocs/core/tpl/commonfields_edit.tpl.php +++ b/htdocs/core/tpl/commonfields_edit.tpl.php @@ -25,7 +25,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (!is_object($form)) { $form = new Form($db); diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 9f8c49198ec..6065f64e189 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -26,7 +26,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (!is_object($form)) { $form = new Form($db); diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index f687f2b883b..d05831af439 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -27,7 +27,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (empty($preselectedtypeofcontact)) { diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 512635e3cba..373fcab1813 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -32,7 +32,7 @@ // Protection to avoid direct call of template if (empty($langs) || !is_object($langs)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/core/tpl/extrafields_add.tpl.php b/htdocs/core/tpl/extrafields_add.tpl.php index 8067e4fedbc..e9a5d283807 100644 --- a/htdocs/core/tpl/extrafields_add.tpl.php +++ b/htdocs/core/tpl/extrafields_add.tpl.php @@ -28,7 +28,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } ?> diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php index e605fbd93fb..e778f59919e 100644 --- a/htdocs/core/tpl/extrafields_edit.tpl.php +++ b/htdocs/core/tpl/extrafields_edit.tpl.php @@ -28,7 +28,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } ?> diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index 3f3f73a9760..46eb1a8b55f 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -11,7 +11,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (empty($extrafieldsobjectkey) && is_object($object)) { diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index c061a0764a9..2ea9aaa1b80 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -3,7 +3,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (empty($extrafieldsobjectkey) && is_object($object)) { diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index f209c9fd49d..886a0cbc092 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -5,7 +5,7 @@ print ''."\n"; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (empty($extrafieldsobjectkey) && is_object($object)) { diff --git a/htdocs/core/tpl/extrafields_list_search_param.tpl.php b/htdocs/core/tpl/extrafields_list_search_param.tpl.php index 2ab5749b4e0..bdfaafbce59 100644 --- a/htdocs/core/tpl/extrafields_list_search_param.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_param.tpl.php @@ -3,7 +3,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } // Loop to complete $param for extrafields diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index ff858ef0d29..31e6acf3c89 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -3,7 +3,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (empty($extrafieldsobjectkey) && is_object($object)) { diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index 8d24c81c2e4..df6386f7557 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php @@ -3,7 +3,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (empty($extrafieldsobjectkey) && is_object($object)) { diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 347e611b8bf..db152a3141f 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -29,7 +29,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (!is_object($form)) { diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index ab549cbbb9a..9c09f821638 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,7 +77,7 @@ print '
    '; // Toolbar if ($permtoadd) { - $websitekeyandpageid = (!empty($websitekey) ? '&website='.urlencode($websitekey) : '').(!empty($pageid) ? '&pageid='.urlencode($pageid) : ''); + $websitekeyandpageid = (!empty($websitekey) ? '&website='.urlencode($websitekey) : '').(!empty($pageid) ? '&pageid='.urlencode((string) $pageid) : ''); print ''; print img_picto('', 'folder-plus', '', false, 0, 0, '', 'size15x marginrightonly'); print ''; @@ -290,7 +291,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) { // Show the link to "Root" if ($showroot) { - print '
    "; } else { - print ""; + print ""; } } else { - print ""; + print ""; } print ""; print ''; diff --git a/htdocs/don/paiement/list.php b/htdocs/don/paiement/list.php index b314131ca5b..23288c8035e 100644 --- a/htdocs/don/paiement/list.php +++ b/htdocs/don/paiement/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2019 Thibault FOUCART + * 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 @@ -98,6 +99,7 @@ $arrayfields = array( 'pd.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 80), ); $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan $optioncss = GETPOST('optioncss', 'alpha'); $moreforfilter = GETPOST('moreforfilter', 'alpha'); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 214b1731a94..fe1f734eb70 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -94,7 +94,7 @@ class EmailCollector extends CommonObject protected $childtables = array(); /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. */ protected $childtablesoncascade = array('emailcollector_emailcollectorfilter', 'emailcollector_emailcollectoraction'); @@ -120,7 +120,7 @@ class EmailCollector extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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' => 2, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1), @@ -1290,6 +1290,8 @@ class EmailCollector extends CommonObject if (strpos($rule['rulevalue'], '!') === 0) { // The value start with !, so we exclude the criteria $not = 'NOT '; + // Then remove the ! from the string for next filters + $rule['rulevalue'] = substr($rule['rulevalue'], 1); } if ($rule['type'] == 'from') { @@ -1428,6 +1430,8 @@ class EmailCollector extends CommonObject if (strpos($rule['rulevalue'], '!') === 0) { // The value start with !, so we exclude the criteria $not = 'NOT '; + // Then remove the ! from the string for next filters + $rule['rulevalue'] = substr($rule['rulevalue'], 1); } if ($rule['type'] == 'from') { @@ -2410,10 +2414,25 @@ class EmailCollector extends CommonObject if ($operation['type'] == 'loadthirdparty') { dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." name_alias=".$namealiastouseforthirdparty." was not found"); - $errorforactions++; - $langs->load("errors"); - $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty, $namealiastouseforthirdparty); - $this->errors[] = $this->error; + //search into contacts of thirdparty + $resultContact = $contactstatic->fetch('', '', '', $emailtouseforthirdparty); + if ($resultContact > 0) { + $idtouseforthirdparty = $contactstatic->socid; + $result = $thirdpartystatic->fetch($idtouseforthirdparty); + if ($result > 0) { + dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." name_alias=".$namealiastouseforthirdparty." was found thanks to linked contact search"); + } else { + $errorforactions++; + $langs->load("errors"); + $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty, $namealiastouseforthirdparty); + $this->errors[] = $this->error; + } + } else { + $errorforactions++; + $langs->load("errors"); + $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty, $namealiastouseforthirdparty); + $this->errors[] = $this->error; + } } elseif ($operation['type'] == 'loadandcreatethirdparty') { dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." name_alias=".$namealiastouseforthirdparty." was not found. We try to create it."); @@ -2618,7 +2637,7 @@ class EmailCollector extends CommonObject $actioncomm->percentage = -1; // Not applicable $actioncomm->socid = $thirdpartystatic->id; $actioncomm->contact_id = $contactstatic->id; - $actioncomm->socpeopleassigned = (!empty($contactstatic->id) ? array($contactstatic->id => '') : array()); + $actioncomm->socpeopleassigned = (!empty($contactstatic->id) ? array($contactstatic->id) : array()); $actioncomm->authorid = $user->id; // User saving action $actioncomm->userownerid = $user->id; // Owner of action // Fields when action is an email (content should be added into note) @@ -2645,14 +2664,6 @@ class EmailCollector extends CommonObject // Overwrite values with values extracted from source email $errorforthisaction = $this->overwritePropertiesOfObject($actioncomm, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); - //var_dump($fk_element_id); - //var_dump($fk_element_type); - //var_dump($alreadycreated); - //var_dump($operation['type']); - //var_dump($actioncomm); - //var_dump($objectemail); - //exit; - if ($errorforthisaction) { $errorforactions++; } else { @@ -2661,7 +2672,7 @@ class EmailCollector extends CommonObject $errorforactions++; $this->errors = $actioncomm->errors; } else { - if ($fk_element_type == "ticket") { + if ($fk_element_type == "ticket" && is_object($objectemail)) { if ($objectemail->status == Ticket::STATUS_CLOSED || $objectemail->status == Ticket::STATUS_CANCELED) { if ($objectemail->fk_user_assign != null) { $res = $objectemail->setStatut(Ticket::STATUS_ASSIGNED); @@ -3050,6 +3061,7 @@ class EmailCollector extends CommonObject $tickettocreate->severity_code = (getDolGlobalString('MAIN_EMAILCOLLECTOR_TICKET_SEVERITY_CODE') ? $conf->global->MAIN_EMAILCOLLECTOR_TICKET_SEVERITY_CODE : dol_getIdFromCode($this->db, 1, 'c_ticket_severity', 'use_default', 'code', 1)); $tickettocreate->origin_email = $from; $tickettocreate->origin_replyto = (!empty($replyto) ? $replyto : null); + $tickettocreate->origin_references = (!empty($headers['References']) ? $headers['References'] : null); $tickettocreate->fk_user_create = $user->id; $tickettocreate->datec = dol_now(); $tickettocreate->fk_project = $projectstatic->id; @@ -3075,19 +3087,17 @@ class EmailCollector extends CommonObject // Search template files $file = ''; $classname = ''; - $filefound = 0; $reldir = ''; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); if (file_exists($file)) { - $filefound = 1; $classname = $modele; break; } } - if ($filefound) { + if ($classname !== '') { if ($savesocid > 0) { if ($savesocid != $tickettocreate->socid) { $errorforactions++; @@ -3435,7 +3445,7 @@ class EmailCollector extends CommonObject //$h = imap_header($mbox,$mid); // add code here to get date, from, to, cc, subject... - // BODY + // BODY @phan-suppress-next-line PhanTypeMismatchArgumentInternal $s = imap_fetchstructure($mbox, $mid, FT_UID); @@ -3483,8 +3493,8 @@ class EmailCollector extends CommonObject // DECODE DATA $data = ($partno) ? - imap_fetchbody($mbox, $mid, $partno, FT_UID) : // multipart - imap_body($mbox, $mid, FT_UID); // simple + imap_fetchbody($mbox, $mid, $partno, FT_UID) : // multipart @phan-suppress-current-line PhanTypeMismatchArgumentInternal + imap_body($mbox, $mid, FT_UID); // simple @phan-suppress-current-line PhanTypeMismatchArgumentInternal // Any part may be encoded, even plain text messages, so check everything. if ($p->encoding == 4) { $data = quoted_printable_decode($data); @@ -3505,6 +3515,7 @@ class EmailCollector extends CommonObject $params[strtolower($x->attribute)] = $x->value; } } + '@phan-var-force array{filename?:string,name?:string,charset?:string} $params'; // ATTACHMENT // Any part with a filename is an attachment, @@ -3521,7 +3532,7 @@ class EmailCollector extends CommonObject } // Get file name (with extension) - $file_name_complete = $params['filename']; + $file_name_complete = $filename; $destination = $destdir.$file_name_complete; // Extract file extension diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index 85c9ad7dc83..bb139c8be38 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -79,7 +79,7 @@ class EmailCollectorAction extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 0089e5f0b6c..37e4cf4525c 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -81,7 +81,7 @@ class EmailCollectorFilter extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/emailcollector/lib/emailcollector.lib.php b/htdocs/emailcollector/lib/emailcollector.lib.php index 3549f20a5a5..3e628a7caaa 100644 --- a/htdocs/emailcollector/lib/emailcollector.lib.php +++ b/htdocs/emailcollector/lib/emailcollector.lib.php @@ -1,6 +1,6 @@ +/* Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ */ function emailcollectorPrepareHead($object) { - global $db, $langs, $conf; + global $langs, $conf; $langs->load("emailcollector@emailcollector"); @@ -117,13 +117,13 @@ function getDParameters($part) */ function getAttachments($jk, $mbox) { - $structure = imap_fetchstructure($mbox, $jk, FT_UID); + $structure = imap_fetchstructure($mbox, $jk, FT_UID); // @phan-suppress-current-line PhanTypeMismatchArgumentInternal $parts = getParts($structure); $fpos = 2; $attachments = array(); $nb = count($parts); - if ($parts && $nb) { + if ($nb && !empty($parts)) { for ($i = 1; $i < $nb; $i++) { $part = $parts[$i]; @@ -154,7 +154,7 @@ function getAttachments($jk, $mbox) */ function getFileData($jk, $fpos, $type, $mbox) { - $merge = imap_fetchbody($mbox, $jk, $fpos, FT_UID); + $merge = imap_fetchbody($mbox, $jk, $fpos, FT_UID); // @phan-suppress-current-line PhanTypeMismatchArgumentInternal $data = getDecodeValue($merge, $type); return $data; diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 683a8d016fe..16c91a9114f 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -112,7 +112,7 @@ class ConferenceOrBooth extends ActionComm // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 7b898c6cc12..f30196c2ef3 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -100,7 +100,7 @@ class ConferenceOrBoothAttendee extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -969,7 +969,7 @@ class ConferenceOrBoothAttendee extends CommonObject $dir = dol_buildpath($reldir."core/modules/eventorganization/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php b/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php index 127ea95a424..e99e7fe8f83 100644 --- a/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php +++ b/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } echo "\n"; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 9ef21f4823f..d915a86929d 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -546,24 +546,24 @@ if (empty($reshook)) { $object->tracking_number = trim(GETPOST('tracking_number', 'alpha')); } if ($action == 'settracking_url') { - $object->tracking_url = trim(GETPOSTINT('tracking_url')); + $object->tracking_url = trim(GETPOST('tracking_url', 'restricthtml')); } if ($action == 'settrueWeight') { - $object->trueWeight = trim(GETPOSTINT('trueWeight')); + $object->trueWeight = GETPOSTINT('trueWeight'); $object->weight_units = GETPOSTINT('weight_units'); } if ($action == 'settrueWidth') { - $object->trueWidth = trim(GETPOSTINT('trueWidth')); + $object->trueWidth = GETPOSTINT('trueWidth'); } if ($action == 'settrueHeight') { - $object->trueHeight = trim(GETPOSTINT('trueHeight')); + $object->trueHeight = GETPOSTINT('trueHeight'); $object->size_units = GETPOSTINT('size_units'); } if ($action == 'settrueDepth') { - $object->trueDepth = trim(GETPOSTINT('trueDepth')); + $object->trueDepth = GETPOSTINT('trueDepth'); } if ($action == 'setshipping_method_id') { - $object->shipping_method_id = trim(GETPOSTINT('shipping_method_id')); + $object->shipping_method_id = GETPOSTINT('shipping_method_id'); } if (!$error) { @@ -1336,7 +1336,7 @@ if ($action == 'create') { // Show warehouse combo list $ent = "entl".$indiceAsked; $idl = "idl".$indiceAsked; - $tmpentrepot_id = is_numeric(GETPOSTINT($ent)) ? GETPOSTINT($ent) : $warehouse_id; + $tmpentrepot_id = is_numeric(GETPOST($ent)) ? GETPOSTINT($ent) : $warehouse_id; if ($line->fk_product > 0) { print ''; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 4f9ef208d88..897927b03d6 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -92,7 +92,7 @@ class Expedition extends CommonObject /** - * @var array|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}> 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,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}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -306,7 +306,7 @@ class Expedition extends CommonObject $dir = dol_buildpath($reldir."core/modules/expedition/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if (!$mybool) { @@ -493,7 +493,7 @@ class Expedition extends CommonObject * * @param int $entrepot_id Id of warehouse * @param int $origin_line_id Id of source line - * @param int $qty Quantity + * @param float $qty Quantity * @param int $rang Rang * @param array $array_options extrafields array * @return int Return integer <0 if KO, line_id if OK @@ -895,7 +895,7 @@ class Expedition extends CommonObject * * @param int $entrepot_id Id of warehouse * @param int $id Id of source line (order line) - * @param int $qty Quantity + * @param float $qty Quantity * @param array $array_options extrafields array * @return int Return integer <0 if KO, >0 if OK */ @@ -1104,7 +1104,7 @@ class Expedition extends CommonObject $this->weight_units = trim($this->weight_units); } if (isset($this->trueWeight)) { - $this->weight = trim($this->trueWeight); + $this->weight = trim((string) $this->trueWeight); } if (isset($this->note_private)) { $this->note_private = trim($this->note_private); @@ -2193,14 +2193,14 @@ class Expedition extends CommonObject if (!empty($tracking) && !empty($value)) { $url = str_replace('{TRACKID}', $value, $tracking); - $this->tracking_url = sprintf(''.($value ? $value : 'url').'', $url, $url); + $this->tracking_url = sprintf('%s', $url, ($value ? $value : 'url')); } else { $this->tracking_url = $value; } } /** - * Classify the shipping as closed (this record also the stock movement) + * Classify the shipping as closed (this records also the stock movement) * * @return int Return integer <0 if KO, >0 if OK */ @@ -3050,7 +3050,8 @@ class ExpeditionLigne extends CommonObjectLine // update lot if (!empty($batch) && isModEnabled('productbatch')) { - dol_syslog(get_class($this)."::update expedition batch id=$expedition_batch_id, batch_id=$batch_id, batch=$batch"); + $batch_id_str = $batch_id ?? 'null'; + dol_syslog(get_class($this)."::update expedition batch id=$expedition_batch_id, batch_id=$batch_id_str, batch=$batch"); if (empty($batch_id) || empty($this->fk_product)) { dol_syslog(get_class($this).'::update missing fk_origin_stock (batch_id) and/or fk_product', LOG_ERR); diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 913f069ff61..ac376353e85 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -773,10 +773,6 @@ if ($object->id > 0 || !empty($object->ref)) { print ''; // Dispatch column print ''; // Warehouse column - /*$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product"; - $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; - $sql .= " WHERE cfd.fk_commandefourndet = ".(int) $objp->rowid;*/ - $sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot,"; $sql .= " eb.batch, eb.eatby, eb.sellby, cd.fk_product"; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index a71b364cdac..0e0fedc9c5d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -6,6 +6,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2023 Christophe Battarel + * 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 @@ -62,7 +63,7 @@ $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); $search_country = GETPOSTINT("search_country"); $search_type_thirdparty = GETPOSTINT("search_type_thirdparty"); -$search_billed = GETPOSTINT("search_billed"); +$search_billed = GETPOST("search_billed", 'intcomma'); $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datedelivery_startmonth'), GETPOSTINT('search_datedelivery_startday'), GETPOSTINT('search_datedelivery_startyear')); $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datedelivery_endmonth'), GETPOSTINT('search_datedelivery_endday'), GETPOSTINT('search_datedelivery_endyear')); $search_datereceipt_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datereceipt_startmonth'), GETPOSTINT('search_datereceipt_startday'), GETPOSTINT('search_datereceipt_startyear')); @@ -145,6 +146,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 // Security check $expeditionid = GETPOSTINT('id'); diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 6b025f8dda7..44341e1ab7d 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -19,7 +19,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 3ccf90c0255..75b116af9e9 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -659,7 +659,7 @@ class ExpenseReports extends DolibarrApi */ public function updatePayment($id, $request_data = null) { - if (!DolibarrApiAccess::$user->hasRights('expensereport', 'creer')) { + if (!DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) { throw new RestException(403); } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 54c4a8b469a..b7aced293b3 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -113,14 +113,32 @@ class ExpenseReport extends CommonObject */ public $fk_statut; + /** + * @var int ID + */ public $fk_c_paiement; + + /** + * @var int ID + */ public $modepaymentid; public $paid; + // Paiement + /** + * @var string Firstname Lastname + */ public $user_paid_infos; + /** + * @var string Firstname Lastname + */ public $user_author_infos; + + /** + * @var string Firstname Lastname + */ public $user_validator_infos; public $rule_warning_message; @@ -211,7 +229,7 @@ class ExpenseReport extends CommonObject public $fk_user_valid; /** - * @var int ID + * @var string Firstname Lastname */ public $user_valid_infos; @@ -656,8 +674,6 @@ class ExpenseReport extends CommonObject */ public function fetch($id, $ref = '') { - global $conf; - $sql = "SELECT d.rowid, d.entity, d.ref, d.note_public, d.note_private,"; // DEFAULT $sql .= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS $sql .= " d.date_refuse, d.date_cancel,"; // ACTIONS @@ -885,6 +901,8 @@ class ExpenseReport extends CommonObject $sql .= " WHERE f.rowid = ".((int) $id); $sql .= " AND f.entity = ".$conf->entity; + + $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql)) { @@ -920,7 +938,7 @@ class ExpenseReport extends CommonObject */ public function initAsSpecimen() { - global $user, $langs, $conf; + global $user, $langs; $now = dol_now(); @@ -983,10 +1001,10 @@ class ExpenseReport extends CommonObject * @param User $user User * @return int Return integer <0 if KO, >0 if OK */ - public function fetch_line_by_project($projectid, $user = '') + public function fetch_line_by_project($projectid, $user) { // phpcs:enable - global $conf, $db, $langs; + global $langs; $langs->load('trips'); @@ -1086,8 +1104,6 @@ class ExpenseReport extends CommonObject public function fetch_lines() { // phpcs:enable - global $conf; - $this->lines = array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; @@ -1713,7 +1729,7 @@ class ExpenseReport extends CommonObject $dir = dol_buildpath($reldir."core/modules/expensereport/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { @@ -1792,7 +1808,7 @@ class ExpenseReport extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) { - global $langs, $conf, $hookmanager; + global $langs, $hookmanager; $result = ''; @@ -1906,7 +1922,7 @@ class ExpenseReport extends CommonObject * @param float $qty Qty * @param double $up Unit price (price with tax) * @param int $fk_c_type_fees Type payment - * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)') + * @param int<-1,0>|string $vatrate Vat rate (Can be '10' or '10 (ABC)') * @param string $date Date * @param string $comments Description * @param int $fk_project Project id @@ -1917,7 +1933,7 @@ class ExpenseReport extends CommonObject */ public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0, $fk_ecm_files = 0) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG); @@ -2029,7 +2045,7 @@ class ExpenseReport extends CommonObject */ public function checkRules($type = 0, $seller = '') { - global $user, $conf, $db, $langs, $mysoc; + global $conf, $db, $langs, $mysoc; $langs->load('trips'); @@ -2105,7 +2121,7 @@ class ExpenseReport extends CommonObject */ public function applyOffset($type = 0, $seller = '') { - global $conf, $mysoc; + global $mysoc; if (!getDolGlobalString('MAIN_USE_EXPENSE_IK')) { return false; @@ -2226,9 +2242,9 @@ class ExpenseReport extends CommonObject // Clean vat code $reg = array(); $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $vatrate, $reg)) { + if (preg_match('/\((.*)\)/', (string) $vatrate, $reg)) { $vat_src_code = $reg[1]; - $vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate. + $vatrate = preg_replace('/\s*\(.*\)/', '', (string) $vatrate); // Remove code into vatrate. } $vatrate = preg_replace('/\*/', '', $vatrate); @@ -2327,10 +2343,10 @@ class ExpenseReport extends CommonObject /** * deleteline * - * @param int $rowid Row id - * @param User $fuser User - * @param int $notrigger 1=No trigger - * @return int Return integer <0 if KO, >0 if OK + * @param int $rowid Row id + * @param User|string $fuser User + * @param int<0,1> $notrigger 1=No trigger + * @return int<-1,1> Return integer <0 if KO, >0 if OK */ public function deleteLine($rowid, $fuser = '', $notrigger = 0) { @@ -2473,8 +2489,6 @@ class ExpenseReport extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf; - $outputlangs->load("trips"); if (!dol_strlen($modele)) { @@ -2530,7 +2544,7 @@ class ExpenseReport extends CommonObject */ public function loadStateBoard() { - global $conf, $user; + global $user; $this->nb = array(); @@ -3040,7 +3054,7 @@ class ExpenseReportLine extends CommonObjectLine */ public function insert($notrigger = 0, $fromaddline = false) { - global $user, $conf; + global $user; $error = 0; @@ -3182,7 +3196,7 @@ class ExpenseReportLine extends CommonObjectLine */ public function update(User $user) { - global $langs, $conf; + global $langs; $error = 0; diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 14727b498e7..96626648b24 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -72,7 +72,7 @@ class ExpenseReportIk extends CommonObject /** * Attribute object linked with database - * @var array|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}> 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,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}> 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', 'index' => 1) diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index 7c640527055..418623df567 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -110,7 +110,7 @@ class ExpenseReportRule extends CommonObject /** * Attribute object linked with database - * @var array|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}> 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,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}> 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', 'index' => 1) diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index f480854dad8..7a9e9171de3 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,7 +66,13 @@ class PaymentExpenseReport extends CommonObject * @var int|string */ public $datep = ''; + /** + * @var float|int + */ public $amount; // Total amount of payment + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -94,7 +101,14 @@ class PaymentExpenseReport extends CommonObject */ public $fk_user_modif; + /** + * @var string + */ public $type_code; + + /** + * @var string + */ public $type_label; /** @@ -146,7 +160,7 @@ class PaymentExpenseReport extends CommonObject $this->fk_expensereport = (int) $this->fk_expensereport; } if (isset($this->amount)) { - $this->amount = trim($this->amount); + $this->amount = (float) $this->amount; } if (isset($this->fk_typepayment)) { $this->fk_typepayment = (int) $this->fk_typepayment; @@ -175,11 +189,11 @@ class PaymentExpenseReport extends CommonObject $totalamount = 0; foreach ($this->amounts as $key => $value) { // How payment is dispatch - $newvalue = price2num($value, 'MT'); + $newvalue = (float) price2num($value, 'MT'); $this->amounts[$key] = $newvalue; $totalamount += $newvalue; } - $totalamount = price2num($totalamount); + // $totalamount = (float) price2num($totalamount); // Check parameters if ($totalamount == 0) { @@ -293,7 +307,6 @@ class PaymentExpenseReport extends CommonObject public function update($user = null, $notrigger = 0) { // phpcs:enable - global $conf, $langs; $error = 0; // Clean parameters @@ -302,7 +315,7 @@ class PaymentExpenseReport extends CommonObject $this->fk_expensereport = (int) $this->fk_expensereport; } if (isset($this->amount)) { - $this->amount = trim($this->amount); + $this->amount = (float) $this->amount; } if (isset($this->fk_typepayment)) { $this->fk_typepayment = (int) $this->fk_typepayment; @@ -323,13 +336,8 @@ class PaymentExpenseReport extends CommonObject $this->fk_user_modif = (int) $this->fk_user_modif; } - - // Check parameters - // Put here code to add control on parameters values - // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET"; - $sql .= " fk_expensereport=".(isset($this->fk_expensereport) ? $this->fk_expensereport : "null").","; $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; @@ -341,8 +349,6 @@ class PaymentExpenseReport extends CommonObject $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null"); - - $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -379,7 +385,6 @@ class PaymentExpenseReport extends CommonObject public function delete($user, $notrigger = 0) { // phpcs:enable - global $conf, $langs; $error = 0; $this->db->begin(); @@ -510,13 +515,14 @@ class PaymentExpenseReport extends CommonObject $this->id = 0; $this->fk_expensereport = 0; - $this->datec = ''; + $this->datec = dol_now(); $this->tms = dol_now(); - $this->datep = ''; - $this->amount = ''; + $this->datep = dol_now(); + $this->amount = 100; $this->fk_typepayment = 0; - $this->num_payment = ''; - $this->note = ''; + $this->num_payment = '123456'; + $this->note_public = 'Public note'; + $this->note_private = 'Private note'; $this->fk_bank = 0; $this->fk_user_creat = 0; $this->fk_user_modif = 0; @@ -539,7 +545,7 @@ class PaymentExpenseReport extends CommonObject */ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { - global $langs, $conf; + global $langs; $error = 0; @@ -693,7 +699,7 @@ class PaymentExpenseReport extends CommonObject } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index bd3ba374d76..88431f01682 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -12,6 +12,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,6 +112,7 @@ $arrayfields = array( 'pndf.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 70), ); $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('paymentexpensereportlist')); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index e1de1f7015b..df91a49f3f7 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -1,7 +1,7 @@ * Copyright (C) 2015 Laurent Destailleur - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -85,14 +85,14 @@ if ($action == 'add_payment') { if (!$error) { $paymentid = 0; - $total = 0; + // $total = 0; // Read possible payments foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { if (GETPOST($key)) { - $amounts[$expensereport->fk_user_author] = price2num(GETPOST($key)); - $total += price2num(GETPOST($key)); + $amounts[$expensereport->fk_user_author] = (float) price2num(GETPOST($key)); + // $total += price2num(GETPOST($key)); } } } @@ -109,8 +109,9 @@ if ($action == 'add_payment') { $payment = new PaymentExpenseReport($db); $payment->fk_expensereport = $expensereport->id; $payment->datep = $datepaid; - $payment->amounts = $amounts; // Tableau de montant - $payment->total = $total; + $payment->amounts = $amounts; // array of amounts + // total is calculated in class + // $payment->total = $total; $payment->fk_typepayment = GETPOSTINT("fk_typepayment"); $payment->num_payment = GETPOST("num_payment", 'alphanohtml'); $payment->note_public = GETPOST("note_public", 'restricthtml'); diff --git a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php index 0c7b7d9bdca..d9970e9bf85 100644 --- a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php @@ -1,4 +1,6 @@ + */ // Add line to select existing file if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { @@ -39,7 +41,7 @@ if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { //print $file['path'].'/'.$minifile.'
    '; $urlforhref = getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(empty($object->entity) ? $conf->entity : $object->entity)); if (empty($urlforhref)) { - $urlforhref = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(empty($object->entity) ? $conf->entity : $object->entity).'&file='.urlencode($fileinfo['relativename'].'.'.strtolower($fileinfo['extension'])); + $urlforhref = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(empty($object->entity) ? $conf->entity : $object->entity).'&file='.urlencode($file['relativename'].'.'.strtolower($fileinfo['extension'])); print ''; } else { print ''; diff --git a/htdocs/expensereport/tpl/linkedobjectblock.tpl.php b/htdocs/expensereport/tpl/linkedobjectblock.tpl.php index dd215f15873..62084f2e73d 100644 --- a/htdocs/expensereport/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expensereport/tpl/linkedobjectblock.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 010427ab2a4..d54497125c1 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -58,6 +58,7 @@ class Fichinter extends CommonObject 'datee' => array('type' => 'date', 'label' => 'Datee', 'enabled' => 1, 'visible' => -1, 'position' => 90), 'datet' => array('type' => 'date', 'label' => 'Datet', 'enabled' => 1, 'visible' => -1, 'position' => 95), 'duree' => array('type' => 'double', 'label' => 'Duree', 'enabled' => 1, 'visible' => -1, 'position' => 100), + 'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 101, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 9 => 'SignedAll')), 'description' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 105, 'showoncombobox' => 2), 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110), 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 115), @@ -134,6 +135,12 @@ class Fichinter extends CommonObject */ public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate + /** + * Signed Status of the intervention (0=NoSignature, 1=SignedBySender, 2=SignedByReceiver, 9=SignedByAll) + * @var int + */ + public $signed_status = 0; + /** * @var string description */ @@ -185,6 +192,26 @@ class Fichinter extends CommonObject */ const STATUS_CLOSED = 3; + /* + * No signature + */ + const STATUS_NO_SIGNATURE = 0; + + /* + * Signed by sender + */ + const STATUS_SIGNED_SENDER = 1; + + /* + * Signed by receiver + */ + const STATUS_SIGNED_RECEIVER = 2; + + /* + * Signed by all + */ + const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) + /** * Date delivery * @var string|int Delivery int @@ -983,7 +1010,7 @@ class Fichinter extends CommonObject $dir = dol_buildpath($reldir."core/modules/fichinter/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { @@ -1600,6 +1627,20 @@ class Fichinter extends CommonObject $return .= ''; return $return; } + + /** + * Set signed status + * + * @param User $user Object user that modify + * @param int $status Newsigned status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers + * @param string $triggercode Trigger code to use + * @return int 0 < if KO, > 0 if OK + */ + public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, $triggercode = ''): int + { + return $this->setSignedStatusCommon($user, $status, $notrigger, $triggercode); + } } /** diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 9e529651f8a..3f34bdf65fb 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2016-2018 Charlie Benke * Copyright (C) 2024 William Mead * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -505,7 +506,7 @@ class FichinterRec extends Fichinter } $pu_ht = price2num($pu_ht); $pu_ttc = price2num($pu_ttc); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } @@ -659,7 +660,7 @@ class FichinterRec extends Fichinter } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -868,7 +869,7 @@ class FichinterRec extends Fichinter $sql .= ' SET nb_gen_done = nb_gen_done + 1'; $sql .= ' , date_last_gen = now()'; // si on et arrivé à la fin des génération - if ($this->nb_gen_max == $this->nb_gen_done + 1) { + if ($this->nb_gen_max <= $this->nb_gen_done + 1) { $sql .= ' , statut = 1'; } diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 20878a34e16..a04b89bef02 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -9,6 +9,7 @@ * Copyright (C) 2021-2023 Frédéric France * Copyright (C) 2022 Charlène Benke * Copyright (C) 2024 William Mead + * 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 @@ -149,6 +150,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 // Security check $id = GETPOSTINT('id'); diff --git a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php index 8d5d8e85c17..9062d9f798b 100644 --- a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index a94af12f92d..0c6698c736c 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -9,6 +9,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Bahfir Abbes + * 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 @@ -75,11 +76,11 @@ function dol_session_start() /** * Replace session_regenerate_id() * - * @return void + * @return bool True if success, false if failed */ function dol_session_regenerate_id() { - session_regenerate_id(); + return session_regenerate_id(); } /** @@ -296,7 +297,7 @@ if (!defined('NOCSRFCHECK') && isset($dolibarr_nocsrfcheck) && $dolibarr_nocsrfc if ($csrfattack) { //print 'NOCSRFCHECK='.defined('NOCSRFCHECK').' REQUEST_METHOD='.$_SERVER['REQUEST_METHOD'].' HTTP_HOST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER']; // Note: We can't use dol_escape_htmltag here to escape output because lib functions.lib.ph is not yet loaded. - dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"])?'':$_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (Bad referrer).", LOG_WARNING); + dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (Bad referrer).", LOG_WARNING); print "Access refused by CSRF protection in main.inc.php. Referrer of form (".htmlentities($_SERVER['HTTP_REFERER'], ENT_COMPAT, 'UTF-8').") is outside the server that serve this page (with method = ".htmlentities($_SERVER['REQUEST_METHOD'], ENT_COMPAT, 'UTF-8').").\n"; print "If you access your server behind a proxy using url rewriting, you might check that all HTTP headers are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file to remove this security check).\n"; die; @@ -389,22 +390,22 @@ define('MAIN_DB_PREFIX', $dolibarr_main_db_prefix); */ // Path to root libraries if (!defined('TCPDF_PATH')) { - define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH.'/'); + define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH.'/'); } if (!defined('TCPDI_PATH')) { - define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH.'/'); + define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH.'/'); } if (!defined('NUSOAP_PATH')) { - define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/nusoap/lib/' : (empty($dolibarr_lib_NUSOAP_PATH) ? '' : $dolibarr_lib_NUSOAP_PATH.'/')); + define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/nusoap/lib/' : (empty($dolibarr_lib_NUSOAP_PATH) ? '' : $dolibarr_lib_NUSOAP_PATH.'/')); } if (!defined('PHPEXCELNEW_PATH')) { - define('PHPEXCELNEW_PATH', (!isset($dolibarr_lib_PHPEXCELNEW_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/phpoffice/phpspreadsheet/src/PhpSpreadsheet/' : (empty($dolibarr_lib_PHPEXCELNEW_PATH) ? '' : $dolibarr_lib_PHPEXCELNEW_PATH.'/')); + define('PHPEXCELNEW_PATH', (!isset($dolibarr_lib_PHPEXCELNEW_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/phpoffice/phpspreadsheet/src/PhpSpreadsheet/' : (empty($dolibarr_lib_PHPEXCELNEW_PATH) ? '' : $dolibarr_lib_PHPEXCELNEW_PATH.'/')); } if (!defined('ODTPHP_PATH')) { - define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/odtphp/' : (empty($dolibarr_lib_ODTPHP_PATH) ? '' : $dolibarr_lib_ODTPHP_PATH.'/')); + define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/odtphp/' : (empty($dolibarr_lib_ODTPHP_PATH) ? '' : $dolibarr_lib_ODTPHP_PATH.'/')); } if (!defined('ODTPHP_PATHTOPCLZIP')) { - define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP)) ?DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/' : (empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP.'/')); + define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP)) ? DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/' : (empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP.'/')); } if (!defined('JS_CKEDITOR')) { define('JS_CKEDITOR', (!isset($dolibarr_js_CKEDITOR)) ? '' : (empty($dolibarr_js_CKEDITOR) ? '' : $dolibarr_js_CKEDITOR.'/')); @@ -417,10 +418,10 @@ if (!defined('JS_JQUERY_UI')) { } // Other required path if (!defined('DOL_DEFAULT_TTF')) { - define('DOL_DEFAULT_TTF', (!isset($dolibarr_font_DOL_DEFAULT_TTF)) ?DOL_DOCUMENT_ROOT.'/includes/fonts/Aerial.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF) ? '' : $dolibarr_font_DOL_DEFAULT_TTF)); + define('DOL_DEFAULT_TTF', (!isset($dolibarr_font_DOL_DEFAULT_TTF)) ? DOL_DOCUMENT_ROOT.'/includes/fonts/Aerial.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF) ? '' : $dolibarr_font_DOL_DEFAULT_TTF)); } if (!defined('DOL_DEFAULT_TTF_BOLD')) { - define('DOL_DEFAULT_TTF_BOLD', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD)) ?DOL_DOCUMENT_ROOT.'/includes/fonts/AerialBd.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF_BOLD) ? '' : $dolibarr_font_DOL_DEFAULT_TTF_BOLD)); + define('DOL_DEFAULT_TTF_BOLD', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD)) ? DOL_DOCUMENT_ROOT.'/includes/fonts/AerialBd.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF_BOLD) ? '' : $dolibarr_font_DOL_DEFAULT_TTF_BOLD)); } diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index fe44a813231..02028392a6f 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2023 Joachim Kueter + * 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 @@ -264,7 +265,7 @@ class SupplierInvoices extends DolibarrApi $this->invoice->$field = $this->_checkValForAPI($field, $value, $this->invoice); } - if ($this->invoice->update($id, DolibarrApiAccess::$user)) { + if ($this->invoice->update(DolibarrApiAccess::$user)) { return $this->get($id); } @@ -387,7 +388,7 @@ class SupplierInvoices extends DolibarrApi } $result = $this->invoice->getListOfPayments(); - if ($result < 0) { + if ($this->invoice->error !== '') { throw new RestException(405, $this->invoice->error); } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7f7511db38f..b018cda619d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1129,7 +1129,7 @@ class CommandeFournisseur extends CommonOrder $dir = dol_buildpath($reldir."core/modules/supplier_order/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { @@ -1929,7 +1929,7 @@ class CommandeFournisseur extends CommonOrder * @param int $date_end Date end of service * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param string $pu_ht_devise Amount in currency + * @param int|string $pu_ht_devise Amount in currency * @param string $origin 'order', ... * @param int $origin_id Id of origin object * @param int $rang Rank @@ -1974,7 +1974,7 @@ class CommandeFournisseur extends CommonOrder $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } $txlocaltax1 = price2num($txlocaltax1); @@ -2206,7 +2206,7 @@ class CommandeFournisseur extends CommonOrder /** - * Save a receiving into the tracking table of receiving (commande_fournisseur_dispatch) and add product into stock warehouse. + * Save a receiving into the tracking table of receiving (receptiondet_batch) and add product into stock warehouse. * * @param User $user User object making change * @param int $product Id of product to dispatch @@ -2251,8 +2251,8 @@ class CommandeFournisseur extends CommonOrder if (($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY || $this->statut == self::STATUS_RECEIVED_COMPLETELY)) { $this->db->begin(); - $sql = "INSERT INTO ".$this->db->prefix()."commande_fournisseur_dispatch"; - $sql .= " (fk_commande, fk_product, qty, fk_entrepot, fk_user, datec, fk_commandefourndet, status, comment, eatby, sellby, batch, fk_reception) VALUES"; + $sql = "INSERT INTO ".$this->db->prefix()."receptiondet_batch"; + $sql .= " (fk_element, fk_product, qty, fk_entrepot, fk_user, datec, fk_elementdet, status, comment, eatby, sellby, batch, fk_reception) VALUES"; $sql .= " ('".$this->id."','".$product."','".$qty."',".($entrepot > 0 ? "'".$entrepot."'" : "null").",'".$user->id."','".$this->db->idate($now)."','".$fk_commandefourndet."', ".$dispatchstatus.", '".$this->db->escape($comment)."', "; $sql .= ($eatby ? "'".$this->db->idate($eatby)."'" : "null").", ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", ".($batch ? "'".$this->db->escape($batch)."'" : "null").", ".($fk_reception > 0 ? "'".$this->db->escape($fk_reception)."'" : "null"); $sql .= ")"; @@ -2497,11 +2497,11 @@ class CommandeFournisseur extends CommonOrder // List of already dispatched lines $sql = "SELECT p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; - $sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.fk_commandefourndet"; + $sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.fk_elementdet"; $sql .= " FROM ".$this->db->prefix()."product as p,"; - $sql .= " ".$this->db->prefix()."commande_fournisseur_dispatch as cfd"; + $sql .= " ".$this->db->prefix()."receptiondet_batch as cfd"; $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e ON cfd.fk_entrepot = e.rowid"; - $sql .= " WHERE cfd.fk_commande = ".((int) $this->id); + $sql .= " WHERE cfd.fk_element = ".((int) $this->id); $sql .= " AND cfd.fk_product = p.rowid"; if ($status >= 0) { $sql .= " AND cfd.status = ".((int) $status); @@ -2521,7 +2521,7 @@ class CommandeFournisseur extends CommonOrder 'productid' => $objp->fk_product, 'warehouseid' => $objp->warehouse_id, 'qty' => $objp->qty, - 'orderlineid' => $objp->fk_commandefourndet + 'orderlineid' => $objp->fk_elementdet ); } @@ -2880,13 +2880,13 @@ class CommandeFournisseur extends CommonOrder * * @param int $rowid ID de la ligne de facture * @param string $desc Line description - * @param float $pu Unit price - * @param float $qty Quantity - * @param float $remise_percent Percent discount on line - * @param float $txtva VAT rate - * @param float $txlocaltax1 Localtax1 tax - * @param float $txlocaltax2 Localtax2 tax - * @param float $price_base_type Type of price base + * @param int|float $pu Unit price + * @param int|float $qty Quantity + * @param int|float $remise_percent Percent discount on line + * @param int|float $txtva VAT rate + * @param int|float $txlocaltax1 Localtax1 tax + * @param int|float $txlocaltax2 Localtax2 tax + * @param string $price_base_type Type of price base * @param int $info_bits Miscellaneous information * @param int $type Type of line (0=product, 1=service) * @param int $notrigger Disable triggers @@ -2894,11 +2894,11 @@ class CommandeFournisseur extends CommonOrder * @param integer $date_end Date end of service * @param array $array_options Extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param float $pu_ht_devise Unit price in currency + * @param int|float $pu_ht_devise Unit price in currency * @param string $ref_supplier Supplier ref * @return int Return integer < 0 if error, > 0 if ok */ - public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') + public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = 0, $date_end = 0, $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') { global $mysoc, $conf, $langs; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit"); @@ -2934,7 +2934,7 @@ class CommandeFournisseur extends CommonOrder } $pu = price2num($pu); $pu_ht_devise = price2num($pu_ht_devise); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } $txlocaltax1 = (float) price2num($txlocaltax1); @@ -3243,8 +3243,8 @@ class CommandeFournisseur extends CommonOrder /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * - * @param User $user Object user - * @param int $mode "opened", "awaiting" for orders awaiting reception + * @param User $user Object user + * @param string $mode "opened", "awaiting" for orders awaiting reception * @return WorkboardResponse|int Return integer <0 if KO, WorkboardResponse if OK */ public function load_board($user, $mode = 'opened') @@ -3534,7 +3534,7 @@ class CommandeFournisseur extends CommonOrder $supplierorderdispatch = new CommandeFournisseurDispatch($this->db); - $filter = array('t.fk_commande' => $this->id); + $filter = array('t.fk_element' => $this->id); if (getDolGlobalString('SUPPLIER_ORDER_USE_DISPATCH_STATUS')) { $filter['t.status'] = 1; // Restrict to lines with status validated } @@ -3661,7 +3661,7 @@ class CommandeFournisseur extends CommonOrder $sql = 'SELECT cd.rowid, cd.fk_product,'; $sql .= ' sum(cfd.qty) as qty'; - $sql .= ' FROM '.$this->db->prefix().'commande_fournisseur_dispatch as cfd,'; + $sql .= ' FROM '.$this->db->prefix().'receptiondet_batch as cfd,'; if ($filtre_statut >= 0) { $sql .= ' '.$this->db->prefix().'reception as e,'; } @@ -3670,7 +3670,7 @@ class CommandeFournisseur extends CommonOrder if ($filtre_statut >= 0) { $sql .= ' cfd.fk_reception = e.rowid AND'; } - $sql .= ' cfd.fk_commandefourndet = cd.rowid'; + $sql .= ' cfd.fk_elementdet = cd.rowid'; $sql .= ' AND cd.fk_commande ='.((int) $this->id); if (isset($this->fk_product) && !empty($this->fk_product) > 0) { $sql .= ' AND cd.fk_product = '.((int) $this->fk_product); diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index ce869f06617..06408ce0fa5 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -2,6 +2,8 @@ /* Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Christophe Battarel * * 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 @@ -25,118 +27,28 @@ */ // Put here all includes required by your class file -require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"; -require_once DOL_DOCUMENT_ROOT."/reception/class/reception.class.php"; +require_once DOL_DOCUMENT_ROOT."/reception/class/receptionlinebatch.class.php"; /** - * Class to manage table commandefournisseurdispatch + * Class to manage table ReceptionLineBatch. + * Old name was CommandeFournisseurDispatch. This is a transition class. */ -class CommandeFournisseurDispatch extends CommonObjectLine +class CommandeFournisseurDispatch extends ReceptionLineBatch { - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string Error code (or message) - */ - public $error; - - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); - /** * @var string ID to identify managed object */ public $element = 'commandefournisseurdispatch'; - - /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = 'commande_fournisseur_dispatch'; //!< Name of table without prefix where object is stored - public $lines = array(); - - /** - * @var int ID - */ - public $id; - /** * @var int ID */ public $fk_commande; - /** * @var int ID */ - public $fk_product; - - /** - * @var int ID. Should be named fk_origin_line ? - */ public $fk_commandefourndet; - public $fk_reception; - - - public $qty; - public $qty_asked; - - public $libelle; - public $label; - public $desc; - public $tva_tx; - public $vat_src_code; - public $ref_supplier; - - /** - * @var int ID - */ - public $fk_entrepot; - - /** - * @var int User ID - */ - public $fk_user; - - public $datec = ''; - public $comment; - - /** - * @var int Status - */ - public $status; - - public $batch; - public $eatby = ''; - public $sellby = ''; - public $cost_price = 0; - - - - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - - // List of language codes for status - $this->labelStatus[0] = 'Received'; - $this->labelStatus[1] = 'Verified'; - $this->labelStatus[2] = 'Denied'; - $this->labelStatusShort[0] = 'Received'; - $this->labelStatusShort[1] = 'Verified'; - $this->labelStatusShort[2] = 'Denied'; - } - /** * Create object into database @@ -147,126 +59,12 @@ class CommandeFournisseurDispatch extends CommonObjectLine */ public function create($user, $notrigger = 0) { - global $conf, $langs, $hookmanager; - $error = 0; + $this->fk_element = $this->fk_commande; + $this->fk_elementdet = $this->fk_commandefourndet; - // Clean parameters - - if (isset($this->fk_commande)) { - $this->fk_commande = (int) $this->fk_commande; - } - if (isset($this->fk_product)) { - $this->fk_product = (int) $this->fk_product; - } - if (isset($this->fk_commandefourndet)) { - $this->fk_commandefourndet = (int) $this->fk_commandefourndet; - } - if (isset($this->qty)) { - $this->qty = trim($this->qty); - } - if (isset($this->fk_entrepot)) { - $this->fk_entrepot = (int) $this->fk_entrepot; - } - if (isset($this->fk_user)) { - $this->fk_user = (int) $this->fk_user; - } - if (isset($this->comment)) { - $this->comment = trim($this->comment); - } - if (isset($this->status)) { - $this->status = (int) $this->status; - } - if (isset($this->batch)) { - $this->batch = trim($this->batch); - } - if (empty($this->datec)) { - $this->datec = dol_now(); - } - - - // Check parameters - // Put here code to add control on parameters values - - // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; - $sql .= "fk_commande,"; - $sql .= "fk_product,"; - $sql .= "fk_commandefourndet,"; - $sql .= "qty,"; - $sql .= "fk_entrepot,"; - $sql .= "fk_user,"; - $sql .= "datec,"; - $sql .= "comment,"; - $sql .= "status,"; - $sql .= "batch,"; - $sql .= "eatby,"; - $sql .= "sellby,"; - $sql .= "fk_reception,"; - $sql .= "cost_price"; - - - $sql .= ") VALUES ("; - $sql .= " ".(!isset($this->fk_commande) ? 'NULL' : "'".$this->db->escape($this->fk_commande)."'").","; - $sql .= " ".(!isset($this->fk_product) ? 'NULL' : "'".$this->db->escape($this->fk_product)."'").","; - $sql .= " ".(!isset($this->fk_commandefourndet) ? 'NULL' : "'".$this->db->escape($this->fk_commandefourndet)."'").","; - $sql .= " ".(!isset($this->qty) ? 'NULL' : "'".$this->db->escape($this->qty)."'").","; - $sql .= " ".(!isset($this->fk_entrepot) ? 'NULL' : "'".$this->db->escape($this->fk_entrepot)."'").","; - $sql .= " ".(!isset($this->fk_user) ? 'NULL' : "'".$this->db->escape($this->fk_user)."'").","; - $sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").","; - $sql .= " ".(!isset($this->comment) ? 'NULL' : "'".$this->db->escape($this->comment)."'").","; - $sql .= " ".(!isset($this->status) ? 'NULL' : "'".$this->db->escape($this->status)."'").","; - $sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").","; - $sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").","; - $sql .= " ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").","; - $sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'").","; - $sql .= " ".(!isset($this->cost_price) ? '0' : "'".$this->db->escape($this->cost_price)."'"); - $sql .= ")"; - - $this->db->begin(); - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; - $this->errors[] = "Error ".$this->db->lasterror(); - } - - if (!$error) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); - - if (!$notrigger) { - // Call triggers - $result = $this->call_trigger('LINERECEPTION_CREATE', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - } - - // Create extrafields - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } - } - - // Commit or rollback - if ($error) { - foreach ($this->errors as $errmsg) { - dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } else { - $this->db->commit(); - return $this->id; - } + return parent::create($user, $notrigger); } - /** * Load object in memory from the database * @@ -276,68 +74,14 @@ class CommandeFournisseurDispatch extends CommonObjectLine */ public function fetch($id, $ref = '') { - global $langs; - $sql = "SELECT"; - $sql .= " t.rowid,"; - - $sql .= " t.fk_commande,"; - $sql .= " t.fk_product,"; - $sql .= " t.fk_commandefourndet,"; - $sql .= " t.qty,"; - $sql .= " t.fk_entrepot,"; - $sql .= " t.fk_user,"; - $sql .= " t.datec,"; - $sql .= " t.comment,"; - $sql .= " t.status,"; - $sql .= " t.tms,"; - $sql .= " t.batch,"; - $sql .= " t.eatby,"; - $sql .= " t.sellby,"; - $sql .= " t.fk_reception"; - - - $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; - if ($ref) { - $sql .= " WHERE t.ref = '".$this->db->escape($ref)."'"; - } else { - $sql .= " WHERE t.rowid = ".((int) $id); - } - - dol_syslog(get_class($this)."::fetch"); - $resql = $this->db->query($sql); - if ($resql) { - if ($this->db->num_rows($resql)) { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - - $this->fk_commande = $obj->fk_commande; - $this->fk_product = $obj->fk_product; - $this->fk_commandefourndet = $obj->fk_commandefourndet; - $this->qty = $obj->qty; - $this->fk_entrepot = $obj->fk_entrepot; - $this->fk_user = $obj->fk_user; - $this->datec = $this->db->jdate($obj->datec); - $this->comment = $obj->comment; - $this->status = $obj->status; - $this->tms = $this->db->jdate($obj->tms); - $this->batch = $obj->batch; - $this->eatby = $this->db->jdate($obj->eatby); - $this->sellby = $this->db->jdate($obj->sellby); - $this->fk_reception = $obj->fk_reception; - - $this->fetch_optionals(); - } - $this->db->free($resql); - - return 1; - } else { - $this->error = "Error ".$this->db->lasterror(); - return -1; + $ret = parent::fetch($id, $ref); + if ($ret > 0) { + $this->fk_commande = $this->fk_element; + $this->fk_commandefourndet = $this->fk_elementdet; } + return $ret; } - /** * Update object into database * @@ -347,408 +91,9 @@ class CommandeFournisseurDispatch extends CommonObjectLine */ public function update($user, $notrigger = 0) { - $error = 0; + $this->fk_element = $this->fk_commande; + $this->fk_elementdet = $this->fk_commandefourndet; - // Clean parameters - - if (isset($this->fk_commande)) { - $this->fk_commande = (int) $this->fk_commande; - } - if (isset($this->fk_product)) { - $this->fk_product = (int) $this->fk_product; - } - if (isset($this->fk_commandefourndet)) { - $this->fk_commandefourndet = (int) $this->fk_commandefourndet; - } - if (isset($this->qty)) { - $this->qty = trim($this->qty); - } - if (isset($this->fk_entrepot)) { - $this->fk_entrepot = (int) $this->fk_entrepot; - } - if (isset($this->fk_user)) { - $this->fk_user = (int) $this->fk_user; - } - if (isset($this->comment)) { - $this->comment = trim($this->comment); - } - if (isset($this->status)) { - $this->status = (int) $this->status; - } - if (isset($this->batch)) { - $this->batch = trim($this->batch); - } - - - - // Check parameters - // Put here code to add a control on parameters values - - // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; - $sql .= " fk_commande=".(isset($this->fk_commande) ? $this->fk_commande : "null").","; - $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").","; - $sql .= " fk_commandefourndet=".(isset($this->fk_commandefourndet) ? $this->fk_commandefourndet : "null").","; - $sql .= " qty=".(isset($this->qty) ? $this->qty : "null").","; - $sql .= " fk_entrepot=".(isset($this->fk_entrepot) ? $this->fk_entrepot : "null").","; - $sql .= " fk_user=".(isset($this->fk_user) ? $this->fk_user : "null").","; - $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; - $sql .= " comment=".(isset($this->comment) ? "'".$this->db->escape($this->comment)."'" : "null").","; - $sql .= " status=".(isset($this->status) ? $this->status : "null").","; - $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; - $sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").","; - $sql .= " eatby=".(dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').","; - $sql .= " sellby=".(dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null'); - $sql .= " WHERE rowid=".((int) $this->id); - - $this->db->begin(); - - dol_syslog(__METHOD__); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; - $this->errors[] = "Error ".$this->db->lasterror(); - } - - if (!$error) { - if (!$error) { - if (empty($this->id) && !empty($this->rowid)) { - $this->id = $this->rowid; - } - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } - } - - if (!$notrigger) { - // Call triggers - $result = $this->call_trigger('LINERECEPTION_MODIFY', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - } - - // Commit or rollback - if ($error) { - foreach ($this->errors as $errmsg) { - dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } else { - $this->db->commit(); - return 1; - } - } - - - /** - * Delete object in database - * - * @param User $user User that deletes - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK - */ - public function delete($user, $notrigger = 0) - { - $error = 0; - - $this->db->begin(); - - if (!$error) { - if (!$notrigger) { - // Call triggers - $result = $this->call_trigger('LINERECEPTION_DELETE', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - } - - // Remove extrafields - if (!$error) { - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR); - } - } - - if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " WHERE rowid=".((int) $this->id); - - dol_syslog(__METHOD__); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; - $this->errors[] = "Error ".$this->db->lasterror(); - } - } - - // Commit or rollback - if ($error) { - foreach ($this->errors as $errmsg) { - dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } else { - $this->db->commit(); - return 1; - } - } - - - /** - * Load an object from its id and create a new one in database - * - * @param User $user User making the clone - * @param int $fromid Id of object to clone - * @return int New id of clone - */ - public function createFromClone(User $user, $fromid) - { - $error = 0; - - $object = new CommandeFournisseurDispatch($this->db); - - $this->db->begin(); - - // Load source object - $object->fetch($fromid); - $object->id = 0; - $object->statut = 0; - - // Clear fields - // ... - - // Create clone - $object->context['createfromclone'] = 'createfromclone'; - $result = $object->create($user); - - // Other options - if ($result < 0) { - $this->error = $object->error; - $error++; - } - - if (!$error) { - } - - unset($object->context['createfromclone']); - - // End - if (!$error) { - $this->db->commit(); - return $object->id; - } else { - $this->db->rollback(); - return -1; - } - } - - - - /** - * Return label of the status of object - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto - * @return string Label - */ - public function getLibStatut($mode = 0) - { - return $this->LibStatut($this->status, $mode); - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return label of a 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 - * @return string Label of status - */ - public function LibStatut($status, $mode = 0) - { - // phpcs:enable - global $langs; - $langs->load('orders'); - - if ($mode == 0) { - return $langs->trans($this->labelStatus[$status]); - } elseif ($mode == 1) { - return $langs->trans($this->labelStatusShort[$status]); - } elseif ($mode == 2) { - return $langs->trans($this->labelStatus[$status]); - } elseif ($mode == 3) { - if ($status == 0) { - return img_picto($langs->trans($this->labelStatus[$status]), 'statut0'); - } elseif ($status == 1) { - return img_picto($langs->trans($this->labelStatus[$status]), 'statut4'); - } elseif ($status == 2) { - return img_picto($langs->trans($this->labelStatus[$status]), 'statut8'); - } - } elseif ($mode == 4) { - if ($status == 0) { - return img_picto($langs->trans($this->labelStatus[$status]), 'statut0').' '.$langs->trans($this->labelStatus[$status]); - } elseif ($status == 1) { - return img_picto($langs->trans($this->labelStatus[$status]), 'statut4').' '.$langs->trans($this->labelStatus[$status]); - } elseif ($status == 2) { - return img_picto($langs->trans($this->labelStatus[$status]), 'statut8').' '.$langs->trans($this->labelStatus[$status]); - } - } elseif ($mode == 5) { - if ($status == 0) { - return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut0'); - } elseif ($status == 1) { - return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut4'); - } elseif ($status == 2) { - return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut8'); - } - } - return ""; - } - - - /** - * Initialise object with example values - * Id must be 0 if object instance is a specimen - * - * @return int - */ - public function initAsSpecimen() - { - $this->id = 0; - - $this->fk_commande = 0; - $this->fk_product = 0; - $this->fk_commandefourndet = 0; - $this->qty = ''; - $this->fk_entrepot = 0; - $this->fk_user = 0; - $this->datec = ''; - $this->comment = ''; - $this->status = 0; - $this->tms = dol_now(); - $this->batch = ''; - $this->eatby = ''; - $this->sellby = ''; - - return 1; - } - - /** - * Load object in memory from the database - * - * @param string $sortorder Sort Order - * @param string $sortfield Sort field - * @param int $limit limit - * @param int $offset offset limit - * @param string|array $filter filter array - * @param string $filtermode filter mode (AND or OR) - * @return int Return integer <0 if KO, >0 if OK - */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') - { - dol_syslog(__METHOD__, LOG_DEBUG); - - $sql = "SELECT"; - $sql .= " t.rowid,"; - $sql .= " t.fk_commande,"; - $sql .= " t.fk_product,"; - $sql .= " t.fk_commandefourndet,"; - $sql .= " t.qty,"; - $sql .= " t.fk_entrepot,"; - $sql .= " t.fk_user,"; - $sql .= " t.datec,"; - $sql .= " t.comment,"; - $sql .= " t.status,"; - $sql .= " t.tms,"; - $sql .= " t.batch,"; - $sql .= " t.eatby,"; - $sql .= " t.sellby"; - $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; - - // Manage filter - if (is_array($filter)) { - $sqlwhere = array(); - if (count($filter) > 0) { - foreach ($filter as $key => $value) { - if ($key == 't.comment') { - $sqlwhere [] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike($value))."%'"; - } elseif ($key == 't.datec' || $key == 't.tms' || $key == 't.eatby' || $key == 't.sellby' || $key == 't.batch') { - $sqlwhere [] = $this->db->sanitize($key)." = '".$this->db->escape($value)."'"; - } elseif ($key == 'qty') { - $sqlwhere [] = $this->db->sanitize($key)." = ".((float) $value); - } else { - $sqlwhere [] = $this->db->sanitize($key)." = ".((int) $value); - } - } - } - if (count($sqlwhere) > 0) { - $sql .= ' WHERE '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere); - } - - $filter = ''; - } - - // Manage filter - $errormessage = ''; - $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); - if ($errormessage) { - $this->errors[] = $errormessage; - dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); - return -1; - } - - if (!empty($sortfield)) { - $sql .= $this->db->order($sortfield, $sortorder); - } - if (!empty($limit)) { - $sql .= $this->db->plimit($limit, $offset); - } - $this->lines = array(); - - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - - while ($obj = $this->db->fetch_object($resql)) { - $line = new self($this->db); - - $line->id = $obj->rowid; - - $line->fk_commande = $obj->fk_commande; - $line->fk_product = $obj->fk_product; - $line->fk_commandefourndet = $obj->fk_commandefourndet; - $line->qty = $obj->qty; - $line->fk_entrepot = $obj->fk_entrepot; - $line->fk_user = $obj->fk_user; - $line->datec = $this->db->jdate($obj->datec); - $line->comment = $obj->comment; - $line->status = $obj->status; - $line->tms = $this->db->jdate($obj->tms); - $line->batch = $obj->batch; - $line->eatby = $this->db->jdate($obj->eatby); - $line->sellby = $this->db->jdate($obj->sellby); - $line->fetch_optionals(); - - $this->lines[$line->id] = $line; - } - $this->db->free($resql); - - return $num; - } else { - $this->errors[] = 'Error '.$this->db->lasterror(); - dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); - - return -1; - } + return parent::update($user, $notrigger); } } diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 900ee4d014a..2fbdc41be62 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -190,7 +190,7 @@ class FactureFournisseurRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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), @@ -373,7 +373,7 @@ class FactureFournisseurRec extends CommonInvoice $num = count($facfourn_src->lines); for ($i = 0; $i < $num; $i++) { $tva_tx = $facfourn_src->lines[$i]->tva_tx; - if (!empty($facfourn_src->lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) { + if (!empty($facfourn_src->lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) { $tva_tx .= ' ('.$facfourn_src->lines[$i]->vat_src_code.')'; } @@ -910,9 +910,9 @@ class FactureFournisseurRec extends CommonInvoice // Clean vat code $reg = array(); $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) { + if (preg_match('/\((.*)\)/', (string) $txtva, $reg)) { $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + $txtva = preg_replace('/\s*\(.*\)/', '', (string) $txtva); // Remove code into vatrate. } // Clean parameters @@ -1107,7 +1107,7 @@ class FactureFournisseurRec extends CommonInvoice $pu_ttc = price2num($pu_ttc); $pu_ht_devise = price2num($pu_ht_devise); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index cd90cf86179..576645afab4 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis + * 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 @@ -253,7 +254,7 @@ class FactureFournisseur extends CommonInvoice 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), 'ref' => array('type' => 'varchar(255)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 15), 'ref_supplier' => array('type' => 'varchar(255)', 'label' => 'RefSupplier', 'enabled' => 1, 'visible' => -1, 'position' => 20), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 25, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 25, 'index' => 1), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'visible' => 0, 'position' => 30), 'type' => array('type' => 'smallint(6)', 'label' => 'Type', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), 'subtype' => array('type' => 'smallint(6)', 'label' => 'InvoiceSubtype', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 36), @@ -1196,9 +1197,9 @@ class FactureFournisseur extends CommonInvoice } if (isset($this->fk_project)) { if (empty($this->fk_project)) { - $this->fk_project = null; + $this->fk_project = 0; } else { - $this->fk_project = intval($this->fk_project); + $this->fk_project = (int) $this->fk_project; } } if (isset($this->cond_reglement_id)) { @@ -2064,7 +2065,7 @@ class FactureFournisseur extends CommonInvoice * @param int $fk_remise_except Id discount used * @return int >0 if OK, <0 if KO */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $fk_code_ventilation = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = 0, $array_options = [], $fk_unit = null, $origin_id = 0, $pu_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0, $fk_remise_except = 0) + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = 0, $date_end = 0, $fk_code_ventilation = 0, $info_bits = 0, $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = 0, $array_options = [], $fk_unit = null, $origin_id = 0, $pu_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0, $fk_remise_except = 0) { global $langs, $mysoc, $conf; @@ -2101,7 +2102,7 @@ class FactureFournisseur extends CommonInvoice $remise_percent = price2num($remise_percent); $qty = price2num($qty); $pu = price2num($pu); - if (!preg_match('/\((.*)\)/', $txtva)) { + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' } $txlocaltax1 = price2num($txlocaltax1); @@ -2223,7 +2224,7 @@ class FactureFournisseur extends CommonInvoice $supplierinvoiceline->desc = $desc; $supplierinvoiceline->ref_supplier = $ref_supplier; - $supplierinvoiceline->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative + $supplierinvoiceline->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs((float) $qty) : $qty); // For credit note, quantity is always positive and unit price negative $supplierinvoiceline->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise $supplierinvoiceline->vat_src_code = $vat_src_code; @@ -2376,9 +2377,9 @@ class FactureFournisseur extends CommonInvoice // Clean vat code $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $vatrate, $reg)) { + if (preg_match('/\((.*)\)/', (string) $vatrate, $reg)) { $vat_src_code = $reg[1]; - $vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate. + $vatrate = preg_replace('/\s*\(.*\)/', '', (string) $vatrate); // Remove code into vatrate. } $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_devise); @@ -2423,7 +2424,7 @@ class FactureFournisseur extends CommonInvoice $line->description = $desc; $line->desc = $desc; - $line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative + $line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs((float) $qty) : $qty); // For credit note, quantity is always positive and unit price negative $line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise $line->pu_ht = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise $line->pu_ttc = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ttc) : $pu_ttc); // For credit note, unit price always negative, always positive otherwise @@ -2962,7 +2963,7 @@ class FactureFournisseur extends CommonInvoice $dir = dol_buildpath($reldir."core/modules/supplier_invoice/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { @@ -3407,10 +3408,11 @@ class FactureFournisseur extends CommonInvoice { global $conf, $langs, $user; - $error = 0; $this->output = ''; $this->error = ''; $nbMailSend = 0; + + $error = 0; $errorsMsg = array(); $langs->load('bills'); @@ -3691,7 +3693,7 @@ class FactureFournisseur extends CommonInvoice return 0; } else { - $this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? implode(', ', $errorsMsg) : $error; + $this->error = 'Nb of emails sent : '.$nbMailSend.', '.(empty($errorsMsg) ? $error : implode(', ', $errorsMsg)); dol_syslog(__METHOD__." end - ".$this->error, LOG_INFO); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index a809866be18..0a3dffdf3dc 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2016-2023 Charlene Benke * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2020 Pierre Ardoin + * 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 @@ -224,7 +225,7 @@ class ProductFournisseur extends Product $this->db = $db; $langs->load("suppliers"); - $this->reputations = array('-1'=>'', 'FAVORITE'=>$langs->trans('Favorite'), 'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier')); + $this->reputations = array('-1' => '', 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -512,7 +513,7 @@ class ProductFournisseur extends Product $productfournisseurprice = new ProductFournisseurPrice($this->db); $res = $productfournisseurprice->fetch($this->product_fourn_price_id); if ($res > 0) { - foreach ($options as $key=>$value) { + foreach ($options as $key => $value) { $productfournisseurprice->array_options[$key] = $value; } $res = $productfournisseurprice->update($user); @@ -616,7 +617,7 @@ class ProductFournisseur extends Product $productfournisseurprice = new ProductFournisseurPrice($this->db); $res = $productfournisseurprice->fetch($this->product_fourn_price_id); if ($res > 0) { - foreach ($options as $key=>$value) { + foreach ($options as $key => $value) { $productfournisseurprice->array_options[$key] = $value; } $res = $productfournisseurprice->update($user); @@ -881,7 +882,7 @@ class ProductFournisseur extends Product * Load properties for minimum price * * @param int $prodid Product id - * @param int $qty Minimum quantity + * @param float $qty Minimum quantity * @param int $socid get min price for specific supplier * @return int Return integer <0 if KO, 0=Not found of no product id provided, >0 if OK * @see list_product_fournisseur_price() @@ -1391,7 +1392,7 @@ class ProductFournisseur extends Product global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index c01feb22892..8c221fff4d9 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2023 Joachim Kueter * Copyright (C) 2023 Sylvain Legrand * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -279,9 +280,9 @@ class PaiementFourn extends Paiement // If we want to closed paid invoices if ($closepaidinvoices) { $paiement = $invoice->getSommePaiement(); - $creditnotes=$invoice->getSumCreditNotesUsed(); + $creditnotes = $invoice->getSumCreditNotesUsed(); //$creditnotes = 0; - $deposits=$invoice->getSumDepositsUsed(); + $deposits = $invoice->getSumDepositsUsed(); //$deposits = 0; $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT'); $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); @@ -712,7 +713,7 @@ class PaiementFourn extends Paiement global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -783,7 +784,7 @@ class PaiementFourn extends Paiement // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } @@ -798,7 +799,7 @@ class PaiementFourn extends Paiement // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) { - $mybool |= include_once $dir.$file; + $mybool = (include_once $dir.$file) || $mybool; } } } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 6b4574ed2a9..f9ec2a67379 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -668,9 +668,9 @@ if ($id > 0 || !empty($ref)) { // Set $products_dispatched with qty dispatched for each product id $products_dispatched = array(); $sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty"; - $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet"; - $sql .= " WHERE cfd.fk_commande = ".((int) $object->id); + $sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on l.rowid = cfd.fk_elementdet"; + $sql .= " WHERE cfd.fk_element = ".((int) $object->id); $sql .= " GROUP BY l.rowid, cfd.fk_product"; $resql = $db->query($sql); @@ -1171,13 +1171,13 @@ if ($id > 0 || !empty($ref)) { $sql .= " ,cfd.fk_reception, r.date_delivery"; } $sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; - $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cd ON cd.rowid = cfd.fk_commandefourndet"; + $sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cd ON cd.rowid = cfd.fk_elementdet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; if ($conf->reception->enabled) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."reception as r ON cfd.fk_reception = r.rowid"; } - $sql .= " WHERE cfd.fk_commande = ".((int) $object->id); + $sql .= " WHERE cfd.fk_element = ".((int) $object->id); $sql .= " AND cfd.fk_product = p.rowid"; $sql .= " ORDER BY cfd.rowid ASC"; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 1bab50ecddd..e42b0e326eb 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -10,6 +10,7 @@ * Copyright (C) 2018-2022 Charlene Benke * Copyright (C) 2019 Nicolas Zabouri * Copyright (C) 2021-2023 Alexandre Spangaro + * 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 @@ -211,6 +212,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 $error = 0; diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 8bb4b3442bb..9dd662c8507 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -19,7 +19,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index a5dc3d0eba1..10dd9fd4e45 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -9,6 +9,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017-2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -559,7 +560,7 @@ if (empty($reshook)) { $tva_npr = $datapriceofproduct['tva_npr']; $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', (string) $prod->tva_tx)); // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? if (!empty($price_ht)) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 97f21ccb533..28c442eb5c6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -697,12 +697,12 @@ if (empty($reshook)) { } if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { foreach ($amount_ht as $tva_tx => $xxx) { - $discount->amount_ht = abs($amount_ht[$tva_tx]); - $discount->amount_tva = abs($amount_tva[$tva_tx]); - $discount->amount_ttc = abs($amount_ttc[$tva_tx]); - $discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]); - $discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]); - $discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]); + $discount->amount_ht = abs((float) $amount_ht[$tva_tx]); + $discount->amount_tva = abs((float) $amount_tva[$tva_tx]); + $discount->amount_ttc = abs((float) $amount_ttc[$tva_tx]); + $discount->multicurrency_amount_ht = abs((float) $multicurrency_amount_ht[$tva_tx]); + $discount->multicurrency_amount_tva = abs((float) $multicurrency_amount_tva[$tva_tx]); + $discount->multicurrency_amount_ttc = abs((float) $multicurrency_amount_ttc[$tva_tx]); // Clean vat code $reg = array(); @@ -1172,6 +1172,7 @@ if (empty($reshook)) { $TTotalByTva[$line->tva_tx] += $line->total_ttc; } + $amount_ttc_diff = 0.; foreach ($TTotalByTva as $tva => &$total) { $coef = $total / $srcobject->total_ttc; // Calc coef $am = $amount * $coef; diff --git a/htdocs/fourn/facture/list-rec.php b/htdocs/fourn/facture/list-rec.php index 62531e8a569..cfa3fbdc457 100644 --- a/htdocs/fourn/facture/list-rec.php +++ b/htdocs/fourn/facture/list-rec.php @@ -8,6 +8,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015-2021 Alexandre Spangaro * Copyright (C) 2016 Meziane Sof + * 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 @@ -159,6 +160,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 ($socid > 0) { $tmpthirdparty = new Societe($db); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 642b4612358..6cf9a81433d 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -11,10 +11,11 @@ * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018-2022 Charlene Benke - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019-2023 Alexandre Spangaro * Copyright (C) 2023 Nick Fragoulis * Copyright (C) 2023 Joachim Kueter + * 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 @@ -103,7 +104,7 @@ $search_datelimit_endmonth = GETPOSTINT('search_datelimit_endmonth'); $search_datelimit_endyear = GETPOSTINT('search_datelimit_endyear'); $search_datelimit_start = dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear); $search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear); -$search_categ_sup = trim(GETPOSTINT("search_categ_sup")); +$search_categ_sup = GETPOSTINT("search_categ_sup"); $search_product_category = GETPOSTINT('search_product_category'); $option = GETPOST('search_option'); @@ -211,6 +212,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 (!isModEnabled('supplier_invoice')) { accessforbidden(); @@ -932,10 +934,10 @@ if ($option) { $param .= "&search_option=".urlencode($option); } if ($search_categ_sup > 0) { - $param .= '&search_categ_sup='.urlencode($search_categ_sup); + $param .= '&search_categ_sup='.$search_categ_sup; } if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); + $param .= '&search_type_thirdparty='.$search_type_thirdparty; } // Add $param from extra fields @@ -1595,7 +1597,6 @@ while ($i < $imaxinloop) { $facturestatic->alreadypaid = ($paiement ? $paiement : 0); $facturestatic->paye = $obj->paye; - $facturestatic->socid = $thirdparty->getNomUrl(1, 'supplier', 3); $facturestatic->date = $db->jdate($obj->datef); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 7c9b3b8b3b7..7776dd888d3 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -13,6 +13,7 @@ * Copyright (C) 2021 Charlene Benke * Copyright (C) 2022 Udo Tamm * Copyright (C) 2023 Sylvain Legrand + * 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 @@ -178,7 +179,7 @@ if (empty($reshook)) { $amountsresttopay[$cursorfacid] = price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement()); if ($amounts[$cursorfacid]) { // Check amount - if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid]))) { + if ($amounts[$cursorfacid] && (abs((float) $amounts[$cursorfacid]) > abs((float) $amountsresttopay[$cursorfacid]))) { $addwarning = 1; $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier"); } @@ -205,7 +206,7 @@ if (empty($reshook)) { $multicurrency_amountsresttopay[$cursorfacid] = price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1)); if ($multicurrency_amounts[$cursorfacid]) { // Check amount - if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid]))) { + if ($multicurrency_amounts[$cursorfacid] && (abs((float) $multicurrency_amounts[$cursorfacid]) > abs((float) $multicurrency_amountsresttopay[$cursorfacid]))) { $addwarning = 1; $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier"); } @@ -280,7 +281,7 @@ if (empty($reshook)) { $tmpinvoice->fetch($key); if ($tmpinvoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) { $newvalue = price2num($value, 'MT'); - $amounts[$key] = - abs($newvalue); + $amounts[$key] = - abs((float) $newvalue); } $multicurrency_code[$key] = $tmpinvoice->multicurrency_code; $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx; @@ -291,7 +292,7 @@ if (empty($reshook)) { $tmpinvoice->fetch($key); if ($tmpinvoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) { $newvalue = price2num($value, 'MT'); - $multicurrency_amounts[$key] = - abs($newvalue); + $multicurrency_amounts[$key] = - abs((float) $newvalue); } $multicurrency_code[$key] = $tmpinvoice->multicurrency_code; $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx; diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 6ebb4f03f4f..02fa09d5ba9 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -21,7 +21,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index aa328d13024..a354a15f3bc 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -12,6 +12,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,6 +108,7 @@ $arrayfields = array( 'p.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 70), ); $arrayfields = dol_sort_array($arrayfields, 'position'); +'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('paymentsupplierlist')); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index e5afa1e524a..6608cbbbb34 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -232,7 +232,7 @@ class Holiday extends CommonObject $dir = dol_buildpath($reldir."core/modules/holiday/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 7bf46c30b86..0598a8cf46b 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -103,7 +103,7 @@ class Evaluation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -161,11 +161,11 @@ class Evaluation extends CommonObject // */ // protected $childtables = array(); - // /** - // * @var array List of child tables. To know object to delete on cascade. - // * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will - // * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object - // */ + /** + * @var string[] List of child tables. To know object to delete on cascade. + * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will + * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object + */ protected $childtablesoncascade = array('@EvaluationLine:hrm/class/evaluationdet.class.php:fk_evaluation'); /** @@ -952,7 +952,7 @@ class Evaluation extends CommonObject $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index ad7c91c86d9..0c6b5149f8a 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -102,7 +102,7 @@ class EvaluationLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -922,7 +922,7 @@ class EvaluationLine extends CommonObjectLine $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index e1a355b54cd..ec9cbea1b91 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -101,7 +101,7 @@ class Job extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -122,8 +122,6 @@ class Job extends CommonObject public $date_creation; public $deplacement; - public $note_public; - public $note_private; public $fk_user_creat; public $fk_user_modif; // END MODULEBUILDER PROPERTIES @@ -136,9 +134,9 @@ class Job extends CommonObject // */ // public $table_element_line = 'hrm_jobline'; - // /** - // * @var string Field with ID of parent key if this object has a parent - // */ + /** + * @var string Field with ID of parent key if this object has a parent + */ public $fk_element = 'fk_job'; // /** @@ -146,16 +144,19 @@ class Job extends CommonObject // */ // public $class_element_line = 'Jobline'; - // /** - // * @var string[] List of child tables. To test if we can delete object. - // */ - protected $childtables = array('hrm_evaluation', 'hrm_job_user'); + /** + * @var array List of child tables. To test if we can delete object. + */ + protected $childtables = array( + 'hrm_evaluation' => ['name' => 'Evaluation'], + 'hrm_job_user' => ['name' => 'Job'], + ); - // /** - // * @var array List of child tables. To know object to delete on cascade. - // * If name matches '@ClassNAme:FilePathClass:ParentFkFieldName' it will - // * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object - // */ + /** + * @var string[] List of child tables. To know object to delete on cascade. + * If name matches '@ClassNAme:FilePathClass:ParentFkFieldName' it will + * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object + */ protected $childtablesoncascade = array("@SkillRank:hrm/class/skillrank.class.php:fk_object:(objecttype:=:'job')"); // /** @@ -960,7 +961,7 @@ class Job extends CommonObject $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index f96cb1539a2..197ac19eb5b 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -100,7 +100,7 @@ class Position extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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, 'index' => 1, 'css' => 'left', 'comment' => "Id"), @@ -1001,7 +1001,7 @@ class Position extends CommonObject $dir = dol_buildpath($reldir . "core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir . $file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index c895035010d..4ce76501127 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -106,7 +106,7 @@ class Skill extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -133,8 +133,6 @@ class Skill extends CommonObject public $date_validite; public $temps_theorique; public $skill_type; - public $note_public; - public $note_private; // END MODULEBUILDER PROPERTIES @@ -145,9 +143,9 @@ class Skill extends CommonObject // */ // public $table_element_line = 'hrm_skillline'; - // /** - // * @var string Field with ID of parent key if this object has a parent - // */ + /** + * @var string Field with ID of parent key if this object has a parent + */ public $fk_element = 'fk_skill'; // /** @@ -155,16 +153,19 @@ class Skill extends CommonObject // */ // public $class_element_line = 'Skillline'; - // /** - // * @var array List of child tables. To test if we can delete object. - // */ - protected $childtables = array('hrm_skillrank', 'hrm_evaluationdet'); + /** + * @var array List of child tables. To test if we can delete object. + */ + protected $childtables = array( + 'hrm_skillrank' => ['name' => 'SkillRank'], + 'hrm_evaluationdet' => ['name' => 'EvaluationDet'], + ); - // /** - // * @var array List of child tables. To know object to delete on cascade. - // * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will - // * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object - // */ + /** + * @var string[] List of child tables. To know object to delete on cascade. + * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will + * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object + */ protected $childtablesoncascade = array('hrm_skilldet'); // /** @@ -259,7 +260,7 @@ class Skill extends CommonObject $this->db->begin(); // Create level of skills - for ($i; $i <= $MaxNumberSkill ; $i++) { + while ($i <= $MaxNumberSkill) { $skilldet = new Skilldet($this->db); $skilldet->description = $defaultSkillDesc . " " . $i; $skilldet->rankorder = $i; @@ -269,9 +270,10 @@ class Skill extends CommonObject if ($result <= 0) { $error++; } + $i++; } - if (! $error) { + if (!$error) { $this->db->commit(); setEventMessage($langs->trans('SkillCreated'), $i); @@ -999,7 +1001,7 @@ class Skill extends CommonObject $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 12258e08025..9190c413bcc 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -100,7 +100,7 @@ class Skilldet extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -889,7 +889,7 @@ class Skilldet extends CommonObjectLine $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 4c599235f72..7640049c4f5 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -104,7 +104,7 @@ class SkillRank extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -965,7 +965,7 @@ class SkillRank extends CommonObject $dir = dol_buildpath($reldir."core/modules/hrm/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/hrm/core/tpl/objectline_title.tpl.php b/htdocs/hrm/core/tpl/objectline_title.tpl.php index e7e5091eb95..f96fd3a72f8 100644 --- a/htdocs/hrm/core/tpl/objectline_title.tpl.php +++ b/htdocs/hrm/core/tpl/objectline_title.tpl.php @@ -40,7 +40,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } print "\n"; diff --git a/htdocs/hrm/core/tpl/objectline_view.tpl.php b/htdocs/hrm/core/tpl/objectline_view.tpl.php index 2c9939e234d..a325e303a10 100644 --- a/htdocs/hrm/core/tpl/objectline_view.tpl.php +++ b/htdocs/hrm/core/tpl/objectline_view.tpl.php @@ -45,7 +45,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } global $mysoc; diff --git a/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php b/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php index 56a3bcb58b1..124d17f50fe 100644 --- a/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php +++ b/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php @@ -3,7 +3,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } if (!empty($object->table_element_line)) { diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index d896cae320c..871030cb774 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -164,7 +164,7 @@ if (php_sapi_name() === "cli" && (float) PHP_VERSION > 7.0) { /** * Previx option with '-' for single characters and -- for more than single characters * @param string $arg - * @return straing + * @return string */ static function ($arg) { if (strlen($arg) > 1) { diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 958a0c65797..5ed3730adc1 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -60,7 +60,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is canceled','facture',8); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_DELETE','Customer invoice deleted','Executed when a customer invoice is deleted','facture',9); diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 1a109507a36..f0e6b72901c 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -5,7 +5,7 @@ -- -- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y -- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y --- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; -- Note that "RENAME TO" is both compatible mysql/postgesql, not "RENAME" alone. -- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; -- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); -- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; @@ -67,8 +67,6 @@ ALTER TABLE llx_categories_extrafields DROP INDEX idx_categories_extrafields; ALTER TABLE llx_categories_extrafields ADD UNIQUE INDEX uk_categories_extrafields (fk_object); ALTER TABLE llx_commande_extrafields DROP INDEX idx_commande_extrafields; ALTER TABLE llx_commande_extrafields ADD UNIQUE INDEX uk_commande_extrafields (fk_object); -ALTER TABLE llx_commande_fournisseur_dispatch_extrafields DROP INDEX idx_commande_fournisseur_dispatch_extrafields; -ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD UNIQUE INDEX uk_commande_fournisseur_dispatch_extrafields (fk_object); ALTER TABLE llx_commande_fournisseur_extrafields DROP INDEX idx_commande_fournisseur_extrafields; ALTER TABLE llx_commande_fournisseur_extrafields ADD UNIQUE INDEX uk_commande_fournisseur_extrafields (fk_object); ALTER TABLE llx_commande_fournisseurdet_extrafields DROP INDEX idx_commande_fournisseurdet_extrafields; @@ -229,11 +227,14 @@ ALTER TABLE llx_product ADD COLUMN last_main_doc varchar(255); ALTER TABLE llx_knowledgemanagement_knowledgerecord MODIFY COLUMN answer longtext; +ALTER TABLE llx_commande_fournisseur_dispatch_extrafields RENAME TO llx_receptiondet_batch_extrafields; +ALTER TABLE llx_commande_fournisseur_dispatch RENAME TO llx_receptiondet_batch; + -- Rename const to add customer categories on not customer/prospect third-party if enabled UPDATE llx_const SET name = 'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT' WHERE name = 'THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER'; -ALTER TABLE llx_fichinter ADD COLUMN signed_status integer DEFAULT NULL AFTER duree; -ALTER TABLE llx_contrat ADD COLUMN signed_status integer DEFAULT NULL AFTER date_contrat; +ALTER TABLE llx_fichinter ADD COLUMN signed_status smallint DEFAULT NULL AFTER duree; +ALTER TABLE llx_contrat ADD COLUMN signed_status smallint DEFAULT NULL AFTER date_contrat; ALTER TABLE llx_mailing ADD COLUMN messtype varchar(16) DEFAULT 'email' after rowid; @@ -241,6 +242,7 @@ ALTER TABLE llx_ticket ADD COLUMN model_pdf varchar(255); ALTER TABLE llx_ticket ADD COLUMN last_main_doc varchar(255); ALTER TABLE llx_ticket ADD COLUMN extraparams varchar(255); ALTER TABLE llx_ticket ADD COLUMN origin_replyto varchar(128); +ALTER TABLE llx_ticket ADD COLUMN origin_references text DEFAULT NULL; ALTER TABLE llx_expensereport MODIFY COLUMN model_pdf varchar(255) DEFAULT NULL; ALTER TABLE llx_fichinter_rec MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; @@ -270,3 +272,17 @@ ALTER TABLE llx_element_element MODIFY COLUMN targettype VARCHAR(64) NOT NULL; ALTER TABLE llx_c_type_contact MODIFY COLUMN element VARCHAR(64) NOT NULL; ALTER TABLE llx_product_association ADD COLUMN import_key varchar(14) DEFAULT NULL; + +ALTER TABLE llx_ticket ADD COLUMN barcode varchar(255) DEFAULT NULL after extraparams; +ALTER TABLE llx_ticket ADD COLUMN fk_barcode_type integer DEFAULT NULL after barcode; + +ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_ticket_barcode_barcode_type (barcode, fk_barcode_type, entity); +ALTER TABLE llx_ticket ADD CONSTRAINT llx_ticket_fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); + +ALTER TABLE llx_societe ADD COLUMN fk_parent integer NULL; + +ALTER TABLE llx_expeditiondet ADD COLUMN fk_element integer; +ALTER TABLE llx_expeditiondet ADD COLUMN element_type varchar(50) DEFAULT 'order' NOT NULL; + +ALTER TABLE llx_receptiondet_batch CHANGE COLUMN fk_commande fk_element integer; +ALTER TABLE llx_receptiondet_batch CHANGE COLUMN fk_commandefourndet fk_elementdet integer; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 6b48ef5ac16..2c0e43dc3fe 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -1,10 +1,10 @@ -- -- Script to repair some fatal errors due to database corruption --- when current version is 2.6.0 or higher. +-- when current version is 2.6.0 or higher. -- --- Replace xxx with your IP Address +-- Replace xxx with your IP Address -- bind-address = xxx.xxx.xxx.xxx -- CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass'; -- CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass'; @@ -65,10 +65,10 @@ -- VMYSQL4.1 INSERT IGNORE INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid; -- -- a tester VPGSQL9.5 INSERT IGNORE INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid ON CONFLICT DO NOTHING; -- -- avant 9.5 faire en variant x pour qu'au 2eme passage, le premier doublon soit dans la tabel cible --- -- INSERT INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) --- -- SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author +-- -- INSERT INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) +-- -- SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author -- -- from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e --- -- WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid +-- -- WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid -- -- AND NOT EXISTS (SELECT 1 FROM llx_product_lot as b WHERE b.fk_product=ps.fk_product and pb.batch=b.batch) LIMIT x @@ -145,13 +145,13 @@ update llx_product_batch set batch = '' where batch = 'Non défini'; update llx_stock_mouvement set batch = null where batch = 'Non défini'; update llx_stock_mouvement set batch = null where batch = 'Non défini'; -DELETE FROM llx_product_lot WHERE fk_product NOT IN (select rowid from llx_product); -DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product); +DELETE FROM llx_product_lot WHERE fk_product NOT IN (select rowid from llx_product); +DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product); DELETE FROM llx_product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM llx_product_batch as pb); --- Merge splitted lines into one in table llx_product_batch +-- Merge splitted lines into one in table llx_product_batch DROP TABLE tmp_llx_product_batch; DROP TABLE tmp_llx_product_batch2; CREATE TABLE tmp_llx_product_batch AS select fk_product_stock, eatby, sellby, batch, SUM(qty) as qty, COUNT(rowid) as nb FROM llx_product_batch GROUP BY fk_product_stock, eatby, sellby, batch HAVING COUNT(rowid) > 1; @@ -175,7 +175,7 @@ delete from llx_product_association where fk_product_fils NOT IN (select rowid f -- Fix: delete category child with no category parent. drop table tmp_categorie; -create table tmp_categorie as select * from llx_categorie; +create table tmp_categorie as select * from llx_categorie; -- select * from llx_categorie where fk_parent not in (select rowid from tmp_categorie) and fk_parent is not null and fk_parent <> 0; delete from llx_categorie where fk_parent not in (select rowid from tmp_categorie) and fk_parent is not null and fk_parent <> 0; drop table tmp_categorie; @@ -397,7 +397,7 @@ update llx_facturedet set product_type = 1 where product_type = 2; update llx_propal set fk_statut = 1 where fk_statut = -1; -delete from llx_commande_fournisseur_dispatch where fk_commandefourndet = 0 or fk_commandefourndet IS NULL; +delete from llx_receptiondet_batch where fk_elementdet = 0 or fk_elementdet IS NULL; delete from llx_menu where menu_handler = 'smartphone'; @@ -408,7 +408,7 @@ update llx_expedition set date_valid = NOW() where fk_statut = 1 and date_valid -- Detect bad consistency between duraction_effective of a task and sum of time of tasks -- select pt.rowid, pt.duration_effective, SUM(ptt.element_duration) as y from llx_projet_task as pt, llx_element_time as ptt where ptt.fk_element = pt.rowid and ptt.elementtype = 'task' group by pt.rowid, pt.duration_effective having pt.duration_effective <> y; update llx_projet_task as pt set pt.duration_effective = (select SUM(ptt.element_duration) as y from llx_element_time as ptt where ptt.fk_element = pt.rowid and ptt.elementtype = 'task') where pt.duration_effective <> (select SUM(ptt.element_duration) as y from llx_element_time as ptt where ptt.fk_element = pt.rowid and ptt.elementtype = 'task'); - + -- Remove duplicate of shipment mode (keep the one with tracking defined) drop table tmp_c_shipment_mode; @@ -443,9 +443,9 @@ UPDATE llx_expensereport_det SET fk_code_ventilation = 0 WHERE fk_code_ventilati -- Clean product prices ---delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05'; +--delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05'; -- Set product prices into llx_product with last price into llx_product_prices ---update llx_product as p set +--update llx_product as p set -- p.price = (select pp.price from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), -- p.price_ttc = (select pp.price_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), -- p.price_min = (select pp.price_min from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), @@ -503,7 +503,7 @@ UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL; --ALTER TABLE llx_table modify column columnname datetime DEFAULT CURRENT_TIMESTAMP; --- Backport a change of value into the hourly rate. +-- Backport a change of value into the hourly rate. -- update llx_element_time as ptt set ptt.thm = (SELECT thm from llx_user as u where ptt.fk_user = u.rowid) where (ptt.thm is null) @@ -513,14 +513,14 @@ update llx_facturedet set product_type = 1 where product_type = 0 AND fk_product update llx_facture_fourn_det set product_type = 0 where product_type = 1 AND fk_product > 0 AND fk_product IN (SELECT rowid FROM llx_product WHERE fk_product_type = 0); update llx_facture_fourn_det set product_type = 1 where product_type = 0 AND fk_product > 0 AND fk_product IN (SELECT rowid FROM llx_product WHERE fk_product_type = 1); - + DELETE FROM llx_mrp_production where qty = 0; UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS NULL; - + -- UPDATE llx_contratdet set label = NULL WHERE label IS NOT NULL; -- UPDATE llx_facturedet_rec set label = NULL WHERE label IS NOT NULL; @@ -528,21 +528,21 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS --Fix bad sign on multicompany column for customer invoice lines UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0)); UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0)); -UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0)); -UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0)); +UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0)); +UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0)); --Fix bad sign on multicompany column for customer invoices -UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0)); -UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0)); -UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0)); +UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0)); +UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0)); +UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0)); --Fix bad sign on multicurrency column for supplier invoice lines UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0)); UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0)); -UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0)); -UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0)); +UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0)); +UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0)); --Fix bad sign on multicompany column for customer invoices -UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0)); -UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0)); -UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0)); +UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0)); +UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0)); +UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0)); UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL; @@ -558,7 +558,7 @@ UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NUL --update llx_facture set paye = 1, fk_statut = 2 where rowid in (select rowid from tmp_invoice_deposit_mark_as_available); --- TODO We should fix multicurrency_amount that are empty into llx_societe_remise_except, but we can't because we don't know what is the rate +-- TODO We should fix multicurrency_amount that are empty into llx_societe_remise_except, but we can't because we don't know what is the rate -- We may retreive info fro minvoice line by using fk_facture_line or fk_facture_supplier_line -- select * from llx_societe_remise_except where multicurrency_amount_ht = 0 and amount_ht <> 0; @@ -586,7 +586,7 @@ DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee'; -- Sequence to fix the content of llx_bank.amount_main_currency (value was empty and should not for payment on bank account with a different currency so when amount_main_currency is different than amount) -- Note: amount is amount in the currency of the bank account -- Note: pamount is always amount into the main currency --- Note: pmulticurrencyamount is in the currency of invoice +-- Note: pmulticurrencyamount is in the currency of invoice -- Note: amount_main_currency must be NULL or amount in main currency of company (we set it when the currency of the bank account differs from main currency) -- DROP TABLE tmp_bank; -- CREATE TABLE tmp_bank SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount, b.datec FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment' INNER JOIN llx_paiement as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount; diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index 2e01e909127..53c97061102 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -29,7 +29,7 @@ create table llx_contrat tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- creation date date_contrat datetime, - signed_status integer DEFAULT NULL, -- signed status + signed_status smallint DEFAULT NULL, -- signed status statut smallint DEFAULT 0, -- not used. deprecated fin_validite datetime, date_cloture datetime, diff --git a/htdocs/install/mysql/tables/llx_expeditiondet.sql b/htdocs/install/mysql/tables/llx_expeditiondet.sql index cccee9e5747..ca52ae7a912 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet.sql @@ -15,16 +15,18 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . --- --- doe not contains the batch -- =================================================================== +-- Note: does not contains the product and batch, the table on supplier side llx_receptiondet_batch does. + create table llx_expeditiondet ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_expedition integer NOT NULL, - fk_origin_line integer, -- Correspondance de la ligne avec le document d'origine (propal, commande) - fk_entrepot integer, -- Entrepot de depart du produit - qty real, -- Quantity + fk_expedition integer NOT NULL, -- ID of parent object + fk_element integer, -- ID of main source object + fk_origin_line integer, -- ID of line of source object (proposal, sale order). TODO should be renamed into fk_elementdet in SQL files and code in same PR + element_type varchar(50) DEFAULT 'order' NOT NULL, -- Type of source object ('order', ...) + qty real, -- Quantity + fk_entrepot integer, -- Warehouse for departure of product rang integer DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql index a8111e67cb9..3efd29dbc53 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql @@ -14,7 +14,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- Similar for supplier with llx_commande_fournisseur_dispatch=llx_receptiondet_batch +-- Similar for supplier with llx_receptiondet_batch -- ============================================================================ CREATE TABLE llx_expeditiondet_batch ( diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 4065f3c64b8..5832ce07e9f 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -39,7 +39,7 @@ create table llx_fichinter datee date, -- date de fin d'intervention datet date, -- date de terminaison de l'intervention duree real, -- duree totale de l'intervention - signed_status integer DEFAULT NULL, -- signed status + signed_status smallint DEFAULT NULL, -- signed status description text, note_private text, note_public text, diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.key.sql b/htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql similarity index 57% rename from htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.key.sql rename to htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql index 98cb3db837f..4470247061b 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.key.sql +++ b/htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql @@ -16,8 +16,8 @@ -- -- =================================================================== -ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_commande (fk_commande); -ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_reception (fk_reception); -ALTER TABLE llx_commande_fournisseur_dispatch ADD CONSTRAINT fk_commande_fournisseur_dispatch_fk_reception FOREIGN KEY (fk_reception) REFERENCES llx_reception (rowid); -ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_product (fk_product); -ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_commandefourndet (fk_commandefourndet); +ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_commande (fk_commande); +ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_reception (fk_reception); +ALTER TABLE llx_receptiondet_batch ADD CONSTRAINT fk_receptiondet_batch_fk_reception FOREIGN KEY (fk_reception) REFERENCES llx_reception (rowid); +ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_product (fk_product); +ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_elementdet (fk_elementdet); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_receptiondet_batch.sql similarity index 79% rename from htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql rename to htdocs/install/mysql/tables/llx_receptiondet_batch.sql index 6bbaea61c45..e8b414510d1 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_receptiondet_batch.sql @@ -14,27 +14,27 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- This table is just an history table to track all receiption to do or done for a +-- This table is just an history table to track all receiption to do or done for a -- particular supplier order. A movement with same information is also done -- into stock_movement so this table may be useless. --- +-- -- Detail of each lines of a reception (qty, batch and into which warehouse must be -- received or has been receveived a purchase order line). -- -- This table should be renamed into llx_receptiondet_batch -- =================================================================== -create table llx_commande_fournisseur_dispatch +create table llx_receptiondet_batch ( rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_reception integer DEFAULT NULL, -- ID of parent object + fk_element integer, -- ID of main source object. TODO should be renamed into fk_element + fk_elementdet integer, -- ID of line of main source object. TODO should be renamed into fk_elementdet + element_type varchar(50) DEFAULT 'supplier_order' NOT NULL, -- Type of source object ('supplier_order', ...) fk_product integer, - fk_commande integer, -- should be renamed into fk_element - fk_commandefourndet integer, -- should be renamed into fk_elementdet - element_type varchar(50) DEFAULT 'supplier_order' NOT NULL, -- Type of source ('supplier_order', ...) - fk_projet integer DEFAULT NULL, - fk_reception integer DEFAULT NULL, qty float, -- qty to move fk_entrepot integer, -- ID of warehouse to use for the stock change + fk_projet integer DEFAULT NULL, comment varchar(255), -- comment on movement batch varchar(128) DEFAULT NULL, -- serial/lot number eatby date DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.key.sql b/htdocs/install/mysql/tables/llx_receptiondet_batch_extrafields.key.sql similarity index 86% rename from htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.key.sql rename to htdocs/install/mysql/tables/llx_receptiondet_batch_extrafields.key.sql index 09b50db8e3a..319720dd1a0 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.key.sql +++ b/htdocs/install/mysql/tables/llx_receptiondet_batch_extrafields.key.sql @@ -17,4 +17,4 @@ -- =================================================================== -ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD UNIQUE INDEX uk_commande_fournisseur_dispatch_extrafields (fk_object); +ALTER TABLE llx_receptiondet_batch_extrafields ADD UNIQUE INDEX uk_receptiondet_batch_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql b/htdocs/install/mysql/tables/llx_receptiondet_batch_extrafields.sql similarity index 95% rename from htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql rename to htdocs/install/mysql/tables/llx_receptiondet_batch_extrafields.sql index d8720358cec..20ab19b4dc1 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_receptiondet_batch_extrafields.sql @@ -17,7 +17,7 @@ -- This table should have been named llx_receptiondet_batch_extrafields -- =================================================================== -create table llx_commande_fournisseur_dispatch_extrafields +create table llx_receptiondet_batch_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql index 4e28d8df270..93b99e79d03 100644 --- a/htdocs/install/mysql/tables/llx_socpeople.sql +++ b/htdocs/install/mysql/tables/llx_socpeople.sql @@ -27,7 +27,9 @@ create table llx_socpeople fk_soc integer, -- lien vers la societe entity integer DEFAULT 1 NOT NULL, -- multi company id ref_ext varchar(255), -- reference into an external system (not used by dolibarr) - name_alias varchar(255), + name_alias varchar(255), + fk_parent integer NULL, + civility varchar(6), lastname varchar(50), firstname varchar(50), diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql index 858f7c7eec5..e7bd5174263 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql @@ -22,7 +22,10 @@ ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_user_assign (fk_user_assign); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_project (fk_project); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_statut (fk_statut); +ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_ticket_barcode_barcode_type (barcode, fk_barcode_type, entity); +ALTER TABLE llx_ticket ADD CONSTRAINT llx_ticket_fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); + -- Idea for better perf to get last num of ticket on large databases ---ALTER TABLE llx_ticket ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'TS' THEN CAST(SUBSTRING(ref FROM 8) AS SIGNED) ELSE 0 END) PERSISTENT; ---ALTER TABLE llx_ticket ADD INDEX idx_calculated_numrefonly (calculated_numrefonly); ---Then, the numering module can use the column calculated_numrefonly to get the max with SELECT MAX(calculated_numrefonly) FROM llx_ticket +-- ALTER TABLE llx_ticket ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'TS' THEN CAST(SUBSTRING(ref FROM 8) AS SIGNED) ELSE 0 END) PERSISTENT; +-- ALTER TABLE llx_ticket ADD INDEX idx_calculated_numrefonly (calculated_numrefonly); +-- Then, the numering module can use the column calculated_numrefonly to get the max with SELECT MAX(calculated_numrefonly) FROM llx_ticket diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql index 67e7ca419dd..7614bcc1ad7 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.sql @@ -26,6 +26,7 @@ CREATE TABLE llx_ticket fk_contract integer DEFAULT 0, origin_email varchar(128), origin_replyto varchar(128), + origin_references text, fk_user_create integer, fk_user_assign integer, subject varchar(255), @@ -49,5 +50,7 @@ CREATE TABLE llx_ticket model_pdf varchar(255), last_main_doc varchar(255), -- relative filepath+filename of last main generated document extraparams varchar(255), -- to save other parameters with json format + barcode varchar(255) DEFAULT NULL, -- barcode + fk_barcode_type integer DEFAULT NULL, -- barcode type import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index dacec28bd89..327fec5d17c 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -89,7 +89,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_chargesociales FOR E CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseur FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseur_dispatch FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_receptiondet_batch FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseur_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseur_log FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseurdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -159,6 +159,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal FOR EACH ROW CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal_merge_pdf_product FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propaldet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_receptiondet_batch FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_resource FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index e6dbe7cdc26..d9c5a808bb5 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2021 Frédéric France * Copyright (C) 2023 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -234,15 +235,15 @@ if ($ok && GETPOST('standard', 'alpha')) { $extrafields = new ExtraFields($db); // List of tables that has an extrafield table - $listofmodulesextra = array('societe'=>'societe', 'adherent'=>'adherent', 'product'=>'product', - 'socpeople'=>'socpeople', 'propal'=>'propal', 'commande'=>'commande', - 'facture'=>'facture', 'facturedet'=>'facturedet', 'facture_rec'=>'facture_rec', 'facturedet_rec'=>'facturedet_rec', - 'supplier_proposal'=>'supplier_proposal', 'commande_fournisseur'=>'commande_fournisseur', - 'facture_fourn'=>'facture_fourn', 'facture_fourn_rec'=>'facture_fourn_rec', 'facture_fourn_det'=>'facture_fourn_det', 'facture_fourn_det_rec'=>'facture_fourn_det_rec', - 'fichinter'=>'fichinter', 'fichinterdet'=>'fichinterdet', - 'inventory'=>'inventory', - 'actioncomm'=>'actioncomm', 'bom_bom'=>'bom_bom', 'mrp_mo'=>'mrp_mo', - 'adherent_type'=>'adherent_type', 'user'=>'user', 'partnership'=>'partnership', 'projet'=>'projet', 'projet_task'=>'projet_task', 'ticket'=>'ticket'); + $listofmodulesextra = array('societe' => 'societe', 'adherent' => 'adherent', 'product' => 'product', + 'socpeople' => 'socpeople', 'propal' => 'propal', 'commande' => 'commande', + 'facture' => 'facture', 'facturedet' => 'facturedet', 'facture_rec' => 'facture_rec', 'facturedet_rec' => 'facturedet_rec', + 'supplier_proposal' => 'supplier_proposal', 'commande_fournisseur' => 'commande_fournisseur', + 'facture_fourn' => 'facture_fourn', 'facture_fourn_rec' => 'facture_fourn_rec', 'facture_fourn_det' => 'facture_fourn_det', 'facture_fourn_det_rec' => 'facture_fourn_det_rec', + 'fichinter' => 'fichinter', 'fichinterdet' => 'fichinterdet', + 'inventory' => 'inventory', + 'actioncomm' => 'actioncomm', 'bom_bom' => 'bom_bom', 'mrp_mo' => 'mrp_mo', + 'adherent_type' => 'adherent_type', 'user' => 'user', 'partnership' => 'partnership', 'projet' => 'projet', 'projet_task' => 'projet_task', 'ticket' => 'ticket'); //$listofmodulesextra = array('fichinter'=>'fichinter'); print '
    '; @@ -275,7 +276,7 @@ if ($ok && GETPOST('standard', 'alpha')) { if (in_array($fieldname, array('rowid', 'tms', 'fk_object', 'import_key'))) { continue; } - $arrayoffieldsfound[$fieldname] = array('type'=>$fieldtype); + $arrayoffieldsfound[$fieldname] = array('type' => $fieldtype); } print ' - Found '.count($arrayoffieldsfound).' fields into table'; if (count($arrayoffieldsfound) > 0) { @@ -318,12 +319,12 @@ if ($ok && GETPOST('standard', 'alpha')) { } $field_desc = array( - 'type'=>$typedb, - 'value'=>$lengthdb, - 'attribute'=>$attribute, - 'default'=>$default, - 'extra'=>$extra, - 'null'=>$null + 'type' => $typedb, + 'value' => $lengthdb, + 'attribute' => $attribute, + 'default' => $default, + 'extra' => $extra, + 'null' => $null ); //var_dump($field_desc);exit; @@ -510,7 +511,7 @@ if ($ok && GETPOST('restore_thirdparties_logos')) { if (!empty($name)) { $filetotest = $dolibarr_main_data_root.'/societe/logos/'.$name.$ext; $filetotestsmall = $dolibarr_main_data_root.'/societe/logos/thumbs/'.$name.'_small'.$ext; - $exists = dol_is_file($filetotest); + $exists = (int) dol_is_file($filetotest); print 'Check thirdparty '.$obj->rowid.' name='.$obj->name.' logo='.$obj->logo.' file '.$filetotest." exists=".$exists."
    \n"; if ($exists) { $filetarget = $dolibarr_main_data_root.'/societe/'.$obj->rowid.'/logos/'.$name.$ext; @@ -585,7 +586,7 @@ if ($ok && GETPOST('restore_user_pictures', 'alpha')) { $filetotest = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/'.$name.$ext; $filetotestsmall = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_small'.$ext; $filetotestmini = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_mini'.$ext; - $exists = dol_is_file($filetotest); + $exists = (int) dol_is_file($filetotest); print 'Check user '.$obj->rowid.' lastname='.$obj->lastname.' firstname='.$obj->firstname.' photo='.$obj->photo.' file '.$filetotest." exists=".$exists."
    \n"; if ($exists) { $filetarget = $dolibarr_main_data_root.'/users/'.$obj->rowid.'/'.$name.$ext; @@ -1484,10 +1485,10 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { $repair_link_dispatch_lines_supplier_order_lines = GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha'); - echo '
    '; + echo ''; echo ''; - $sql_dispatch = 'SELECT * FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0'; + $sql_dispatch = 'SELECT * FROM '.MAIN_DB_PREFIX.'receptiondet_batch WHERE COALESCE(fk_elementdet, 0) = 0'; $db->begin(); $resql_dispatch = $db->query($sql_dispatch); $n_processed_rows = 0; @@ -1527,21 +1528,21 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { } $qty_for_line = min($remaining_qty, $obj_line->qty); if ($first_iteration) { - $sql_attach = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; - $sql_attach .= ' SET fk_commandefourndet = '.((int) $obj_line->rowid).', qty = '.((float) $qty_for_line); + $sql_attach = 'UPDATE '.MAIN_DB_PREFIX.'receptiondet_batch'; + $sql_attach .= ' SET fk_elementdet = '.((int) $obj_line->rowid).', qty = '.((float) $qty_for_line); $sql_attach .= ' WHERE rowid = '.((int) $obj_dispatch->rowid); $first_iteration = false; } else { $sql_attach_values = array( - ((int) $obj_dispatch->fk_commande), - ((int) $obj_dispatch->fk_product), - ((int) $obj_line->rowid), - ((float) $qty_for_line), - ((int) $obj_dispatch->fk_entrepot), - ((int) $obj_dispatch->fk_user), + (string) ((int) $obj_dispatch->fk_element), + (string) ((int) $obj_dispatch->fk_product), + (string) ((int) $obj_line->rowid), + (string) ((float) $qty_for_line), + (string) ((int) $obj_dispatch->fk_entrepot), + (string) ((int) $obj_dispatch->fk_user), $obj_dispatch->datec ? "'".$db->idate($db->jdate($obj_dispatch->datec))."'" : 'NULL', $obj_dispatch->comment ? "'".$db->escape($obj_dispatch->comment)."'" : 'NULL', - $obj_dispatch->status ? ((int) $obj_dispatch->status) : 'NULL', + $obj_dispatch->status ? (string) ((int) $obj_dispatch->status) : 'NULL', $obj_dispatch->tms ? "'".$db->idate($db->jdate($obj_dispatch->tms))."'" : 'NULL', $obj_dispatch->batch ? "'".$db->escape($obj_dispatch->batch)."'" : 'NULL', $obj_dispatch->eatby ? "'".$db->escape($obj_dispatch->eatby)."'" : 'NULL', @@ -1549,9 +1550,9 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { ); $sql_attach_values = implode(', ', $sql_attach_values); - $sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; - $sql_attach .= ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)'; - $sql_attach .= " VALUES (".$sql_attach_values.")"; + $sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'receptiondet_batch'; + $sql_attach .= ' (fk_element, fk_product, fk_elementdet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)'; + $sql_attach .= " VALUES (".$sql_attach_values.")"; // The string is already sanitized } if ($repair_link_dispatch_lines_supplier_order_lines == 'confirmed') { diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 85e77bbbd79..fc444534b95 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -264,8 +264,7 @@ if (!$error) { $db = getDoliDBInstance($db_type, $db_host, $userroot, $passroot, $databasefortest, (int) $db_port); - dol_syslog("databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected, LOG_DEBUG); - //print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected; + dol_syslog("databasefortest=".$databasefortest." connected=".json_encode($db->connected)." database_selected=".json_encode($db->database_selected), LOG_DEBUG); if (empty($db_create_database) && $db->connected && !$db->database_selected) { print '
    '.$langs->trans("ErrorConnectedButDatabaseNotFound", $db_name).'
    '; @@ -860,7 +859,7 @@ function write_conf_file($conffile) $error = 0; - $key = md5(uniqid(mt_rand(), true)); // Generate random hash + $key = md5(uniqid((string) mt_rand(), true)); // Generate random hash $fp = fopen("$conffile", "w"); if ($fp) { diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 99170d4c9c6..cb18b8a4c91 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2015 Cedric GROSS * Copyright (C) 2015-2016 Raphaël Doursenaud + * 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 @@ -90,6 +91,7 @@ if (@file_exists($forcedfile)) { dolibarr_install_syslog("--- step2: entering step2.php page"); +'@phan-var-force string $dolibarr_main_db_prefix'; // From configuraiotn file or install/inc.php /* * View @@ -171,7 +173,7 @@ if ($action == "set") { $ok = 0; $handle = opendir($dir); - dolibarr_install_syslog("step2: open tables directory ".$dir." handle=".$handle); + dolibarr_install_syslog("step2: open tables directory ".$dir." handle=".(is_bool($handle) ? json_encode($handle) : $handle)); $tablefound = 0; $tabledata = array(); if (is_resource($handle)) { @@ -269,7 +271,7 @@ if ($action == "set") { $okkeys = 0; $handle = opendir($dir); - dolibarr_install_syslog("step2: open keys directory ".$dir." handle=".$handle); + dolibarr_install_syslog("step2: open keys directory ".$dir." handle=".(is_bool($handle) ? json_encode($handle) : $handle)); $tablefound = 0; $tabledata = array(); if (is_resource($handle)) { @@ -400,7 +402,7 @@ if ($action == "set") { $file = "functions.sql"; if (file_exists($dir.$file)) { $fp = fopen($dir.$file, "r"); - dolibarr_install_syslog("step2: open function file ".$dir.$file." handle=".$fp); + dolibarr_install_syslog("step2: open function file ".$dir.$file." handle=".(is_bool($fp) ? json_encode($fp) : $fp)); if ($fp) { $buffer = ''; while (!feof($fp)) { @@ -467,7 +469,7 @@ if ($action == "set") { // Insert data $handle = opendir($dir); - dolibarr_install_syslog("step2: open directory data ".$dir." handle=".$handle); + dolibarr_install_syslog("step2: open directory data ".$dir." handle=".(is_bool($handle) ? json_encode($handle) : $handle)); $tablefound = 0; $tabledata = array(); if (is_resource($handle)) { @@ -492,7 +494,7 @@ if ($action == "set") { foreach ($tabledata as $file) { $name = substr($file, 0, dol_strlen($file) - 4); $fp = fopen($dir.$file, "r"); - dolibarr_install_syslog("step2: open data file ".$dir.$file." handle=".$fp); + dolibarr_install_syslog("step2: open data file ".$dir.$file." handle=".(is_bool($fp) ? json_encode($fp) : $fp)); if ($fp) { $arrayofrequests = array(); $linefound = 0; diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 7f2dfc0f0cd..d80205028c8 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2015-2016 Raphaël Doursenaud + * 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 @@ -417,7 +418,8 @@ if (!$ok && isset($argv[1])) { } dolibarr_install_syslog("Exit ".$ret); -dolibarr_install_syslog("--- upgrade: end ".((!$ok && empty($_GET["ignoreerrors"])) || $dirmodule)); +dolibarr_install_syslog("--- upgrade: end ".((int) (!$ok && empty($_GET["ignoreerrors"])))." dirmodule=".$dirmodule); + $nonext = (!$ok && empty($_GET["ignoreerrors"])) ? 2 : 0; if ($dirmodule) { $nonext = 1; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 931d2f5e44e..d4daa58f943 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -5,6 +5,7 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015-2016 Raphaël Doursenaud * Copyright (C) 2023 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -515,41 +516,41 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ if (versioncompare($versiontoarray, $versionranarray) >= 0 || versioncompare($versiontoarray, $versionranarray) <= -3) { // Reload modules (this must be always done and only into last targeted version, because code to reload module may need table structure of last version) $listofmodule = array( - 'MAIN_MODULE_ACCOUNTING'=>'newboxdefonly', - 'MAIN_MODULE_AGENDA'=>'newboxdefonly', - 'MAIN_MODULE_BOM'=>'menuonly', - 'MAIN_MODULE_BANQUE'=>'menuonly', - 'MAIN_MODULE_BARCODE'=>'newboxdefonly', - 'MAIN_MODULE_CRON'=>'newboxdefonly', - 'MAIN_MODULE_COMMANDE'=>'newboxdefonly', - 'MAIN_MODULE_BLOCKEDLOG'=>'noboxes', - 'MAIN_MODULE_DEPLACEMENT'=>'newboxdefonly', - 'MAIN_MODULE_DON'=>'newboxdefonly', - 'MAIN_MODULE_ECM'=>'newboxdefonly', - 'MAIN_MODULE_EXTERNALSITE'=>'newboxdefonly', - 'MAIN_MODULE_EXPENSEREPORT'=>'newboxdefonly', - 'MAIN_MODULE_FACTURE'=>'newboxdefonly', - 'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly', - 'MAIN_MODULE_FICHEINTER'=>'newboxdefonly', - 'MAIN_MODULE_HOLIDAY'=>'newboxdefonly', - 'MAIN_MODULE_MARGIN'=>'menuonly', - 'MAIN_MODULE_MRP'=>'menuonly', - 'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly', - 'MAIN_MODULE_PAYBOX'=>'newboxdefonly', - 'MAIN_MODULE_PRINTING'=>'newboxdefonly', - 'MAIN_MODULE_PRODUIT'=>'newboxdefonly', - 'MAIN_MODULE_RECRUITMENT'=>'menuonly', - 'MAIN_MODULE_RESOURCE'=>'noboxes', - 'MAIN_MODULE_SALARIES'=>'newboxdefonly', - 'MAIN_MODULE_SERVICE'=>'newboxdefonly', - 'MAIN_MODULE_SYSLOG'=>'newboxdefonly', - 'MAIN_MODULE_SOCIETE'=>'newboxdefonly', - 'MAIN_MODULE_STRIPE'=>'menuonly', - 'MAIN_MODULE_TICKET'=>'newboxdefonly', - 'MAIN_MODULE_TAKEPOS'=>'newboxdefonly', - 'MAIN_MODULE_USER'=>'newboxdefonly', //This one must be always done and only into last targeted version) - 'MAIN_MODULE_VARIANTS'=>'newboxdefonly', - 'MAIN_MODULE_WEBSITE'=>'newboxdefonly', + 'MAIN_MODULE_ACCOUNTING' => 'newboxdefonly', + 'MAIN_MODULE_AGENDA' => 'newboxdefonly', + 'MAIN_MODULE_BOM' => 'menuonly', + 'MAIN_MODULE_BANQUE' => 'menuonly', + 'MAIN_MODULE_BARCODE' => 'newboxdefonly', + 'MAIN_MODULE_CRON' => 'newboxdefonly', + 'MAIN_MODULE_COMMANDE' => 'newboxdefonly', + 'MAIN_MODULE_BLOCKEDLOG' => 'noboxes', + 'MAIN_MODULE_DEPLACEMENT' => 'newboxdefonly', + 'MAIN_MODULE_DON' => 'newboxdefonly', + 'MAIN_MODULE_ECM' => 'newboxdefonly', + 'MAIN_MODULE_EXTERNALSITE' => 'newboxdefonly', + 'MAIN_MODULE_EXPENSEREPORT' => 'newboxdefonly', + 'MAIN_MODULE_FACTURE' => 'newboxdefonly', + 'MAIN_MODULE_FOURNISSEUR' => 'newboxdefonly', + 'MAIN_MODULE_FICHEINTER' => 'newboxdefonly', + 'MAIN_MODULE_HOLIDAY' => 'newboxdefonly', + 'MAIN_MODULE_MARGIN' => 'menuonly', + 'MAIN_MODULE_MRP' => 'menuonly', + 'MAIN_MODULE_OPENSURVEY' => 'newboxdefonly', + 'MAIN_MODULE_PAYBOX' => 'newboxdefonly', + 'MAIN_MODULE_PRINTING' => 'newboxdefonly', + 'MAIN_MODULE_PRODUIT' => 'newboxdefonly', + 'MAIN_MODULE_RECRUITMENT' => 'menuonly', + 'MAIN_MODULE_RESOURCE' => 'noboxes', + 'MAIN_MODULE_SALARIES' => 'newboxdefonly', + 'MAIN_MODULE_SERVICE' => 'newboxdefonly', + 'MAIN_MODULE_SYSLOG' => 'newboxdefonly', + 'MAIN_MODULE_SOCIETE' => 'newboxdefonly', + 'MAIN_MODULE_STRIPE' => 'menuonly', + 'MAIN_MODULE_TICKET' => 'newboxdefonly', + 'MAIN_MODULE_TAKEPOS' => 'newboxdefonly', + 'MAIN_MODULE_USER' => 'newboxdefonly', //This one must be always done and only into last targeted version) + 'MAIN_MODULE_VARIANTS' => 'newboxdefonly', + 'MAIN_MODULE_WEBSITE' => 'newboxdefonly', ); $result = migrate_reload_modules($db, $langs, $conf, $listofmodule); @@ -583,7 +584,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ // Can call a dedicated external upgrade process with hook doUpgradeAfterDB() if (!$error) { - $parameters = array('versionfrom' => $versionfrom, 'versionto' => $versionto, 'conf'=>$conf); + $parameters = array('versionfrom' => $versionfrom, 'versionto' => $versionto, 'conf' => $conf); $object = new stdClass(); $action = "upgrade"; $reshook = $hookmanager->executeHooks('doUpgradeAfterDB', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -655,7 +656,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ migrate_rename_directories($db, $langs, $conf, '/banque/bordereau', '/bank/checkdeposits'); - $parameters = array('versionfrom' => $versionfrom, 'versionto' => $versionto, 'conf'=>$conf); + $parameters = array('versionfrom' => $versionfrom, 'versionto' => $versionto, 'conf' => $conf); $object = new stdClass(); $action = "upgrade"; $reshook = $hookmanager->executeHooks('doUpgradeAfterFiles', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -3386,7 +3387,7 @@ function migrate_clean_association($db, $langs, $conf) if (!isset($children[$obj->fk_categorie_fille])) { // Only one record as child (a child has only on parent). if ($obj->fk_categorie_mere != $obj->fk_categorie_fille) { $children[$obj->fk_categorie_fille] = 1; // Set record for this child - $couples[$obj->fk_categorie_mere.'_'.$obj->fk_categorie_fille] = array('mere'=>$obj->fk_categorie_mere, 'fille'=>$obj->fk_categorie_fille); + $couples[$obj->fk_categorie_mere.'_'.$obj->fk_categorie_fille] = array('mere' => $obj->fk_categorie_mere, 'fille' => $obj->fk_categorie_fille); } } } @@ -4216,33 +4217,33 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".implode(',', array_keys($listofmodule))); $reloadactionformodules = array( - 'MAIN_MODULE_AGENDA' => array('class' => 'modAgenda', 'remove'=> 1), + 'MAIN_MODULE_AGENDA' => array('class' => 'modAgenda', 'remove' => 1), 'MAIN_MODULE_API' => array('class' => 'modApi'), - 'MAIN_MODULE_BARCODE' => array('class' => 'modBarcode', 'remove'=> 1), - 'MAIN_MODULE_BLOCKEDLOG' => array('class' => 'modBlockedLog', 'deleteinsertmenus'=> 1), - 'MAIN_MODULE_CRON' => array('class' => 'modCron', 'remove'=> 1), - 'MAIN_MODULE_EXTERNALSITE' => array('class' => 'modExternalSite', 'remove'=> 1), - 'MAIN_MODULE_SOCIETE' => array('class' => 'modSociete', 'remove'=> 1), + 'MAIN_MODULE_BARCODE' => array('class' => 'modBarcode', 'remove' => 1), + 'MAIN_MODULE_BLOCKEDLOG' => array('class' => 'modBlockedLog', 'deleteinsertmenus' => 1), + 'MAIN_MODULE_CRON' => array('class' => 'modCron', 'remove' => 1), + 'MAIN_MODULE_EXTERNALSITE' => array('class' => 'modExternalSite', 'remove' => 1), + 'MAIN_MODULE_SOCIETE' => array('class' => 'modSociete', 'remove' => 1), 'MAIN_MODULE_PRODUIT' => array('class' => 'modProduct'), 'MAIN_MODULE_SERVICE' => array('class' => 'modService'), 'MAIN_MODULE_COMMANDE' => array('class' => 'modCommande'), 'MAIN_MODULE_FACTURE' => array('class' => 'modFacture'), 'MAIN_MODULE_FICHEINTER' => array('class' => 'modFicheinter'), 'MAIN_MODULE_FOURNISSEUR' => array('class' => 'modFournisseur'), - 'MAIN_MODULE_HOLIDAY' => array('class' => 'modHoliday', 'remove'=>1), + 'MAIN_MODULE_HOLIDAY' => array('class' => 'modHoliday', 'remove' => 1), 'MAIN_MODULE_EXPEDITION' => array('class' => 'modExpedition'), 'MAIN_MODULE_EXPENSEREPORT' => array('class' => 'modExpenseReport'), 'MAIN_MODULE_DON' => array('class' => 'modDon'), - 'MAIN_MODULE_ECM' => array('class' => 'modECM', 'remove'=>1), - 'MAIN_MODULE_KNOWLEDGEMANAGEMENT' => array('class' => 'modKnowledgeManagement', 'remove'=>1), - 'MAIN_MODULE_EVENTORGANIZATION' => array('class' => 'modEventOrganization', 'remove'=>1), - 'MAIN_MODULE_PAYBOX' => array('class' => 'modPaybox', 'remove'=>1), + 'MAIN_MODULE_ECM' => array('class' => 'modECM', 'remove' => 1), + 'MAIN_MODULE_KNOWLEDGEMANAGEMENT' => array('class' => 'modKnowledgeManagement', 'remove' => 1), + 'MAIN_MODULE_EVENTORGANIZATION' => array('class' => 'modEventOrganization', 'remove' => 1), + 'MAIN_MODULE_PAYBOX' => array('class' => 'modPaybox', 'remove' => 1), 'MAIN_MODULE_PROPAL' => array('class' => 'modPropale'), - 'MAIN_MODULE_SUPPLIERPROPOSAL' => array('class' => 'modSupplierProposal', 'remove'=>1), - 'MAIN_MODULE_OPENSURVEY' => array('class' => 'modOpenSurvey', 'remove'=>1), - 'MAIN_MODULE_PRODUCTBATCH' => array('class' => 'modProductBatch', 'remove'=>1), - 'MAIN_MODULE_TAKEPOS' => array('class' => 'modTakePos', 'remove'=>1), - 'MAIN_MODULE_EMAILCOLLECTOR' => array('class' => 'modEmailCollector', 'remove'=>1), + 'MAIN_MODULE_SUPPLIERPROPOSAL' => array('class' => 'modSupplierProposal', 'remove' => 1), + 'MAIN_MODULE_OPENSURVEY' => array('class' => 'modOpenSurvey', 'remove' => 1), + 'MAIN_MODULE_PRODUCTBATCH' => array('class' => 'modProductBatch', 'remove' => 1), + 'MAIN_MODULE_TAKEPOS' => array('class' => 'modTakePos', 'remove' => 1), + 'MAIN_MODULE_EMAILCOLLECTOR' => array('class' => 'modEmailCollector', 'remove' => 1), ); foreach ($listofmodule as $moduletoreload => $reloadmode) { // reloadmodule can be 'noboxes', 'newboxdefonly', 'forceactivate' @@ -4619,7 +4620,7 @@ function migrate_users_socialnetworks() $obj->socialnetworks = '[]'; } $socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true)); - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."user SET socialnetworks='".$db->escape(json_encode($socialnetworks, true))."'"; + $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."user SET socialnetworks='".$db->escape(json_encode($socialnetworks))."'"; $sqlupd .= ', skype=null'; $sqlupd .= ', twitter=null'; $sqlupd .= ', facebook=null'; @@ -4711,7 +4712,7 @@ function migrate_members_socialnetworks() $obj->socialnetworks = '[]'; } $socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true)); - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."adherent SET socialnetworks='".$db->escape(json_encode($socialnetworks, true))."'"; + $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."adherent SET socialnetworks='".$db->escape(json_encode($socialnetworks))."'"; $sqlupd .= ', skype=null'; $sqlupd .= ', twitter=null'; $sqlupd .= ', facebook=null'; @@ -4806,7 +4807,7 @@ function migrate_contacts_socialnetworks() $obj->socialnetworks = '[]'; } $socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true)); - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."socpeople SET socialnetworks='".$db->escape(json_encode($socialnetworks, true))."'"; + $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."socpeople SET socialnetworks='".$db->escape(json_encode($socialnetworks))."'"; $sqlupd .= ', jabberid=null'; $sqlupd .= ', skype=null'; $sqlupd .= ', twitter=null'; @@ -4898,7 +4899,7 @@ function migrate_thirdparties_socialnetworks() $obj->socialnetworks = '[]'; } $socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true)); - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."societe SET socialnetworks='".$db->escape(json_encode($socialnetworks, true))."'"; + $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."societe SET socialnetworks='".$db->escape(json_encode($socialnetworks))."'"; $sqlupd .= ', skype=null'; $sqlupd .= ', twitter=null'; $sqlupd .= ', facebook=null'; @@ -5017,17 +5018,17 @@ function migrate_contractdet_rank() print ''.$langs->trans('MigrationContractLineRank')."
    \n"; $sql = "SELECT c.rowid as cid ,cd.rowid as cdid,cd.rang FROM ".$db->prefix()."contratdet as cd INNER JOIN ".$db->prefix()."contrat as c ON c.rowid=cd.fk_contrat AND cd.rang=0"; - $sql .=" ORDER BY c.rowid,cd.rowid"; + $sql .= " ORDER BY c.rowid,cd.rowid"; $resql = $db->query($sql); if ($resql) { - $currentRank=0; - $current_contract=0; + $currentRank = 0; + $current_contract = 0; while ($obj = $db->fetch_object($resql)) { - if (empty($current_contract) || $current_contract==$obj->cid) { + if (empty($current_contract) || $current_contract == $obj->cid) { $currentRank++; } else { - $currentRank=1; + $currentRank = 1; } $sqlUpd = "UPDATE ".$db->prefix()."contratdet SET rang=".(int) $currentRank." WHERE rowid=".(int) $obj->cdid; diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index 3cbfd839537..1975994353e 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015 ATM Consulting * Copyright (C) 2019-2020 Open-DSI * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,8 +93,8 @@ class IntracommReport extends CommonObject const TYPE_DES = 1; public static $type = array( - 'introduction'=>'Introduction', - 'expedition'=>'Expédition' + 'introduction' => 'Introduction', + 'expedition' => 'Expédition' ); @@ -156,7 +157,7 @@ class IntracommReport extends CommonObject global $conf, $mysoc; /**************Construction de quelques variables********************/ - $party_id = substr(strtr($mysoc->tva_intra, array(' '=>'')), 0, 4).$mysoc->idprof2; + $party_id = substr(strtr($mysoc->tva_intra, array(' ' => '')), 0, 4).$mysoc->idprof2; $declarant = substr($mysoc->managers, 0, 14); $id_declaration = self::getDeclarationNumber($this->numero_declaration); /********************************************************************/ @@ -221,8 +222,8 @@ class IntracommReport extends CommonObject $declaration_des = $e->addChild('declaration_des'); $declaration_des->addChild('num_des', self::getDeclarationNumber($this->numero_declaration)); $declaration_des->addChild('num_tvaFr', $mysoc->tva_intra); // /^FR[a-Z0-9]{2}[0-9]{9}$/ // Doit faire 13 caractères - $declaration_des->addChild('mois_des', $period_month); - $declaration_des->addChild('an_des', $period_year); + $declaration_des->addChild('mois_des', (string) $period_month); + $declaration_des->addChild('an_des', (string) $period_year); // Add invoice lines $res = $this->addItemsFact($declaration_des, $type_declaration, $period_year.'-'.$period_month, 'des'); @@ -349,7 +350,7 @@ class IntracommReport extends CommonObject * Add item for DEB * * @param SimpleXMLElement $declaration Reference declaration - * @param Resource $res Result of request SQL + * @param stdClass $res Result of request SQL * @param int $i Line Id * @param string $code_douane_spe Specific customs authorities code * @return void @@ -357,7 +358,7 @@ class IntracommReport extends CommonObject public function addItemXMl(&$declaration, &$res, $i, $code_douane_spe = '') { $item = $declaration->addChild('Item'); - $item->addChild('itemNumber', $i); + $item->addChild('itemNumber', (string) $i); $cn8 = $item->addChild('CN8'); if (empty($code_douane_spe)) { $code_douane = $res->customcode; @@ -367,17 +368,17 @@ class IntracommReport extends CommonObject $cn8->addChild('CN8Code', $code_douane); $item->addChild('MSConsDestCode', $res->code); // code iso pays client $item->addChild('countryOfOriginCode', substr($res->zip, 0, 2)); // code iso pays d'origine - $item->addChild('netMass', round($res->weight * $res->qty)); // Poids du produit - $item->addChild('quantityInSU', $res->qty); // Quantité de produit dans la ligne - $item->addChild('invoicedAmount', round($res->total_ht)); // Montant total ht de la facture (entier attendu) + $item->addChild('netMass', (string) round($res->weight * $res->qty)); // Poids du produit + $item->addChild('quantityInSU', (string) $res->qty); // Quantité de produit dans la ligne + $item->addChild('invoicedAmount', (string) round($res->total_ht)); // Montant total ht de la facture (entier attendu) // $item->addChild('invoicedNumber', $res->refinvoice); // Numéro facture if (!empty($res->tva_intra)) { $item->addChild('partnerId', $res->tva_intra); } $item->addChild('statisticalProcedureCode', '11'); $nature_of_transaction = $item->addChild('NatureOfTransaction'); - $nature_of_transaction->addChild('natureOfTransactionACode', 1); - $nature_of_transaction->addChild('natureOfTransactionBCode', 1); + $nature_of_transaction->addChild('natureOfTransactionACode', '1'); + $nature_of_transaction->addChild('natureOfTransactionBCode', '1'); $item->addChild('modeOfTransportCode', $res->mode_transport); $item->addChild('regionCode', substr($res->zip, 0, 2)); } @@ -386,15 +387,15 @@ class IntracommReport extends CommonObject * Add item for DES * * @param SimpleXMLElement $declaration Reference declaration - * @param Resource $res Result of request SQL + * @param stdClass $res Result of request SQL * @param int $i Line Id * @return void */ public function addItemXMlDes($declaration, &$res, $i) { $item = $declaration->addChild('ligne_des'); - $item->addChild('numlin_des', $i); - $item->addChild('valeur', round($res->total_ht)); // Total amount excl. tax of the invoice (whole amount expected) + $item->addChild('numlin_des', (string) $i); + $item->addChild('valeur', (string) round($res->total_ht)); // Total amount excl. tax of the invoice (whole amount expected) $item->addChild('partner_des', $res->tva_intra); // Represents the foreign customer's VAT number } @@ -482,7 +483,7 @@ class IntracommReport extends CommonObject */ public static function getDeclarationNumber($number) { - return str_pad($number, 6, 0, STR_PAD_LEFT); + return str_pad($number, 6, '0', STR_PAD_LEFT); } /** diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index 3611ae2c51e..cbdd0838d0c 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -1,6 +1,7 @@ * Copyright (C) 2019-2020 Open-DSI + * 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 @@ -113,20 +114,20 @@ else $result=restrictedArea($user, 'produit|service', '', '', '', '', '', $objca // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'i.ref'=>"Ref", - 'pfi.ref_fourn'=>"RefSupplier", - 'i.label'=>"ProductLabel", - 'i.description'=>"Description", - "i.note"=>"Note", + 'i.ref' => "Ref", + 'pfi.ref_fourn' => "RefSupplier", + 'i.label' => "ProductLabel", + 'i.description' => "Description", + "i.note" => "Note", ); $isInEEC = isInEEC($mysoc); // Definition of fields for lists $arrayfields = array( - 'i.ref' => array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'i.label' => array('label'=>$langs->trans("Label"), 'checked'=>1), - 'i.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(isModEnabled("product") && isModEnabled("service"))), + 'i.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), + 'i.label' => array('label' => $langs->trans("Label"), 'checked' => 1), + 'i.fk_product_type' => array('label' => $langs->trans("Type"), 'checked' => 0, 'enabled' => (isModEnabled("product") && isModEnabled("service"))), ); /* @@ -143,6 +144,7 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array $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 // Security check if ($search_type == '0') { @@ -360,7 +362,7 @@ $param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>$langs->trans("PDFMerge"), //'presend'=>$langs->trans("SendByMail"), ); @@ -415,6 +417,9 @@ if ($search_all) { $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (!isset($moreforfilter)) { + $moreforfilter = ''; +} if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -470,7 +475,7 @@ if (!empty($arrayfields['customerorsupplier']['checked'])) { if (!empty($arrayfields['i.fk_product_type']['checked'])) { print '
    '; } @@ -480,7 +485,7 @@ if (!empty($arrayfields['i.fk_product_type']['checked'])) { 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; // Date creation @@ -532,7 +537,7 @@ if (!empty($arrayfields['i.fk_product_type']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; */ // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['i.datec']['checked'])) { diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 2b5f1e56d4f..402e41c7d76 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -99,7 +99,7 @@ class KnowledgeRecord extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -189,7 +189,7 @@ class KnowledgeRecord extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs; + global $langs; $this->db = $db; @@ -1027,7 +1027,7 @@ class KnowledgeRecord extends CommonObject $dir = dol_buildpath($reldir."core/modules/knowledgemanagement/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php index 3d509d7d25c..c4652df83b1 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,7 +155,7 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_knowledgerecord_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index cee9b17d6c0..d8b67a715cd 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -178,6 +178,7 @@ ACCOUNTING_SELL_JOURNAL=Sales journal - sales and returns ACCOUNTING_PURCHASE_JOURNAL=Purchase journal - purchase and returns ACCOUNTING_BANK_JOURNAL=Cash journal - receipts and disbursements ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal +ACCOUNTING_ACCOUNT_EXPENSEREPORT=Default accounting account for "expense reports" ACCOUNTING_MISCELLANEOUS_JOURNAL=General journal ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal ACCOUNTING_INVENTORY_JOURNAL=Inventory journal diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f20f46f5c03..2c776a5264d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1438,9 +1438,9 @@ CompanySetup=Companies module setup CompanyCodeChecker=Options for automatic generation of customer/vendor codes AccountCodeManager=Options for automatic generation of customer/vendor accounting codes NotificationsDesc=Email notifications can be sent automatically for some Dolibarr events.
    Recipients of notifications can be defined: -NotificationsDescUser=* per user, one user at a time. -NotificationsDescContact=* per third-party contacts (customers or vendors), one contact at a time. -NotificationsDescGlobal=* or by setting global email addresses in the setup page of the module. +NotificationsDescUser=* per user (on the tab "Notifications" of a user) +NotificationsDescContact=* per third-party contacts (on the tab "Notifications" of a third party) +NotificationsDescGlobal=* or by setting global email addresses (on the setup page of the module). ModelModules=Document Templates DocumentModelOdt=Generate documents from OpenDocument templates (.ODT / .ODS files from LibreOffice, OpenOffice, KOffice, TextEdit,...) WatermarkOnDraft=Watermark on draft document @@ -1666,7 +1666,7 @@ LDAPDescUsers=This page allows you to define LDAP attributes name in LDAP tree f LDAPDescGroups=This page allows you to define LDAP attributes name in LDAP tree for each data found on Dolibarr groups. LDAPDescMembers=This page allows you to define LDAP attributes name in LDAP tree for each data found on Dolibarr members module. LDAPDescMembersTypes=This page allows you to define LDAP attributes name in LDAP tree for each data found on Dolibarr members types. -LDAPDescValues=Example values are designed for OpenLDAP with following loaded schemas: core.schema, cosine.schema, inetorgperson.schema). If you use thoose values and OpenLDAP, modify your LDAP config file slapd.conf to have all thoose schemas loaded. +LDAPDescValues=Example values are designed for OpenLDAP with following loaded schemas: core.schema, cosine.schema, inetorgperson.schema). If you use those values and OpenLDAP, modify your LDAP config file slapd.conf to have all those schemas loaded. ForANonAnonymousAccess=For an authenticated access (for a write access for example) PerfDolibarr=Performance setup/optimizing report YouMayFindPerfAdviceHere=This page provides some checks or advice related to performance. @@ -2452,3 +2452,5 @@ VideoGeneration=Video generation AudioText=Audio - Text AIPromptForFeatures=AI custom prompts for features EnterAnIP=Enter an IP address +ConvertInto=Convert into +YouAreHere=You are here diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 70ce8809858..8ce39450cd8 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -21,7 +21,6 @@ MenuDoneMyActions=My terminated events ListOfEvents=List of events (default calendar) ActionsAskedBy=Events reported by ActionsToDoBy=Events assigned to -ActionsDoneBy=Events done by ActionAssignedTo=Event assigned to ViewCal=Month view ViewDay=Day view diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index d0c684cb961..ff42af8c3fb 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -147,6 +147,7 @@ ShowProductReference=Show reference or label of products UsePriceHT=Use price excl. taxes and not price incl. taxes when modifying a price TerminalName=Terminal %s TerminalNameDesc=Terminal name +TakePosCustomerMandatory=You must choose a customer DefaultPOSThirdLabel=TakePOS generic customer DefaultPOSCatLabel=Point Of Sale (POS) products DefaultPOSProductLabel=Product example for TakePOS diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 2f6e4da03dc..7b0ab3ed30e 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -47,7 +47,6 @@ LastProspectToContact=To contact LastProspectContactInProcess=Contact in process LastProspectContactDone=Contact done ActionAffectedTo=Event assigned to -ActionDoneBy=Event done by ActionAC_TEL=Phone call ActionAC_FAX=Send fax ActionAC_PROP=Send proposal by mail diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 57b3cf539cf..526483b1339 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -6,7 +6,7 @@ ErrorSetACountryFirst=Set the country first SelectThirdParty=Select a third party ConfirmDeleteCompany=Are you sure you want to delete this company and all related information? DeleteContact=Delete a contact/address -ConfirmDeleteContact=Are you sure you want to delete this contact and all related information? +ConfirmDeleteContact=Are you sure you want to delete this contact? MenuNewThirdParty=New Third Party MenuNewCustomer=New Customer MenuNewProspect=New Prospect @@ -527,4 +527,4 @@ HideSocialNetworks=Hide social networks ExternalSystemID=External system ID IDOfPaymentInAnExternalSystem=ID of the payment mode into an external system (like Stripe, Paypal, ...) AADEWebserviceCredentials=AADE Webservice Credentials -ThirdPartyMustBeACustomerToCreateBANOnStripe=The third-party must be a customer to allow the creation of its bank info on Stripe side +ThirdPartyMustBeACustomerToCreateBANOnStripe=The third-party must be a customer to allow the creation of its bank info on Stripe side diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 1fde12f73ff..d8ebfa352e5 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -332,6 +332,8 @@ ErrorDictionaryNotFound=Dictionary %s not found ErrorFailedToCreateSymLinkToMedias=Failed to create the symbolic link %s to point to %s ErrorCheckTheCommandInsideTheAdvancedOptions=Check the command used for the export into the Advanced options of the export +ErrorEndTimeMustBeGreaterThanStartTime=End time must be greater than start time +ErrorIncoherentDates=Date start must be less than date end # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 9d3b5c5fb08..e0e26dc460b 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -27,6 +27,7 @@ EventOrganizationMenuLeft = Organized events EventOrganizationConferenceOrBoothMenuLeft = Conference Or Booth PaymentEvent=Payment of event +EventFee=Event fee # # Admin page diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index d2e29b3941a..4c1a5a08f0a 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -135,8 +135,8 @@ NoNotificationsWillBeSent=No automatic email notifications are planned for this ANotificationsWillBeSent=1 automatic notification will be sent by email SomeNotificationsWillBeSent=%s automatic notifications will be sent by email AddNewNotification=Subscribe to a new automatic email notification (target/event) -ListOfActiveNotifications=List of all active subscriptions (targets/events) for automatic email notification -ListOfNotificationsDone=List of all automatic email notifications sent +ListOfActiveNotifications=Active subscriptions (targets/events) for automatic email notification +ListOfNotificationsDone=Automatic email notifications sent MailSendSetupIs=Configuration of email sending has been setup to '%s'. This mode can't be used to send mass emailing. MailSendSetupIs2=You must first go, with an admin account, into menu %sHome - Setup - EMails%s to change parameter '%s' to use mode '%s'. With this mode, you can enter setup of the SMTP server provided by your Internet Service Provider and use Mass emailing feature. MailSendSetupIs3=If you have any questions on how to setup your SMTP server, you can ask to %s. @@ -187,7 +187,8 @@ EmailOptedOut=Email owner has requested to not contact him with this email anymo EvenUnsubscribe=Include opt-out emails EvenUnsubscribeDesc=Include opt-out emails when you select emails as targets. Useful for mandatory service emails for example. XEmailsDoneYActionsDone=%s emails pre-qualified, %s emails successfully processed (for %s record/actions done) -helpWithAi=Generate message from AI YouCanMakeSomeInstructionForEmail=You can make some instructions for your Email (Example: generate image in email template...) ModelTemplate=Email template YouCanChooseAModelForYouMailContent= You can choose one of template models or generate one with AI +TitleOfMailHolder=Title of the e-mail goes here +ContentOfMailHolder=Content of email goes here... diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 718041fdd7b..786453d972d 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -246,3 +246,4 @@ XSubsriptionCreated=%s subscription(s) created XSubsriptionErrors=%s subscription(s) where in error CreateSubscription=Create subscription WarningNoComplementaryActionDone=No Complementary action on recording will be executed with this massaction +NewMembership=New membership \ No newline at end of file diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 948bff00757..ee3a75c3e81 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -100,6 +100,7 @@ WorkstationSetup = Workstations setup WorkstationSetupPage = Workstations setup page WorkstationList=Workstation list WorkstationCreate=Add new workstation +NewWorkstation=New workstation ConfirmEnableWorkstation=Are you sure you want to enable workstation %s ? EnableAWorkstation=Enable a workstation ConfirmDisableWorkstation=Are you sure you want to disable workstation %s ? @@ -136,4 +137,3 @@ NoRemainQtyToDispatch=No quantity remaining to divide THMOperatorEstimatedHelp=Estimated cost of operator per hour. Will be used to estimate cost of a BOM using this workstation. THMMachineEstimatedHelp=Estimated cost of machine per hour. Will be used to estimate cost of a BOM using this workstation. - diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index a1e25cea1af..12955cc9f0e 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -207,6 +207,7 @@ EMailTextInterventionValidated=The intervention %s has been validated. EMailTextInterventionClosed=The intervention %s has been closed. EMailTextInvoiceValidated=Invoice %s has been validated. EMailTextInvoicePayed=Invoice %s has been paid. +EMailTextInvoiceCanceled=Invoice %s has been canceled. EMailTextProposalValidated=Proposal %s has been validated. EMailTextProposalClosedSigned=Proposal %s has been closed signed. EMailTextProposalClosedSignedWeb=Proposal %s has been closed signed on portal page. @@ -214,6 +215,7 @@ EMailTextProposalClosedRefused=Proposal %s has been closed refused. EMailTextProposalClosedRefusedWeb=Proposal %s has been closed refuse on portal page. EMailTextOrderValidated=Order %s has been validated. EMailTextOrderClose=Order %s has been delivered. +EMailTextOrderCanceled=Order %s has been canceled. EMailTextSupplierOrderApprovedBy=Purchase order %s has been approved by %s. EMailTextSupplierOrderValidatedBy=Purchase order %s has been recorded by %s. EMailTextSupplierOrderSubmittedBy=Purchase order %s has been submitted by %s. @@ -327,6 +329,7 @@ SetupOfFTPClientModuleNotComplete=The setup of the FTP or SFTP client module see FTPFeatureNotSupportedByYourPHP=Your PHP does not support FTP or SFTP functions FailedToConnectToFTPServer=Failed to connect to server (server %s, port %s) FailedToConnectToFTPServerWithCredentials=Failed to login to server with defined login/password +FailedToChdirOnFTPServer=Failed to change directory on the FTP server FTPFailedToRemoveFile=Failed to remove file %s. FTPFailedToRemoveDir=Failed to remove directory %s: check permissions and that the directory is empty. FTPPassiveMode=Passive mode diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 93bf150de17..dbdc58acdcb 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -437,3 +437,4 @@ AllowStockMovementVariantParent=Also records stock movements on parent products AllowStockMovementVariantParentHelp=By default, a parent of a variant is a virtual product, so no stock is managed for it. By enabling this option, a stock will be managed for parent products and each time a stock quantity is modified for a variant product, the same quantity will be modified for the parent product. You should not need this option, except if you are using variant to manage the same product than parent (but with different descriptions, prices...) ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?
    The quantities currently set in the inventory will be reset. WarningLineProductNotToSell=Product or service "%s" is not to sell and was cloned +PriceLabel=Price label diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 70a25ea5e27..7740eb8d647 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -128,7 +128,7 @@ Replenishment=Replenishment ReplenishmentOrders=Replenishment orders VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical stock + open orders) may differ UseRealStockByDefault=Use real stock, instead of virtual stock, for replenishment feature -ReplenishmentCalculation=Amount to order will be (desired quantity - real stock) instead of (desired quantity - virtual stock) +ReplenishmentCalculation=Amount to order will be (desired quantity - real stock) instead of (desired quantity - virtual stock) UseVirtualStock=Use virtual stock UsePhysicalStock=Use physical stock CurentSelectionMode=Current selection mode @@ -245,7 +245,7 @@ AlwaysShowFullArbo=Display the full path of a warehouse (parent warehouses) on t StockAtDatePastDesc=You can view here the stock (real stock) at a given date in the past StockAtDateFutureDesc=You can view here the stock (virtual stock) at a given date in the future CurrentStock=Current stock -InventoryRealQtyHelp=Set value to 0 to reset qty
    Keep field empty, or remove line, to keep unchanged +InventoryRealQtyHelp=The quantity you found in stock when making the inventory. Set value to 0 to reset qty
    Keep field empty, or remove line, to keep unchanged UpdateByScaning=Complete real qty by scanning UpdateByScaningProductBarcode=Update by scan (product barcode) UpdateByScaningLot=Update by scan (lot|serial barcode) @@ -322,7 +322,7 @@ BatchNotFound=Lot / serial not found for this product StockEntryDate=Date of
    entry in stock StockMovementWillBeRecorded=Stock movement will be recorded StockMovementNotYetRecorded=Stock movement will not be affected by this step -ReverseConfirmed=Stock movement has been reversed successfully +ReverseConfirmed=Stock movement has been reversed successfully WarningThisWIllAlsoDeleteStock=Warning, this will also destroy all quantities in stock in the warehouse ValidateInventory=Inventory validation IncludeSubWarehouse=Include sub-warehouse ? @@ -332,3 +332,5 @@ ConfirmDeleteBatch=Are you sure you want to delete lot/serial ? WarehouseUsage=Warehouse usage InternalWarehouse=Internal warehouse ExternalWarehouse=External warehouse +QtyCurrentlyKnownInStock=The quantity the system think you have in stock. As long as the inventory is not closed, this is a realtime value and it may change if you continue to make stock movement during the inventory (not recommended). +QtyInStockWhenInventoryWasValidated=The quantity the system think you had in stock when the inventory was validated (before the stock correction) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index b61db89919d..0f0faf90c05 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -69,7 +69,6 @@ Read=Read Assigned=Assigned NeedMoreInformation=Waiting for reporter feedback NeedMoreInformationShort=Waiting for feedback -TicketAnswered=Answered Waiting=Waiting SolvedClosed=Solved Deleted=Deleted @@ -135,7 +134,7 @@ TicketsActivatePublicInterfaceHelp=Public interface allow any visitors to create TicketsAutoAssignTicket=Automatically assign the user who created the ticket TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket. TicketNumberingModules=Tickets numbering module -TicketsModelModule=Document templates for tickets +TicketsModelModule=Document templates for tickets TicketNotifyTiersAtCreation=Notify third party at creation TicketsDisableCustomerEmail=Always disable emails when a ticket is created from public interface TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is added to a ticket diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 5238503b35f..9d6976b8c2a 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -146,6 +146,7 @@ ShowProductReference=Afficher la référence ou libellé des produits UsePriceHT=Utilisez le prix HT et non le prix TTC lors de la modification d'un prix. TerminalName=Terminal %s TerminalNameDesc=Nom du terminal +TakePosCustomerMandatory=Vous devez choisir un client DefaultPOSThirdLabel=Client générique TakePOS DefaultPOSCatLabel=Produits du Point de Vente (PdV) DefaultPOSProductLabel=Exemple de produit pour TakePOS diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index b794cbde418..a939cc392ba 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -436,3 +436,4 @@ WarningConvertFromBatchToSerial=Si vous disposez actuellement d'une quantité su AllowStockMovementVariantParent=Enregistre également les mouvements de stock sur les produits parent des produits variants AllowStockMovementVariantParentHelp=Par défaut, un parent d'une variante est un produit virtuel, donc aucun stock n'est géré pour celui-ci. En activant cette option, un stock sera géré pour les produits parents et à chaque fois qu'une quantité de stock est modifiée pour une variante de produit, la même quantité sera modifiée pour le produit parent. Vous ne devriez pas avoir besoin de cette option, sauf si vous utilisez une variante pour gérer le même produit que le parent (mais avec des descriptions, des prix différents...) ConfirmSetToDraftInventory=Êtes-vous sûr de vouloir revenir à l'état de brouillon ?
    Les quantités actuellement définies dans l'inventaire seront réinitialisées. +PriceLabel=Libellé du prix diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index f095f480a04..6d0c922aad3 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2014-2018 Alexandre Spangaro * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2020 Maxime DEMAREST + * 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 @@ -62,14 +63,23 @@ class PaymentLoan extends CommonObject public $datep = ''; /** - * @var array Array of amounts + * @var array Array of amounts */ public $amounts = array(); - public $amount_capital; // Total amount of payment + /** + * @var float|int Total amount of payment + */ + public $amount_capital; + /** + * @var float|int + */ public $amount_insurance; + /** + * @var float|int + */ public $amount_interest; /** @@ -98,11 +108,28 @@ class PaymentLoan extends CommonObject */ public $fk_user_modif; + /** + * @var string + */ public $type_code; + /** + * @var string + */ public $type_label; public $chid; + /** + * @var string + */ public $label; + + /** + * @var int + */ public $paymenttype; + + /** + * @var int + */ public $bank_account; public $bank_line; @@ -143,13 +170,13 @@ class PaymentLoan extends CommonObject $this->fk_loan = (int) $this->fk_loan; } if (isset($this->amount_capital)) { - $this->amount_capital = price2num($this->amount_capital ? $this->amount_capital : 0); + $this->amount_capital = (float) price2num($this->amount_capital ? $this->amount_capital : 0); } if (isset($this->amount_insurance)) { - $this->amount_insurance = price2num($this->amount_insurance ? $this->amount_insurance : 0); + $this->amount_insurance = (float) price2num($this->amount_insurance ? $this->amount_insurance : 0); } if (isset($this->amount_interest)) { - $this->amount_interest = price2num($this->amount_interest ? $this->amount_interest : 0); + $this->amount_interest = (float) price2num($this->amount_interest ? $this->amount_interest : 0); } if (isset($this->fk_typepayment)) { $this->fk_typepayment = (int) $this->fk_typepayment; @@ -174,7 +201,7 @@ class PaymentLoan extends CommonObject } $totalamount = $this->amount_capital + $this->amount_insurance + $this->amount_interest; - $totalamount = price2num($totalamount); + $totalamount = (float) price2num($totalamount); // Check parameters if ($totalamount == 0) { @@ -305,13 +332,13 @@ class PaymentLoan extends CommonObject $this->fk_loan = (int) $this->fk_loan; } if (isset($this->amount_capital)) { - $this->amount_capital = trim($this->amount_capital); + $this->amount_capital = (float) $this->amount_capital; } if (isset($this->amount_insurance)) { - $this->amount_insurance = trim($this->amount_insurance); + $this->amount_insurance = (float) $this->amount_insurance; } if (isset($this->amount_interest)) { - $this->amount_interest = trim($this->amount_interest); + $this->amount_interest = (float) $this->amount_interest; } if (isset($this->fk_typepayment)) { $this->fk_typepayment = (int) $this->fk_typepayment; @@ -521,7 +548,7 @@ class PaymentLoan extends CommonObject // Insert payment into llx_bank $bank_line_id = $acc->addline( $this->datep, - $this->paymenttype, // Payment mode ID or code ("CHQ or VIR for example") + $this->paymenttype, // Payment mode ID or code ("CHQ or VIR for example") it's integer in db $label, $total, $this->num_payment, @@ -666,7 +693,7 @@ class PaymentLoan extends CommonObject global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5dd096ef228..cc625787aed 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -104,7 +104,7 @@ function testSqlAndScriptInject($val, $type) $val = preg_replace_callback( '/&#(x?[0-9][0-9a-f]+;?)/i', /** - * @param string $m + * @param string[] $m * @return string */ static function ($m) { @@ -243,7 +243,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type, $stopcode = 1) $ip = (empty($_SERVER['REMOTE_ADDR']) ? 'unknown' : $_SERVER['REMOTE_ADDR']); if ($stopcode) { - $errormessage = 'Access refused to '.htmlentities($ip, ENT_COMPAT, 'UTF-8').' by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type='.htmlentities($type, ENT_COMPAT, 'UTF-8'); + $errormessage = 'Access refused to '.htmlentities($ip, ENT_COMPAT, 'UTF-8').' by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type='.htmlentities((string) $type, ENT_COMPAT, 'UTF-8'); //$errormessage .= ' paramkey='.htmlentities($key, ENT_COMPAT, 'UTF-8'); // Disabled to avoid text injection $errormessage2 = 'page='.htmlentities((empty($_SERVER["REQUEST_URI"]) ? '' : $_SERVER["REQUEST_URI"]), ENT_COMPAT, 'UTF-8'); @@ -342,7 +342,7 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) { $cookievalue = json_encode($cookiearrayvalue); //var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue); if (PHP_VERSION_ID < 70300) { - setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), true); // keep cookie 1 year and add tag httponly + setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', '', ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), true); // keep cookie 1 year and add tag httponly } else { // Only available for php >= 7.3 $cookieparams = array( @@ -573,7 +573,7 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) { // Note: Using MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL is not recommended: if a user succeed in entering a data from // a public page with a link that make a token regeneration, it can make use of the backoffice no more possible ! // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken'] - $token = dol_hash(uniqid(mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value. + $token = dol_hash(uniqid((string) mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value. $_SESSION['newtoken'] = $token; dol_syslog("NEW TOKEN generated by : ".$_SERVER['PHP_SELF'], LOG_DEBUG); } @@ -2332,8 +2332,10 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } $text .= '
    '; diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index c052377fc92..8eaf9523c46 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2012 Christophe Battarel * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2016 Florian Henry + * 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 @@ -142,7 +143,7 @@ function getMarginInfos($pv_ht, $remise_percent, $tva_tx, $localtax1_tx, $localt // calcul marge if ($pu_ht_remise < 0) { - $marge = -1 * (abs($pu_ht_remise) - $pa_ht_ret); + $marge = -1 * (abs((float) $pu_ht_remise) - $pa_ht_ret); } else { $marge = $pu_ht_remise - $pa_ht_ret; } diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 6eb2db3db15..3c0d1e41776 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -4353,8 +4353,9 @@ if ($module == 'initmodule') { $mod = strtolower($module); $obj = strtolower($tabobj); $newproperty = dolGetButtonTitle($langs->trans('NewProperty'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.urlencode($module).'&tabobj=createproperty&obj='.urlencode($tabobj)); + $nbOfProperties = count($reflectorpropdefault['fields']); - print_barre_liste($langs->trans("ObjectProperties"), 0, $_SERVER["PHP_SELF"], '', '', '', '', '', 0, '', 0, $newproperty, '', '', 0, 0, 1); + print_barre_liste($langs->trans("ObjectProperties"), 0, $_SERVER["PHP_SELF"], '', '', '', '', '', $nbOfProperties, '', 0, $newproperty, '', '', 0, 0, 1); //var_dump($reflectorpropdefault);exit; print ''."\n"; diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 3fce4970731..eaaf8206e87 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -171,6 +171,16 @@ $setupnotempty += count($formSetup->items); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); +$moduledir = 'mymodule'; +$myTmpObjects = array(); +// TODO Scan list of objects to fill this array +$myTmpObjects['myobject'] = array('label'=>'MyObject', 'includerefgeneration'=>0, 'includedocgeneration'=>0, 'class'=>'MyObject'); + +$tmpobjectkey = GETPOST('object', 'aZ09'); +if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) { + accessforbidden('Bad value for object. Hack attempt ?'); +} + /* * Actions @@ -199,23 +209,23 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { +} elseif ($action == 'specimen' && $tmpobjectkey) { $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - $tmpobject = new $tmpobjectkey($db); + $className = $myTmpObjects[$tmpobjectkey]['class']; + $tmpobject = new $className($db); $tmpobject->initAsSpecimen(); // Search template files $file = ''; - $classname = ''; + $className = ''; $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { $filefound = 1; - $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); + $className = "pdf_".$modele."_".strtolower($tmpobjectkey); break; } } @@ -223,7 +233,7 @@ if ($action == 'updateMask') { if ($filefound) { require_once $file; - $module = new $classname($db); + $module = new $className($db); if ($module->write_file($tmpobject, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mymodule-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); @@ -238,7 +248,6 @@ if ($action == 'updateMask') { } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey)."_ADDON"; dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); @@ -249,7 +258,6 @@ if ($action == 'updateMask') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (getDolGlobalString($constforval) == "$value") { @@ -259,7 +267,6 @@ if ($action == 'updateMask') { } } elseif ($action == 'setdoc') { // Set or unset default model - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { @@ -275,7 +282,6 @@ if ($action == 'updateMask') { } } } elseif ($action == 'unsetdoc') { - $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; dolibarr_del_const($db, $constforval, $conf->entity); @@ -327,14 +333,8 @@ if (!empty($formSetup->items)) { } -$moduledir = 'mymodule'; -$myTmpObjects = array(); -// TODO Scan list of objects -$myTmpObjects['myobject'] = array('label'=>'MyObject', 'includerefgeneration'=>0, 'includedocgeneration'=>0, 'class'=>'MyObject'); - - foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectArray['includerefgeneration']) { + if (!empty($myTmpObjectArray['includerefgeneration'])) { /* * Orders Numbering model */ @@ -406,8 +406,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print ''; - $nameofclass = $myTmpObjectArray['class']; - $mytmpinstance = new $nameofclass($db); + $className = $myTmpObjectArray['class']; + $mytmpinstance = new $className($db); $mytmpinstance->initAsSpecimen(); // Info @@ -442,7 +442,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print "
    '.$langs->trans('CustomerCode'); if (!empty($array_query['cust_code'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + $cust_code_str = (string) $array_query['cust_code']; +} else { + $cust_code_str = "null"; } -print ''."\n"; +print ''."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '
    '; if ($module == 'medias') { print $langs->trans("RootOfMedias"); } else { diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index eb0c48e27c3..e7eea603e18 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -27,7 +27,7 @@ if (!defined('NOBROWSERNOTIF')) { // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } // DDOS protection diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 8ca0cc44990..4f56f9c6435 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } // $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 3dc3b059e8c..cf4ddd5c88b 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -36,7 +36,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 121f0466db9..10489412b08 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -37,7 +37,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } '@phan-var-force CommonObject $this diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 24a298e1ba5..414ba6b9461 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -41,7 +41,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } '@phan-var-force CommonObject $this diff --git a/htdocs/core/tpl/objectlinked_lineimport.tpl.php b/htdocs/core/tpl/objectlinked_lineimport.tpl.php index 3193f3db96d..eb6f7b470b6 100644 --- a/htdocs/core/tpl/objectlinked_lineimport.tpl.php +++ b/htdocs/core/tpl/objectlinked_lineimport.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } $objectUrl = $object->getNomUrl(0, '', 0, 1); diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index b5e24042ee3..f599ccd736b 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; diff --git a/htdocs/core/tpl/originproductline.tpl.php b/htdocs/core/tpl/originproductline.tpl.php index 40a3656a7fd..9bad8c41a25 100644 --- a/htdocs/core/tpl/originproductline.tpl.php +++ b/htdocs/core/tpl/originproductline.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } ?> diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 188e3099f6c..8c7a04d2af3 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -23,7 +23,7 @@ if (!defined('NOBROWSERNOTIF')) { // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } // DDOS protection diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php index e778be0afb5..c73c1ac5088 100644 --- a/htdocs/core/tpl/passwordreset.tpl.php +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -25,7 +25,7 @@ if (!defined('NOBROWSERNOTIF')) { // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } // DDOS protection diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index bff55cca329..6b67021096b 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -4,7 +4,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index d62169697da..3f66edd22d7 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -3,7 +3,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index e1eb9be0c0c..fd3004a9c9d 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -186,5 +186,5 @@ abstract class DolibarrTriggers * @param conf $conf Object conf * @return int if KO: <0 || if no trigger ran: 0 || if OK: >0 */ - abstract public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf); + abstract public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf); } diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 47432eeb75c..adc63815e33 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -88,7 +88,7 @@ class InterfaceLogevents extends DolibarrTriggers * @return int if KO: <0, if no trigger ran: 0, if OK: >0 * @throws Exception dol_syslog can throw Exceptions */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (getDolGlobalString('MAIN_LOGEVENTS_DISABLE_ALL')) { return 0; // Log events is disabled (hidden features) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index ea792005846..785aac5f0fc 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -52,17 +52,17 @@ class InterfaceWorkflowManager extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code - * @param Object $object Object + * @param CommonObject $object Object * @param User $user Object user * @param Translate $langs Object langs * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->workflow) || empty($conf->workflow->enabled)) { return 0; // Module not active, we do nothing @@ -135,7 +135,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['propal'] as $element) { $ret = $element->classifyBilled($user); @@ -160,7 +160,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['commande'] as $element) { $ret = $element->classifyBilled($user); @@ -179,7 +179,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['propal'] as $element) { $ret = $element->classifyBilled($user); @@ -198,7 +198,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); + dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG); if ($totalonlinkedelements == $object->total_ht) { foreach ($object->linkedObjects['shipping'] as $element) { $ret = $element->setClosed(); @@ -219,7 +219,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); + dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG); if ($totalonlinkedelements == $object->total_ht) { foreach ($object->linkedObjects['shipping'] as $element) { $ret = $element->setBilled(); @@ -249,7 +249,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['order_supplier'] as $element) { $ret = $element->classifyBilled($user); @@ -271,7 +271,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['supplier_proposal'] as $element) { $ret = $element->classifyBilled($user); @@ -317,7 +317,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked reception = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); + dol_syslog("Amount of linked reception = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG); if ($totalonlinkedelements == $object->total_ht) { foreach ($object->linkedObjects['reception'] as $element) { $ret = $element->setBilled(); @@ -345,7 +345,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $totalonlinkedelements += $element->total_ht; } } - dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); + dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['commande'] as $element) { $ret = $element->classifyBilled($user); diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index dad0a0a68d4..4d6a062e38b 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -56,7 +56,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database: @@ -77,7 +77,7 @@ class InterfaceActionsAuto extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (!isModEnabled('agenda')) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 68cfccb49d5..a27ee6b7d66 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -56,7 +56,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->blockedlog) || empty($conf->blockedlog->enabled)) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php index 738ad23d173..445bbf4ac3c 100644 --- a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php +++ b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2021 Florian Henry + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,7 +48,7 @@ class InterfaceEventOrganization extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database: @@ -68,19 +69,19 @@ class InterfaceEventOrganization extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->eventorganization) || empty($conf->eventorganization->enabled)) { return 0; // Module not active, we do nothing } - $error=0; + $error = 0; // Actions if ($action == 'PROJECT_VALIDATE') { if (getDolGlobalString('EVENTORGANIZATION_TASK_LABEL') && !empty($object->usage_organize_event)) { $taskToDo = explode("\n", getDolGlobalString('EVENTORGANIZATION_TASK_LABEL')); - if (is_array($taskToDo) && count($taskToDo)>0) { + if (is_array($taskToDo) && count($taskToDo) > 0) { // Load translation files required by the page $langs->loadLangs(array("eventorganization")); @@ -107,7 +108,7 @@ class InterfaceEventOrganization extends DolibarrTriggers $result = $task->create($user); if ($result < 0) { - $this->errors=array_merge($this->errors, $task->errors); + $this->errors = array_merge($this->errors, $task->errors); $error++; } } diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 3f5c0c8ba77..1a92bca5b66 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2021 Regis Houssin * Copyright (C) 2014 Marcos García + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +49,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code @@ -58,7 +59,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->ldap) || empty($conf->ldap->enabled)) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php index 3da6aeb7ea3..5b746b971cb 100644 --- a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Marcos García + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +47,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code @@ -56,7 +57,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->mailmanspip) || empty($conf->mailmanspip->enabled)) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index a66659f0e90..b9a009f7c0a 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2011 Regis Houssin * Copyright (C) 2013-2014 Marcos García * Copyright (C) 2022 Anthony Berton + * 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 @@ -53,7 +54,7 @@ class InterfaceNotification extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code @@ -63,7 +64,7 @@ class InterfaceNotification extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { global $hookmanager; @@ -167,7 +168,7 @@ class InterfaceNotification extends DolibarrTriggers } if ($qualified) { - $ret[] = array('rowid'=>$obj->rowid, 'code'=>$obj->code, 'contexts'=>$obj->contexts, 'label'=>$obj->label, 'description'=>$obj->description, 'elementtype'=>$obj->elementtype); + $ret[] = array('rowid' => $obj->rowid, 'code' => $obj->code, 'contexts' => $obj->contexts, 'label' => $obj->label, 'description' => $obj->description, 'elementtype' => $obj->elementtype); } $i++; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 3610fdf840a..904f2212369 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -49,7 +49,7 @@ class InterfaceTicketEmail extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers * * @param string $action Event action code @@ -59,7 +59,7 @@ class InterfaceTicketEmail extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { global $mysoc; @@ -428,7 +428,9 @@ class InterfaceTicketEmail extends DolibarrTriggers $message = dol_nl2br($message); } $message_customer .= '

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

    '.$message.'


    '; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + + $url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'view.php?track_id='.$object->track_id; + $message_customer .= '

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

    '; $message_customer .= '

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

    '; diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index d42c2c92264..908f4b858bf 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -1,6 +1,7 @@ + * 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 @@ -52,7 +53,7 @@ class InterfaceStripe extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file * is inside directory core/triggers * @@ -63,7 +64,7 @@ class InterfaceStripe extends DolibarrTriggers * @param Conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { // Put here code you want to execute when a Dolibarr business event occurs. // Data and type of action are stored into $object and $action @@ -86,7 +87,7 @@ class InterfaceStripe extends DolibarrTriggers } // If customer is linked to Stripe, we update/delete Stripe too - if ($action == 'COMPANY_MODIFY') { + if ($action == 'COMPANY_MODIFY' && $object instanceof Societe) { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. @@ -128,10 +129,10 @@ class InterfaceStripe extends DolibarrTriggers if (($customer->tax_exempt == 'exempt' && !$object->tva_assuj) || (!$customer->tax_exempt == 'exempt' && empty($object->tva_assuj))) { $changerequested++; } - if (!isset($customer->tax_ids['data']) && !is_null($vatcleaned)) { + if (!isset($customer->tax_ids->data) && !is_null($vatcleaned)) { $changerequested++; - } elseif (isset($customer->tax_ids['data'])) { - $taxinfo = reset($customer->tax_ids['data']); + } elseif (isset($customer->tax_ids->data)) { + $taxinfo = reset($customer->tax_ids->data); if (empty($taxinfo) && !empty($vatcleaned)) { $changerequested++; } @@ -157,7 +158,7 @@ class InterfaceStripe extends DolibarrTriggers $isineec = isInEEC($object); if ($object->country_code && $isineec) { //$taxids = $customer->allTaxIds($customer->id); - $customer->createTaxId($customer->id, array('type'=>'eu_vat', 'value'=>$vatcleaned)); + $customer->createTaxId($customer->id, array('type' => 'eu_vat', 'value' => $vatcleaned)); } } else { $taxids = $customer->allTaxIds($customer->id); @@ -171,6 +172,7 @@ class InterfaceStripe extends DolibarrTriggers } // Update Customer on Stripe + // @phan-suppress-next-line PhanDeprecatedFunction $customer->save(); } catch (Exception $e) { //var_dump(\Stripe\Stripe::getApiVersion()); @@ -181,7 +183,7 @@ class InterfaceStripe extends DolibarrTriggers } } } - if ($action == 'COMPANY_DELETE') { + if ($action == 'COMPANY_DELETE' && $object instanceof Societe) { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (getDolGlobalString('STRIPE_DELETE_STRIPE_ACCOUNT_WHEN_DELETING_THIRDPARTY')) { @@ -207,7 +209,7 @@ class InterfaceStripe extends DolibarrTriggers if ($action == 'COMPANYPAYMENTMODE_CREATE' && $object->type == 'card') { // For creation of credit card, we do not create in Stripe automatically } - if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card') { + if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card' && $object instanceof CompanyPaymentMode) { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($object->stripe_card_ref)) { @@ -226,8 +228,10 @@ class InterfaceStripe extends DolibarrTriggers dol_syslog("We got the customer, so now we update the credit card", LOG_DEBUG); $card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus); if ($card) { - $card->metadata = array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])); + // @phan-suppress-next-line PhanTypeMismatchPropertyProbablyReal + $card->metadata = array('dol_id' => $object->id, 'dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])); try { + // @phan-suppress-next-line PhanDeprecatedFunction $card->save(); } catch (Exception $e) { $ok = -1; @@ -238,7 +242,7 @@ class InterfaceStripe extends DolibarrTriggers } } } - if ($action == 'COMPANYPAYMENTMODE_DELETE' && $object->type == 'card') { + if ($action == 'COMPANYPAYMENTMODE_DELETE' && $object->type == 'card' && $object instanceof CompanyPaymentMode) { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($object->stripe_card_ref)) { diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index b2f6a99b07e..6906157f6ef 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Cedric GROSS * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Bahfir Abbes + * 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 @@ -50,7 +51,7 @@ class InterfaceContactRoles extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database: @@ -64,7 +65,7 @@ class InterfaceContactRoles extends DolibarrTriggers * @param conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE' || $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' || $action === 'PROPOSAL_SUPPLIER_CREATE' diff --git a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php index 70777a03ed4..c78c99fc304 100644 --- a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php @@ -65,7 +65,7 @@ class InterfaceWebhookTriggers extends DolibarrTriggers * @param Conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->webhook) || empty($conf->webhook->enabled)) { return 0; // If module is not enabled, we do nothing diff --git a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php index eb91fb9ad4d..bfb4cf8ada3 100644 --- a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +47,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file * is inside directory core/triggers * @@ -57,7 +58,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers * @param Conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->zapier) || empty($conf->zapier->enabled)) { // Module not active, we do nothing @@ -97,14 +98,14 @@ class InterfaceZapierTriggers extends DolibarrTriggers } $logtriggeraction = true; break; - //case 'USER_NEW_PASSWORD': - //case 'USER_ENABLEDISABLE': - //case 'USER_DELETE': - //case 'USER_LOGIN': - //case 'USER_LOGIN_FAILED': - //case 'USER_LOGOUT': + //case 'USER_NEW_PASSWORD': + //case 'USER_ENABLEDISABLE': + //case 'USER_DELETE': + //case 'USER_LOGIN': + //case 'USER_LOGIN_FAILED': + //case 'USER_LOGOUT': - // Actions + // Actions case 'ACTION_MODIFY': //$logtriggeraction = true; break; @@ -125,18 +126,18 @@ class InterfaceZapierTriggers extends DolibarrTriggers //$logtriggeraction = true; break; - // Groups - //case 'USERGROUP_CREATE': - //case 'USERGROUP_MODIFY': - //case 'USERGROUP_DELETE': + // Groups + //case 'USERGROUP_CREATE': + //case 'USERGROUP_MODIFY': + //case 'USERGROUP_DELETE': - // Categories - // case 'CATEGORY_CREATE': - // case 'CATEGORY_MODIFY': - // case 'CATEGORY_DELETE': - // case 'CATEGORY_SET_MULTILANGS': + // Categories + // case 'CATEGORY_CREATE': + // case 'CATEGORY_MODIFY': + // case 'CATEGORY_DELETE': + // case 'CATEGORY_SET_MULTILANGS': - // Companies + // Companies case 'COMPANY_CREATE': $resql = $this->db->query($sql); while ($resql && $obj = $this->db->fetch_array($resql)) { @@ -161,7 +162,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers //$logtriggeraction = true; break; - // Contacts + // Contacts case 'CONTACT_CREATE': $resql = $this->db->query($sql); while ($resql && $obj = $this->db->fetch_array($resql)) { @@ -186,23 +187,23 @@ class InterfaceZapierTriggers extends DolibarrTriggers break; case 'CONTACT_ENABLEDISABLE': break; - // Products - // case 'PRODUCT_CREATE': - // case 'PRODUCT_MODIFY': - // case 'PRODUCT_DELETE': - // case 'PRODUCT_PRICE_MODIFY': - // case 'PRODUCT_SET_MULTILANGS': - // case 'PRODUCT_DEL_MULTILANGS': + // Products + // case 'PRODUCT_CREATE': + // case 'PRODUCT_MODIFY': + // case 'PRODUCT_DELETE': + // case 'PRODUCT_PRICE_MODIFY': + // case 'PRODUCT_SET_MULTILANGS': + // case 'PRODUCT_DEL_MULTILANGS': - //Stock movement - // case 'STOCK_MOVEMENT': + //Stock movement + // case 'STOCK_MOVEMENT': - //MYECMDIR - // case 'MYECMDIR_DELETE': - // case 'MYECMDIR_CREATE': - // case 'MYECMDIR_MODIFY': + //MYECMDIR + // case 'MYECMDIR_DELETE': + // case 'MYECMDIR_CREATE': + // case 'MYECMDIR_MODIFY': - // Sales orders + // Sales orders case 'ORDER_CREATE': $resql = $this->db->query($sql); while ($resql && $obj = $this->db->fetch_array($resql)) { @@ -226,108 +227,108 @@ class InterfaceZapierTriggers extends DolibarrTriggers case 'LINEORDER_UPDATE': case 'LINEORDER_DELETE': break; - // Supplier orders - // case 'ORDER_SUPPLIER_CREATE': - // case 'ORDER_SUPPLIER_CLONE': - // case 'ORDER_SUPPLIER_VALIDATE': - // case 'ORDER_SUPPLIER_DELETE': - // case 'ORDER_SUPPLIER_APPROVE': - // case 'ORDER_SUPPLIER_REFUSE': - // case 'ORDER_SUPPLIER_CANCEL': - // case 'ORDER_SUPPLIER_SENTBYMAIL': - // case 'ORDER_SUPPLIER_RECEIVE': - // case 'LINEORDER_SUPPLIER_DISPATCH': - // case 'LINEORDER_SUPPLIER_CREATE': - // case 'LINEORDER_SUPPLIER_UPDATE': + // Supplier orders + // case 'ORDER_SUPPLIER_CREATE': + // case 'ORDER_SUPPLIER_CLONE': + // case 'ORDER_SUPPLIER_VALIDATE': + // case 'ORDER_SUPPLIER_DELETE': + // case 'ORDER_SUPPLIER_APPROVE': + // case 'ORDER_SUPPLIER_REFUSE': + // case 'ORDER_SUPPLIER_CANCEL': + // case 'ORDER_SUPPLIER_SENTBYMAIL': + // case 'ORDER_SUPPLIER_RECEIVE': + // case 'LINEORDER_SUPPLIER_DISPATCH': + // case 'LINEORDER_SUPPLIER_CREATE': + // case 'LINEORDER_SUPPLIER_UPDATE': - // Proposals - // case 'PROPAL_CREATE': - // case 'PROPAL_CLONE': - // case 'PROPAL_MODIFY': - // case 'PROPAL_VALIDATE': - // case 'PROPAL_SENTBYMAIL': - // case 'PROPAL_CLOSE_SIGNED': - // case 'PROPAL_CLOSE_REFUSED': - // case 'PROPAL_DELETE': - // case 'LINEPROPAL_INSERT': - // case 'LINEPROPAL_UPDATE': - // case 'LINEPROPAL_DELETE': + // Proposals + // case 'PROPAL_CREATE': + // case 'PROPAL_CLONE': + // case 'PROPAL_MODIFY': + // case 'PROPAL_VALIDATE': + // case 'PROPAL_SENTBYMAIL': + // case 'PROPAL_CLOSE_SIGNED': + // case 'PROPAL_CLOSE_REFUSED': + // case 'PROPAL_DELETE': + // case 'LINEPROPAL_INSERT': + // case 'LINEPROPAL_UPDATE': + // case 'LINEPROPAL_DELETE': - // SupplierProposal - // case 'SUPPLIER_PROPOSAL_CREATE': - // case 'SUPPLIER_PROPOSAL_CLONE': - // case 'SUPPLIER_PROPOSAL_MODIFY': - // case 'SUPPLIER_PROPOSAL_VALIDATE': - // case 'SUPPLIER_PROPOSAL_SENTBYMAIL': - // case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED': - // case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED': - // case 'SUPPLIER_PROPOSAL_DELETE': - // case 'LINESUPPLIER_PROPOSAL_INSERT': - // case 'LINESUPPLIER_PROPOSAL_UPDATE': - // case 'LINESUPPLIER_PROPOSAL_DELETE': + // SupplierProposal + // case 'SUPPLIER_PROPOSAL_CREATE': + // case 'SUPPLIER_PROPOSAL_CLONE': + // case 'SUPPLIER_PROPOSAL_MODIFY': + // case 'SUPPLIER_PROPOSAL_VALIDATE': + // case 'SUPPLIER_PROPOSAL_SENTBYMAIL': + // case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED': + // case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED': + // case 'SUPPLIER_PROPOSAL_DELETE': + // case 'LINESUPPLIER_PROPOSAL_INSERT': + // case 'LINESUPPLIER_PROPOSAL_UPDATE': + // case 'LINESUPPLIER_PROPOSAL_DELETE': - // Contracts - // case 'CONTRACT_CREATE': - // case 'CONTRACT_ACTIVATE': - // case 'CONTRACT_CANCEL': - // case 'CONTRACT_CLOSE': - // case 'CONTRACT_DELETE': - // case 'LINECONTRACT_INSERT': - // case 'LINECONTRACT_UPDATE': - // case 'LINECONTRACT_DELETE': + // Contracts + // case 'CONTRACT_CREATE': + // case 'CONTRACT_ACTIVATE': + // case 'CONTRACT_CANCEL': + // case 'CONTRACT_CLOSE': + // case 'CONTRACT_DELETE': + // case 'LINECONTRACT_INSERT': + // case 'LINECONTRACT_UPDATE': + // case 'LINECONTRACT_DELETE': - // Bills - // case 'BILL_CREATE': - // case 'BILL_CLONE': - // case 'BILL_MODIFY': - // case 'BILL_VALIDATE': - // case 'BILL_UNVALIDATE': - // case 'BILL_SENTBYMAIL': - // case 'BILL_CANCEL': - // case 'BILL_DELETE': - // case 'BILL_PAYED': - // case 'LINEBILL_INSERT': - // case 'LINEBILL_UPDATE': - // case 'LINEBILL_DELETE': + // Bills + // case 'BILL_CREATE': + // case 'BILL_CLONE': + // case 'BILL_MODIFY': + // case 'BILL_VALIDATE': + // case 'BILL_UNVALIDATE': + // case 'BILL_SENTBYMAIL': + // case 'BILL_CANCEL': + // case 'BILL_DELETE': + // case 'BILL_PAYED': + // case 'LINEBILL_INSERT': + // case 'LINEBILL_UPDATE': + // case 'LINEBILL_DELETE': - //Supplier Bill - // case 'BILL_SUPPLIER_CREATE': - // case 'BILL_SUPPLIER_UPDATE': - // case 'BILL_SUPPLIER_DELETE': - // case 'BILL_SUPPLIER_PAYED': - // case 'BILL_SUPPLIER_UNPAYED': - // case 'BILL_SUPPLIER_VALIDATE': - // case 'BILL_SUPPLIER_UNVALIDATE': - // case 'LINEBILL_SUPPLIER_CREATE': - // case 'LINEBILL_SUPPLIER_UPDATE': - // case 'LINEBILL_SUPPLIER_DELETE': + //Supplier Bill + // case 'BILL_SUPPLIER_CREATE': + // case 'BILL_SUPPLIER_UPDATE': + // case 'BILL_SUPPLIER_DELETE': + // case 'BILL_SUPPLIER_PAYED': + // case 'BILL_SUPPLIER_UNPAYED': + // case 'BILL_SUPPLIER_VALIDATE': + // case 'BILL_SUPPLIER_UNVALIDATE': + // case 'LINEBILL_SUPPLIER_CREATE': + // case 'LINEBILL_SUPPLIER_UPDATE': + // case 'LINEBILL_SUPPLIER_DELETE': - // Payments - // case 'PAYMENT_CUSTOMER_CREATE': - // case 'PAYMENT_SUPPLIER_CREATE': - // case 'PAYMENT_ADD_TO_BANK': - // case 'PAYMENT_DELETE': + // Payments + // case 'PAYMENT_CUSTOMER_CREATE': + // case 'PAYMENT_SUPPLIER_CREATE': + // case 'PAYMENT_ADD_TO_BANK': + // case 'PAYMENT_DELETE': - // Online - // case 'PAYMENT_PAYBOX_OK': - // case 'PAYMENT_PAYPAL_OK': - // case 'PAYMENT_STRIPE_OK': + // Online + // case 'PAYMENT_PAYBOX_OK': + // case 'PAYMENT_PAYPAL_OK': + // case 'PAYMENT_STRIPE_OK': - // Donation - // case 'DON_CREATE': - // case 'DON_UPDATE': - // case 'DON_DELETE': + // Donation + // case 'DON_CREATE': + // case 'DON_UPDATE': + // case 'DON_DELETE': - // Interventions - // case 'FICHINTER_CREATE': - // case 'FICHINTER_MODIFY': - // case 'FICHINTER_VALIDATE': - // case 'FICHINTER_DELETE': - // case 'LINEFICHINTER_CREATE': - // case 'LINEFICHINTER_UPDATE': - // case 'LINEFICHINTER_DELETE': + // Interventions + // case 'FICHINTER_CREATE': + // case 'FICHINTER_MODIFY': + // case 'FICHINTER_VALIDATE': + // case 'FICHINTER_DELETE': + // case 'LINEFICHINTER_CREATE': + // case 'LINEFICHINTER_UPDATE': + // case 'LINEFICHINTER_DELETE': - // Members + // Members case 'MEMBER_CREATE': $resql = $this->db->query($sql); while ($resql && $obj = $this->db->fetch_array($resql)) { @@ -348,26 +349,26 @@ class InterfaceZapierTriggers extends DolibarrTriggers } $logtriggeraction = true; break; - // case 'MEMBER_VALIDATE': - // case 'MEMBER_SUBSCRIPTION': - // case 'MEMBER_NEW_PASSWORD': - // case 'MEMBER_RESILIATE': - // case 'MEMBER_DELETE': + // case 'MEMBER_VALIDATE': + // case 'MEMBER_SUBSCRIPTION': + // case 'MEMBER_NEW_PASSWORD': + // case 'MEMBER_RESILIATE': + // case 'MEMBER_DELETE': - // Projects - // case 'PROJECT_CREATE': - // case 'PROJECT_MODIFY': - // case 'PROJECT_DELETE': + // Projects + // case 'PROJECT_CREATE': + // case 'PROJECT_MODIFY': + // case 'PROJECT_DELETE': - // Project tasks - // case 'TASK_CREATE': - // case 'TASK_MODIFY': - // case 'TASK_DELETE': + // Project tasks + // case 'TASK_CREATE': + // case 'TASK_MODIFY': + // case 'TASK_DELETE': - // Task time spent - // case 'TASK_TIMESPENT_CREATE': - // case 'TASK_TIMESPENT_MODIFY': - // case 'TASK_TIMESPENT_DELETE': + // Task time spent + // case 'TASK_TIMESPENT_CREATE': + // case 'TASK_TIMESPENT_MODIFY': + // case 'TASK_TIMESPENT_DELETE': case 'TICKET_CREATE': $resql = $this->db->query($sql); // TODO voir comment regrouper les webhooks en un post @@ -379,20 +380,20 @@ class InterfaceZapierTriggers extends DolibarrTriggers } $logtriggeraction = true; break; - // case 'TICKET_MODIFY': - // break; - // case 'TICKET_DELETE': - // break; + // case 'TICKET_MODIFY': + // break; + // case 'TICKET_DELETE': + // break; - // Shipping - // case 'SHIPPING_CREATE': - // case 'SHIPPING_MODIFY': - // case 'SHIPPING_VALIDATE': - // case 'SHIPPING_SENTBYMAIL': - // case 'SHIPPING_BILLED': - // case 'SHIPPING_CLOSED': - // case 'SHIPPING_REOPEN': - // case 'SHIPPING_DELETE': + // Shipping + // case 'SHIPPING_CREATE': + // case 'SHIPPING_MODIFY': + // case 'SHIPPING_VALIDATE': + // case 'SHIPPING_SENTBYMAIL': + // case 'SHIPPING_BILLED': + // case 'SHIPPING_CLOSED': + // case 'SHIPPING_REOPEN': + // case 'SHIPPING_DELETE': } if ($logtriggeraction) { dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__." id=".$object->id); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 621de20afa6..8026793fb3a 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -729,7 +729,7 @@ class Cronjob extends CommonObject $this->note_private = trim($this->note_private); } if (isset($this->nbrun)) { - $this->nbrun = (is_numeric($this->nbrun)) ? (int) trim($this->nbrun) : 0; + $this->nbrun = (is_numeric($this->nbrun)) ? (int) trim((string) $this->nbrun) : 0; } if (isset($this->libname)) { $this->libname = trim($this->libname); @@ -1297,7 +1297,7 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs START ".$this->objectname."->".$this->methodename."(".$this->params."); (Note: Log for cron jobs may be into a different log file)", LOG_DEBUG); // Create Object for the called module - $nameofclass = $this->objectname; + $nameofclass = (string) $this->objectname; $object = new $nameofclass($this->db); if ($this->entity > 0) { $object->entity = $this->entity; // We work on a dedicated entity diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php index de7ec5c5b50..aa76563c82e 100644 --- a/htdocs/datapolicy/admin/setup.php +++ b/htdocs/datapolicy/admin/setup.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,24 +37,24 @@ $backtopage = GETPOST('backtopage', 'alpha'); $arrayofparameters = array(); $arrayofparameters['ThirdParty'] = array( - 'DATAPOLICY_TIERS_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), - 'DATAPOLICY_TIERS_PROSPECT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), - 'DATAPOLICY_TIERS_PROSPECT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), - 'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), - 'DATAPOLICY_TIERS_FOURNISSEUR'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'supplier', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_CLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_PROSPECT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_PROSPECT_CLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_FOURNISSEUR' => array('css' => 'minwidth200', 'picto' => img_picto('', 'supplier', 'class="pictofixedwidth"')), ); if (getDolGlobalString('DATAPOLICY_USE_SPECIFIC_DELAY_FOR_CONTACT')) { $arrayofparameters['Contact'] = array( - 'DATAPOLICY_CONTACT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), - 'DATAPOLICY_CONTACT_PROSPECT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), - 'DATAPOLICY_CONTACT_PROSPECT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), - 'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), - 'DATAPOLICY_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_CLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_PROSPECT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_PROSPECT_CLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_FOURNISSEUR' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), ); } if (isModEnabled('member')) { $arrayofparameters['Member'] = array( - 'DATAPOLICY_ADHERENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'member', 'class="pictofixedwidth"')), + 'DATAPOLICY_ADHERENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'member', 'class="pictofixedwidth"')), ); } @@ -79,15 +80,16 @@ if (!$user->admin) { } +'@phan-var-force array> $arrayofparameters'; + /* * Actions */ - foreach ($arrayofparameters as $title => $tab) { foreach ($tab as $key => $val) { // Modify constant only if key was posted (avoid resetting key to the null value) if (GETPOSTISSET($key)) { - if (preg_match('/category:/', $val['type'])) { + if (preg_match('/category:/', (string) $val['type'])) { if (GETPOSTINT($key) == '-1') { $val_const = ''; } else { diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 943c2e57956..ca90c123829 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 William Mead + * 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 @@ -463,6 +464,7 @@ class DataPolicyCron foreach ($arrayofparameters as $key => $params) { if (getDolGlobalInt($key) > 0) { + // @phan-suppress-next-line PhanPluginPrintfVariableFormatString $sql = sprintf($params['sql'], (int) $conf->entity, (int) getDolGlobalInt($key), (int) getDolGlobalInt($key)); $resql = $this->db->query($sql); diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index ad1b7cb1290..4ccc4510355 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -97,7 +97,7 @@ $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack( /** * @param string $username Username to validate as a login * @param string $password Password to validate for $username - * @return true True if login ok, false if not + * @return bool True if login ok, false if not */ static function ($username, $password) { global $user, $conf; @@ -247,7 +247,7 @@ $server->addPlugin($tempFF); */ // And off we go! -$server->exec(); +$server->start(); if (is_object($db)) { $db->close(); diff --git a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php index c074068dba1..a114937ce59 100644 --- a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,6 +64,7 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid $info = $langs->trans('Host').': '.$conf->db->host.'
    '; $info .= $langs->trans('Port').': '.$conf->db->port.'
    '; $info .= $langs->trans('Name').': '.$conf->db->name.'
    '; + // @phan-suppress-next-line PhanTypeSuspiciousStringExpression $info .= $langs->trans('User').': '.$conf->db->user.'
    '; $info .= $langs->trans('Type').': '.$conf->db->type.'
    '; $info .= $langs->trans('Prefix').': '.$conf->db->prefix.'
    '; diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 6f9af2136c7..013a31b66ac 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -494,7 +495,7 @@ class TraceableDB extends DoliDB * Create a table into database * * @param string $table Name of table - * @param array $fields Tableau associatif [nom champ][tableau des descriptions] + * @param array|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}> $fields Associative table [field name][table of descriptions] * @param string $primary_key Nom du champ qui sera la clef primaire * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur @@ -533,7 +534,7 @@ class TraceableDB extends DoliDB * * @param string $table Name of table * @param string $field_name Name of field to add - * @param string $field_desc Tableau associatif de description du champ a inserer[nom du parameter][valeur du parameter] + * @param array{type:string,label:string,enabled:int|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} $field_desc Tableau associatif de description du champ a inserer[nom du parameter][valeur du parameter] * @param string $field_position Optionnel ex.: "after champtruc" * @return int Return integer <0 if KO, >0 if OK */ @@ -559,7 +560,7 @@ class TraceableDB extends DoliDB * * @param string $table Name of table * @param string $field_name Name of field to modify - * @param string $field_desc Array with description of field format + * @param array{type:string,label:string,enabled:int|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} $field_desc Array with description of field format * @return int Return integer <0 if KO, >0 if OK */ public function DDLUpdateField($table, $field_name, $field_desc) diff --git a/htdocs/debugbar/class/autoloader.php b/htdocs/debugbar/class/autoloader.php index b5e54aa29dd..df0c22e9e11 100644 --- a/htdocs/debugbar/class/autoloader.php +++ b/htdocs/debugbar/class/autoloader.php @@ -3,12 +3,14 @@ */ /** * Simple autoloader, so we don't need Composer just for this. + * + * @phan-file-suppress PhanTypeMismatchArgumentInternal */ spl_autoload_register( /** * @param string $class Class to load - * @return true If class could be loaded + * @return bool If class could be loaded */ static function ($class) { if (preg_match('/^DebugBar/', $class)) { diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index b4d139a0120..9b964889136 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -615,7 +616,7 @@ class Delivery extends CommonObject $result = $line->insertExtraFields(); if ($result < 0) { - $this->error[] = $line->error; + $this->errors[] = $line->error; $error++; } } @@ -632,7 +633,7 @@ class Delivery extends CommonObject * Add line * * @param int $origin_id Origin id - * @param int $qty Qty + * @param float $qty Qty * @param array $array_options Array options * @return void */ @@ -826,7 +827,7 @@ class Delivery extends CommonObject global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/delivery/tpl/linkedobjectblock.tpl.php b/htdocs/delivery/tpl/linkedobjectblock.tpl.php index 3c7e12abe45..16eb40fc209 100644 --- a/htdocs/delivery/tpl/linkedobjectblock.tpl.php +++ b/htdocs/delivery/tpl/linkedobjectblock.tpl.php @@ -20,7 +20,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } print "\n"; diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 3a0854cb103..b88040c2ed7 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -64,9 +64,9 @@ if ($action == 'specimen') { $dir = DOL_DOCUMENT_ROOT."/core/modules/dons/"; $file = $modele.".modules.php"; if ($modele !== '' && file_exists($dir.$file)) { - $classname = $modele; require_once $dir.$file; + $classname = (string) $modele; $obj = new $classname($db); if ($obj->write_file($don, $langs) > 0) { diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 4bdcaa4a853..693b76e7b91 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -336,9 +336,9 @@ class Don extends CommonObject $this->amount = (float) $this->amount; $map = range(0, 9); - $len = dol_strlen($this->amount); + $len = dol_strlen((string) $this->amount); for ($i = 0; $i < $len; $i++) { - if (!isset($map[substr($this->amount, $i, 1)])) { + if (!isset($map[substr((string) $this->amount, $i, 1)])) { $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Amount')); $err++; $amount_invalid = 1; @@ -352,7 +352,7 @@ class Don extends CommonObject $err++; } else { if ($this->amount < $minimum && $minimum > 0) { - $error_string[] = $langs->trans('MinimumAmount', $langs->transnoentitiesnoconv('$minimum')); + $error_string[] = $langs->trans('MinimumAmount', $minimum); $err++; } } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 13ffaf15511..907ec01e668 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2019 Thibault FOUCART + * 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 @@ -465,10 +466,10 @@ while ($i < $imaxinloop) { if (!empty($obj->socid) && $company->id > 0) { print "
    ".$company->getNomUrl(1)."".$obj->societe."".((string) $obj->societe)."".$obj->societe."".((string) $obj->societe)."".$donationstatic->getFullName($langs)."'.dol_print_date($db->jdate($obj->datedon), 'day').'

    *** Check fields into extra table structure match table of definition. If not add column into table
    Repair llx_commande_fournisseur_dispatch.fk_commandefourndet
    Repair llx_receptiondet_batch.fk_commandefourndet
    Repair in progress. This may take a while.
    '; - $array = array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); + $array = array('-1' => ' ', '0' => $langs->trans('Product'), '1' => $langs->trans('Service')); print $form->selectarray('search_type', $array, $search_type); print '

    \n"; } - if ($myTmpObjectArray['includedocgeneration']) { + if (!empty($myTmpObjectArray['includedocgeneration'])) { /* * Document templates generators */ @@ -500,10 +500,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); + $className = substr($file, 0, dol_strlen($file) - 12); require_once $dir.'/'.$file; - $module = new $classname($db); + $module = new $className($db); $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index fbf37e0e025..4ff7f9ff232 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -116,7 +116,7 @@ class MyObject extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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'), diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 53c7957cf78..eb3c4d656a0 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -326,7 +326,8 @@ class modMyModule extends DolibarrModules /* END MODULEBUILDER TOPMENU MYOBJECT */ /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT */ - /*$this->menu[$r++]=array( + /* + $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry 'titre'=>'MyObject', @@ -341,6 +342,20 @@ class modMyModule extends DolibarrModules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'New_MyObject', + 'mainmenu'=>'mymodule', + 'leftmenu'=>'mymodule_myobject_new', + 'url'=>'/mymodule/myobject_card.php?action=create', + 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'isModEnabled("mymodule")', // Define condition to show or hide menu entry. Use 'isModEnabled("mymodule")' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'$user->hasRight("mymodule", "myobject", "write")' + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry @@ -355,20 +370,7 @@ class modMyModule extends DolibarrModules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'New_MyObject', - 'mainmenu'=>'mymodule', - 'leftmenu'=>'mymodule_myobject_new', - 'url'=>'/mymodule/myobject_card.php?action=create', - 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'isModEnabled("mymodule")', // Define condition to show or hide menu entry. Use 'isModEnabled("mymodule")' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->hasRight("mymodule", "myobject", "write")' - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both - );*/ + */ /* END MODULEBUILDER LEFTMENU MYOBJECT */ diff --git a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php index f34850b5166..b655a692c62 100644 --- a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php +++ b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 8b0077b8f49..32a980784e1 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -1,5 +1,6 @@ * * 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 @@ -53,7 +54,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers } /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarr business event is done. * All functions "runTrigger" are triggered if file * is inside directory core/triggers * @@ -64,7 +65,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers * @param Conf $conf Object conf * @return int Return integer <0 if KO, 0 if no triggered ran, >0 if OK */ - public function runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (!isModEnabled('mymodule')) { return 0; // If module is not enabled, we do nothing @@ -138,7 +139,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_DELETE': //case 'ORDER_CANCEL': //case 'ORDER_SENTBYMAIL': - //case 'ORDER_CLASSIFY_BILLED': + //case 'ORDER_CLASSIFY_BILLED': // TODO Replace it with ORDER_BILLED + //case 'ORDER_CLASSIFY_UNBILLED': // TODO Replace it with ORDER_UNBILLED //case 'ORDER_SETDRAFT': //case 'LINEORDER_INSERT': //case 'LINEORDER_UPDATE': @@ -150,6 +152,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_SUPPLIER_VALIDATE': //case 'ORDER_SUPPLIER_DELETE': //case 'ORDER_SUPPLIER_APPROVE': + //case 'ORDER_SUPPLIER_CLASSIFY_BILLED': // TODO Replace with ORDER_SUPPLIER_BILLED + //case 'ORDER_SUPPLIER_CLASSIFY_UNBILLED': // TODO Replace with ORDER_SUPPLIER_UNBILLED //case 'ORDER_SUPPLIER_REFUSE': //case 'ORDER_SUPPLIER_CANCEL': //case 'ORDER_SUPPLIER_SENTBYMAIL': @@ -164,6 +168,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'PROPAL_MODIFY': //case 'PROPAL_VALIDATE': //case 'PROPAL_SENTBYMAIL': + //case 'PROPAL_CLASSIFY_BILLED': // TODO Replace it with PROPAL_BILLED + //case 'PROPAL_CLASSIFY_UNBILLED': // TODO Replace it with PROPAL_UNBILLED //case 'PROPAL_CLOSE_SIGNED': //case 'PROPAL_CLOSE_REFUSED': //case 'PROPAL_DELETE': @@ -239,6 +245,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'FICHINTER_CREATE': //case 'FICHINTER_MODIFY': //case 'FICHINTER_VALIDATE': + //case 'FICHINTER_CLASSIFY_BILLED': // TODO Replace it with FICHINTER_BILLED + //case 'FICHINTER_CLASSIFY_UNBILLED': // TODO Replace it with FICHINTER_UNBILLED //case 'FICHINTER_DELETE': //case 'LINEFICHINTER_CREATE': //case 'LINEFICHINTER_UPDATE': diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 87f3e4ed8e4..c7aca98e383 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -80,10 +80,8 @@ if (!$res) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - // load module libraries require_once __DIR__.'/class/myobject.class.php'; - // for other modules //dol_include_once('/othermodule/class/otherobject.class.php'); @@ -106,7 +104,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); // Load variable for pagination -$limit = GETPOSTINT('limit', $conf->liste_limit); +$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); @@ -147,8 +145,8 @@ foreach ($object->fields as $key => $val) { $search[$key] = GETPOST('search_'.$key, 'alpha'); } if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int')); - $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int')); + $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear')); + $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear')); } } @@ -514,7 +512,7 @@ $arrayofmassactions = array( if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { +if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 2951c1069eb..a67d23b6877 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2019 Maxime Kohlhaas + * 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 @@ -628,8 +629,7 @@ class Mos extends DolibarrApi } // Update status of MO - dol_syslog("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); - //var_dump("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); + dol_syslog("consumptioncomplete = ".json_encode($consumptioncomplete)." productioncomplete = ".json_encode($productioncomplete)); if ($consumptioncomplete && $productioncomplete) { $result = $this->mo->setStatut(Mo::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED'); } else { diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 082a27a1ead..c82f54d4568 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -94,7 +94,7 @@ class Mo extends CommonObject */ /** - * @var array|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}> 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,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}> 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",), @@ -1020,7 +1020,7 @@ class Mo extends CommonObject $dir = dol_buildpath($reldir."core/modules/mrp/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index d88c5755d45..97170377d71 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -432,7 +432,20 @@ if ($action == 'create') { print '
    '; print ''; - $object->lines = $objectbom->lines; + $arrayOfMoLines = array(); + foreach ($objectbom->lines as $key => $val) { + $moLine = new MoLine($db); + $moLine->id = $objectbom->lines[$key]->id; + $moLine->position = $objectbom->lines[$key]->position; + $moLine->fk_product = $objectbom->lines[$key]->fk_product; + $moLine->fk_unit = $objectbom->lines[$key]->fk_unit; + $moLine->qty = $objectbom->lines[$key]->qty; + $moLine->qty_frozen = $objectbom->lines[$key]->qty_frozen; + $moLine->disable_stock_change = $objectbom->lines[$key]->disable_stock_change; + + $arrayOfMoLines[] = $moLine; + } + $object->lines = $arrayOfMoLines; $object->mrptype = $objectbom->bomtype; $object->bom = $objectbom; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index c13813c342f..7926ba1cfcf 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -3,6 +3,7 @@ * Copyright (C) 2023 Christian Humpel * Copyright (C) 2023 Vincent de Grandpré * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -422,8 +423,7 @@ if (empty($reshook)) { } // Update status of MO - dol_syslog("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); - //var_dump("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); + dol_syslog("consumptioncomplete = ".json_encode($consumptioncomplete)." productioncomplete = ".json_encode($productioncomplete)); if ($consumptioncomplete && $productioncomplete) { $result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED'); } else { @@ -823,7 +823,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $url = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addconsumeline&token='.newToken(); $permissiontoaddaconsumeline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED; - $parameters = array('morecss'=>'reposition'); + $parameters = array('morecss' => 'reposition'); $newcardbutton = ''; if ($action != 'consumeorproduce' && $action != 'consumeandproduceall') { @@ -1432,7 +1432,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $newcardbutton = ''; $url = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addproduceline&token='.newToken(); $permissiontoaddaproductline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED; - $parameters = array('morecss'=>'reposition'); + $parameters = array('morecss' => 'reposition'); if ($action != 'consumeorproduce' && $action != 'consumeandproduceall') { if ($nblinetoproduce == 0 || $object->mrptype == 1) { $newcardbutton = dolGetButtonTitle($langs->trans('AddNewProduceLines'), '', 'fa fa-plus-circle size15x', $url, '', $permissiontoaddaproductline, $parameters); diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index 4bdad2cc588..094a6b0c21f 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -21,7 +21,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } print "\n"; diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index b4fbbfa998e..237a9914246 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -19,7 +19,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } '@phan-var-force CommonObject $this'; diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index f2ff645052c..ed4affb4e1a 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -5,6 +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 * * 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 @@ -90,7 +91,7 @@ class MultiCurrency extends CommonObject public $fk_user; /** - * @var CurrencyRate|null The currency rate + * @var ?CurrencyRate The currency rate */ public $rate; diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 836b3de06de..430dda9ec0a 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -12,6 +12,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2023 Lenin Rivas + * 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 @@ -93,23 +94,24 @@ if (empty($action)) { // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'cr.date_sync'=>"date_sync", - 'cr.rate'=>"rate", - 'cr.rate_indirect'=>"rate_indirect", - 'm.code'=>"code", + 'cr.date_sync' => "date_sync", + 'cr.rate' => "rate", + 'cr.rate_indirect' => "rate_indirect", + 'm.code' => "code", ); // 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), ); $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 // Access control // TODO Open this page to a given permission so a sale representative can modify change rates. Permission should be added into module multicurrency. @@ -242,7 +244,7 @@ if (empty($reshook)) { 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 $sall = ""; $search_date_sync = ""; - $search_date_sync_end=""; + $search_date_sync_end = ""; $search_rate = ""; $search_code = ""; $search_array_options = array(); @@ -403,13 +405,13 @@ if ($resql) { $param = "&search_date_sync=".$search_date_sync; } if ($search_date_sync_end) { - $param="&search_date_sync_end=".$search_date_sync_end; + $param = "&search_date_sync_end=".$search_date_sync_end; } if ($search_rate) { $param = "&search_rate=".urlencode($search_rate); } if ($search_code != '') { - $param.="&search_code=".urlencode($search_code); + $param .= "&search_code=".urlencode($search_code); } // Add $param from extra fields @@ -504,7 +506,7 @@ if ($resql) { } // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); + $parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -533,7 +535,7 @@ if ($resql) { } // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -669,5 +671,5 @@ if ($resql) { } - llxFooter(); - $db->close(); +llxFooter(); +$db->close(); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 8e57437c2cd..91e62bdd414 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -101,7 +101,7 @@ class Opensurveysondage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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,), diff --git a/htdocs/opensurvey/lib/opensurvey.lib.php b/htdocs/opensurvey/lib/opensurvey.lib.php index c2509c334ec..141f01ab5af 100644 --- a/htdocs/opensurvey/lib/opensurvey.lib.php +++ b/htdocs/opensurvey/lib/opensurvey.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Marcos García + * 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 @@ -217,7 +218,7 @@ function dol_survey_random($car) { $string = ""; $chaine = "abcdefghijklmnopqrstuvwxyz123456789"; - mt_srand((float) microtime() * 1000000); + mt_srand((int) ((float) microtime() * 1000000)); for ($i = 0; $i < $car; $i++) { $string .= $chaine[mt_rand() % strlen($chaine)]; } diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 3eca1f0e68f..ff15655c5ff 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -38,6 +38,7 @@ $_SESSION["formatsondage"] = "D"; $erreur = false; $erreurNbchoice = 0; +$choixdate = ''; /* * Actions @@ -178,7 +179,7 @@ if (GETPOST('confirmation')) { // Add survey into database if (!$erreur && $erreurNb == 0) { - $_SESSION["toutchoix"] = substr("$choixdate", 1); + $_SESSION["toutchoix"] = substr($choixdate, 1); unset($_SESSION["nbrecaseshoraires"]); ajouter_sondage(); diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 51e44645703..68ffaeb291c 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -104,7 +104,7 @@ class Partnership extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -205,7 +205,7 @@ class Partnership extends CommonObject public function create(User $user, $notrigger = 0) { if ($this->fk_soc <= 0 && $this->fk_member <= 0) { - $this->error[] = "ErrorThirpdartyOrMemberidIsMandatory"; + $this->errors[] = "ErrorThirpdartyOrMemberidIsMandatory"; return -1; } @@ -522,7 +522,7 @@ class Partnership extends CommonObject public function update(User $user, $notrigger = 0) { if ($this->fk_soc <= 0 && $this->fk_member <= 0) { - $this->error[] = "ErrorThirpdartyOrMemberidIsMandatory"; + $this->errors[] = "ErrorThirpdartyOrMemberidIsMandatory"; // Mistyping in key is in translations return -1; } if (empty($this->fk_user_creat)) { // For the case the object was created with empty user (from public page). @@ -1230,7 +1230,7 @@ class Partnership extends CommonObject $dir = dol_buildpath($reldir."core/modules/partnership/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 8248860f83b..4194b117698 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +92,7 @@ class PartnershipUtils dol_syslog(get_class($this)."::doCancelStatusOfMemberPartnership cancel expired partnerships with grace delay of ".$gracedelay); $now = dol_now(); - $datetotest = dol_time_plus_duree($now, -1 * abs($gracedelay), 'd'); + $datetotest = dol_time_plus_duree($now, -1 * abs((float) $gracedelay), 'd'); $this->db->begin(); diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php index 92c39356a7f..9dd883cd2fb 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,7 +155,7 @@ class mod_partnership_standard extends ModeleNumRefPartnership if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_partnership_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 327b8e7988e..ccbda2e2e62 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -862,6 +862,7 @@ $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); +$textlate = ''; while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { diff --git a/htdocs/product/canvas/product/tpl/card_create.tpl.php b/htdocs/product/canvas/product/tpl/card_create.tpl.php index ca7f6000a82..c6802081d3b 100644 --- a/htdocs/product/canvas/product/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_create.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/product/canvas/product/tpl/card_edit.tpl.php b/htdocs/product/canvas/product/tpl/card_edit.tpl.php index be4d4099d9b..2caf95cd468 100644 --- a/htdocs/product/canvas/product/tpl/card_edit.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_edit.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php index 86bbf9627fa..1730a75a7c3 100644 --- a/htdocs/product/canvas/product/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/product/canvas/service/tpl/card_create.tpl.php b/htdocs/product/canvas/service/tpl/card_create.tpl.php index 73f79b6efdb..65d95524d03 100644 --- a/htdocs/product/canvas/service/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_create.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/product/canvas/service/tpl/card_edit.tpl.php b/htdocs/product/canvas/service/tpl/card_edit.tpl.php index a656d749a4b..d67a9cfa964 100644 --- a/htdocs/product/canvas/service/tpl/card_edit.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_edit.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/product/canvas/service/tpl/card_view.tpl.php b/htdocs/product/canvas/service/tpl/card_view.tpl.php index 9c9c15efb27..402c604d9ff 100644 --- a/htdocs/product/canvas/service/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_view.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 086163975a3..0f927f3a6e9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -703,8 +703,8 @@ if (empty($reshook)) { $object->setCategories($categories); if (!empty($backtopage)) { - $backtopage = preg_replace('/__ID__/', $object->id, $backtopage); // New method to autoselect parent project after a New on another form object creation - $backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect parent after a New on another form object creation + $backtopage = preg_replace('/__ID__/', (string) $object->id, $backtopage); // New method to autoselect parent project after a New on another form object creation + $backtopage = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $backtopage); // New method to autoselect parent after a New on another form object creation if (preg_match('/\?/', $backtopage)) { $backtopage .= '&productid='.$object->id; // Old method } @@ -807,7 +807,7 @@ if (empty($reshook)) { if ($fk_default_bom >= 0) { $object->fk_default_bom = $fk_default_bom; } else { - $object->fk_default_bom = null; + $object->fk_default_bom = 0; } $units = GETPOSTINT('units'); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5c59e925394..040f4d77183 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -184,6 +184,7 @@ class Product extends CommonObject * @var string */ public $price_base_type; + public $price_label; //! Arrays for multiprices public $multiprices = array(); @@ -310,7 +311,7 @@ class Product extends CommonObject /** * Status indicates whether the product is on sale '1' or not '0' * @var int - * @deprecated + * @deprecated Use $status instead * @see $status */ public $tosell; @@ -325,7 +326,7 @@ class Product extends CommonObject /** * Status indicate whether the product is available for purchase '1' or not '0' * @var int - * @deprecated + * @deprecated Use $status_buy instead * @see $status_buy */ public $tobuy; @@ -333,7 +334,7 @@ class Product extends CommonObject /** * Status indicates whether the product is a finished product '1' or a raw material '0' * - * @var int + * @var ?int */ public $finished; @@ -583,7 +584,7 @@ class Product extends CommonObject */ /** - * @var array|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}> 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,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}> 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, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), @@ -684,6 +685,7 @@ class Product extends CommonObject $this->price = (float) price2num($this->price); $this->price_min_ttc = (float) price2num($this->price_min_ttc); $this->price_min = (float) price2num($this->price_min); + $this->price_label = trim($this->price_label); if (empty($this->tva_tx)) { $this->tva_tx = 0; } @@ -826,6 +828,7 @@ class Product extends CommonObject $sql .= ", price"; $sql .= ", price_ttc"; $sql .= ", price_base_type"; + $sql .= ", price_label"; $sql .= ", tobuy"; $sql .= ", tosell"; if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { @@ -853,6 +856,7 @@ class Product extends CommonObject $sql .= ", ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= ", ".((int) $user->id); $sql .= ", ".((int) $this->type); + $sql .= ", ".(!empty($this->price_label) ? "'".$this->db->escape($this->price_label)."'" : "null"); $sql .= ", ".price2num($price_ht, 'MT'); $sql .= ", ".price2num($price_ttc, 'MT'); $sql .= ", '".$this->db->escape($this->price_base_type)."'"; @@ -1894,13 +1898,13 @@ class Product extends CommonObject while ($obj = $this->db->fetch_object($result)) { //print 'lang='.$obj->lang.' current='.$current_lang.'
    '; if ($obj->lang == $current_lang) { // si on a les traduct. dans la langue courante on les charge en infos principales. - $this->label = $obj->label; + $this->label = $obj->label; $this->description = $obj->description; - $this->other = $obj->other; + $this->other = $obj->other; } - $this->multilangs["$obj->lang"]["label"] = $obj->label; - $this->multilangs["$obj->lang"]["description"] = $obj->description; - $this->multilangs["$obj->lang"]["other"] = $obj->other; + $this->multilangs[(string) $obj->lang]["label"] = $obj->label; + $this->multilangs[(string) $obj->lang]["description"] = $obj->description; + $this->multilangs[(string) $obj->lang]["other"] = $obj->other; } return 1; } else { @@ -1965,9 +1969,9 @@ class Product extends CommonObject } // Add new price - $sql = "INSERT INTO ".$this->db->prefix()."product_price(price_level,date_price, fk_product, fk_user_author, price, price_ttc, price_base_type,tosell, tva_tx, default_vat_code, recuperableonly,"; + $sql = "INSERT INTO ".$this->db->prefix()."product_price(price_level,date_price, fk_product, fk_user_author, price_label, price, price_ttc, price_base_type,tosell, tva_tx, default_vat_code, recuperableonly,"; $sql .= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, price_min,price_min_ttc,price_by_qty,entity,fk_price_expression) "; - $sql .= " VALUES(".($level ? ((int) $level) : 1).", '".$this->db->idate($now)."', ".((int) $this->id).", ".((int) $user->id).", ".((float) price2num($this->price)).", ".((float) price2num($this->price_ttc)).",'".$this->db->escape($this->price_base_type)."',".((int) $this->status).", ".((float) price2num($this->tva_tx)).", ".($this->default_vat_code ? ("'".$this->db->escape($this->default_vat_code)."'") : "null").", ".((int) $this->tva_npr).","; + $sql .= " VALUES(".($level ? ((int) $level) : 1).", '".$this->db->idate($now)."', ".((int) $this->id).", ".((int) $user->id).", ".(empty($this->price_label) ? "null" : "'".$this->db->escape($this->price_label)."'").", ".((float) price2num($this->price)).", ".((float) price2num($this->price_ttc)).",'".$this->db->escape($this->price_base_type)."',".((int) $this->status).", ".((float) price2num($this->tva_tx)).", ".($this->default_vat_code ? ("'".$this->db->escape($this->default_vat_code)."'") : "null").", ".((int) $this->tva_npr).","; $sql .= " ".price2num($this->localtax1_tx).", ".price2num($this->localtax2_tx).", '".$this->db->escape($this->localtax1_type)."', '".$this->db->escape($this->localtax2_type)."', ".price2num($this->price_min).", ".price2num($this->price_min_ttc).", ".price2num($this->price_by_qty).", ".((int) $conf->entity).",".($this->fk_price_expression > 0 ? ((int) $this->fk_price_expression) : 'null'); $sql .= ")"; @@ -2139,7 +2143,7 @@ class Product extends CommonObject * @param int $product_id Filter on a particular product id * @param string $fourn_ref Filter on a supplier price ref. 'none' to exclude ref in search. * @param int $fk_soc If of supplier - * @return int Return integer <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) + * @return int|string Return integer <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...), or printable result of hook * @see getSellPrice(), find_min_price_product_fournisseur() */ public function get_buyprice($prodfournprice, $qty, $product_id = 0, $fourn_ref = '', $fk_soc = 0) @@ -2304,7 +2308,7 @@ class Product extends CommonObject * @param double $newprice New price * @param string $newpricebase HT or TTC * @param User $user Object user that make change - * @param double $newvat New VAT Rate (For example 8.5. Should not be a string) + * @param ?double $newvat New VAT Rate (For example 8.5. Should not be a string) * @param double $newminprice New price min * @param int $level 0=standard, >0 = level if multilevel prices * @param int $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT @@ -2312,10 +2316,11 @@ class Product extends CommonObject * @param int $ignore_autogen Used to avoid infinite loops * @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). * @param string $newdefaultvatcode Default vat code + * @param string $price_label Price Label * @param int $notrigger Disable triggers * @return int Return integer <0 if KO, >0 if OK */ - public function updatePrice($newprice, $newpricebase, $user, $newvat = '', $newminprice = 0, $level = 0, $newnpr = 0, $newpbq = 0, $ignore_autogen = 0, $localtaxes_array = array(), $newdefaultvatcode = '', $notrigger = 0) + public function updatePrice($newprice, $newpricebase, $user, $newvat = null, $newminprice = 0, $level = 0, $newnpr = 0, $newpbq = 0, $ignore_autogen = 0, $localtaxes_array = array(), $newdefaultvatcode = '', $price_label = '', $notrigger = 0) { global $conf, $langs; @@ -2337,7 +2342,7 @@ class Product extends CommonObject } // Check parameters - if ($newvat == '') { + if ($newvat === null || $newvat == '') { // Maintain '' for backwards compatibility $newvat = $this->tva_tx; } @@ -2439,6 +2444,7 @@ class Product extends CommonObject $sql .= " localtax1_type = ".($localtaxtype1 != '' ? "'".$this->db->escape($localtaxtype1)."'" : "'0'").","; $sql .= " localtax2_type = ".($localtaxtype2 != '' ? "'".$this->db->escape($localtaxtype2)."'" : "'0'").","; $sql .= " default_vat_code = ".($newdefaultvatcode ? "'".$this->db->escape($newdefaultvatcode)."'" : "null").","; + $sql .= " price_label = ".(!empty($price_label) ? "'".$this->db->escape($price_label)."'" : "null").","; $sql .= " tva_tx = ".(float) price2num($newvat).","; $sql .= " recuperableonly = '".$this->db->escape($newnpr)."'"; $sql .= " WHERE rowid = ".((int) $id); @@ -2456,6 +2462,7 @@ class Product extends CommonObject $this->multiprices_recuperableonly[$level] = $newnpr; $this->price = $price; + $this->price_label = $price_label; $this->price_ttc = $price_ttc; $this->price_min = $price_min; $this->price_min_ttc = $price_min_ttc; @@ -2463,6 +2470,7 @@ class Product extends CommonObject $this->default_vat_code = $newdefaultvatcode; $this->tva_tx = $newvat; $this->tva_npr = $newnpr; + //Local taxes $this->localtax1_tx = $localtax1; $this->localtax2_tx = $localtax2; @@ -2580,6 +2588,7 @@ class Product extends CommonObject } $sql .= " p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.sell_or_eat_by_mandatory, p.batch_mask, p.fk_unit,"; $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf,"; + $sql .= " p.price_label,"; if ($separatedStock) { $sql .= " SUM(sp.reel) as stock"; } else { @@ -2623,6 +2632,7 @@ class Product extends CommonObject } $sql .= " p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.sell_or_eat_by_mandatory, p.batch_mask, p.fk_unit,"; $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf"; + $sql .= " ,p.price_label"; if (!$separatedStock) { $sql .= ", p.stock"; } @@ -2646,6 +2656,7 @@ class Product extends CommonObject $this->note = $obj->note_private; // deprecated $this->type = $obj->fk_product_type; + $this->price_label = $obj->price_label; $this->status = $obj->tosell; $this->status_buy = $obj->tobuy; $this->status_batch = $obj->tobatch; @@ -2742,6 +2753,7 @@ class Product extends CommonObject for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly"; + $sql .= " ,price_label"; $sql .= " FROM ".$this->db->prefix()."product_price"; $sql .= " WHERE entity IN (".getEntity('productprice').")"; $sql .= " AND price_level=".((int) $i); @@ -3470,11 +3482,11 @@ class Product extends CommonObject /** * Charge tableau des stats réception fournisseur pour le produit/service * - * @param int $socid Id societe pour filtrer sur une societe - * @param string $filtrestatut Id statut pour filtrer sur un statut - * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. + * @param int $socid Id societe pour filtrer sur une societe + * @param string $filtrestatut Id statut pour filtrer sur un statut + * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @param int $dateofvirtualstock Date of virtual stock - * @return int Array of stats in $this->stats_reception, <0 if ko or >0 if ok + * @return int Array of stats in $this->stats_reception, <0 if ko or >0 if ok */ public function load_stats_reception($socid = 0, $filtrestatut = '', $forVirtualStock = 0, $dateofvirtualstock = null) { @@ -3483,13 +3495,13 @@ class Product extends CommonObject $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_suppliers, COUNT(DISTINCT cf.rowid) as nb,"; $sql .= " COUNT(fd.rowid) as nb_rows, SUM(fd.qty) as qty"; - $sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as fd"; + $sql .= " FROM ".$this->db->prefix()."receptiondet_batch as fd"; $sql .= ", ".$this->db->prefix()."commande_fournisseur as cf"; $sql .= ", ".$this->db->prefix()."societe as s"; if (!$user->hasRight('societe', 'client', 'voir') && !$forVirtualStock) { $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; } - $sql .= " WHERE cf.rowid = fd.fk_commande"; + $sql .= " WHERE cf.rowid = fd.fk_element"; $sql .= " AND cf.fk_soc = s.rowid"; $sql .= " AND cf.entity IN (".getEntity($forVirtualStock && getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")"; $sql .= " AND fd.fk_product = ".((int) $this->id); @@ -3531,12 +3543,12 @@ class Product extends CommonObject /** * Charge tableau des stats production pour le produit/service * - * @param int $socid Id societe pour filtrer sur une societe - * @param string $filtrestatut Id statut pour filtrer sur un statut - * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. + * @param int $socid Id societe pour filtrer sur une societe + * @param string $filtrestatut Id statut pour filtrer sur un statut + * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @param int $dateofvirtualstock Date of virtual stock - * @param int $warehouseid Filter by a warehouse - * @return integer Array of stats in $this->stats_mrptoproduce (nb=nb of order, qty=qty ordered), <0 if ko or >0 if ok + * @param int $warehouseid Filter by a warehouse. Warning: When a filter on a warehous is set, it is not possible to calculate an accurate virtual stock because we can't knnow in which warehouse will be done virtual stock changes. + * @return integer Array of stats in $this->stats_mrptoproduce (nb=nb of order, qty=qty ordered), <0 if ko or >0 if ok */ public function load_stats_inproduction($socid = 0, $filtrestatut = '', $forVirtualStock = 0, $dateofvirtualstock = null, $warehouseid = 0) { @@ -3593,13 +3605,13 @@ class Product extends CommonObject $result = $this->db->query($sql); if ($result) { while ($obj = $this->db->fetch_object($result)) { - if ($obj->role == 'toconsume') { + if ($obj->role == 'toconsume' && empty($warehouseid)) { $this->stats_mrptoconsume['customers'] += $obj->nb_customers; $this->stats_mrptoconsume['nb'] += $obj->nb; $this->stats_mrptoconsume['rows'] += $obj->nb_rows; $this->stats_mrptoconsume['qty'] += ($obj->qty ? $obj->qty : 0); } - if ($obj->role == 'consumed') { + if ($obj->role == 'consumed' && empty($warehouseid)) { //$this->stats_mrptoconsume['customers'] += $obj->nb_customers; //$this->stats_mrptoconsume['nb'] += $obj->nb; //$this->stats_mrptoconsume['rows'] += $obj->nb_rows; @@ -4435,7 +4447,7 @@ class Product extends CommonObject * * @param int $id_pere Id of parent product/service * @param int $id_fils Id of child product/service - * @param int $qty Quantity + * @param float $qty Quantity * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @param int $notrigger Disable triggers * @return int Return integer < 0 if KO, > 0 if OK @@ -4508,7 +4520,7 @@ class Product extends CommonObject * * @param int $id_pere Id of parent product/service * @param int $id_fils Id of child product/service - * @param int $qty Quantity + * @param float $qty Quantity * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @param int $notrigger Disable triggers * @return int Return integer < 0 if KO, > 0 if OK @@ -4817,6 +4829,7 @@ class Product extends CommonObject $sql .= ", price_min"; $sql .= ", price_min_ttc"; $sql .= ", price_base_type"; + $sql .= ", price_label"; $sql .= ", default_vat_code"; $sql .= ", tva_tx"; $sql .= ", recuperableonly"; @@ -4844,6 +4857,7 @@ class Product extends CommonObject $sql .= ", price_min"; $sql .= ", price_min_ttc"; $sql .= ", price_base_type"; + $sql .= ", price_label"; $sql .= ", default_vat_code"; $sql .= ", tva_tx"; $sql .= ", recuperableonly"; @@ -5686,8 +5700,8 @@ class Product extends CommonObject $nbpiece = abs($nbpiece); } $op = array(); - $op[0] = "+".trim($nbpiece); - $op[1] = "-".trim($nbpiece); + $op[0] = "+".trim((string) $nbpiece); + $op[1] = "-".trim((string) $nbpiece); $movementstock = new MouvementStock($this->db); $movementstock->setOrigin($origin_element, $origin_id); // Set ->origin_type and ->origin_id @@ -5750,8 +5764,8 @@ class Product extends CommonObject } $op = array(); - $op[0] = "+".trim($nbpiece); - $op[1] = "-".trim($nbpiece); + $op[0] = "+".trim((string) $nbpiece); + $op[1] = "-".trim((string) $nbpiece); $movementstock = new MouvementStock($this->db); $movementstock->setOrigin($origin_element, $origin_id); // Set ->origin_type and ->fk_origin diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 7322dcdb0dd..b83dbae4b28 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014 Cedric GROSS * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -367,7 +368,7 @@ class Productbatch extends CommonObject $this->batch = trim($this->batch); } if (isset($this->qty)) { - $this->qty = (float) trim($this->qty); + $this->qty = (float) trim((string) $this->qty); } if (isset($this->import_key)) { $this->import_key = trim($this->import_key); diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 7120d9b3434..6eda4aaf297 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; class ProductCustomerPrice extends CommonObject { /** - * @var array|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}> 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,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}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 4, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'showoncombobox' => 1, 'noteditable' => 1), @@ -44,6 +44,7 @@ class ProductCustomerPrice extends CommonObject 'price_ttc' => array('type' => 'decimal(20,6)', 'label' => 'TTC', 'enabled' => 1, 'visible' => 1, 'position' => 8, 'notnull' => -1, 'comment' => 'Price TTC'), 'price_min' => array('type' => 'decimal(20,6)', 'label' => 'MinPriceHT', 'enabled' => 1, 'visible' => 1, 'position' => 9, 'notnull' => -1, 'comment' => 'Minimum Price'), 'price_min_ttc' => array('type' => 'decimal(20,6)', 'label' => 'MinPriceTTC', 'enabled' => 1, 'visible' => 1, 'position' => 10, 'notnull' => -1, 'comment' => 'Minimum Price TTC'), + 'price_label' => array('type' => 'varchar(255)', 'label' => 'PriceLabel', 'enabled' => 1, 'visible' => 1, 'position' => 20, 'notnull' => -1, 'comment' => 'Price Label'), 'fk_user' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => 1, 'position' => 510, 'notnull' => 1, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax100'), ); @@ -91,6 +92,7 @@ class ProductCustomerPrice extends CommonObject public $localtax1_tx; public $localtax2_type; public $localtax2_tx; + public $price_label; /** * @var int User ID @@ -170,6 +172,9 @@ class ProductCustomerPrice extends CommonObject if (isset($this->fk_user)) { $this->fk_user = (int) $this->fk_user; } + if (isset($this->price_label)) { + $this->price_label = trim($this->price_label); + } if (isset($this->import_key)) { $this->import_key = trim($this->import_key); } @@ -228,6 +233,7 @@ class ProductCustomerPrice extends CommonObject $sql .= "localtax2_type,"; $sql .= "localtax2_tx,"; $sql .= "fk_user,"; + $sql .= "price_label,"; $sql .= "import_key"; $sql .= ") VALUES ("; $sql .= " ".((int) $conf->entity).","; @@ -248,6 +254,7 @@ class ProductCustomerPrice extends CommonObject $sql .= " ".(empty($this->localtax2_type) ? "'0'" : "'".$this->db->escape($this->localtax2_type)."'").","; $sql .= " ".(!isset($this->localtax2_tx) ? 'NULL' : (empty($this->localtax2_tx) ? 0 : $this->localtax2_tx)).","; $sql .= " ".((int) $user->id).","; + $sql .= " ".(!isset($this->price_label) ? 'NULL' : "'".$this->db->escape($this->price_label)."'").","; $sql .= " ".(!isset($this->import_key) ? 'NULL' : "'".$this->db->escape($this->import_key)."'"); $sql .= ")"; @@ -321,6 +328,7 @@ class ProductCustomerPrice extends CommonObject $sql .= " t.localtax1_tx,"; $sql .= " t.localtax2_tx,"; $sql .= " t.fk_user,"; + $sql .= " t.price_label,"; $sql .= " t.import_key"; $sql .= " FROM ".$this->db->prefix()."product_customer_price as t"; $sql .= " WHERE t.rowid = ".((int) $id); @@ -350,6 +358,7 @@ class ProductCustomerPrice extends CommonObject $this->localtax1_tx = $obj->localtax1_tx; $this->localtax2_tx = $obj->localtax2_tx; $this->fk_user = $obj->fk_user; + $this->price_label = $obj->price_label; $this->import_key = $obj->import_key; $this->db->free($resql); @@ -407,6 +416,7 @@ class ProductCustomerPrice extends CommonObject $sql .= " t.localtax1_type,"; $sql .= " t.localtax2_type,"; $sql .= " t.fk_user,"; + $sql .= " t.price_label,"; $sql .= " t.import_key,"; $sql .= " soc.nom as socname,"; $sql .= " prod.ref as prodref"; @@ -483,6 +493,7 @@ class ProductCustomerPrice extends CommonObject $line->localtax1_type = $obj->localtax1_type; $line->localtax2_type = $obj->localtax2_type; $line->fk_user = $obj->fk_user; + $line->price_label = $obj->price_label; $line->import_key = $obj->import_key; $line->socname = $obj->socname; $line->prodref = $obj->prodref; @@ -535,6 +546,7 @@ class ProductCustomerPrice extends CommonObject $sql .= " t.localtax1_tx,"; $sql .= " t.localtax2_tx,"; $sql .= " t.fk_user,"; + $sql .= " t.price_label,"; $sql .= " t.import_key,"; $sql .= " soc.nom as socname,"; $sql .= " prod.ref as prodref"; @@ -590,6 +602,7 @@ class ProductCustomerPrice extends CommonObject $line->localtax1_tx = $obj->localtax1_tx; $line->localtax2_tx = $obj->localtax2_tx; $line->fk_user = $obj->fk_user; + $line->price_label = $obj->price_label; $line->import_key = $obj->import_key; $line->socname = $obj->socname; $line->prodref = $obj->prodref; @@ -662,6 +675,9 @@ class ProductCustomerPrice extends CommonObject if (isset($this->fk_user)) { $this->fk_user = (int) $this->fk_user; } + if (isset($this->price_label)) { + $this->price_label = trim($this->price_label); + } if (isset($this->import_key)) { $this->import_key = trim($this->import_key); } @@ -722,6 +738,7 @@ class ProductCustomerPrice extends CommonObject $sql .= "localtax1_type,"; $sql .= "localtax2_type,"; $sql .= "fk_user,"; + $sql .= "price_label,"; $sql .= "import_key"; $sql .= ") "; @@ -745,6 +762,7 @@ class ProductCustomerPrice extends CommonObject $sql .= " t.localtax1_type,"; $sql .= " t.localtax2_type,"; $sql .= " t.fk_user,"; + $sql .= " t.price_label,"; $sql .= " t.import_key"; $sql .= " FROM ".$this->db->prefix()."product_customer_price as t"; @@ -780,6 +798,7 @@ class ProductCustomerPrice extends CommonObject $sql .= " localtax1_type=".(!empty($this->localtax1_type) ? "'".$this->db->escape($this->localtax1_type)."'" : "'0'").","; $sql .= " localtax2_type=".(!empty($this->localtax2_type) ? "'".$this->db->escape($this->localtax2_type)."'" : "'0'").","; $sql .= " fk_user=".$user->id.","; + $sql .= " price_label=".(isset($this->price_label) ? "'".$this->db->escape($this->price_label)."'" : "null").","; $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= " WHERE rowid=".((int) $this->id); @@ -876,6 +895,7 @@ class ProductCustomerPrice extends CommonObject $prodsocpriceupd->price_base_type = $this->price_base_type; $prodsocpriceupd->tva_tx = $this->tva_tx; $prodsocpriceupd->recuperableonly = $this->recuperableonly; + $prodsocpriceupd->price_label = $this->price_label; $resultupd = $prodsocpriceupd->update($user, 0, $forceupdateaffiliate); if ($resultupd < 0) { @@ -894,6 +914,7 @@ class ProductCustomerPrice extends CommonObject $prodsocpricenew->price_base_type = $this->price_base_type; $prodsocpricenew->tva_tx = $this->tva_tx; $prodsocpricenew->recuperableonly = $this->recuperableonly; + $prodsocpricenew->price_label = $this->price_label; $resultupd = $prodsocpricenew->create($user, 0, $forceupdateaffiliate); if ($resultupd < 0) { @@ -1039,6 +1060,7 @@ class ProductCustomerPrice extends CommonObject $this->localtax1_tx = ''; $this->localtax2_tx = ''; $this->fk_user = 0; + $this->price_label = ''; $this->import_key = ''; return 1; @@ -1093,6 +1115,7 @@ class PriceByCustomerLine * @var int User ID */ public $fk_user; + public $price_label; public $import_key; public $socname; diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index d5f64ad5e0f..93666b0431b 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -92,7 +92,7 @@ class ProductFournisseurPrice extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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,), @@ -824,7 +824,7 @@ class ProductFournisseurPrice extends CommonObject $dir = dol_buildpath($reldir."core/modules/buypricehistory/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index c0ec8226e3d..11b8b1db214 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ion Agorria * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 13e793e2920..71de87fbb6a 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -96,7 +96,7 @@ class Inventory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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',), @@ -264,7 +264,6 @@ class Inventory extends CommonObject */ public function validate(User $user, $notrigger = 0, $include_sub_warehouse = 0) { - global $conf; $this->db->begin(); $result = 0; @@ -281,10 +280,17 @@ class Inventory extends CommonObject // Scan existing stock to prefill the inventory $sql = "SELECT ps.rowid, ps.fk_entrepot as fk_warehouse, ps.fk_product, ps.reel,"; - $sql .= " pb.batch, pb.qty"; + if (isModEnabled('productbatch')) { + $sql .= " pb.batch as batch, pb.qty as qty,"; + } else { + $sql .= " '' as batch, 0 as qty,"; + } + $sql .= " p.ref, p.tobatch"; $sql .= " FROM ".$this->db->prefix()."product_stock as ps"; - $sql .= " LEFT JOIN ".$this->db->prefix()."product_batch as pb ON pb.fk_product_stock = ps.rowid,"; - $sql .= " ".$this->db->prefix()."product as p, ".$this->db->prefix()."entrepot as e"; + if (isModEnabled('productbatch')) { + $sql .= " LEFT JOIN ".$this->db->prefix()."product_batch as pb ON pb.fk_product_stock = ps.rowid"; + } + $sql .= ", ".$this->db->prefix()."product as p, ".$this->db->prefix()."entrepot as e"; $sql .= " WHERE p.entity IN (".getEntity('product').")"; $sql .= " AND ps.fk_product = p.rowid AND ps.fk_entrepot = e.rowid"; if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { @@ -317,6 +323,7 @@ class Inventory extends CommonObject $sql .= " WHERE pa.fk_product_pere = ps.fk_product"; $sql .= ")"; } + $sql .= " ORDER BY p.rowid"; $inventoryline = new InventoryLine($this->db); @@ -335,10 +342,18 @@ class Inventory extends CommonObject $inventoryline->datec = dol_now(); if (isModEnabled('productbatch')) { + if ($obj->batch && empty($obj->tobatch)) { + // Bad consistency of data. The product is not a product with lot/serial but we found a stock for some lot/serial. + $result = -2; + $this->error = 'The product ID='.$obj->ref." has stock with lot/serial but is configured to not manage lot/serial. You must first fix this, this way: Set the product to have 'Management of Lot/Serial' to Yes, then set it back to 'Management of Lot/Serial to No"; + break; + } + $inventoryline->qty_stock = ($obj->batch ? $obj->qty : $obj->reel); // If there is batch detail, we take qty for batch, else global qty } else { $inventoryline->qty_stock = $obj->reel; } + //var_dump($obj->batch.' '.$obj->qty.' '.$obj->reel.' '.$this->error);exit; $resultline = $inventoryline->create($user); if ($resultline <= 0) { @@ -826,7 +841,7 @@ class InventoryLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 793e9cf3c3c..0aab3be055c 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -150,12 +150,15 @@ if (empty($reshook)) { $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.pmp_real'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); + $sql .= ' ORDER BY id.rowid'; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; $totalarray = array(); + $option = ''; + while ($i < $num) { $line = $db->fetch_object($resql); @@ -183,9 +186,10 @@ if (empty($reshook)) { $realqtynow = $product_static->stock_warehouse[$line->fk_warehouse]->detail_batch[$line->batch]->qty; } - if (!is_null($qty_view)) { $stock_movement_qty = price2num($qty_view - $realqtynow, 'MS'); + //print "Process inventory line ".$line->rowid." product=".$product_static->id." realqty=".$realqtynow." qty_stock=".$qty_stock." qty_view=".$qty_view." warehouse=".$line->fk_warehouse." qty to move=".$stock_movement_qty."
    \n"; + if ($stock_movement_qty != 0) { if ($stock_movement_qty < 0) { $movement_type = 1; @@ -926,7 +930,13 @@ if (isModEnabled('productbatch')) { print $langs->trans("Batch"); print ''; } -print '
    '; +if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { + // Expected quantity = If inventory is open: Quantity currently in stock (may change if stock movement are done during the inventory) + print ''; +} else { + // Expected quantity = If inventory is closed: Quantity we had in stock when we start the inventory. + print ''; +} if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { print ''; print ''; @@ -1060,7 +1070,8 @@ if ($resql) { print ''; } - // Expected quantity = Quantity in stock when we start inventory + // Expected quantity = If inventory is open: Quantity currently in stock (may change if stock movement are done during the inventory) + // Expected quantity = If inventory is closed: Quantity we had in stock when we start the inventory. print ''; + // Price Label + print ''; // Price by quantity @@ -1521,6 +1532,14 @@ if ($action == 'edit_price' && $object->getRights()->creer) { print ''; print ''; + // Price Label + print ''; + print ''; + $parameters = array(); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -1661,6 +1680,7 @@ if ((!getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || $action == 'showlog_defau $sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.recuperableonly, p.localtax1_tx, p.localtax1_type, p.localtax2_tx, p.localtax2_type,"; $sql .= " p.price_level, p.price_min, p.price_min_ttc,p.price_by_qty,"; $sql .= " p.date_price as dp, p.fk_price_expression, u.rowid as user_id, u.login"; + $sql .= " ,p.price_label"; $sql .= " FROM ".MAIN_DB_PREFIX."product_price as p,"; $sql .= " ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE fk_product = ".((int) $object->id); @@ -1740,6 +1760,7 @@ if ((!getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || $action == 'showlog_defau } print ''; print ''; + print ''; print ''; if ($user->hasRight('produit', 'supprimer')) { print ''; @@ -1869,6 +1890,11 @@ if ((!getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || $action == 'showlog_defau } print ''; + // Price Label + print ''; + // User print ''; + // Action if ($user->hasRight('produit', 'supprimer')) { $candelete = 0; @@ -2014,6 +2041,14 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { } print ''; + // Price Label + print ''; + print ''; + print '
    '.$langs->trans("ExpectedQty").''.$form->textwithpicto($langs->trans("ExpectedQty"), $langs->trans("QtyCurrentlyKnownInStock")).''.$form->textwithpicto($langs->trans("ExpectedQty"), $langs->trans("QtyInStockWhenInventoryWasValidated")).''.$langs->trans('PMPExpected').''.$langs->trans('ExpectedValuation').''; $valuetoshow = $obj->qty_stock; // For inventory not yet close, we overwrite with the real value in stock now diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 1fe8ae87fa5..d7f5d7450ba 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -14,6 +14,7 @@ * Copyright (C) 2020-2021 Open-DSI * Copyright (C) 2022 Charlene Benke * Copyright (C) 2020-2023 Alexandre Spangaro + * 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 @@ -296,7 +297,7 @@ if (getDolGlobalString('PRODUIT_MULTIPRICES')) { } else { $labelp = $langs->transnoentitiesnoconv("SellingPrice")." ".$i; } - $arrayfields['p.sellprice'.$i] = array('label' => $labelp, 'checked' => ($i == 1 ? 1 : 0), 'enabled' => getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => (float) ('40.'.sprintf('%03s', $i))); + $arrayfields['p.sellprice'.$i] = array('label' => $labelp, 'checked' => ($i == 1 ? 1 : 0), 'enabled' => getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => (float) ('40.'.sprintf('%03d', $i))); $arraypricelevel[$i] = array($i); } } @@ -307,6 +308,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 // Security check if ($search_type == '0') { diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 0af9c8052ae..8ed597110eb 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -37,7 +37,7 @@ $langs->loadLangs(array('commande', 'propal', 'bills', 'other', 'products')); $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -$type = GETPOSTINT("type"); +$type = GETPOST('type', 'intcomma'); $mode = GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : ''; // Security check diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 747604f0f70..0ece26ed6d8 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -123,6 +123,8 @@ if (empty($reshook)) { if (($action == 'update_vat') && !$cancel && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) { $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)' + $price_label = GETPOST('price_label', 'alpha'); + // We must define tva_tx, npr and local taxes $tva_tx = $tva_tx_txt; $reg = array(); @@ -190,6 +192,7 @@ if (empty($reshook)) { $object->localtax2_tx = $localtax2; $object->localtax1_type = $localtax1_type; $object->localtax2_type = $localtax2_type; + $object->price_label = $price_label; $db->begin(); @@ -216,7 +219,7 @@ if (empty($reshook)) { //$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2); $localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them. $level = $i; - $ret = $object->updatePrice($oldprice, $oldpricebasetype, $user, $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode); + $ret = $object->updatePrice($oldprice, $oldpricebasetype, $user, $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode, $price_label); if ($ret < 0) { $error++; @@ -238,7 +241,7 @@ if (empty($reshook)) { //$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2); $localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them when required. $level = 0; - $ret = $object->updatePrice($oldprice, $oldpricebasetype, $user, $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode); + $ret = $object->updatePrice($oldprice, $oldpricebasetype, $user, $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode, $price_label); if ($ret < 0) { $error++; @@ -292,7 +295,7 @@ if (empty($reshook)) { $newlocaltax2_type = GETPOST('localtax2_type', 'array'); //Shall we generate prices using price rules? - $object->price_autogen = GETPOST('usePriceRules') == 'on'; + $object->price_autogen = (int) (GETPOST('usePriceRules') == 'on'); for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { if (!isset($newprice[$i])) { @@ -382,6 +385,7 @@ if (empty($reshook)) { $newprice_min = price2num(GETPOST('price_min', 'alpha'), '', 2); $newpricebase = GETPOST('price_base_type', 'alpha'); $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)' + $price_label = GETPOST('price_label', 'alpha'); $tva_tx = $tva_tx_txt; $vatratecode = ''; @@ -447,6 +451,7 @@ if (empty($reshook)) { $pricestoupdate[0] = array( 'price' => $newprice, + 'price_label' => $price_label, 'price_min' => $newprice_min, 'price_base_type' => $newpricebase, 'default_vat_code' => $vatratecode, @@ -478,7 +483,7 @@ if (empty($reshook)) { // If price has changed, we update it if (!array_key_exists($key, $object->multiprices) || $object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) { - $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']); + $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code'], $val['price_label']); } else { $res = 0; } @@ -638,6 +643,7 @@ if (empty($reshook)) { $prodcustprice->price = price2num(GETPOST("price"), 'MU'); $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); + $prodcustprice->price_label = GETPOST("price_label", 'alpha'); $tva_tx_txt = GETPOST("tva_tx", 'alpha'); @@ -761,6 +767,7 @@ if (empty($reshook)) { $prodcustprice->price = price2num(GETPOST("price"), 'MU'); $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); + $prodcustprice->price_label = GETPOST("price_label", 'alpha'); $tva_tx_txt = GETPOST("tva_tx"); @@ -1234,7 +1241,11 @@ if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUS print ' - ' . price($object->price_min_ttc).' '.$langs->trans('TTC') . ''; } } + print '
    '.$langs->trans("PriceLabel").''; + print $object->price_label; print '
    '; + print $langs->trans('PriceLabel'); + print ''; + print ''; + print '
    '.$langs->trans("MinPrice").' '.$langs->trans("HT").''.$langs->trans("MinPrice").' '.$langs->trans("TTC").''.$langs->trans("Label").''.$langs->trans("ChangedBy").' '; + print $objp->price_label; + print ''; if ($objp->user_id > 0) { @@ -1878,6 +1904,7 @@ if ((!getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || $action == 'showlog_defau } print '
    '; + print $langs->trans('PriceLabel'); + print ''; + print ''; + print '
    '; print '
    '; @@ -2101,6 +2136,16 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { } print ''; + + + // Price Label + print ''; + print $langs->trans('PriceLabel'); + print ''; + print ''; + print ''; + print ''; + print ''; @@ -2164,6 +2209,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { } print ''.$langs->trans("MinPrice").' '.$langs->trans("HT").''; print ''.$langs->trans("MinPrice").' '.$langs->trans("TTC").''; + print ''.$langs->trans("PriceLabel").''; print ''.$langs->trans("ChangedBy").''; print ' '; print ''; @@ -2228,6 +2274,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { print ''.price($line->price_min).''; print ''.price($line->price_min_ttc).''; + print ''.$line->price_label.''; // User $userstatic = new User($db); @@ -2272,7 +2319,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { print ''."\n"; if (count($prodcustprice->lines) > 0 || $search_soc) { - $colspan = 9; + $colspan = 10; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { $colspan++; } @@ -2301,6 +2348,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { } print ''; print ''; + print ''; print ''; print ''; print ''; @@ -2360,6 +2408,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { print ''; print ''; + print ''; print ''; if ($user->hasRight('produit', 'supprimer') || $user->hasRight('service', 'supprimer')) { @@ -2438,6 +2487,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { print ''; print ''; + print ''; // User $userstatic = new User($db); diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php index 73714afa21c..4e9cc30d12a 100644 --- a/htdocs/product/stats/bom.php +++ b/htdocs/product/stats/bom.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2020 Floiran Henry + * 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 @@ -265,10 +266,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) $search_month); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) $search_year); } print ''."\n"; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index c812e507035..3cf0ae94ee5 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -8,6 +8,7 @@ * Copyright (C) 2021 Frédéric France * Copyright (C) 2022-2023 Charlene Benke * Copyright (C) 2023 Christian Foellmann + * 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 @@ -164,7 +165,7 @@ if (empty($reshook)) { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); if (!empty($backtopage)) { - $backtopage = str_replace("__ID__", $id, $backtopage); + $backtopage = str_replace("__ID__", (string) $id, $backtopage); header("Location: ".$backtopage); exit; } else { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 2ffb55706f8..a062d053ed9 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -121,7 +121,7 @@ class Entrepot extends CommonObject /** - * @var array|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}> 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,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}> 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' => 'ID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 74396b9ecc5..d4899512a9d 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -166,7 +166,7 @@ class MouvementStock extends CommonObject * @param User $user User object * @param int $fk_product Id of product * @param int $entrepot_id Id of warehouse - * @param int $qty Qty of movement (can be <0 or >0 depending on parameter type) + * @param float $qty Qty of movement (can be <0 or >0 depending on parameter type) * @param int $type Direction of movement: * 0=input (stock increase by a stock transfer), 1=output (stock decrease by a stock transfer), * 2=output (stock decrease), 3=input (stock increase) @@ -183,7 +183,7 @@ class MouvementStock extends CommonObject * @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (useful only if product is a subproduct) * @param int $donotcleanemptylines Do not clean lines in stock table with qty=0 (because we want to have this done by the caller) * @param boolean $force_update_batch Allows to add batch stock movement even if $product doesn't use batch anymore - * @return int Return integer <0 if KO, 0 if fk_product is null or product id does not exists, >0 if OK + * @return int|string Return integer <0 if KO, 0 if fk_product is null or product id does not exists, >0 if OK, or printabl result of hook */ public function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0, $disablestockchangeforsubproduct = 0, $donotcleanemptylines = 0, $force_update_batch = false) { @@ -194,7 +194,7 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; $error = 0; - dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch); + dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".json_encode($skip_batch)); // Call hook at beginning global $action, $hookmanager; @@ -747,7 +747,7 @@ class MouvementStock extends CommonObject * @param User $user Object user * @param int $idProduct Id product * @param int $entrepot_id Warehouse id - * @param int $qty Quantity + * @param float $qty Quantity * @param int $type Type * @param int $price Price * @param string $label Label of movement @@ -810,7 +810,7 @@ class MouvementStock extends CommonObject * @param User $user Object user * @param int $fk_product Id product * @param int $entrepot_id Warehouse id - * @param int $qty Quantity + * @param float $qty Quantity * @param int $price Price * @param string $label Label of stock movement * @param int|string $datem Force date of movement @@ -837,7 +837,7 @@ class MouvementStock extends CommonObject * @param User $user Object user * @param int $fk_product Id product * @param int $entrepot_id Warehouse id - * @param int $qty Quantity + * @param float $qty Quantity * @param int $price Price * @param string $label Label of stock movement * @param integer|string $eatby eat-by date @@ -893,7 +893,7 @@ class MouvementStock extends CommonObject * @param array|int $dluo Could be either * - int if row id of product_batch table (for update) * - or complete array('fk_product_stock'=>, 'batchnumber'=>) - * @param int $qty Quantity of product with batch number. May be a negative amount. + * @param float $qty Quantity of product with batch number. May be a negative amount. * @return int Return integer <0 if KO, -2 if we try to update a product_batchid that does not exist, else return productbatch id */ private function createBatch($dluo, $qty) @@ -962,8 +962,8 @@ class MouvementStock extends CommonObject /** * Return Url link of origin object * - * @param int $origin_id Id origin - * @param int $origin_type Type origin + * @param int $origin_id Id origin + * @param string $origin_type Type origin ('project', 'xxx@MODULENAME', etc) * @return string */ public function get_origin($origin_id, $origin_type) @@ -1014,7 +1014,7 @@ class MouvementStock extends CommonObject break; default: if ($origin_type) { - // Separate originetype with "@" : left part is class name, right part is module name + // Separate origin_type with "@" : left part is class name, right part is module name $origin_type_array = explode('@', $origin_type); $classname = $origin_type_array[0]; $modulename = empty($origin_type_array[1]) ? strtolower($classname) : $origin_type_array[1]; diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 537a4bb9b3d..edbf9be17b8 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -99,7 +99,7 @@ class Productlot extends CommonObject */ /** - * @var array|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}> 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,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}> 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'), @@ -854,8 +854,8 @@ class Productlot extends CommonObject $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,"; $sql .= " COUNT(cfd.rowid) as nb_rows, SUM(cfdi.qty) as qty"; - $sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as cfdi"; - $sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseurdet as cfd ON (cfd.rowid = cfdi.fk_commandefourndet)"; + $sql .= " FROM ".$this->db->prefix()."receptiondet_batch as cfdi"; + $sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseurdet as cfd ON (cfd.rowid = cfdi.fk_elementdet)"; $sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseur as cf ON (cf.rowid = cfd.fk_commande)"; // $sql .= ", ".$this->db->prefix()."societe as s"; if (!$user->hasRight('societe', 'client', 'voir')) { @@ -929,7 +929,7 @@ class Productlot extends CommonObject $sql = "SELECT COUNT(DISTINCT recep.fk_soc) as nb_customers, COUNT(DISTINCT recep.rowid) as nb,"; $sql .= " COUNT(cfdi.rowid) as nb_rows, SUM(cfdi.qty) as qty"; - $sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as cfdi"; + $sql .= " FROM ".$this->db->prefix()."receptiondet_batch as cfdi"; $sql .= " INNER JOIN ".$this->db->prefix()."reception as recep ON (recep.rowid = cfdi.fk_reception)"; // $sql .= ", ".$this->db->prefix()."societe as s"; if (!$user->hasRight('societe', 'client', 'voir')) { diff --git a/htdocs/product/stock/lib/replenishment.lib.php b/htdocs/product/stock/lib/replenishment.lib.php index 8751935cb13..e6bf9d8a060 100644 --- a/htdocs/product/stock/lib/replenishment.lib.php +++ b/htdocs/product/stock/lib/replenishment.lib.php @@ -38,7 +38,7 @@ function dolDispatchToDo($order_id) $ordered = array(); // Count nb of quantity dispatched per product - $sql = 'SELECT fk_product, SUM(qty) as qtydispatched FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; + $sql = 'SELECT fk_product, SUM(qty) as qtydispatched FROM '.MAIN_DB_PREFIX.'receptiondet_batch'; $sql .= ' WHERE fk_commande = '.((int) $order_id); $sql .= ' GROUP BY fk_product'; $sql .= ' ORDER by fk_product'; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index eae9deb3ef0..ae3f0f0f621 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -973,10 +973,10 @@ if ($resql) { $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['m.datec']['checked'])) { - print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + print_liste_field_titre($arrayfields['m.datec']['label'], $_SERVER["PHP_SELF"], "m.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } if (!empty($arrayfields['m.tms']['checked'])) { - print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + print_liste_field_titre($arrayfields['m.tms']['label'], $_SERVER["PHP_SELF"], "m.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 9a054d18375..34c08a3186f 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1365,10 +1365,10 @@ $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $warehouse, $action); // Note that $action and $warehouse may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['m.datec']['checked'])) { - print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + print_liste_field_titre($arrayfields['m.datec']['label'], $_SERVER["PHP_SELF"], "m.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } if (!empty($arrayfields['m.tms']['checked'])) { - print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + print_liste_field_titre($arrayfields['m.tms']['label'], $_SERVER["PHP_SELF"], "m.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 24e9d0d8a10..e83e505f3e0 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -451,7 +451,7 @@ if ($usevirtualstock) { $sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd4.qty) IS NULL", "0", "SUM(fd4.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlReceptionFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf4,"; - $sqlReceptionFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd4"; + $sqlReceptionFourn .= " ".MAIN_DB_PREFIX."receptiondet_batch as fd4"; $sqlReceptionFourn .= " WHERE fd4.fk_commande = cf4.rowid AND cf4.entity IN (".getEntity(getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")"; $sqlReceptionFourn .= " AND fd4.fk_product = p.rowid"; $sqlReceptionFourn .= " AND cf4.fk_statut IN (3,4))"; diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php index 7f362de5f01..a2e40c1db92 100644 --- a/htdocs/product/stock/stats/commande_fournisseur.php +++ b/htdocs/product/stock/stats/commande_fournisseur.php @@ -224,7 +224,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur as cf ON (cf.fk_soc = s.rowid)"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cfd ON (cfd.fk_commande = cf.rowid)"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfdi ON (cfdi.fk_commandefourndet = cfd.rowid)"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."receptiondet_batch as cfdi ON (cfdi.fk_elementdet = cfd.rowid)"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php index ced528e301d..e9061222cc3 100644 --- a/htdocs/product/stock/stats/reception.php +++ b/htdocs/product/stock/stats/reception.php @@ -223,7 +223,7 @@ if ($id > 0 || !empty($ref)) { } $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."reception as recep ON (recep.fk_soc = s.rowid)"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as d ON (d.fk_reception = recep.rowid)"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."receptiondet_batch as d ON (d.fk_reception = recep.rowid)"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index f29ae639830..a8e1267175d 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -124,7 +124,7 @@ class StockTransfer extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -975,7 +975,7 @@ class StockTransfer extends CommonObject $dir = dol_buildpath($reldir."core/modules/stocktransfer/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index af7e7946e72..cd77a955806 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -94,7 +94,7 @@ class StockTransferLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -429,8 +429,8 @@ class StockTransferLine extends CommonObjectLine $p->fetch($this->fk_product); $op = array(); - $op[0] = "+".trim($this->qty); - $op[1] = "-".trim($this->qty); + $op[0] = "+".trim((string) $this->qty); + $op[1] = "-".trim((string) $this->qty); $movementstock = new MouvementStock($this->db); $st = new StockTransfer($this->db); $movementstock->origin_type = $st->origin_type; @@ -939,7 +939,7 @@ class StockTransferLine extends CommonObjectLine $dir = dol_buildpath($reldir."core/modules/stocktransfer/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/product/stock/tpl/extrafields_add.tpl.php b/htdocs/product/stock/tpl/extrafields_add.tpl.php index 05a4436e82b..d880e516500 100644 --- a/htdocs/product/stock/tpl/extrafields_add.tpl.php +++ b/htdocs/product/stock/tpl/extrafields_add.tpl.php @@ -28,7 +28,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } ?> diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 87f6acee486..708c527ee6a 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -22,7 +22,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } ?> diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index b24230fdf38..13f54ce6b56 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -22,7 +22,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } ?> diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index 9dc673aa745..94741d31e4d 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -136,18 +136,16 @@ if ($action == 'updateMaskTask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/project/task/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); @@ -842,16 +840,14 @@ print '', - '', - '', - ''; - +print ''; +print ''; +print ''; +print ''; print '
    '.$langs->trans("MinPrice").' '.$langs->trans("HT").''.$langs->trans("MinPrice").' '.$langs->trans("TTC").''.$langs->trans("PriceLabel").''.$langs->trans("ChangedBy").'
    '.price($object->price_min).''.price($object->price_min_ttc).''.$object->price_label.''; print ''.price($line->price_min).''.price($line->price_min_ttc).''.$line->price_label.'
    ', - $form->textwithpicto($langs->transnoentities($key), $langs->transnoentities($key . '_help')), - '', - ajax_constantonoff($key), - '
    '; +print $form->textwithpicto($langs->transnoentities('PROJECT_DISPLAY_LINKED_BY_CONTACT'), $langs->transnoentities('PROJECT_DISPLAY_LINKED_BY_CONTACT_help')); +print ''; +print ajax_constantonoff('PROJECT_DISPLAY_LINKED_BY_CONTACT'); +print '
    '; print ''; diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index d06cde2a04b..966d6f212ff 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,7 +84,7 @@ if (!$user->hasRight('projet', 'lire')) { * Actions */ -$parameters = array('id'=>$socid); +$parameters = array('id' => $socid); $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'); @@ -129,7 +130,7 @@ print dol_get_fiche_head($head, 'agenda', $langs->trans("Project"), -1, ($object if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { $tmpurl = $_SESSION['pageforbacktolist']['project']; - $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); $linkback = '
    '.$langs->trans("BackToList").''; } else { $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6925294ec2d..3c7e60e8173 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -271,7 +271,7 @@ if (empty($reshook)) { $db->commit(); if (!empty($backtopage)) { - $backtopage = preg_replace('/--IDFORBACKTOPAGE--|__ID__/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation + $backtopage = preg_replace('/--IDFORBACKTOPAGE--|__ID__/', (string) $object->id, $backtopage); // New method to autoselect project after a New on another form object creation $backtopage = $backtopage.'&projectid='.$object->id; // Old method header("Location: ".$backtopage); exit; @@ -508,7 +508,7 @@ if (empty($reshook)) { if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { $tmpurl = $_SESSION['pageforbacktolist']['project']; - $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); $urlback = $tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1'; } else { $urlback = DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1'; @@ -1300,7 +1300,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { $tmpurl = $_SESSION['pageforbacktolist']['project']; - $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); $linkback = ''.$langs->trans("BackToList").''; } else { $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ad0fa548c13..779f4995f51 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -155,7 +155,7 @@ class Project extends CommonObject public $public; //!< Tell if this is a public or private project /** - * @var float budget Amount + * @var float|string budget Amount (May need price2num) */ public $budget_amount; @@ -190,17 +190,17 @@ class Project extends CommonObject public $accept_booth_suggestions; /** - * @var float Event organization: registration price + * @var float|string Event organization: registration price (may need price2num) */ public $price_registration; /** - * @var float Event organization: booth price + * @var float|string Event organization: booth price (may need price2num) */ public $price_booth; /** - * @var float Max attendees + * @var int|string Max attendees (may be empty/need cast to iint) */ public $max_attendees; @@ -293,7 +293,7 @@ class Project extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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' => 'ID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -480,16 +480,16 @@ class Project extends CommonObject $sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); $sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); $sql .= ", ".(strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : 'null'); - $sql .= ", ".(strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : 'null'); + $sql .= ", ".(strcmp((string) $this->budget_amount, '') ? price2num($this->budget_amount) : 'null'); $sql .= ", ".($this->usage_opportunity ? 1 : 0); $sql .= ", ".($this->usage_task ? 1 : 0); $sql .= ", ".($this->usage_bill_time ? 1 : 0); $sql .= ", ".($this->usage_organize_event ? 1 : 0); $sql .= ", ".($this->accept_conference_suggestions ? 1 : 0); $sql .= ", ".($this->accept_booth_suggestions ? 1 : 0); - $sql .= ", ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : 'null'); - $sql .= ", ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : 'null'); - $sql .= ", ".(strcmp($this->max_attendees, '') ? ((int) $this->max_attendees) : 'null'); + $sql .= ", ".(strcmp((string) $this->price_registration, '') ? price2num($this->price_registration) : 'null'); + $sql .= ", ".(strcmp((string) $this->price_booth, '') ? price2num($this->price_booth) : 'null'); + $sql .= ", ".(strcmp((string) $this->max_attendees, '') ? ((int) $this->max_attendees) : 'null'); $sql .= ", ".($this->date_start_event != '' ? "'".$this->db->idate($this->date_start_event)."'" : 'null'); $sql .= ", ".($this->date_end_event != '' ? "'".$this->db->idate($this->date_end_event)."'" : 'null'); $sql .= ", ".($this->location ? "'".$this->db->escape($this->location)."'" : 'null'); @@ -605,8 +605,8 @@ class Project extends CommonObject $sql .= ", accept_conference_suggestions = ".($this->accept_conference_suggestions ? 1 : 0); $sql .= ", accept_booth_suggestions = ".($this->accept_booth_suggestions ? 1 : 0); $sql .= ", price_registration = ".(isset($this->price_registration) && strcmp($this->price_registration, '') ? price2num($this->price_registration) : "null"); - $sql .= ", price_booth = ".(isset($this->price_booth) && strcmp($this->price_booth, '') ? price2num($this->price_booth) : "null"); - $sql .= ", max_attendees = ".(strcmp($this->max_attendees, '') ? price2num($this->max_attendees) : "null"); + $sql .= ", price_booth = ".(isset($this->price_booth) && strcmp((string) $this->price_booth, '') ? price2num($this->price_booth) : "null"); + $sql .= ", max_attendees = ".(strcmp((string) $this->max_attendees, '') ? (int) $this->max_attendees : "null"); $sql .= ", date_start_event = ".($this->date_start_event != '' ? "'".$this->db->idate($this->date_start_event)."'" : 'null'); $sql .= ", date_end_event = ".($this->date_end_event != '' ? "'".$this->db->idate($this->date_end_event)."'" : 'null'); $sql .= ", location = '".$this->db->escape($this->location)."'"; @@ -1688,7 +1688,7 @@ class Project extends CommonObject * @param bool $clone_task_file Clone file of task (if task are copied) * @param bool $clone_note Clone note of project * @param bool $move_date Move task date on clone - * @param integer $notrigger No trigger flag + * @param int $notrigger No trigger flag * @param int $newthirdpartyid New thirdparty id * @return int New id of clone */ @@ -1697,8 +1697,9 @@ class Project extends CommonObject global $langs, $conf; $error = 0; + $clone_project_id = 0; // For static toolcheck - dol_syslog("createFromClone clone_contact=".$clone_contact." clone_task=".$clone_task." clone_project_file=".$clone_project_file." clone_note=".$clone_note." move_date=".$move_date, LOG_DEBUG); + dol_syslog("createFromClone clone_contact=".json_encode($clone_contact)." clone_task=".json_encode($clone_task)." clone_project_file=".json_encode($clone_project_file)." clone_note=".json_encode($clone_note)." move_date=".json_encode($move_date), LOG_DEBUG); $now = dol_mktime(0, 0, 0, idate('m', dol_now()), idate('d', dol_now()), idate('Y', dol_now())); @@ -1900,7 +1901,7 @@ class Project extends CommonObject unset($clone_project->context['createfromclone']); - if (!$error) { + if (!$error && $clone_project_id != 0) { $this->db->commit(); return $clone_project_id; } else { @@ -2566,6 +2567,8 @@ class Project extends CommonObject $now = dol_now(); $nowDate = dol_getdate($now, true); + + $errormesg = ''; $errorsMsg = array(); $firstDayOfWeekTS = dol_get_first_day_week($nowDate['mday'], $nowDate['mon'], $nowDate['year']); @@ -2585,9 +2588,9 @@ class Project extends CommonObject u.email,u.weeklyhours, SUM(et.element_duration) AS total_seconds FROM - llx_element_time AS et + ".MAIN_DB_PREFIX."element_time AS et JOIN - llx_user AS u ON et.fk_user = u.rowid + ".MAIN_DB_PREFIX."user AS u ON et.fk_user = u.rowid WHERE et.element_date BETWEEN '".$this->db->escape($startDate)."' AND '".$this->db->escape($endDate)."' AND et.elementtype = 'task' @@ -2673,7 +2676,7 @@ class Project extends CommonObject $actioncomm->errors_to = $errors_to; $actioncomm->elementtype = 'project_task'; - $actioncomm->fk_element = $this->element; + $actioncomm->fk_element = (int) $this->element; $actioncomm->create($user); } else { @@ -2707,14 +2710,14 @@ class Project extends CommonObject $actioncomm->errors_to = $errors_to; $actioncomm->elementtype = 'project_task'; - $actioncomm->fk_element = $this->element; + $actioncomm->fk_element = (int) $this->element; $actioncomm->create($user); } $this->db->commit(); } } - if ($errormesg) { + if (!empty($errormesg)) { $errorsMsg[] = $errormesg; } @@ -2723,7 +2726,7 @@ class Project extends CommonObject dol_syslog(__METHOD__." end - ".$this->output, LOG_INFO); return 0; } else { - $this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? implode(', ', $errorsMsg) : $error; + $this->error = 'Nb of emails sent : '.$nbMailSend.', '.(empty($errorsMsg) ? $error : implode(', ', $errorsMsg)); dol_syslog(__METHOD__." end - ".$this->error, LOG_INFO); return $error; } diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index b671f147636..4a789b17d8b 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -1,6 +1,7 @@ + * 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 @@ -289,7 +290,7 @@ class ProjectStats extends Stats * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $wonlostfilter Add a filter on status won/lost - * @return array|int Array of values or <0 if error + * @return array|int<-1,-1> Array of values or <0 if error */ public function getWeightedAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $wonlostfilter = 1) { @@ -328,6 +329,7 @@ class ProjectStats extends Stats if ($foundintocache) { // Cache file found and is not too old dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); $data = json_decode(file_get_contents($newpathofdestfile), true); + '@phan-var-force array $data'; // Phan can not interpret json_decode } else { $year = $startyear; while ($year <= $endyear) { @@ -438,6 +440,7 @@ class ProjectStats extends Stats if ($foundintocache) { // Cache file found and is not too old dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); $data = json_decode(file_get_contents($newpathofdestfile), true); + '@phan-var-force array $data'; // Phan can not interpret json_decode } else { $year = $startyear; while ($year <= $endyear) { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 754f465e574..84d78726599 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -934,9 +934,9 @@ class Task extends CommonObjectLine * @param string $filteronproj Filter on project ref or label * @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated only) * @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...') - * @param string $filteronprojuser Filter on user that is a contact of project - * @param string $filterontaskuser Filter on user assigned to task - * @param Extrafields $extrafields Show additional column from project or task + * @param int $filteronprojuser Filter on user that is a contact of project + * @param int $filterontaskuser Filter on user assigned to task + * @param ?Extrafields $extrafields Show additional column from project or task * @param int $includebilltime Calculate also the time to bill and billed * @param array $search_array_options Array of search filters. Not Used yet. * @param int $loadextras Fetch all Extrafields on each project and task @@ -945,9 +945,9 @@ class Task extends CommonObjectLine * @param string $sortorder Sort order * @return array|string Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = null, $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') { - global $conf, $hookmanager; + global $hookmanager; $tasks = array(); @@ -1054,17 +1054,19 @@ class Task extends CommonObjectLine if ($filteronproj) { $sql .= natural_search(array("p.ref", "p.title"), $filteronproj); } - if ($filteronprojstatus && $filteronprojstatus != '-1') { + if ($filteronprojstatus && (int) $filteronprojstatus != '-1') { $sql .= " AND p.fk_statut IN (".$this->db->sanitize($filteronprojstatus).")"; } if ($morewherefilter) { $sql .= $morewherefilter; } + // Add where from extra fields $extrafieldsobjectkey = 'projet_task'; $extrafieldsobjectprefix = 'efpt.'; - global $db; // needed for extrafields_list_search_sql.tpl + global $db, $conf; // needed for extrafields_list_search_sql.tpl include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook @@ -1205,7 +1207,7 @@ class Task extends CommonObjectLine { $arrayroles = array(); - dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks userp=".is_object($userp)." usert=".is_object($usert)." projectid=".$projectid." taskid=".$taskid); + dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks userp=".json_encode(is_object($userp))." usert=".json_encode(is_object($usert))." projectid=".$projectid." taskid=".$taskid); // We want role of user for a projet or role of user for a task. Both are not possible. if (empty($userp) && empty($usert)) { @@ -2049,9 +2051,10 @@ class Task extends CommonObjectLine $this->error = $clone_task->error; $error++; } - // End - if (!$error) { + if ($error) { + $clone_task_id = 0; // For static tool check + } else { $clone_task_id = $clone_task->id; $clone_task_ref = $clone_task->ref; diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 299b15c12fa..cceb564e7e0 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,7 +101,7 @@ $param = ($mode == 'mine' ? '&mode=mine' : ''); if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { $tmpurl = $_SESSION['pageforbacktolist']['project']; - $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); $linkback = ''.$langs->trans("BackToList").''; } else { $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index c9c32359711..84695fb78b2 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -1,6 +1,7 @@ * Copyright (C) 2012-2015 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,9 +35,9 @@ if (isModEnabled('category')) { } // Load translation files required by the page -$langsLoad=array('projects', 'companies'); +$langsLoad = array('projects', 'companies'); if (isModEnabled('eventorganization')) { - $langsLoad[]='eventorganization'; + $langsLoad[] = 'eventorganization'; } $langs->loadLangs($langsLoad); @@ -69,7 +70,7 @@ $hookmanager->initHooks(array('projectcontactcard', 'globalcard')); * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -81,7 +82,7 @@ if (empty($reshook)) { if ($action == 'addcontact') { $form = new Form($db); - $source=GETPOST("source", 'aZ09'); + $source = GETPOST("source", 'aZ09'); $taskstatic = new Task($db); $task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0); @@ -91,7 +92,7 @@ if (empty($reshook)) { $type_to = (GETPOST('typecontact') ? 'typecontact='.GETPOST('typecontact') : 'type='.GETPOST('type')); $personToAffect = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid')); $affect_to = (GETPOST('userid') ? 'userid='.$personToAffect : 'contactid='.$personToAffect); - $url_redirect='?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source; + $url_redirect = '?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source; if ($personToAffect > 0 && (!getDolGlobalString('PROJECT_HIDE_TASKS') || $nbTasks > 0)) { $text = $langs->trans('AddPersonToTask'); @@ -100,13 +101,13 @@ if (empty($reshook)) { $task_to_affect = array(); foreach ($task_array as $task) { - $task_already_affected=false; + $task_already_affected = false; $personsLinked = $task->liste_contact(-1, $source); if (!is_array($personsLinked) && count($personsLinked) < 0) { setEventMessage($object->error, 'errors'); } else { foreach ($personsLinked as $person) { - if ($person['id']==$personToAffect) { + if ($person['id'] == $personToAffect) { $task_already_affected = true; break; } @@ -131,11 +132,11 @@ if (empty($reshook)) { 'value' => $formcompany->selectTypeContact($taskstatic, '', 'person_role_'.$key, $source, 'position', 0, 'minwidth100imp', 0, 1) ); } - $formquestion[] = array('type'=> 'other', 'name'=>'tasksavailable', 'label'=>'', 'value' => ''); + $formquestion[] = array('type' => 'other', 'name' => 'tasksavailable', 'label' => '', 'value' => ''); } $formconfirmtoaddtasks = $form->formconfirm($_SERVER['PHP_SELF'] . $url_redirect, $text, '', 'addcontact_confirm', $formquestion, '', 1, 300, 590); - $formconfirmtoaddtasks .=' + $formconfirmtoaddtasks .= ' 0 ? getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) : ''; +$keyCodeForEnter = ''; +if (!empty($_SESSION['takeposterminal'])) { + $keyCodeForEnter = getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) > 0 ? getDolGlobalString('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) : ''; +} ?>
    +
    @@ -1165,7 +1186,7 @@ if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { ?> @@ -1256,7 +1277,7 @@ if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
    @@ -1331,38 +1352,38 @@ $menus = array(); $r = 0; if (!getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("New").'
    ', 'action'=>'New();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("New").'
    ', 'action' => 'New();'); } else { // BAR RESTAURANT specific menu - $menus[$r++] = array('title'=>'
    '.$langs->trans("Place").'
    ', 'action'=>'Floors();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("Place").'
    ', 'action' => 'Floors();'); } if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { if (getDolGlobalString('TAKEPOS_CHOOSE_CONTACT')) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("Contact").'
    ', 'action'=>'Contact();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("Contact").'
    ', 'action' => 'Contact();'); } else { - $menus[$r++] = array('title'=>'
    '.$langs->trans("Customer").'
    ', 'action'=>'Customer();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("Customer").'
    ', 'action' => 'Customer();'); } } if (! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("History").'
    ', 'action'=>'History();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("History").'
    ', 'action' => 'History();'); } -$menus[$r++] = array('title'=>'
    '.$langs->trans("FreeZone").'
    ', 'action'=>'FreeZone();'); -$menus[$r++] = array('title'=>'
    '.$langs->trans("InvoiceDiscountShort").'
    ', 'action'=>'Reduction();'); +$menus[$r++] = array('title' => '
    '.$langs->trans("FreeZone").'
    ', 'action' => 'FreeZone();'); +$menus[$r++] = array('title' => '
    '.$langs->trans("InvoiceDiscountShort").'
    ', 'action' => 'Reduction();'); -$menus[$r++] = array('title'=>'
    '.$langs->trans("SplitSale").'
    ', 'action'=>'Split();'); +$menus[$r++] = array('title' => '
    '.$langs->trans("SplitSale").'
    ', 'action' => 'Split();'); // BAR RESTAURANT specific menu if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("Order").'', 'action'=>'TakeposPrintingOrder();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("Order").'', 'action' => 'TakeposPrintingOrder();'); } } // Last action that close the sell (payments) -$menus[$r++] = array('title'=>'
    '.$langs->trans("Payment").'
    ', 'action'=>'CloseBill();'); +$menus[$r++] = array('title' => '
    '.$langs->trans("Payment").'
    ', 'action' => 'CloseBill();'); if (getDolGlobalString('TAKEPOS_DIRECT_PAYMENT')) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("DirectPayment").' ('.$langs->trans("Cash").')
    ', 'action'=>'DirectPayment();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("DirectPayment").' ('.$langs->trans("Cash").')
    ', 'action' => 'DirectPayment();'); } // BAR RESTAURANT specific menu @@ -1371,26 +1392,26 @@ if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("Receipt").'
    ', 'action'=>'TakeposConnector(placeid);'); + $menus[$r++] = array('title' => '
    '.$langs->trans("Receipt").'
    ', 'action' => 'TakeposConnector(placeid);'); } else { - $menus[$r++] = array('title'=>'
    '.$langs->trans("Receipt").'
    ', 'action'=>'TakeposPrinting(placeid);'); + $menus[$r++] = array('title' => '
    '.$langs->trans("Receipt").'
    ', 'action' => 'TakeposPrinting(placeid);'); } } elseif ((isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { - $menus[$r++] = array('title'=>'
    '.$langs->trans("Receipt").'
    ', 'action'=>'DolibarrTakeposPrinting(placeid);'); + $menus[$r++] = array('title' => '
    '.$langs->trans("Receipt").'
    ', 'action' => 'DolibarrTakeposPrinting(placeid);'); } else { - $menus[$r++] = array('title'=>'
    '.$langs->trans("Receipt").'
    ', 'action'=>'Print(placeid);'); + $menus[$r++] = array('title' => '
    '.$langs->trans("Receipt").'
    ', 'action' => 'Print(placeid);'); } } if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && getDolGlobalString('TAKEPOS_ORDER_NOTES') == 1) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("OrderNotes").'
    ', 'action'=>'TakeposOrderNotes();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("OrderNotes").'
    ', 'action' => 'TakeposOrderNotes();'); } if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("ProductSupplements").'
    ', 'action'=>'LoadProducts(\'supplements\');'); + $menus[$r++] = array('title' => '
    '.$langs->trans("ProductSupplements").'
    ', 'action' => 'LoadProducts(\'supplements\');'); } } if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { - $menus[$r++] = array('title'=>'
    '.$langs->trans("DOL_OPEN_DRAWER").'
    ', 'action'=>'OpenDrawer();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("DOL_OPEN_DRAWER").'
    ', 'action' => 'OpenDrawer();'); } if (getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0 || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { $menus[$r++] = array( @@ -1401,7 +1422,7 @@ if (getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0 || getDolGlobalString('T $sql = "SELECT rowid, status, entity FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE"; $sql .= " entity = ".((int) $conf->entity)." AND "; -$sql .= " posnumber = ".((int) $_SESSION["takeposterminal"])." AND "; +$sql .= " posnumber = ".((int) empty($_SESSION["takeposterminal"]) ? 0 : $_SESSION["takeposterminal"])." AND "; $sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'"; $resql = $db->query($sql); @@ -1409,14 +1430,14 @@ if ($resql) { $num = $db->num_rows($resql); if ($num) { $obj = $db->fetch_object($resql); - $menus[$r++] = array('title'=>'
    '.$langs->trans("CashReport").'
    ', 'action'=>'CashReport('.$obj->rowid.');'); + $menus[$r++] = array('title' => '
    '.$langs->trans("CashReport").'
    ', 'action' => 'CashReport('.$obj->rowid.');'); if ($obj->status == 0) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("CloseCashFence").'
    ', 'action'=>'CloseCashFence('.$obj->rowid.');'); + $menus[$r++] = array('title' => '
    '.$langs->trans("CloseCashFence").'
    ', 'action' => 'CloseCashFence('.$obj->rowid.');'); } } } -$parameters = array('menus'=>$menus); +$parameters = array('menus' => $menus); $reshook = $hookmanager->executeHooks('ActionButtons', $parameters); if ($reshook == 0) { //add buttons if (is_array($hookmanager->resArray)) { @@ -1438,15 +1459,15 @@ if ($reshook == 0) { //add buttons } if ($r % 3 == 2) { - $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;'); + $menus[$r++] = array('title' => '', 'style' => 'visibility: hidden;'); } if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("Logout").'
    ', 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'\';'); + $menus[$r++] = array('title' => '
    '.$langs->trans("Logout").'
    ', 'action' => 'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'\';'); } if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) { - $menus[$r++] = array('title'=>'
    '.$langs->trans("WeighingScale").'
    ', 'action'=>'WeighingScale();'); + $menus[$r++] = array('title' => '
    '.$langs->trans("WeighingScale").'
    ', 'action' => 'WeighingScale();'); } ?> @@ -1478,7 +1499,7 @@ if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) {
    @@ -1511,15 +1532,15 @@ if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) { echo ''; } } ?> - +
    - +
    ...
    -
    @@ -1532,14 +1553,14 @@ if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) { $count = 0; while ($count < $MAXPRODUCT) { print '
    - onclick="MoreProducts('less')" onclick="MoreProducts('more')" > + onclick="MoreProducts('less')" onclick="MoreProducts('more')" > '; @@ -1557,15 +1578,15 @@ if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) { print ''; } } ?> - +
    - +
    ...
    - diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index a1d1f03cb54..2592d778715 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -567,6 +567,7 @@ if (empty($reshook)) { echo ""; if ($nbofsuggested > 0) { + $quantityToBeDelivered = 0; echo "
    ".$langs->trans("SearchIntoBatch").": $nbofsuggested

    "; foreach ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch as $dbatch) { // $dbatch is instance of Productbatch $batchStock = + $dbatch->qty; // To get a numeric @@ -1506,7 +1507,7 @@ if (!empty($conf->use_javascript_ajax)) { $usediv = (GETPOST('format') == 'div'); -print ''."\n"; +print ''."\n"; print '
    '; if ($usediv) { print '
    '; @@ -1560,6 +1561,9 @@ if ($reshook < 0) { print $hookmanager->resPrint; if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { + if (getDolGlobalInt("TAKEPOS_SHOW_SUBPRICE")) { + print '
    '; + } print ''; print ''; if (getDolGlobalString('TAKEPOS_SHOW_HT')) { @@ -1604,6 +1608,7 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categorie = new Categorie($db); $categories = $categorie->get_full_arbo('product'); + $htmlforlines = ''; foreach ($categories as $row) { if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { $htmlforlines .= '
    0) { } $htmlforlines .= $hookmanager->resPrint; + if (getDolGlobalInt("TAKEPOS_SHOW_SUBPRICE")) { + $htmlforlines .= '
    '; + } $htmlforlines .= ''; $htmlforlines .= ''; } @@ -1349,9 +1350,10 @@ if ($action == 'create' || $action == 'presend') { foreach (array('internal', 'external') as $source) { $tmpobject = $object; $tab = $tmpobject->listeContact(-1, $source); - $num = count($tab); + '@phan-var-force array $tab'; + $num = is_array($tab) ? 0 : count($tab); $i = 0; - while ($i < $num) { + foreach (array_keys($tab) as $i) { $var = !$var; print '
    '; @@ -1372,7 +1374,7 @@ if ($action == 'create' || $action == 'presend') { echo $companystatic->getNomUrl(-1); } if ($tab[$i]['socid'] < 0) { - echo $conf->global->MAIN_INFO_SOCIETE_NOM; + echo getDolGlobalString('MAIN_INFO_SOCIETE_NOM'); } if (!$tab[$i]['socid']) { echo ' '; @@ -1536,6 +1538,7 @@ if ($action == 'create' || $action == 'presend') { $morehtmlright = ''; $help = ""; $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); $morehtmlright .= $form->textwithpicto(''.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution'); print '
    '; @@ -1642,7 +1645,7 @@ if ($action == 'create' || $action == 'presend') { print showDirectPublicLink($object).'
    '; print '
    '; - if (!getDolGlobalString('TICKET_SHOW_MESSAGES_ON_CARD')) { + if (getDolGlobalString('TICKET_SHOW_MESSAGES_ON_CARD')) { print '
    '; $MAXEVENT = 10; diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 2a54f797e0a..cc7e302db74 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -216,6 +216,9 @@ class ActionsTicket extends CommonHookActions include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $uselocalbrowser = true; $ckeditorenabledforticket = getDolGlobalString('FCKEDITOR_ENABLE_TICKET'); + if (!$ckeditorenabledforticket) { + $msg = dol_string_nohtmltag($msg, 2); + } $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $ckeditorenabledforticket, ROWS_9, '95%'); $doleditor->Create(); } else { diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index e4bcccb7e5e..4e3497882e6 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -75,7 +75,7 @@ class CTicketCategory extends CommonObject * 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. * '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 '$conf->global->MY_SETUP_PARAM) + * '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) @@ -98,7 +98,7 @@ class CTicketCategory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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 778bd6ef730..70aba99dcea 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -76,7 +76,7 @@ class Ticket extends CommonObject /** - * @var string Hash to identify ticket publicly + * @var ?string Hash to identify ticket publicly */ public $track_id; @@ -97,17 +97,17 @@ class Ticket extends CommonObject public $fk_contract; /** - * @var string Person email who have create ticket + * @var ?string Email of person who created the ticket */ public $origin_email; /** - * @var int User id who have create ticket + * @var int User id who created the ticket */ public $fk_user_create; /** - * @var int User id who have ticket assigned + * @var int User id who the ticket is assigned to */ public $fk_user_assign; @@ -193,6 +193,11 @@ class Ticket extends CommonObject */ public $origin_replyto; + /** + * References from origin email + */ + public $origin_references; + /** * @var int Creation date */ @@ -297,7 +302,7 @@ class Ticket extends CommonObject * 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. * '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 '$conf->global->MY_SETUP_PARAM) + * '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) @@ -327,7 +332,8 @@ class Ticket extends CommonObject 'fk_user_create' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Author', 'visible' => 1, 'enabled' => 1, 'position' => 15, 'notnull' => 1, 'csslist' => 'tdoverflowmax100 maxwidth150onsmartphone'), 'origin_email' => array('type' => 'mail', 'label' => 'OriginEmail', 'visible' => -2, 'enabled' => 1, 'position' => 16, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'csslist' => 'tdoverflowmax150'), 'origin_replyto' => array('type' => 'mail', 'label' => 'EmailReplyto', 'visible' => -2, 'enabled' => 1, 'position' => 17, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Email to reply to", 'csslist' => 'tdoverflowmax150'), - 'subject' => array('type' => 'varchar(255)', 'label' => 'Subject', 'visible' => 1, 'enabled' => 1, 'position' => 18, 'notnull' => -1, 'searchall' => 1, 'help' => "", 'css' => 'maxwidth200 tdoverflowmax200', 'autofocusoncreate' => 1), + 'origin_references' => array('type' => 'text', 'label' => 'EmailReferences', 'visible' => -2, 'enabled' => 1, 'position' => 18, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "References from origin email", 'csslist' => 'tdoverflowmax150'), + 'subject' => array('type' => 'varchar(255)', 'label' => 'Subject', 'visible' => 1, 'enabled' => 1, 'position' => 19, 'notnull' => -1, 'searchall' => 1, 'help' => "", 'css' => 'maxwidth200 tdoverflowmax200', 'autofocusoncreate' => 1), 'type_code' => array('type' => 'varchar(32)', 'label' => 'Type', 'visible' => 1, 'enabled' => 1, 'position' => 20, 'notnull' => -1, 'help' => "", 'csslist' => 'maxwidth125 tdoverflowmax50'), 'category_code' => array('type' => 'varchar(32)', 'label' => 'TicketCategory', 'visible' => -1, 'enabled' => 1, 'position' => 21, 'notnull' => -1, 'help' => "", 'css' => 'maxwidth100 tdoverflowmax200'), 'severity_code' => array('type' => 'varchar(32)', 'label' => 'Severity', 'visible' => 1, 'enabled' => 1, 'position' => 22, 'notnull' => -1, 'help' => "", 'css' => 'maxwidth100'), @@ -518,6 +524,7 @@ class Ticket extends CommonObject $sql .= "fk_contract,"; $sql .= "origin_email,"; $sql .= "origin_replyto,"; + $sql .= "origin_references,"; $sql .= "fk_user_create,"; $sql .= "fk_user_assign,"; $sql .= "email_msgid,"; @@ -546,6 +553,7 @@ class Ticket extends CommonObject $sql .= " ".($this->fk_contract > 0 ? $this->db->escape($this->fk_contract) : "null").","; $sql .= " ".(!isset($this->origin_email) ? 'NULL' : "'".$this->db->escape($this->origin_email)."'").","; $sql .= " ".(!isset($this->origin_replyto) ? 'NULL' : "'".$this->db->escape($this->origin_replyto)."'").","; + $sql .= " ".(!isset($this->origin_references) ? 'NULL' : "'".$this->db->escape($this->origin_references)."'").","; $sql .= " ".(!isset($this->fk_user_create) ? ($user->id > 0 ? $user->id : 'NULL') : ($this->fk_user_create > 0 ? $this->fk_user_create : 'NULL')).","; $sql .= " ".($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL').","; $sql .= " ".(empty($this->email_msgid) ? 'NULL' : "'".$this->db->escape($this->email_msgid)."'").","; @@ -672,6 +680,7 @@ class Ticket extends CommonObject $sql .= " t.fk_contract,"; $sql .= " t.origin_email,"; $sql .= " t.origin_replyto,"; + $sql .= " t.origin_references,"; $sql .= " t.fk_user_create,"; $sql .= " t.fk_user_assign,"; $sql .= " t.email_msgid,"; @@ -728,6 +737,7 @@ class Ticket extends CommonObject $this->fk_contract = $obj->fk_contract; $this->origin_email = $obj->origin_email; $this->origin_replyto = $obj->origin_replyto; + $this->origin_references = $obj->origin_references; $this->fk_user_create = $obj->fk_user_create; $this->fk_user_assign = $obj->fk_user_assign; $this->email_msgid = $obj->email_msgid; @@ -808,6 +818,7 @@ class Ticket extends CommonObject $sql .= " t.fk_contract,"; $sql .= " t.origin_email,"; $sql .= " t.origin_replyto,"; + $sql .= " t.origin_references,"; $sql .= " t.fk_user_create, uc.lastname as user_create_lastname, uc.firstname as user_create_firstname,"; $sql .= " t.fk_user_assign, ua.lastname as user_assign_lastname, ua.firstname as user_assign_firstname,"; $sql .= " t.subject,"; @@ -926,6 +937,7 @@ class Ticket extends CommonObject $line->fk_contract = $obj->fk_contract; $line->origin_email = $obj->origin_email; $line->origin_replyto = $obj->origin_replyto; + $line->origin_references = $obj->origin_references; $line->fk_user_create = $obj->fk_user_create; $line->fk_user_assign = $obj->fk_user_assign; @@ -1079,6 +1091,7 @@ class Ticket extends CommonObject $sql .= " fk_contract=".(isset($this->fk_contract) ? (int) $this->fk_contract : "null").","; $sql .= " origin_email=".(isset($this->origin_email) ? "'".$this->db->escape($this->origin_email)."'" : "null").","; $sql .= " origin_replyto=".(isset($this->origin_replyto) ? "'".$this->db->escape($this->origin_replyto)."'" : "null").","; + $sql .= " origin_references=".(isset($this->origin_references) ? "'".$this->db->escape($this->origin_references)."'" : "null").","; $sql .= " fk_user_create=".(isset($this->fk_user_create) ? (int) $this->fk_user_create : "null").","; $sql .= " fk_user_assign=".(isset($this->fk_user_assign) ? (int) $this->fk_user_assign : "null").","; $sql .= " subject=".(isset($this->subject) ? "'".$this->db->escape($this->subject)."'" : "null").","; @@ -1818,7 +1831,7 @@ class Ticket extends CommonObject $actioncomm->socid = $this->socid; $actioncomm->label = $this->subject; $actioncomm->note_private = $this->message; - $actioncomm->userassigned = array($user->id); + $actioncomm->userassigned = array($user->id => array('id' => $user->id,'transparency' => 0)); $actioncomm->userownerid = $user->id; $actioncomm->datep = $now; $actioncomm->percentage = -1; // percentage is not relevant for punctual events @@ -2187,8 +2200,8 @@ class Ticket extends CommonObject /** * Retrieve information about internal contacts * - * @param int $status Status of user or company - * @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status + * @param int $status Status of user or company array + * @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status */ public function getInfosTicketInternalContact($status = -1) { @@ -2282,7 +2295,7 @@ class Ticket extends CommonObject * @param int $list 0:Return array contains all properties, 1:Return array contains just id * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @param int $status Status of user or company - * @return array|int Array of array('email'=>..., 'lastname'=>...) + * @return array|int<-1,-1> Array of array('email'=>..., 'lastname'=>...) */ public function listeContact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1) { @@ -2401,23 +2414,21 @@ class Ticket extends CommonObject global $conf; $defaultref = ''; - $modele = !getDolGlobalString('TICKET_ADDON') ? 'mod_ticket_simple' : $conf->global->TICKET_ADDON; + $modele = getDolGlobalString('TICKET_ADDON', 'mod_ticket_simple'); // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); if (file_exists($file)) { - $filefound = 1; $classname = $modele; break; } } - if ($filefound) { + if ($classname !== '') { $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); $modTicket = new $classname(); @@ -2705,7 +2716,7 @@ class Ticket extends CommonObject // Add global email address recipient if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && - getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto) + getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto) ) { $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); } @@ -2808,8 +2819,8 @@ class Ticket extends CommonObject $message .= '
    '.$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.$object->track_id.'
    '; // Add global email address recipient - if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') !== '' && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto)) { - if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') !== '') { + if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto)) { + if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')) { $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); } } @@ -2867,7 +2878,7 @@ class Ticket extends CommonObject $message .= '

    '; foreach ($external_contacts as $key => $info_sendto) { - // altairis: avoid duplicate emails to external contacts + // avoid duplicate emails to external contacts if ($info_sendto['id'] == $user->contact_id) { continue; } @@ -2885,6 +2896,7 @@ class Ticket extends CommonObject // If public interface is not enable, use link to internal page into mail $url_public_ticket = (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE') ? (getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') !== '' ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.$object->track_id; + $message .= '
    '.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.$object->track_id.'
    '; // Build final message @@ -2906,8 +2918,8 @@ class Ticket extends CommonObject } // Add global email address recipient - if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') !== '' && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto)) { - if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') !== '') { + if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto)) { + if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')) { $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); } } @@ -2951,8 +2963,8 @@ class Ticket extends CommonObject * * @param string $subject Email subject * @param string $message Email message - * @param int $send_internal_cc Receive a copy on internal email ($conf->global->TICKET_NOTIFICATION_EMAIL_FROM) - * @param array $array_receiver Array of receiver. example array('name' => 'John Doe', 'email' => 'john@doe.com', etc...) + * @param int $send_internal_cc Receive a copy on internal email (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM') + * @param array $array_receiver Array of receiver. Example array('name' => 'John Doe', 'email' => 'john@doe.com', etc...) * @param array $filename_list List of files to attach (full path of filename on file system) * @param array $mimetype_list List of MIME type of attached files * @param array $mimefilename_list List of attached file name in message @@ -2962,7 +2974,7 @@ class Ticket extends CommonObject { global $conf, $langs, $user; - if (getDolGlobalInt('TICKET_DISABLE_ALL_MAILS')) { + if (getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) { dol_syslog(get_class($this).'::sendTicketMessageByEmail: Emails are disable into ticket setup by option TICKET_DISABLE_ALL_MAILS', LOG_WARNING); return false; } @@ -2978,10 +2990,9 @@ class Ticket extends CommonObject $array_receiver = array_merge($array_receiver, $this->getInfosTicketExternalContact(1)); } + $sendtocc = ''; if ($send_internal_cc) { $sendtocc = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM'); - } else { - $sendtocc = ''; } $from = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM'); @@ -2996,8 +3007,7 @@ class Ticket extends CommonObject // Send email $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO'); - - if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '') { + if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) { $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } @@ -3008,10 +3018,26 @@ class Ticket extends CommonObject $moreinheader = 'X-Dolibarr-Info: sendTicketMessageByEmail'."\r\n"; if (!empty($this->email_msgid)) { - $moreinheader .= 'References: <'.$this->email_msgid.'>'."\r\n"; + // We must also add 1 entry In-Reply-To: <$this->email_msgid> with Message-ID we respond from (See RFC5322). + $moreinheader .= 'In-Reply-To: <'.$this->email_msgid.'>'."\r\n"; + } + + // We should add here also a header 'References:' + // According to RFC5322, we should add here all the References fields of the initial message concatenated with + // the Message-ID of the message we respond from (but each ID must be once). + $references = ''; + if (empty($this->origin_references)) { + // TODO If No References is set, use the In-Reply-To for $references .= (empty($references) ? '' : ' ').Source In-reply-To + } else { + $references .= (empty($references) ? '' : ' ').$this->origin_references; + } + $references .= (empty($references) ? '' : ' ').'<'.$this->email_msgid.'>'; + if ($references) { + $moreinheader .= 'References: '.$references."\r\n"; } $mailfile = new CMailFile($subject, $receiver, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid, $moreinheader, 'ticket', '', $upload_dir_tmp); + if ($mailfile->error) { setEventMessages($mailfile->error, null, 'errors'); } else { @@ -3030,7 +3056,7 @@ class Ticket extends CommonObject } } - if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '') { + if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) { $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; } } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 4ccef134ea0..2b1a28cbdb0 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -447,9 +447,9 @@ if ($search_dateclose_end) { $sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'"; } -if (!$user->socid && ($mode == "mine" || (!$user->admin && getDolGlobalInt('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')))) { +if (!$user->socid && ($mode == "mine" || (!$user->admin && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')))) { $sql .= " AND (t.fk_user_assign = ".((int) $user->id); - if (!getDolGlobalInt('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) { + if (!getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) { $sql .= " OR t.fk_user_create = ".((int) $user->id); } $sql .= ")"; @@ -498,7 +498,7 @@ if (!$resql) { $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { +if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".DOL_URL_ROOT.'/ticket/card.php?id='.$id); @@ -785,7 +785,7 @@ if ($massaction == 'presendonclose') { "name" => "massaction", "value" => "close" ]); - $selectedchoice = getDolGlobalInt('TICKET_NOTIFY_AT_CLOSING') ? "yes" : "no"; + $selectedchoice = getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') ? "yes" : "no"; print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassTicketClosingSendEmail"), $langs->trans("ConfirmMassTicketClosingSendEmailQuestion"), 'confirm_send_close', $hidden_form, $selectedchoice, 0, 200, 500, 1); } @@ -1145,13 +1145,13 @@ while ($i < $imaxinloop) { $date_last_msg_sent = (int) $object->date_last_msg_sent; $hour_diff = ($now - $date_last_msg_sent) / 3600 ; - if (!empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE && $date_last_msg_sent == 0)) { + if (getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE') && $date_last_msg_sent == 0) { $creation_date = $object->datec; $hour_diff_creation = ($now - $creation_date) / 3600 ; - if ($hour_diff_creation > $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE) { + if ($hour_diff_creation > getDolGlobalInt('TICKET_DELAY_BEFORE_FIRST_RESPONSE')) { print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE')), 'warning', 'style="color: red;"', false, 0, 0, '', ''); } - } elseif (getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE') && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) { + } elseif (getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE') && $hour_diff > getDolGlobalInt('TICKET_DELAY_SINCE_LAST_RESPONSE')) { print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE')), 'warning'); } } diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 98fb7551fe1..51c65f71f45 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -146,7 +146,7 @@ $userstat = new User($db); $formticket = new FormTicket($db); $title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/ticketnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); } $help_url = 'FR:DocumentationModuleTicket'; diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index f8e0c80c612..fe4d8b42f97 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -47,7 +47,7 @@ if ($user->socid > 0) { $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOSTINT('year') : $nowyear; -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; // Load translation files required by the page diff --git a/htdocs/ticket/tpl/linkedobjectblock.tpl.php b/htdocs/ticket/tpl/linkedobjectblock.tpl.php index e4ccd67308c..e70395eb79b 100644 --- a/htdocs/ticket/tpl/linkedobjectblock.tpl.php +++ b/htdocs/ticket/tpl/linkedobjectblock.tpl.php @@ -18,7 +18,7 @@ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } print "\n"; @@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } ?>
    diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 20fa770194a..ff445c5cf85 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -7,6 +7,7 @@ * Copyright (C) 2015-2016 Marcos García * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -957,7 +958,7 @@ if ($id && ($action == 'edit' || $action == 'create') && $user->hasRight('user', // Show fields of bank account $bankaccount = $account; - // Code here is similare than into paymentmodes.php for third-parties + // Code here is similar as in paymentmodes.php for third-parties foreach ($bankaccount->getFieldsToShow(1) as $val) { $require = false; $tooltip = ''; diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 230344118c6..de46e5b1005 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -264,7 +264,7 @@ class Users extends DolibarrApi */ public function getInfo($includepermissions = 0) { - if (!DolibarrApiAccess::$user->hasRights('user', 'self', 'creer') && !DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && empty(DolibarrApiAccess::$user->admin)) { + if (!DolibarrApiAccess::$user->hasRight('user', 'self', 'creer') && !DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && empty(DolibarrApiAccess::$user->admin)) { throw new RestException(401, 'Not allowed'); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ba8f8116bdf..78f0b4e6e42 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -336,7 +336,10 @@ class User extends CommonObject public $lastsearch_values_tmp; // To store current search criteria for user public $lastsearch_values; // To store last saved search criteria for user - public $users = array(); // To store all tree of users hierarchy + /** + * @var array Store the entire hierarchy tree of users + */ + public $users = array(); public $parentof; // To store an array of all parents for all ids. private $cache_childids; // Cache array of already loaded children @@ -3635,7 +3638,7 @@ class User extends CommonObject /** * Return and array with all instantiated first level children users of current user * - * @return User[]|int + * @return User[]|int<-1,-1> * @see getAllChildIds() */ public function get_children() @@ -3664,7 +3667,7 @@ class User extends CommonObject /** * Load this->parentof that is array(id_son=>id_parent, ...) * - * @return int Return integer <0 if KO, >0 if OK + * @return int<-1,1> Return integer <0 if KO, >0 if OK */ private function loadParentOf() { @@ -3759,7 +3762,7 @@ class User extends CommonObject return -1; } - // We add the fullpath property to each elements of first level (no parent exists) + // We add the fullpath property to each element of the first level (no parent exists) dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG); foreach ($this->users as $key => $val) { $result = $this->build_path_from_id_user($key, 0); // Process a branch from the root user key (this user has no parent) @@ -3776,9 +3779,10 @@ class User extends CommonObject $keyfilter2 = '_'.$deleteafterid.'$'; $keyfilter3 = '^'.$deleteafterid.'_'; $keyfilter4 = '_'.$deleteafterid.'_'; - foreach ($this->users as $key => $val) { - if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) - || preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])) { + foreach (array_keys($this->users) as $key) { + $fullpath = (string) $this->users[$key]['fullpath']; + if (preg_match('/'.$keyfilter1.'/', $fullpath) || preg_match('/'.$keyfilter2.'/', $fullpath) + || preg_match('/'.$keyfilter3.'/', $fullpath) || preg_match('/'.$keyfilter4.'/', $fullpath)) { unset($this->users[$key]); } } @@ -3836,7 +3840,7 @@ class User extends CommonObject * * @param int $id_user id_user entry to update * @param int $protection Deep counter to avoid infinite loop (no more required, a protection is added with array useridfound) - * @return int Return integer < 0 if KO (infinite loop), >= 0 if OK + * @return int<-1,1> Return integer < 0 if KO (infinite loop), >= 0 if OK */ public function build_path_from_id_user($id_user, $protection = 0) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 25a188fa8ee..401d661e5b7 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -113,7 +113,7 @@ class UserGroup extends CommonObject public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => 1, 'index' => 1, 'position' => 5), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => '1', 'index' => 1, 'position' => 5), 'nom' => array('type' => 'varchar(180)', 'label' => 'Name', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 10, 'searchall' => 1, 'comment' => 'Group name'), 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => 1, 'position' => 20, 'notnull' => -1, 'searchall' => 1), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 50, 'notnull' => 1,), diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index ea7a4ef554b..5a5c452e6ee 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -438,7 +438,7 @@ if ($object->id > 0) { if ($user->admin) { print ''; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index e55dc5ea1bc..65955a4c39f 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -151,6 +151,7 @@ include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; $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 // Init search fields $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 75f2fa6f069..be39b2fda02 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -72,7 +72,7 @@ if ($reshook < 0) { } // Define url to go after disconnect -$urlfrom = empty($_SESSION["urlfrom"]) ? '' : $_SESSION["urlfrom"]; +$urlfrom = empty($_SESSION["urlfrom"]) ? GETPOST('urlfrom') : $_SESSION["urlfrom"]; // Define url to go $url = DOL_URL_ROOT."/index.php"; // By default go to login page diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 240723c47c8..bd0158d91c2 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -217,8 +217,10 @@ if ($result > 0) { // Help print ''; print '
    '.$langs->trans("NotificationsDesc"); - print '
    '.$langs->trans("NotificationsDescUser"); - print '
    '.$langs->trans("NotificationsDescContact"); + print '
    '.$langs->trans("NotificationsDescUser").' - '.$langs->trans("YouAreHere"); + if (isModEnabled('societe')) { + print '
    '.$langs->trans("NotificationsDescContact"); + } print '
    '.$langs->trans("NotificationsDescGlobal"); print '
    '; @@ -269,12 +271,11 @@ if ($result > 0) { $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); - $title = $langs->trans("ListOfActiveNotifications"); + $titlelist = $langs->trans("ListOfActiveNotifications"); // List of active notifications - //print load_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')', '', ''); // @phan-suppress-next-line PhanPluginSuspiciousParamPosition, PhanPluginSuspiciousParamOrder - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $num, 'email', 0, $newcardbutton, '', $limit, 0, 0, 1); + print_barre_liste($titlelist, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $num, 'email', 0, $newcardbutton, '', $limit, 0, 0, 1); // Line with titles print '
    '.$langs->trans('PriceUHT').''.$langs->trans('ReductionShort').''.$langs->trans('Qty').''.price($line->subprice).''.vatrate($line->remise_percent, true).''; if (isModEnabled('stock') && $user->hasRight('stock', 'mouvement', 'lire')) { @@ -1832,8 +1840,11 @@ if ($placeid > 0) { $sql .= " AND ps.fk_product = ".((int) $line->fk_product); $resql = $db->query($sql); if ($resql) { + $stock_real = 0; $obj = $db->fetch_object($resql); - $stock_real = price2num($obj->reel, 'MS'); + if ($obj) { + $stock_real = price2num($obj->reel, 'MS'); + } $htmlforlines .= $line->qty; if ($line->qty && $line->qty > $stock_real) { $htmlforlines .= ''; diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index aabf6977fa3..65a47cceadf 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -158,7 +158,7 @@ div#topmenu-global-search-dropdown a::after, div#topmenu-quickadd-dropdown a::af /* * MENU Dropdown */ - + .login_block.usedropdown .logout-btn{ display: none; } @@ -182,7 +182,8 @@ div#topmenu-global-search-dropdown a::after, div#topmenu-quickadd-dropdown a::af .side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu { border-top-right-radius: 0; border-top-left-radius: 0; - padding: 1px 0 0 0; + padding: 0 0 0 0; + margin-top: 2px !important; border-top-width: 0; width: 360px; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 3c87a03153a..dfdf1bc9439 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2476,8 +2476,8 @@ span.widthpictotitle.pictotitle { opacity: 0.4; } .pictofixedwidth { - text-align: ; - width: 20px; + text-align: start; + width: 21px; /* padding-right: 0; */ } @@ -3137,8 +3137,8 @@ div.login a:hover { div.login_block_user { display: inline-block; vertical-align: middle; - line-height: px; - height: px; + line-height: px; + height: px; } div.login_block_other { display: inline-block; @@ -8153,8 +8153,6 @@ table.jPicker { margin-top: 30px; } } - - @media only screen and (max-width: 320px) { .dropdown dd ul { diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 74cb95e87d5..4ee2bb01b11 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -149,7 +149,7 @@ $userstat = new User($db); $formticket = new FormTicket($db); $title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/ticketnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); } $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|DE:Modul_Terminplanung'; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 037ec5c57c4..8e08101bc70 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -6,6 +6,7 @@ * Copyright (C) 2021 Alexandre Spangaro * Copyright (C) 2022-2023 Charlene Benke * Copyright (C) 2023 Benjamin Falière + * 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 @@ -438,7 +439,7 @@ if (empty($reshook)) { foreach ($internal_contacts as $key => $contact) { if ($contact['id'] !== $usertoassign) { $result = $object->delete_contact($contact['rowid']); - if ($result<0) { + if ($result < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); } @@ -446,9 +447,9 @@ if (empty($reshook)) { } } - if ($usertoassign > 0 && $usertoassign!==$useroriginassign) { + if ($usertoassign > 0 && $usertoassign !== $useroriginassign) { $result = $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0); - if ($result<0) { + if ($result < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); } @@ -754,7 +755,7 @@ if ($action == 'create' || $action == 'presend') { $formticket->withfromsocid = $socid ? $socid : $user->socid; $formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withtitletopic = 1; - $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (!getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION') ? 0 : 1)); + $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION') ? 1 : 0)); $formticket->withusercreate = 0; $formticket->withref = 1; $formticket->fk_user_create = $user->id; @@ -835,7 +836,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', @@ -1180,7 +1181,7 @@ if ($action == 'create' || $action == 'presend') { print '
    '; print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1); print ''; - print $foundinter ? convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY) : ''; + print $foundinter ? convertSecondToTime($timing, 'all', getDolGlobalString('MAIN_DURATION_OF_WORKDAY')) : ''; print '
    trans("Ticket"); ?> - global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { + getNomUrl(0, '', 0, 1).'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > '; $htmltext = $langs->trans("ID").': '.$obj->id; - $htmltext .= '
    '.$langs->trans("Permission").': user->hasRights(\''.$obj->module.'\', \''.$obj->perms.'\''.($obj->subperms ? ', \''.$obj->subperms.'\'' : '').')'; + $htmltext .= '
    '.$langs->trans("Permission").': user->hasRight(\''.$obj->module.'\', \''.$obj->perms.'\''.($obj->subperms ? ', \''.$obj->subperms.'\'' : '').')'; print $form->textwithpicto('', $htmltext); //print ''.$obj->id.''; print '
    '; diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 255a1428386..38fa0793305 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -98,7 +98,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,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}> 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,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}> 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/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index a6ddfcd9570..1c291476d9e 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -76,7 +76,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,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}> 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,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}> 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/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index ef23ce4857d..11c9f1db2e5 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -631,6 +631,7 @@ class ProductCombination $features, /** * @param mixed $v Feature information of a product. + * @return bool */ static function ($v) { return !empty($v); @@ -718,14 +719,14 @@ class ProductCombination * * @param User $user Object user * @param Product $product Parent product - * @param array $combinations Attribute and value combinations. + * @param array> $combinations Attribute and value combinations. * @param array $variations Price and weight variations * @param bool|array $price_var_percent Is the price variation a relative variation? * @param bool|float $forced_pricevar If the price variation is forced * @param bool|float $forced_weightvar If the weight variation is forced * @param bool|string $forced_refvar If the reference is forced * @param string $ref_ext External reference - * @return int Return integer <0 KO, >0 OK + * @return int<-1,1> Return integer <0 KO, >0 OK */ public function createProductCombination(User $user, Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false, $forced_refvar = false, $ref_ext = '') { @@ -738,7 +739,7 @@ class ProductCombination $price_impact = array(1 => 0); // init level price impact - $forced_refvar = trim($forced_refvar); + $forced_refvar = trim((string) $forced_refvar); if (!empty($forced_refvar) && $forced_refvar != $product->ref) { $existingProduct = new Product($this->db); @@ -884,7 +885,7 @@ class ProductCombination if ($result < 0) { //In case the error is not related with an already existing product if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->error[] = $newproduct->error; + $this->error = $newproduct->error; $this->errors = $newproduct->errors; $this->db->rollback(); return -1; diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index 0bee01ba154..8c2a486c322 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Open-Dsi + * 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 @@ -97,7 +98,7 @@ foreach ($object->fields as $key => $val) { $fieldstosearchall['t.'.$key] = $val['label']; } } -$parameters = array('fieldstosearchall'=>$fieldstosearchall); +$parameters = array('fieldstosearchall' => $fieldstosearchall); $reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $fieldstosearchall = empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']; @@ -112,11 +113,11 @@ foreach ($object->fields as $key => $val) { if (!empty($val['visible'])) { $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (int) 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 && (int) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -139,6 +140,7 @@ $arrayfields['nb_products'] = array( $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 $permissiontoread = $user->hasRight('variants', 'read'); $permissiontoadd = $user->hasRight('variants', 'write'); @@ -459,8 +461,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.'/variants/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); @@ -561,7 +563,7 @@ foreach ($object->fields as $key => $val) { // Extra fields 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; @@ -618,7 +620,7 @@ foreach ($object->fields as $key => $val) { // 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; @@ -757,7 +759,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; // Other @@ -826,7 +828,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, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/variants/tpl/productattributevalueline_edit.tpl.php b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php index e38cd431ef2..ec99925f320 100644 --- a/htdocs/variants/tpl/productattributevalueline_edit.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php @@ -29,7 +29,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } // Define colspan for the button 'Add' diff --git a/htdocs/variants/tpl/productattributevalueline_title.tpl.php b/htdocs/variants/tpl/productattributevalueline_title.tpl.php index b2905b535f2..b455c347bf9 100644 --- a/htdocs/variants/tpl/productattributevalueline_title.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_title.tpl.php @@ -30,7 +30,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } print "\n"; diff --git a/htdocs/variants/tpl/productattributevalueline_view.tpl.php b/htdocs/variants/tpl/productattributevalueline_view.tpl.php index 54349ca725f..3c3b7cbbcc6 100644 --- a/htdocs/variants/tpl/productattributevalueline_view.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_view.tpl.php @@ -35,7 +35,7 @@ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; - exit; + exit(1); } '@phan-var-force CommonObject $this diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 4b6db01486a..abd25cd844e 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -101,7 +101,7 @@ class Target extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -901,7 +901,7 @@ class Target extends CommonObject $dir = dol_buildpath($reldir."core/modules/webhook/"); // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } if ($mybool === false) { diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index cbcca8fbfe8..2a119373a51 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -88,7 +88,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') !== '') { @@ -131,7 +131,6 @@ $object->fields = dol_sort_array($object->fields, 'position'); //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); -// Permissions // There is several ways to check permission. // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; @@ -154,7 +153,7 @@ if ($user->socid > 0) { //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); if (!isModEnabled('webhook')) { - accessforbidden('Module not enabled'); + accessforbidden('Module webhook not enabled'); } if (!$permissiontoread) { accessforbidden(); @@ -192,6 +191,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } + $search_all = ''; $toselect = array(); $search_array_options = array(); } @@ -235,10 +235,12 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // 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); -//$sql .= ", COUNT(rc.rowid) as anotherfield"; + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."anothertable as rc ON rc.parent = t.rowid"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { @@ -246,10 +248,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, (GETPOST('search_current_entity', 'int') ? 0 : 1)).")"; } else { $sql .= " WHERE 1 = 1"; } @@ -290,7 +292,7 @@ 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 @@ -304,9 +306,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); */ @@ -314,33 +316,26 @@ $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 +$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 $nbtotalofrecords = ''; if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { - /* This old and fast method to get and count full list returns all record so use a high amount of memory. - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - */ - /* The slow method does not consume memory on mysql (not tested on pgsql) */ - /*$resql = $db->query($sql, 0, 'auto', 1); - while ($db->fetch_object($resql)) { - if (empty($nbtotalofrecords)) { - $nbtotalofrecords = 1; // We can't make +1 because init value is '' - } else { - $nbtotalofrecords++; - } - }*/ /* The fast and low memory method to get and count full list converts the sql into a sql count */ - $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); - $resql = $db->query($sqlforcount); - $objforcount = $db->fetch_object($resql); - $nbtotalofrecords = $objforcount->nbtotalofrecords; + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -363,7 +358,7 @@ $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_buildpath('/webhook/target_card.php', 1).'?id='.$id); @@ -416,25 +411,29 @@ 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]) && 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='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); } 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(); -$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 @@ -444,7 +443,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'))) { @@ -482,9 +481,11 @@ $trackid = 'xxxx'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); } + print ''."\n"; print '
    '.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'
    '; } @@ -494,7 +495,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': '; print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print ''; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) : ''); // This also change content of $arrayfields $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 @@ -518,6 +522,13 @@ print '
    '; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -526,15 +537,15 @@ 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 ''; }*/ // Action column -print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''."\n"; $totalarray = array(); @@ -575,6 +589,11 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column +if (getDolGlobalString('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') { @@ -583,11 +602,12 @@ 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']++; } } @@ -595,15 +615,17 @@ foreach ($object->fields as $key => $val) { 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); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$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'])) { print ''; $totalarray['nbfield']++; }*/ // Action column -print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; -$totalarray['nbfield']++; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} print ''."\n"; @@ -622,6 +644,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // -------------------------------------------------------------------- $i = 0; $savnbfield = $totalarray['nbfield']; +$totalarray = array(); $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { @@ -656,9 +679,25 @@ 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')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } 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'))) { @@ -668,18 +707,22 @@ while ($i < $imaxinloop) { } 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)) { + print ' title="'.dol_escape_htmltag($object->$key).'"'; + } + print '>'; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { @@ -709,23 +752,25 @@ while ($i < $imaxinloop) { 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; /*if (!empty($arrayfields['anotherfield']['checked'])) { print ''; }*/ // Action column - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; } print ''."\n"; @@ -752,7 +797,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 '
    '; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { - print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); + print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
    '; print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -545,7 +556,7 @@ foreach ($object->fields as $key => $val) { } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); + print $formadmin->select_language((isset($search[$key]) ? $search[$key] : ''), 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); } else { print ''; } @@ -557,16 +568,19 @@ 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; /*if (!empty($arrayfields['anotherfield']['checked'])) { print '
    '; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
    '.$langs->trans("AnotherField").'
    '; + 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; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''.$obj->anotherfield.''; - 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; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + if (!getDolGlobalString('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; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
    '."\n"; @@ -777,7 +822,7 @@ if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords $genallowed = $permissiontoread; $delallowed = $permissiontoadd; - print $formfile->showdocuments('massfilesarea_webhook', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); + print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } // End of page diff --git a/htdocs/webportal/admin/setup.php b/htdocs/webportal/admin/setup.php index 7680e08cd9a..3884a965121 100644 --- a/htdocs/webportal/admin/setup.php +++ b/htdocs/webportal/admin/setup.php @@ -42,7 +42,7 @@ $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleopti $value = GETPOST('value', 'alpha'); $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); -$type = 'myobject'; +$type = 'webportal'; $error = 0; $setupnotempty = 0; @@ -111,9 +111,17 @@ $item->helpText = $langs->transnoentities('WebPortalUserLoggedHelp'); $setupnotempty += count($formSetup->items); - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); +$moduledir = 'webportal'; +$myTmpObjects = array(); +$myTmpObjects['webportal'] = array('label' => 'WebPortal', 'includerefgeneration' => 0, 'includedocgeneration' => 0, 'class' => 'WebPortal'); + +$tmpobjectkey = GETPOST('object', 'aZ09'); +if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) { + accessforbidden('Bad value for object. Hack attempt ?'); +} + /* * Actions @@ -121,103 +129,6 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); include DOL_DOCUMENT_ROOT . '/core/actions_setmoduleoptions.inc.php'; -if ($action == 'updateMask') { - $maskconst = GETPOST('maskconst', 'aZ09'); - $maskvalue = GETPOST('maskvalue', 'alpha'); - - if ($maskconst && preg_match('/_MASK$/', $maskconst)) { - $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } - - if (!$error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} elseif ($action == 'specimen') { - $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); - - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir . "core/modules/webportal/doc/pdf_" . $modele . "_" . strtolower($tmpobjectkey) . ".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_" . $modele . "_" . strtolower($tmpobjectkey); - break; - } - } - - if ($classname !== '') { - require_once $file; - - $module = new $classname($db); - - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=webportal-" . strtolower($tmpobjectkey) . "&file=SPECIMEN.pdf"); - return; - } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); - } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } -} elseif ($action == 'setmod') { - // TODO Check if numbering module chosen can be activated by calling method canBeActivated - $tmpobjectkey = GETPOST('object'); - if (!empty($tmpobjectkey)) { - $constforval = 'WEBPORTAL_' . strtoupper($tmpobjectkey) . "_ADDON"; - dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); - } -} elseif ($action == 'set') { - // Activate a model - $ret = addDocumentModel($value, $type, $label, $scandir); -} elseif ($action == 'del') { - $ret = delDocumentModel($value, $type); - if ($ret > 0) { - $tmpobjectkey = GETPOST('object'); - if (!empty($tmpobjectkey)) { - $constforval = 'WEBPORTAL_' . strtoupper($tmpobjectkey) . '_ADDON_PDF'; - if (getDolGlobalString($constforval) == "$value") { - dolibarr_del_const($db, $constforval, $conf->entity); - } - } - } -} elseif ($action == 'setdoc') { - // Set or unset default model - $tmpobjectkey = GETPOST('object'); - if (!empty($tmpobjectkey)) { - $constforval = 'WEBPORTAL_' . strtoupper($tmpobjectkey) . '_ADDON_PDF'; - if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { - // The constant that was read before the new set - // We therefore requires a variable to have a coherent view - $conf->global->$constforval = $value; - } - - // We disable/enable the document template (into llx_document_model table) - $ret = delDocumentModel($value, $type); - if ($ret > 0) { - $ret = addDocumentModel($value, $type, $label, $scandir); - } - } -} elseif ($action == 'unsetdoc') { - $tmpobjectkey = GETPOST('object'); - if (!empty($tmpobjectkey)) { - $constforval = 'WEBPORTAL_' . strtoupper($tmpobjectkey) . '_ADDON_PDF'; - dolibarr_del_const($db, $constforval, $conf->entity); - } -} - // Force always edit mode if (empty($action) || $action == 'update') { $action = 'edit'; @@ -283,270 +194,6 @@ if ($action == 'edit') { print '
    ' . $langs->trans("NothingToSetup"); } - -$moduledir = 'webportal'; -$myTmpObjects = array(); -$myTmpObjects['MyObject'] = array('label' => 'MyObject', 'includerefgeneration' => 0, 'includedocgeneration' => 0); - -foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } - if ($myTmpObjectArray['includerefgeneration']) { - /* - * Orders Numbering model - */ - $setupnotempty++; - - print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectArray['label']), '', ''); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '' . "\n"; - - clearstatcache(); - - foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir . "core/modules/" . $moduledir); - - if (is_dir($dir)) { - $handle = opendir($dir); - if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { - if (strpos($file, 'mod_' . strtolower($myTmpObjectKey) . '_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') { - $file = substr($file, 0, dol_strlen($file) - 4); - - require_once $dir . '/' . $file . '.php'; - - $module = new $file($db); - - // Show modules according to features level - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { - continue; - } - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { - continue; - } - - if ($module->isEnabled()) { - dol_include_once('/' . $moduledir . '/class/' . strtolower($myTmpObjectKey) . '.class.php'); - - print ''; - - // Show example of numbering model - print '' . "\n"; - - print ''; - - $mytmpinstance = new $myTmpObjectKey($db); - $mytmpinstance->initAsSpecimen(); - - // Info - $htmltooltip = ''; - $htmltooltip .= '' . $langs->trans("Version") . ': ' . $module->getVersion() . '
    '; - - $nextval = $module->getNextValue($mytmpinstance); - if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval - $htmltooltip .= '' . $langs->trans("NextValue") . ': '; - if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { - $nextval = $langs->trans($nextval); - } - $htmltooltip .= $nextval . '
    '; - } else { - $htmltooltip .= $langs->trans($module->error) . '
    '; - } - } - - print ''; - - print "\n"; - } - } - } - closedir($handle); - } - } - } - print "
    ' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Example") . '' . $langs->trans("Status") . '' . $langs->trans("ShortInfo") . '
    ' . $module->name . "\n"; - print $module->info(); - print ''; - $tmp = $module->getExample(); - if (preg_match('/^Error/', $tmp)) { - $langs->load("errors"); - print '
    ' . $langs->trans($tmp) . '
    '; - } elseif ($tmp == 'NotConfigured') { - print $langs->trans($tmp); - } else { - print $tmp; - } - print '
    '; - $constforvar = 'WEBPORTAL_' . strtoupper($myTmpObjectKey) . '_ADDON'; - if (getDolGlobalString($constforvar) == $file) { - print img_picto($langs->trans("Activated"), 'switch_on'); - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); - print '

    \n"; - } - - if ($myTmpObjectArray['includedocgeneration']) { - /* - * Document templates generators - */ - $setupnotempty++; - $type = strtolower($myTmpObjectKey); - - print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', ''); - - // Load array def with activated templates - $def = array(); - $sql = "SELECT nom"; - $sql .= " FROM " . $db->prefix() . "document_model"; - $sql .= " WHERE type = '" . $db->escape($type) . "'"; - $sql .= " AND entity = " . $conf->entity; - $resql = $db->query($sql); - if ($resql) { - $i = 0; - $num_rows = $db->num_rows($resql); - while ($i < $num_rows) { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; - } - } else { - dol_print_error($db); - } - - print "\n"; - print "\n"; - print ''; - print ''; - print '\n"; - print '\n"; - print ''; - print ''; - print "\n"; - - clearstatcache(); - $filelist = array(); - - foreach ($dirmodels as $reldir) { - foreach (array('', '/doc') as $valdir) { - $realpath = $reldir . "core/modules/" . $moduledir . $valdir; - $dir = dol_buildpath($realpath); - - if (is_dir($dir)) { - $handle = opendir($dir); - if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { - $filelist[] = $file; - } - closedir($handle); - arsort($filelist); - - foreach ($filelist as $file) { - if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir . '/' . $file)) { - $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); - - require_once $dir . '/' . $file; - $module = new $classname($db); - - $modulequalified = 1; - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { - $modulequalified = 0; - } - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { - $modulequalified = 0; - } - - if ($modulequalified) { - print ''; - - // Active - if (in_array($name, $def)) { - print ''; - } else { - print '"; - } - - // Default - print ''; - - // Info - $htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name; - $htmltooltip .= '
    ' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown")); - if ($module->type == 'pdf') { - $htmltooltip .= '
    ' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur; - } - $htmltooltip .= '
    ' . $langs->trans("Path") . ': ' . preg_replace('/^\//', '', $realpath) . '/' . $file; - - $htmltooltip .= '

    ' . $langs->trans("FeaturesSupported") . ':'; - $htmltooltip .= '
    ' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1); - $htmltooltip .= '
    ' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1); - - print ''; - - // Preview - print ''; - - print "\n"; - } - } - } - } - } - } - } - } - - print '
    ' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Status") . "' . $langs->trans("Default") . "' . $langs->trans("ShortInfo") . '' . $langs->trans("Preview") . '
    '; - print(empty($module->name) ? $name : $module->name); - print "\n"; - if (method_exists($module, 'info')) { - print $module->info($langs); - } else { - print $module->description; - } - print '' . "\n"; - print ''; - print img_picto($langs->trans("Enabled"), 'switch_on'); - print ''; - print '' . "\n"; - print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; - print "'; - $constforvar = 'WEBPORTAL_' . strtoupper($myTmpObjectKey) . '_ADDON_PDF'; - if (getDolGlobalString($constforvar) == $name) { - //print img_picto($langs->trans("Default"), 'on'); - // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset - print '' . img_picto($langs->trans("Enabled"), 'on') . ''; - } else { - print '' . img_picto($langs->trans("Disabled"), 'off') . ''; - } - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); - print ''; - if ($module->type == 'pdf') { - $newname = preg_replace('/_' . preg_quote(strtolower($myTmpObjectKey), '/') . '/', '', $name); - print '' . img_object($langs->trans("Preview"), 'pdf') . ''; - } else { - print img_object($langs->trans("PreviewNotAvailable"), 'generic'); - } - print '
    '; - } -} - // Page end print dol_get_fiche_end(); diff --git a/htdocs/webportal/class/context.class.php b/htdocs/webportal/class/context.class.php index d14efdc2d98..c0a77ffcb2f 100644 --- a/htdocs/webportal/class/context.class.php +++ b/htdocs/webportal/class/context.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,11 +17,11 @@ * along with this program. If not, see . */ - /** - * \file htdocs/webportal/class/context.class.php - * \ingroup webportal - * \brief File of context class for WebPortal - */ +/** +* \file htdocs/webportal/class/context.class.php +* \ingroup webportal +* \brief File of context class for WebPortal +*/ require_once __DIR__ . '/controller.class.php'; require_once __DIR__ . '/webPortalTheme.class.php'; @@ -281,7 +282,7 @@ class Context * * @return string Web Portal root url */ - static public function getRootConfigUrl() + public static function getRootConfigUrl() { global $conf; @@ -351,7 +352,7 @@ class Context * @param array $Tparams Parameters * @return string */ - static public function getPublicControllerUrl($controller = '', $moreParams = '', $Tparams = array()) + public static function getPublicControllerUrl($controller = '', $moreParams = '', $Tparams = array()) { $url = self::getRootConfigUrl(); @@ -364,7 +365,9 @@ class Context // if $moreParams is an array if (!empty($moreParams) && is_array($moreParams)) { - if (isset($moreParams['controller'])) unset($moreParams['controller']); + if (isset($moreParams['controller'])) { + unset($moreParams['controller']); + } if (!empty($moreParams)) { foreach ($moreParams as $paramKey => $paramVal) { $Tparams[$paramKey] = $paramVal; @@ -383,8 +386,12 @@ class Context // if $moreParams is a string if (!empty($moreParams) && !is_array($moreParams)) { if (empty($Tparams)) { - if ($moreParams[0] !== '?') $url .= '?'; - if ($moreParams[0] === '&') $moreParams = substr($moreParams, 1); + if ($moreParams[0] !== '?') { + $url .= '?'; + } + if ($moreParams[0] === '&') { + $moreParams = substr($moreParams, 1); + } } $url .= $moreParams; } @@ -399,7 +406,7 @@ class Context * @param bool $use_forwarded_host Use formatted host * @return string */ - static public function urlOrigin($withRequestUri = true, $use_forwarded_host = false) + public static function urlOrigin($withRequestUri = true, $use_forwarded_host = false) { $s = $_SERVER; @@ -453,10 +460,16 @@ class Context */ public function setError($errors) { - if (!is_array($errors)) $errors = array($errors); - if (!isset($_SESSION['webportal_errors'])) $_SESSION['webportal_errors'] = array(); + if (!is_array($errors)) { + $errors = array($errors); + } + if (!isset($_SESSION['webportal_errors'])) { + $_SESSION['webportal_errors'] = array(); + } foreach ($errors as $msg) { - if (!in_array($msg, $_SESSION['webportal_errors'])) $_SESSION['webportal_errors'][] = $msg; + if (!in_array($msg, $_SESSION['webportal_errors'])) { + $_SESSION['webportal_errors'][] = $msg; + } } } @@ -593,14 +606,14 @@ class Context { $currentToken = $this->newToken(); // Creation of a token against CSRF vulnerabilities - if (!defined('NOTOKENRENEWAL') || empty($currentToken) ) { + if (!defined('NOTOKENRENEWAL') || empty($currentToken)) { // Rolling token at each call ($_SESSION['token'] contains token of previous page) if (isset($_SESSION['newtoken'])) { $_SESSION['token'] = $_SESSION['newtoken']; } // Save what will be next token. Into forms, we will add param $context->newToken(); - $token = dol_hash(uniqid(mt_rand(), true)); // Generate + $token = dol_hash(uniqid((string) mt_rand(), true)); // Generate $_SESSION['newtoken'] = $token; return $token; diff --git a/htdocs/webportal/class/html.formcardwebportal.class.php b/htdocs/webportal/class/html.formcardwebportal.class.php index 702d4dfb3cb..b34577fa1cb 100644 --- a/htdocs/webportal/class/html.formcardwebportal.class.php +++ b/htdocs/webportal/class/html.formcardwebportal.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller + * 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 @@ -403,7 +404,7 @@ class FormCardWebPortal if ($result >= 0) { $action = 'view'; $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation + $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect project after a New on another form object creation if ($urltogo && empty($noback)) { header("Location: " . $urltogo); exit; diff --git a/htdocs/webportal/class/webportalinvoice.class.php b/htdocs/webportal/class/webportalinvoice.class.php index ddb7e7bec8a..751bb28e10f 100644 --- a/htdocs/webportal/class/webportalinvoice.class.php +++ b/htdocs/webportal/class/webportalinvoice.class.php @@ -97,7 +97,7 @@ class WebPortalInvoice extends Facture // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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,), diff --git a/htdocs/webportal/class/webportalmember.class.php b/htdocs/webportal/class/webportalmember.class.php index c4954e4886d..803a405fd5d 100644 --- a/htdocs/webportal/class/webportalmember.class.php +++ b/htdocs/webportal/class/webportalmember.class.php @@ -113,7 +113,7 @@ class WebPortalMember extends Adherent // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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 e9cd8757b61..157dcb25775 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -98,7 +98,7 @@ class WebPortalOrder extends Commande // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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/webportalpartnership.class.php b/htdocs/webportal/class/webportalpartnership.class.php index 78b87cc04dd..c72ae9397f0 100644 --- a/htdocs/webportal/class/webportalpartnership.class.php +++ b/htdocs/webportal/class/webportalpartnership.class.php @@ -97,7 +97,7 @@ class WebPortalPartnership extends Partnership // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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 c49d8bfd686..47669b08c55 100644 --- a/htdocs/webportal/class/webportalpropal.class.php +++ b/htdocs/webportal/class/webportalpropal.class.php @@ -98,7 +98,7 @@ class WebPortalPropal extends Propal // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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/lib/webportal.lib.php b/htdocs/webportal/lib/webportal.lib.php index 97feb78f06a..a2f3fb0eff3 100644 --- a/htdocs/webportal/lib/webportal.lib.php +++ b/htdocs/webportal/lib/webportal.lib.php @@ -32,16 +32,12 @@ function webportalAdminPrepareHead() { global $langs, $conf; - // global $db; - // $extrafields = new ExtraFields($db); - // $extrafields->fetch_name_optionals_label('myobject'); - $langs->load("website"); $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT . '"/webportal/admin/setup.php'; + $head[$h][0] = DOL_URL_ROOT . '/webportal/admin/setup.php'; $head[$h][1] = $langs->trans("Settings"); $head[$h][2] = 'settings'; $h++; @@ -56,17 +52,6 @@ function webportalAdminPrepareHead() $head[$h][2] = 'css'; $h++; - /* - $head[$h][0] = dol_buildpath("/webportal/admin/myobject_extrafields.php", 1); - $head[$h][1] = $langs->trans("ExtraFields"); - $nbExtrafields = is_countable($extrafields->attributes['myobject']['label']) ? count($extrafields->attributes['myobject']['label']) : 0; - if ($nbExtrafields > 0) { - $head[$h][1] .= ' ' . $nbExtrafields . ''; - } - $head[$h][2] = 'myobject_extrafields'; - $h++; - */ - // Show more tabs from modules // Entries must be declared in modules descriptor with line //$this->tabs = array( @@ -75,9 +60,9 @@ function webportalAdminPrepareHead() //$this->tabs = array( // 'entity:-tabname:Title:@webportal:/webportal/mypage.php?id=__ID__' //); // to remove a tab - complete_head_from_modules($conf, $langs, null, $head, $h, 'website'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'webportal'); - complete_head_from_modules($conf, $langs, null, $head, $h, 'website', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'webportal', 'remove'); return $head; } diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index 6bd2c21a0b1..4347affafb2 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 Florian Henry + * 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 @@ -82,11 +83,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), ) ); @@ -98,37 +99,37 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); $actioncomm_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'type_id' => array('name'=>'type_id', 'type'=>'xsd:string'), - 'type_code' => array('name'=>'type_code', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:string'), - 'label' => array('name'=>'label', 'type'=>'xsd:string'), - 'datep' => array('name'=>'datep', 'type'=>'xsd:dateTime'), - 'datef' => array('name'=>'datef', 'type'=>'xsd:dateTime'), - 'datec' => array('name'=>'datec', 'type'=>'xsd:dateTime'), - 'datem' => array('name'=>'datem', 'type'=>'xsd:dateTime'), - 'note' => array('name'=>'note', 'type'=>'xsd:string'), - 'percentage' => array('name'=>'percentage', 'type'=>'xsd:string'), - 'author' => array('name'=>'author', 'type'=>'xsd:string'), - 'usermod' => array('name'=>'usermod', 'type'=>'xsd:string'), - 'userownerid' => array('name'=>'userownerid', 'type'=>'xsd:string'), - 'priority' => array('name'=>'priority', 'type'=>'xsd:string'), - 'fulldayevent' => array('name'=>'fulldayevent', 'type'=>'xsd:string'), - 'location' => array('name'=>'location', 'type'=>'xsd:string'), - 'socid' => array('name'=>'socid', 'type'=>'xsd:string'), - 'contactid' => array('name'=>'contactid', 'type'=>'xsd:string'), - 'projectid' => array('name'=>'projectid', 'type'=>'xsd:string'), - 'fk_element' => array('name'=>'fk_element', 'type'=>'xsd:string'), - 'elementtype' => array('name'=>'elementtype', 'type'=>'xsd:string')); + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'ref' => array('name' => 'ref', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'type_id' => array('name' => 'type_id', 'type' => 'xsd:string'), + 'type_code' => array('name' => 'type_code', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:string'), + 'label' => array('name' => 'label', 'type' => 'xsd:string'), + 'datep' => array('name' => 'datep', 'type' => 'xsd:dateTime'), + 'datef' => array('name' => 'datef', 'type' => 'xsd:dateTime'), + 'datec' => array('name' => 'datec', 'type' => 'xsd:dateTime'), + 'datem' => array('name' => 'datem', 'type' => 'xsd:dateTime'), + 'note' => array('name' => 'note', 'type' => 'xsd:string'), + 'percentage' => array('name' => 'percentage', 'type' => 'xsd:string'), + 'author' => array('name' => 'author', 'type' => 'xsd:string'), + 'usermod' => array('name' => 'usermod', 'type' => 'xsd:string'), + 'userownerid' => array('name' => 'userownerid', 'type' => 'xsd:string'), + 'priority' => array('name' => 'priority', 'type' => 'xsd:string'), + 'fulldayevent' => array('name' => 'fulldayevent', 'type' => 'xsd:string'), + 'location' => array('name' => 'location', 'type' => 'xsd:string'), + 'socid' => array('name' => 'socid', 'type' => 'xsd:string'), + 'contactid' => array('name' => 'contactid', 'type' => 'xsd:string'), + 'projectid' => array('name' => 'projectid', 'type' => 'xsd:string'), + 'fk_element' => array('name' => 'fk_element', 'type' => 'xsd:string'), + 'elementtype' => array('name' => 'elementtype', 'type' => 'xsd:string')); $elementtype = 'actioncomm'; @@ -150,7 +151,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie $type = 'xsd:string'; } - $extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type); + $extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type); } } if (is_array($extrafield_array)) { @@ -175,8 +176,8 @@ $server->wsdl->addComplexType( 'sequence', '', array( - 'code' => array('name'=>'code', 'type'=>'xsd:string'), - 'libelle' => array('name'=>'libelle', 'type'=>'xsd:string') + 'code' => array('name' => 'code', 'type' => 'xsd:string'), + 'libelle' => array('name' => 'libelle', 'type' => 'xsd:string') ) ); @@ -209,9 +210,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getListActionCommType', // Entry values - array('authentication'=>'tns:authentication'), + array('authentication' => 'tns:authentication'), // Exit values - array('result'=>'tns:result', 'actioncommtypes'=>'tns:actioncommtypes'), + array('result' => 'tns:result', 'actioncommtypes' => 'tns:actioncommtypes'), $ns, $ns.'#getListActionCommType', $styledoc, @@ -223,9 +224,9 @@ $server->register( $server->register( 'getActionComm', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'actioncomm'=>'tns:actioncomm'), + array('result' => 'tns:result', 'actioncomm' => 'tns:actioncomm'), $ns, $ns.'#getActionComm', $styledoc, @@ -237,9 +238,9 @@ $server->register( $server->register( 'createActionComm', // Entry values - array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'), + array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#createActionComm', $styledoc, @@ -251,9 +252,9 @@ $server->register( $server->register( 'updateActionComm', // Entry values - array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'), + array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#updateActionComm', $styledoc, @@ -303,29 +304,29 @@ function getActionComm($authentication, $id) if ($result > 0) { $actioncomm_result_fields = array( 'id' => $actioncomm->id, - 'ref'=> $actioncomm->ref, - 'ref_ext'=> $actioncomm->ref_ext, - 'type_id'=> $actioncomm->type_id, - 'type_code'=> $actioncomm->type_code, - 'type'=> $actioncomm->type, - 'label'=> $actioncomm->label, - 'datep'=> dol_print_date($actioncomm->datep, 'dayhourrfc'), - 'datef'=> dol_print_date($actioncomm->datef, 'dayhourrfc'), - 'datec'=> dol_print_date($actioncomm->datec, 'dayhourrfc'), - 'datem'=> dol_print_date($actioncomm->datem, 'dayhourrfc'), - 'note'=> $actioncomm->note_private, - 'percentage'=> $actioncomm->percentage, - 'author'=> $actioncomm->authorid, - 'usermod'=> $actioncomm->usermodid, - 'userownerid'=> $actioncomm->userownerid, - 'priority'=> $actioncomm->priority, - 'fulldayevent'=> $actioncomm->fulldayevent, - 'location'=> $actioncomm->location, - 'socid'=> $actioncomm->socid, - 'contactid'=> $actioncomm->contact_id, - 'projectid'=> $actioncomm->fk_project, - 'fk_element'=> $actioncomm->fk_element, - 'elementtype'=> $actioncomm->elementtype + 'ref' => $actioncomm->ref, + 'ref_ext' => $actioncomm->ref_ext, + 'type_id' => $actioncomm->type_id, + 'type_code' => $actioncomm->type_code, + 'type' => $actioncomm->type, + 'label' => $actioncomm->label, + 'datep' => dol_print_date($actioncomm->datep, 'dayhourrfc'), + 'datef' => dol_print_date($actioncomm->datef, 'dayhourrfc'), + 'datec' => dol_print_date($actioncomm->datec, 'dayhourrfc'), + 'datem' => dol_print_date($actioncomm->datem, 'dayhourrfc'), + 'note' => $actioncomm->note_private, + 'percentage' => $actioncomm->percentage, + 'author' => $actioncomm->authorid, + 'usermod' => $actioncomm->usermodid, + 'userownerid' => $actioncomm->userownerid, + 'priority' => $actioncomm->priority, + 'fulldayevent' => $actioncomm->fulldayevent, + 'location' => $actioncomm->location, + 'socid' => $actioncomm->socid, + 'contactid' => $actioncomm->contact_id, + 'projectid' => $actioncomm->fk_project, + 'fk_element' => $actioncomm->fk_element, + 'elementtype' => $actioncomm->elementtype ); $elementtype = 'actioncomm'; @@ -345,8 +346,8 @@ function getActionComm($authentication, $id) // Create $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'actioncomm'=>$actioncomm_result_fields); + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'actioncomm' => $actioncomm_result_fields); } else { $error++; $errorcode = 'NOT_FOUND'; @@ -360,7 +361,7 @@ function getActionComm($authentication, $id) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -399,12 +400,12 @@ function getListActionCommType($authentication) if ($result > 0) { $resultarray = array(); foreach ($cactioncomm->liste_array as $code => $libeller) { - $resultarray[] = array('code'=>$code, 'libelle'=>$libeller); + $resultarray[] = array('code' => $code, 'libelle' => $libeller); } $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'actioncommtypes'=>$resultarray); + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'actioncommtypes' => $resultarray); } else { $error++; $errorcode = 'NOT_FOUND'; @@ -418,7 +419,7 @@ function getListActionCommType($authentication) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -493,7 +494,7 @@ function createActionComm($authentication, $actioncomm) if (!$error) { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id); } else { $db->rollback(); $error++; @@ -503,7 +504,7 @@ function createActionComm($authentication, $actioncomm) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -586,12 +587,13 @@ function updateActionComm($authentication, $actioncomm) $error++; } } + '@phan-var-force array{id:string} $actioncomm'; if ((!$error) && ($objectfound)) { $db->commit(); $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'id'=>$object->id + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'id' => $object->id ); } elseif ($objectfound) { $db->rollback(); @@ -606,7 +608,7 @@ function updateActionComm($authentication, $actioncomm) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 388fe0392c2..0089b625dfe 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 JF FERRY + * 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 @@ -706,6 +707,7 @@ function updateContact($authentication, $contact) $error++; } } + '@phan-var-force array{id:string} $contact'; if ((!$error) && ($objectfound)) { $db->commit(); diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 90d916e72b0..bb4d104c18d 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Juanjo Menent + * 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 @@ -83,11 +84,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string') + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string') ) ); // Define WSDL Return object @@ -98,8 +99,8 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); @@ -111,22 +112,22 @@ $server->wsdl->addComplexType( 'all', '', array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:int'), - 'desc' => array('name'=>'desc', 'type'=>'xsd:string'), - 'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:double'), - 'qty' => array('name'=>'qty', 'type'=>'xsd:double'), - 'unitprice' => array('name'=>'unitprice', 'type'=>'xsd:double'), - 'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'), - 'total' => array('name'=>'total', 'type'=>'xsd:double'), - 'date_start' => array('name'=>'date_start', 'type'=>'xsd:date'), - 'date_end' => array('name'=>'date_end', 'type'=>'xsd:date'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:int'), + 'desc' => array('name' => 'desc', 'type' => 'xsd:string'), + 'vat_rate' => array('name' => 'vat_rate', 'type' => 'xsd:double'), + 'qty' => array('name' => 'qty', 'type' => 'xsd:double'), + 'unitprice' => array('name' => 'unitprice', 'type' => 'xsd:double'), + 'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'), + 'total' => array('name' => 'total', 'type' => 'xsd:double'), + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:date'), + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:date'), // From product - 'product_id' => array('name'=>'product_id', 'type'=>'xsd:int'), - 'product_ref' => array('name'=>'product_ref', 'type'=>'xsd:string'), - 'product_label' => array('name'=>'product_label', 'type'=>'xsd:string'), - 'product_desc' => array('name'=>'product_desc', 'type'=>'xsd:string') + 'product_id' => array('name' => 'product_id', 'type' => 'xsd:int'), + 'product_ref' => array('name' => 'product_ref', 'type' => 'xsd:string'), + 'product_label' => array('name' => 'product_label', 'type' => 'xsd:string'), + 'product_desc' => array('name' => 'product_desc', 'type' => 'xsd:string') ) ); @@ -168,29 +169,29 @@ $server->wsdl->addComplexType( 'all', '', array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'thirdparty_id' => array('name'=>'thirdparty_id', 'type'=>'xsd:int'), - 'fk_user_author' => array('name'=>'fk_user_author', 'type'=>'xsd:string'), - 'fk_user_valid' => array('name'=>'fk_user_valid', 'type'=>'xsd:string'), - 'date' => array('name'=>'date', 'type'=>'xsd:date'), - 'date_due' => array('name'=>'date_due', 'type'=>'xsd:date'), - 'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'), - 'date_validation' => array('name'=>'date_validation', 'type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'), - 'payment_mode_id' => array('name'=>'payment_mode_id', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:int'), - 'total_net' => array('name'=>'type', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'type', 'type'=>'xsd:double'), - 'total' => array('name'=>'type', 'type'=>'xsd:double'), - 'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'), - 'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'), - 'status' => array('name'=>'status', 'type'=>'xsd:int'), - 'close_code' => array('name'=>'close_code', 'type'=>'xsd:string'), - 'close_note' => array('name'=>'close_note', 'type'=>'xsd:string'), - 'project_id' => array('name'=>'project_id', 'type'=>'xsd:string'), - 'lines' => array('name'=>'lines', 'type'=>'tns:LinesArray2') + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'ref' => array('name' => 'ref', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'thirdparty_id' => array('name' => 'thirdparty_id', 'type' => 'xsd:int'), + 'fk_user_author' => array('name' => 'fk_user_author', 'type' => 'xsd:string'), + 'fk_user_valid' => array('name' => 'fk_user_valid', 'type' => 'xsd:string'), + 'date' => array('name' => 'date', 'type' => 'xsd:date'), + 'date_due' => array('name' => 'date_due', 'type' => 'xsd:date'), + 'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'), + 'date_validation' => array('name' => 'date_validation', 'type' => 'xsd:dateTime'), + 'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'), + 'payment_mode_id' => array('name' => 'payment_mode_id', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:int'), + 'total_net' => array('name' => 'type', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'type', 'type' => 'xsd:double'), + 'total' => array('name' => 'type', 'type' => 'xsd:double'), + 'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'), + 'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'), + 'status' => array('name' => 'status', 'type' => 'xsd:int'), + 'close_code' => array('name' => 'close_code', 'type' => 'xsd:string'), + 'close_note' => array('name' => 'close_note', 'type' => 'xsd:string'), + 'project_id' => array('name' => 'project_id', 'type' => 'xsd:string'), + 'lines' => array('name' => 'lines', 'type' => 'tns:LinesArray2') ) ); /* @@ -237,9 +238,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getInvoice', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'invoice'=>'tns:invoice'), + array('result' => 'tns:result', 'invoice' => 'tns:invoice'), $ns, $ns.'#getInvoice', $styledoc, @@ -249,9 +250,9 @@ $server->register( $server->register( 'getInvoicesForThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'idthirdparty'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'idthirdparty' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'invoices'=>'tns:InvoicesArray2'), + array('result' => 'tns:result', 'invoices' => 'tns:InvoicesArray2'), $ns, $ns.'#getInvoicesForThirdParty', $styledoc, @@ -261,9 +262,9 @@ $server->register( $server->register( 'createInvoice', // Entry values - array('authentication'=>'tns:authentication', 'invoice'=>'tns:invoice'), + array('authentication' => 'tns:authentication', 'invoice' => 'tns:invoice'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), $ns, $ns.'#createInvoice', $styledoc, @@ -273,9 +274,9 @@ $server->register( $server->register( 'createInvoiceFromOrder', // Entry values - array('authentication'=>'tns:authentication', 'id_order'=>'xsd:string', 'ref_order'=>'xsd:string', 'ref_ext_order'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id_order' => 'xsd:string', 'ref_order' => 'xsd:string', 'ref_ext_order' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), $ns, $ns.'#createInvoiceFromOrder', $styledoc, @@ -285,9 +286,9 @@ $server->register( $server->register( 'updateInvoice', // Entry values - array('authentication'=>'tns:authentication', 'invoice'=>'tns:invoice'), + array('authentication' => 'tns:authentication', 'invoice' => 'tns:invoice'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), $ns, $ns.'#updateInvoice', $styledoc, @@ -340,29 +341,29 @@ function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') foreach ($invoice->lines as $line) { //var_dump($line); exit; $linesresp[] = array( - 'id'=>$line->id, - 'type'=>$line->product_type, - 'desc'=>dol_htmlcleanlastbr($line->desc), - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'vat_rate'=>$line->tva_tx, - 'qty'=>$line->qty, - 'unitprice'=> $line->subprice, - 'date_start'=> $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '', - 'date_end'=> $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '', - 'product_id'=>$line->fk_product, - 'product_ref'=>$line->product_ref, - 'product_label'=>$line->product_label, - 'product_desc'=>$line->product_desc, + 'id' => $line->id, + 'type' => $line->product_type, + 'desc' => dol_htmlcleanlastbr($line->desc), + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'vat_rate' => $line->tva_tx, + 'qty' => $line->qty, + 'unitprice' => $line->subprice, + 'date_start' => $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '', + 'date_end' => $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '', + 'product_id' => $line->fk_product, + 'product_ref' => $line->product_ref, + 'product_label' => $line->product_label, + 'product_desc' => $line->product_desc, ); $i++; } // Create invoice $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'invoice'=>array( + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'invoice' => array( 'id' => $invoice->id, 'ref' => $invoice->ref, 'ref_ext' => $invoice->ref_ext ? $invoice->ref_ext : '', // If not defined, field is not added into soap @@ -400,7 +401,7 @@ function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -475,20 +476,20 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) $linesresp = array(); foreach ($invoice->lines as $line) { $linesresp[] = array( - 'id'=>$line->id, - 'type'=>$line->product_type, - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'vat_rate'=>$line->tva_tx, - 'qty'=>$line->qty, - 'unitprice'=> $line->subprice, - 'date_start'=> $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '', - 'date_end'=> $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '', - 'product_id'=>$line->fk_product, - 'product_ref'=>$line->product_ref, - 'product_label'=>$line->product_label, - 'product_desc'=>$line->product_desc, + 'id' => $line->id, + 'type' => $line->product_type, + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'vat_rate' => $line->tva_tx, + 'qty' => $line->qty, + 'unitprice' => $line->subprice, + 'date_start' => $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '', + 'date_end' => $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '', + 'product_id' => $line->fk_product, + 'product_ref' => $line->product_ref, + 'product_label' => $line->product_label, + 'product_desc' => $line->product_desc, ); } @@ -510,7 +511,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) 'total' => $invoice->total_ttc, 'note_private' => $invoice->note_private ? $invoice->note_private : '', 'note_public' => $invoice->note_public ? $invoice->note_public : '', - 'status'=> $invoice->statut, + 'status' => $invoice->statut, 'project_id' => $invoice->fk_project, 'close_code' => $invoice->close_code ? $invoice->close_code : '', 'close_note' => $invoice->close_note ? $invoice->close_note : '', @@ -523,8 +524,8 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) } $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'invoices'=>$linesinvoice + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'invoices' => $linesinvoice ); } else { @@ -535,7 +536,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -641,8 +642,8 @@ function createInvoice($authentication, $invoice) if (!$error) { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$new_invoice->id, - 'ref'=>$new_invoice->ref, 'ref_ext'=>$new_invoice->ref_ext); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $new_invoice->id, + 'ref' => $new_invoice->ref, 'ref_ext' => $new_invoice->ref_ext); } else { $db->rollback(); $error++; @@ -653,7 +654,7 @@ function createInvoice($authentication, $invoice) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -662,11 +663,11 @@ function createInvoice($authentication, $invoice) /** * Create an invoice from an order * - * @param array $authentication Array of authentication information + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information * @param string $id_order id of order to copy invoice from * @param string $ref_order ref of order to copy invoice from * @param string $ref_ext_order ref_ext of order to copy invoice from - * @return array Array result + * @return array{result:array{result_code:string,result_label:string},id?:int,ref?:string,ref_ext?:string} Array result */ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '', $ref_ext_order = '') { @@ -732,20 +733,20 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '' } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } else { - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref, 'ref_ext'=>$newobject->ref_ext); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref, 'ref_ext' => $newobject->ref_ext); } return $objectresp; } /** - * Uddate an invoice, only change the state of an invoice + * Update an invoice, only change the state of an invoice * - * @param array $authentication Array of authentication information - * @param array $invoice Invoice - * @return array Array result + * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information + * @param array{id:string,ref:string,ref_ext:string,status?:string} $invoice Invoice + * @return array{result:array{result_code:string,result_label:string},id?:int,ref?:string,ref_ext?:string} Array result */ function updateInvoice($authentication, $invoice) { @@ -808,10 +809,10 @@ function updateInvoice($authentication, $invoice) if ((!$error) && ($objectfound)) { $db->commit(); $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'id'=>$object->id, - 'ref'=>$object->ref, - 'ref_ext'=>$object->ref_ext + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'id' => $object->id, + 'ref' => $object->ref, + 'ref_ext' => $object->ref_ext ); } elseif ($objectfound) { $db->rollback(); @@ -826,7 +827,7 @@ function updateInvoice($authentication, $invoice) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 792f7a5889b..11b375e0211 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2012 JF FERRY * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,11 +83,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string') + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string') ) ); // Define WSDL Return object @@ -97,37 +98,37 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); $line_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:int'), - 'fk_commande' => array('name'=>'fk_commande', 'type'=>'xsd:int'), - 'fk_parent_line' => array('name'=>'fk_parent_line', 'type'=>'xsd:int'), - 'desc' => array('name'=>'desc', 'type'=>'xsd:string'), - 'qty' => array('name'=>'qty', 'type'=>'xsd:double'), - 'price' => array('name'=>'price', 'type'=>'xsd:double'), - 'unitprice' => array('name'=>'unitprice', 'type'=>'xsd:double'), - 'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:double'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:int'), + 'fk_commande' => array('name' => 'fk_commande', 'type' => 'xsd:int'), + 'fk_parent_line' => array('name' => 'fk_parent_line', 'type' => 'xsd:int'), + 'desc' => array('name' => 'desc', 'type' => 'xsd:string'), + 'qty' => array('name' => 'qty', 'type' => 'xsd:double'), + 'price' => array('name' => 'price', 'type' => 'xsd:double'), + 'unitprice' => array('name' => 'unitprice', 'type' => 'xsd:double'), + 'vat_rate' => array('name' => 'vat_rate', 'type' => 'xsd:double'), - 'remise' => array('name'=>'remise', 'type'=>'xsd:double'), - 'remise_percent' => array('name'=>'remise_percent', 'type'=>'xsd:double'), + 'remise' => array('name' => 'remise', 'type' => 'xsd:double'), + 'remise_percent' => array('name' => 'remise_percent', 'type' => 'xsd:double'), - 'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'), - 'total' => array('name'=>'total', 'type'=>'xsd:double'), + 'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'), + 'total' => array('name' => 'total', 'type' => 'xsd:double'), - 'date_start' => array('name'=>'date_start', 'type'=>'xsd:date'), - 'date_end' => array('name'=>'date_end', 'type'=>'xsd:date'), + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:date'), + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:date'), // From product - 'product_id' => array('name'=>'product_id', 'type'=>'xsd:int'), - 'product_ref' => array('name'=>'product_ref', 'type'=>'xsd:string'), - 'product_label' => array('name'=>'product_label', 'type'=>'xsd:string'), - 'product_desc' => array('name'=>'product_desc', 'type'=>'xsd:string') + 'product_id' => array('name' => 'product_id', 'type' => 'xsd:int'), + 'product_ref' => array('name' => 'product_ref', 'type' => 'xsd:string'), + 'product_label' => array('name' => 'product_label', 'type' => 'xsd:string'), + 'product_desc' => array('name' => 'product_desc', 'type' => 'xsd:string') ); $elementtype = 'commandedet'; @@ -149,7 +150,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie } else { $type = 'xsd:string'; } - $extrafield_line_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type); + $extrafield_line_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type); } } if (is_array($extrafield_line_array)) { @@ -198,39 +199,39 @@ $server->wsdl->addComplexType( ); $order_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), - 'ref_client' => array('name'=>'ref_client', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'thirdparty_id' => array('name'=>'thirdparty_id', 'type'=>'xsd:int'), - 'status' => array('name'=>'status', 'type'=>'xsd:int'), - 'billed' => array('name'=>'billed', 'type'=>'xsd:string'), - 'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'), - 'total_localtax1' => array('name'=>'total_localtax1', 'type'=>'xsd:double'), - 'total_localtax2' => array('name'=>'total_localtax2', 'type'=>'xsd:double'), - 'total' => array('name'=>'total', 'type'=>'xsd:double'), - 'date' => array('name'=>'date', 'type'=>'xsd:date'), - 'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'), - 'date_validation' => array('name'=>'date_validation', 'type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'), - 'source' => array('name'=>'source', 'type'=>'xsd:string'), - 'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'), - 'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'), - 'project_id' => array('name'=>'project_id', 'type'=>'xsd:string'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'ref' => array('name' => 'ref', 'type' => 'xsd:string'), + 'ref_client' => array('name' => 'ref_client', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'thirdparty_id' => array('name' => 'thirdparty_id', 'type' => 'xsd:int'), + 'status' => array('name' => 'status', 'type' => 'xsd:int'), + 'billed' => array('name' => 'billed', 'type' => 'xsd:string'), + 'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'), + 'total_localtax1' => array('name' => 'total_localtax1', 'type' => 'xsd:double'), + 'total_localtax2' => array('name' => 'total_localtax2', 'type' => 'xsd:double'), + 'total' => array('name' => 'total', 'type' => 'xsd:double'), + 'date' => array('name' => 'date', 'type' => 'xsd:date'), + 'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'), + 'date_validation' => array('name' => 'date_validation', 'type' => 'xsd:dateTime'), + 'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'), + 'source' => array('name' => 'source', 'type' => 'xsd:string'), + 'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'), + 'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'), + 'project_id' => array('name' => 'project_id', 'type' => 'xsd:string'), - 'mode_reglement_id' => array('name'=>'mode_reglement_id', 'type'=>'xsd:string'), - 'mode_reglement_code' => array('name'=>'mode_reglement_code', 'type'=>'xsd:string'), - 'mode_reglement' => array('name'=>'mode_reglement', 'type'=>'xsd:string'), - 'cond_reglement_id' => array('name'=>'cond_reglement_id', 'type'=>'xsd:string'), - 'cond_reglement_code' => array('name'=>'cond_reglement_code', 'type'=>'xsd:string'), - 'cond_reglement' => array('name'=>'cond_reglement', 'type'=>'xsd:string'), - 'cond_reglement_doc' => array('name'=>'cond_reglement_doc', 'type'=>'xsd:string'), + 'mode_reglement_id' => array('name' => 'mode_reglement_id', 'type' => 'xsd:string'), + 'mode_reglement_code' => array('name' => 'mode_reglement_code', 'type' => 'xsd:string'), + 'mode_reglement' => array('name' => 'mode_reglement', 'type' => 'xsd:string'), + 'cond_reglement_id' => array('name' => 'cond_reglement_id', 'type' => 'xsd:string'), + 'cond_reglement_code' => array('name' => 'cond_reglement_code', 'type' => 'xsd:string'), + 'cond_reglement' => array('name' => 'cond_reglement', 'type' => 'xsd:string'), + 'cond_reglement_doc' => array('name' => 'cond_reglement_doc', 'type' => 'xsd:string'), - 'date_livraison' => array('name'=>'date_livraison', 'type'=>'xsd:date'), - 'demand_reason_id' => array('name'=>'demand_reason_id', 'type'=>'xsd:string'), + 'date_livraison' => array('name' => 'date_livraison', 'type' => 'xsd:date'), + 'demand_reason_id' => array('name' => 'demand_reason_id', 'type' => 'xsd:string'), - 'lines' => array('name'=>'lines', 'type'=>'tns:LinesArray2') + 'lines' => array('name' => 'lines', 'type' => 'tns:LinesArray2') ); $elementtype = 'commande'; @@ -252,7 +253,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie } else { $type = 'xsd:string'; } - $extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type); + $extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type); } } if (is_array($extrafield_array)) { @@ -312,8 +313,8 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped // Register WSDL $server->register( 'getOrder', - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), // Entry values - array('result'=>'tns:result', 'order'=>'tns:order'), // Exit values + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Entry values + array('result' => 'tns:result', 'order' => 'tns:order'), // Exit values $ns, $ns.'#getOrder', $styledoc, @@ -323,8 +324,8 @@ $server->register( $server->register( 'getOrdersForThirdParty', - array('authentication'=>'tns:authentication', 'idthirdparty'=>'xsd:string'), // Entry values - array('result'=>'tns:result', 'orders'=>'tns:OrdersArray2'), // Exit values + array('authentication' => 'tns:authentication', 'idthirdparty' => 'xsd:string'), // Entry values + array('result' => 'tns:result', 'orders' => 'tns:OrdersArray2'), // Exit values $ns, $ns.'#getOrdersForThirdParty', $styledoc, @@ -334,8 +335,8 @@ $server->register( $server->register( 'createOrder', - array('authentication'=>'tns:authentication', 'order'=>'tns:order'), // Entry values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string'), // Exit values + array('authentication' => 'tns:authentication', 'order' => 'tns:order'), // Entry values + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string'), // Exit values $ns, $ns.'#createOrder', $styledoc, @@ -345,8 +346,8 @@ $server->register( $server->register( 'updateOrder', - array('authentication'=>'tns:authentication', 'order'=>'tns:order'), // Entry values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), // Exit values + array('authentication' => 'tns:authentication', 'order' => 'tns:order'), // Entry values + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Exit values $ns, $ns.'#updateOrder', $styledoc, @@ -356,8 +357,8 @@ $server->register( $server->register( 'validOrder', - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'id_warehouse'=>'xsd:string'), // Entry values - array('result'=>'tns:result'), // Exit values + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'id_warehouse' => 'xsd:string'), // Entry values + array('result' => 'tns:result'), // Exit values $ns, $ns.'#validOrder', $styledoc, @@ -424,34 +425,34 @@ function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '') foreach ($order->lines as $line) { //var_dump($line); exit; $linesresp[] = array( - 'id'=>$line->rowid, - 'fk_commande'=>$line->fk_commande, - 'fk_parent_line'=>$line->fk_parent_line, - 'desc'=>$line->desc, - 'qty'=>$line->qty, - 'price'=>$line->price, - 'unitprice'=>$line->subprice, - 'vat_rate'=>$line->tva_tx, - 'remise'=>$line->remise, - 'remise_percent'=>$line->remise_percent, - 'product_id'=>$line->fk_product, - 'product_type'=>$line->product_type, - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'date_start'=>$line->date_start, - 'date_end'=>$line->date_end, - 'product_ref'=>$line->product_ref, - 'product_label'=>$line->product_label, - 'product_desc'=>$line->product_desc + 'id' => $line->rowid, + 'fk_commande' => $line->fk_commande, + 'fk_parent_line' => $line->fk_parent_line, + 'desc' => $line->desc, + 'qty' => $line->qty, + 'price' => $line->price, + 'unitprice' => $line->subprice, + 'vat_rate' => $line->tva_tx, + 'remise' => $line->remise, + 'remise_percent' => $line->remise_percent, + 'product_id' => $line->fk_product, + 'product_type' => $line->product_type, + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'date_start' => $line->date_start, + 'date_end' => $line->date_end, + 'product_ref' => $line->product_ref, + 'product_label' => $line->product_label, + 'product_desc' => $line->product_desc ); $i++; } // Create order $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'order'=>array( + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'order' => array( 'id' => $order->id, 'ref' => $order->ref, 'ref_client' => $order->ref_client, @@ -503,7 +504,7 @@ function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '') } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -579,26 +580,26 @@ function getOrdersForThirdParty($authentication, $idthirdparty) $linesresp = array(); foreach ($order->lines as $line) { $linesresp[] = array( - 'id'=>$line->rowid, - 'type'=>$line->product_type, - 'fk_commande'=>$line->fk_commande, - 'fk_parent_line'=>$line->fk_parent_line, - 'desc'=>$line->desc, - 'qty'=>$line->qty, - 'price'=>$line->price, - 'unitprice'=>$line->subprice, - 'tva_tx'=>$line->tva_tx, - 'remise'=>$line->remise, - 'remise_percent'=>$line->remise_percent, - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'date_start'=>$line->date_start, - 'date_end'=>$line->date_end, - 'product_id'=>$line->fk_product, - 'product_ref'=>$line->product_ref, - 'product_label'=>$line->product_label, - 'product_desc'=>$line->product_desc + 'id' => $line->rowid, + 'type' => $line->product_type, + 'fk_commande' => $line->fk_commande, + 'fk_parent_line' => $line->fk_parent_line, + 'desc' => $line->desc, + 'qty' => $line->qty, + 'price' => $line->price, + 'unitprice' => $line->subprice, + 'tva_tx' => $line->tva_tx, + 'remise' => $line->remise, + 'remise_percent' => $line->remise_percent, + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'date_start' => $line->date_start, + 'date_end' => $line->date_end, + 'product_id' => $line->fk_product, + 'product_ref' => $line->product_ref, + 'product_label' => $line->product_label, + 'product_desc' => $line->product_desc ); } @@ -644,8 +645,8 @@ function getOrdersForThirdParty($authentication, $idthirdparty) } $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'orders'=>$linesorders + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'orders' => $linesorders ); } else { @@ -656,7 +657,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -786,7 +787,7 @@ function createOrder($authentication, $order) if ($result >= 0) { dol_syslog("Webservice server_order:: order creation & validation succeeded, commit", LOG_DEBUG); $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref); } else { dol_syslog("Webservice server_order:: order creation or validation failed, rollback", LOG_ERR); $db->rollback(); @@ -797,7 +798,7 @@ function createOrder($authentication, $order) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -865,10 +866,10 @@ function validOrder($authentication, $id = 0, $id_warehouse = 0) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } else { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>'')); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => '')); } return $objectresp; @@ -878,7 +879,7 @@ function validOrder($authentication, $id = 0, $id_warehouse = 0) * Update an order * * @param array $authentication Array of authentication information - * @param array $order Order info + * @param array{id:string,ref:string,refext:string} $order Order info * @return array Array result */ function updateOrder($authentication, $order) @@ -969,10 +970,10 @@ function updateOrder($authentication, $order) if ((!$error) && ($objectfound)) { $db->commit(); $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'id'=>$object->id, - 'ref'=>$object->ref, - 'ref_ext'=>$object->ref_ext + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'id' => $object->id, + 'ref' => $object->ref, + 'ref_ext' => $object->ref_ext ); } elseif ($objectfound) { $db->rollback(); @@ -987,7 +988,7 @@ function updateOrder($authentication, $order) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 353387f7681..a768b970652 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,11 +82,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), ) ); // Define WSDL Return object @@ -96,48 +97,48 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); $thirdparty_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'name', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'fk_user_author' => array('name'=>'fk_user_author', 'type'=>'xsd:string'), - 'status' => array('name'=>'status', 'type'=>'xsd:string'), - 'client' => array('name'=>'client', 'type'=>'xsd:string'), - 'supplier' => array('name'=>'supplier', 'type'=>'xsd:string'), - 'customer_code' => array('name'=>'customer_code', 'type'=>'xsd:string'), - 'supplier_code' => array('name'=>'supplier_code', 'type'=>'xsd:string'), - 'customer_code_accountancy' => array('name'=>'customer_code_accountancy', 'type'=>'xsd:string'), - 'supplier_code_accountancy' => array('name'=>'supplier_code_accountancy', 'type'=>'xsd:string'), - 'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'), - 'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'), - 'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'), - 'address' => array('name'=>'address', 'type'=>'xsd:string'), - 'zip' => array('name'=>'zip', 'type'=>'xsd:string'), - 'town' => array('name'=>'town', 'type'=>'xsd:string'), - 'region_code' => array('name'=>'region_code', 'type'=>'xsd:string'), - 'country_id' => array('name'=>'country_id', 'type'=>'xsd:string'), - 'country_code' => array('name'=>'country_code', 'type'=>'xsd:string'), - 'country' => array('name'=>'country', 'type'=>'xsd:string'), - 'phone' => array('name'=>'phone', 'type'=>'xsd:string'), - 'fax' => array('name'=>'fax', 'type'=>'xsd:string'), - 'email' => array('name'=>'email', 'type'=>'xsd:string'), - 'url' => array('name'=>'url', 'type'=>'xsd:string'), - 'profid1' => array('name'=>'profid1', 'type'=>'xsd:string'), - 'profid2' => array('name'=>'profid2', 'type'=>'xsd:string'), - 'profid3' => array('name'=>'profid3', 'type'=>'xsd:string'), - 'profid4' => array('name'=>'profid4', 'type'=>'xsd:string'), - 'profid5' => array('name'=>'profid5', 'type'=>'xsd:string'), - 'profid6' => array('name'=>'profid6', 'type'=>'xsd:string'), - 'capital' => array('name'=>'capital', 'type'=>'xsd:string'), - 'vat_used' => array('name'=>'vat_used', 'type'=>'xsd:string'), - 'vat_number' => array('name'=>'vat_number', 'type'=>'xsd:string')); + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'ref' => array('name' => 'name', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'fk_user_author' => array('name' => 'fk_user_author', 'type' => 'xsd:string'), + 'status' => array('name' => 'status', 'type' => 'xsd:string'), + 'client' => array('name' => 'client', 'type' => 'xsd:string'), + 'supplier' => array('name' => 'supplier', 'type' => 'xsd:string'), + 'customer_code' => array('name' => 'customer_code', 'type' => 'xsd:string'), + 'supplier_code' => array('name' => 'supplier_code', 'type' => 'xsd:string'), + 'customer_code_accountancy' => array('name' => 'customer_code_accountancy', 'type' => 'xsd:string'), + 'supplier_code_accountancy' => array('name' => 'supplier_code_accountancy', 'type' => 'xsd:string'), + 'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'), + 'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'), + 'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'), + 'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'), + 'address' => array('name' => 'address', 'type' => 'xsd:string'), + 'zip' => array('name' => 'zip', 'type' => 'xsd:string'), + 'town' => array('name' => 'town', 'type' => 'xsd:string'), + 'region_code' => array('name' => 'region_code', 'type' => 'xsd:string'), + 'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'), + 'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'), + 'country' => array('name' => 'country', 'type' => 'xsd:string'), + 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), + 'fax' => array('name' => 'fax', 'type' => 'xsd:string'), + 'email' => array('name' => 'email', 'type' => 'xsd:string'), + 'url' => array('name' => 'url', 'type' => 'xsd:string'), + 'profid1' => array('name' => 'profid1', 'type' => 'xsd:string'), + 'profid2' => array('name' => 'profid2', 'type' => 'xsd:string'), + 'profid3' => array('name' => 'profid3', 'type' => 'xsd:string'), + 'profid4' => array('name' => 'profid4', 'type' => 'xsd:string'), + 'profid5' => array('name' => 'profid5', 'type' => 'xsd:string'), + 'profid6' => array('name' => 'profid6', 'type' => 'xsd:string'), + 'capital' => array('name' => 'capital', 'type' => 'xsd:string'), + 'vat_used' => array('name' => 'vat_used', 'type' => 'xsd:string'), + 'vat_number' => array('name' => 'vat_number', 'type' => 'xsd:string')); $elementtype = 'societe'; @@ -159,7 +160,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie $type = 'xsd:string'; } - $extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type); + $extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type); } } @@ -186,9 +187,9 @@ $server->wsdl->addComplexType( '', array( //'limit' => array('name'=>'limit','type'=>'xsd:string'), - 'client' => array('name'=>'client', 'type'=>'xsd:string'), - 'supplier' => array('name'=>'supplier', 'type'=>'xsd:string'), - 'category' => array('name'=>'category', 'type'=>'xsd:string') + 'client' => array('name' => 'client', 'type' => 'xsd:string'), + 'supplier' => array('name' => 'supplier', 'type' => 'xsd:string'), + 'category' => array('name' => 'category', 'type' => 'xsd:string') ) ); @@ -200,7 +201,7 @@ $server->wsdl->addComplexType( 'SOAP-ENC:Array', array(), array( - array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:thirdparty[]') + array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:thirdparty[]') ), 'tns:thirdparty' ); @@ -232,9 +233,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string', 'barcode'=>'xsd:string', 'profid1'=>'xsd:string', 'profid2'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string', 'barcode' => 'xsd:string', 'profid1' => 'xsd:string', 'profid2' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'thirdparty'=>'tns:thirdparty'), + array('result' => 'tns:result', 'thirdparty' => 'tns:thirdparty'), $ns, $ns.'#getThirdParty', $styledoc, @@ -246,9 +247,9 @@ $server->register( $server->register( 'createThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'thirdparty'=>'tns:thirdparty'), + array('authentication' => 'tns:authentication', 'thirdparty' => 'tns:thirdparty'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string'), $ns, $ns.'#createThirdParty', $styledoc, @@ -260,9 +261,9 @@ $server->register( $server->register( 'updateThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'thirdparty'=>'tns:thirdparty'), + array('authentication' => 'tns:authentication', 'thirdparty' => 'tns:thirdparty'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#updateThirdParty', $styledoc, @@ -275,9 +276,9 @@ $server->register( $server->register( 'getListOfThirdParties', // Entry values - array('authentication'=>'tns:authentication', 'filterthirdparty'=>'tns:filterthirdparty'), + array('authentication' => 'tns:authentication', 'filterthirdparty' => 'tns:filterthirdparty'), // Exit values - array('result'=>'tns:result', 'thirdparties'=>'tns:ThirdPartiesArray2'), + array('result' => 'tns:result', 'thirdparties' => 'tns:ThirdPartiesArray2'), $ns, $ns.'#getListOfThirdParties', $styledoc, @@ -289,9 +290,9 @@ $server->register( $server->register( 'deleteThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#deleteThirdParty', $styledoc, @@ -401,8 +402,8 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar // Create $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'thirdparty'=>$thirdparty_result_fields); + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'thirdparty' => $thirdparty_result_fields); } elseif ($result == -2) { $error++; $errorcode = 'DUPLICATE_FOUND'; @@ -420,7 +421,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -544,7 +545,7 @@ function createThirdParty($authentication, $thirdparty) $newobject->add_commercial($fuser, $thirdparty["commid"]); } - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref); } else { $db->rollback(); $error++; @@ -554,7 +555,7 @@ function createThirdParty($authentication, $thirdparty) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -669,11 +670,13 @@ function updateThirdParty($authentication, $thirdparty) } } + '@phan-var-force array{id:string} $thirdparty'; + if ((!$error) && ($objectfound)) { $db->commit(); $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'id'=>$object->id + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'id' => $object->id ); } elseif ($objectfound) { $db->rollback(); @@ -688,7 +691,7 @@ function updateThirdParty($authentication, $thirdparty) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -769,16 +772,16 @@ function getListOfThirdParties($authentication, $filterthirdparty) } } - $arraythirdparties[] = array('id'=>$obj->socRowid, - 'ref'=>$obj->ref, - 'ref_ext'=>$obj->ref_ext, - 'address'=>$obj->address, - 'zip'=>$obj->zip, - 'town'=>$obj->town, - 'country'=>$obj->country, - 'phone'=>$obj->phone, - 'fax'=>$obj->fax, - 'url'=>$obj->url + $arraythirdparties[] = array('id' => $obj->socRowid, + 'ref' => $obj->ref, + 'ref_ext' => $obj->ref_ext, + 'address' => $obj->address, + 'zip' => $obj->zip, + 'town' => $obj->town, + 'country' => $obj->country, + 'phone' => $obj->phone, + 'fax' => $obj->fax, + 'url' => $obj->url ); $arraythirdparties[$i] = array_merge($arraythirdparties[$i], $extrafieldsOptions); @@ -793,13 +796,13 @@ function getListOfThirdParties($authentication, $filterthirdparty) if ($error) { $objectresp = array( - 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), - 'thirdparties'=>$arraythirdparties + 'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel), + 'thirdparties' => $arraythirdparties ); } else { $objectresp = array( - 'result'=>array('result_code' => 'OK', 'result_label' => ''), - 'thirdparties'=>$arraythirdparties + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'thirdparties' => $arraythirdparties ); } @@ -855,7 +858,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') if ($result > 0) { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>'')); + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => '')); } else { $db->rollback(); $error++; @@ -876,7 +879,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 2dbc2227f9d..e8d198f61b3 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1310,7 +1310,7 @@ class Website extends CommonObject $newid = 0; // Scan the line - if (preg_match('/^-- Page ID (\d+)\s[^\s]+\s(\d+).*Aliases\s(.*)\s--;/i', $buf, $reg)) { + if (preg_match('/^-- Page ID (\d+)\s[^\s]+\s(\d+).*Aliases\s(.+)\s--;/i', $buf, $reg)) { // Example of line: "-- Page ID 179 -> 1__+MAX_llx_website_page__ - Aliases about-us --;" $oldid = $reg[1]; $newid = ($reg[2] + $maxrowid); @@ -1319,12 +1319,12 @@ class Website extends CommonObject dol_syslog("In sql source file, we have the page ID ".$oldid." to replace with the new ID ".$newid.", and we must create the shortcut aliases: ".$reg[3]); //dol_move($conf->website->dir_output.'/'.$object->ref.'/page'.$oldid.'.tpl.php', $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php', 0, 1, 0, 0); - } elseif (preg_match('/^-- Page ID (\d+).*Aliases\s(.*)\s--;/i', $buf, $reg)) { + } elseif (preg_match('/^-- Page ID (\d+).*Aliases\s(.*)\s--;/i', $buf, /** @var string[] $reg */ $reg)) { // Example of line: "-- Page ID 1__+MAX_llx_website_page__ - Aliases about-us --;" $newid = ($reg[1] + $maxrowid); $aliasesarray = explode(',', $reg[2]); - dol_syslog("In sql source file, we have the page with the new ID ".$newid.", and we must create the shortcut aliases: ".$reg[3]); + dol_syslog("In sql source file, we have the page with the new ID ".$newid.", and we must create the shortcut aliases: ".$reg[2]); } if ($newid) { @@ -1868,6 +1868,8 @@ class Website extends CommonObject $numOfPageDest = $this->extractNumberFromFilename($fileNeeded['name']); $differences = $this->showDifferences($destContent, $sourceContent, array($numOfPageDest,$numOfPageSource)); $differences['file_destination'] = $fileNeeded; + } else { + $differences = array(); } return $differences; } diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 2da0b7f5390..7d9d21357ed 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -163,7 +163,7 @@ class WebsitePage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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'), diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 74c43d54e48..d64888743cb 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -683,7 +683,7 @@ if ($action == 'adddir' && $permtouploadfile) } */ -// Add site +// Add a website if ($action == 'addsite' && $usercanedit) { $db->begin(); @@ -3397,7 +3397,7 @@ if (!GETPOST('hide_websitemenu')) { // Edit CKEditor if (getDolGlobalInt('WEBSITE_ALLOW_CKEDITOR')) { - print ''.dol_escape_htmltag($langs->trans("CKEditor")).''; + print ''.dol_escape_htmltag("CKEditor").''; } print ''; diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index f7542c226f1..bed11601dc0 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL - * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ */ /** - * \file class/workstation.class.php + * \file htdocs/workstation/class/workstation.class.php * \ingroup workstation * \brief This file is a CRUD class file for Workstation (Create/Read/Update/Delete) */ @@ -96,7 +96,7 @@ class Workstation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|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}> 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,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}> 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"), @@ -878,7 +878,7 @@ class Workstation extends CommonObject // Load file with numbering class (if found) if (file_exists($dir.$file)) { - $mybool |= @include_once $dir.$file; + $mybool = ((bool) @include_once $dir.$file) || $mybool; } } diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 83a326ead04..e38de9938a5 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +19,7 @@ */ /** - * \file class/workstationresource.class.php + * \file htdocs/workstation/class/workstationresource.class.php * \ingroup workstation * \brief This file is a CRUD class file for WorkstationResource (Create/Read/Update/Delete) */ @@ -36,11 +37,11 @@ class WorkstationResource extends CommonObject public $element = 'workstationresource'; /** - * @var array|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}> 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,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}> 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'), - 'fk_resource' => array('type' => 'integer') + 'fk_workstation' => array('type' => 'integer', 'label' => 'Workstation', 'enabled' => 1, 'position' => 10, 'visible' => 1), + 'fk_resource' => array('type' => 'integer', 'label' => 'UserGroup', 'enabled' => 1, 'position' => 20, 'visible' => 1), ); /** diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index 290b6d34714..a3c73facdcc 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +19,7 @@ */ /** - * \file class/workstationusergroup.class.php + * \file htdocs/workstation/class/workstationusergroup.class.php * \ingroup workstation * \brief This file is a CRUD class file for WorkstationUserGroup (Create/Read/Update/Delete) */ @@ -35,11 +36,11 @@ class WorkstationUserGroup extends CommonObject public $element = 'workstationusergroup'; /** - * @var array|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}> 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,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}> 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'), - 'fk_usergroup' => array('type' => 'integer') + 'fk_workstation' => array('type' => 'integer', 'label' => 'Workstation', 'enabled' => 1, 'position' => 10, 'visible' => 1), + 'fk_usergroup' => array('type' => 'integer', 'label' => 'UserGroup', 'enabled' => 1, 'position' => 20, 'visible' => 1), ); /** diff --git a/htdocs/workstation/lib/workstation.lib.php b/htdocs/workstation/lib/workstation.lib.php index 8250a85adda..5cca71a1738 100644 --- a/htdocs/workstation/lib/workstation.lib.php +++ b/htdocs/workstation/lib/workstation.lib.php @@ -1,5 +1,6 @@ + * 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 @@ -16,7 +17,7 @@ */ /** - * \file workstation/lib/workstation.lib.php + * \file htdocs/workstation/lib/workstation.lib.php * \ingroup workstation * \brief Library files with common functions for Workstation */ diff --git a/htdocs/workstation/lib/workstation_workstation.lib.php b/htdocs/workstation/lib/workstation_workstation.lib.php index 7f66f8ded4e..e044de7566d 100644 --- a/htdocs/workstation/lib/workstation_workstation.lib.php +++ b/htdocs/workstation/lib/workstation_workstation.lib.php @@ -1,5 +1,6 @@ + * 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 @@ -16,7 +17,7 @@ */ /** - * \file lib/workstation_workstation.lib.php + * \file htdocs/workstation/lib/workstation_workstation.lib.php * \ingroup workstation * \brief Library files with common functions for Workstation */ diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 2d1e9d9fefc..3638739a101 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -149,6 +150,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $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 $permissiontoread = $user->hasRight('workstation', 'workstation', 'read'); $permissiontoadd = $user->hasRight('workstation', 'workstation', 'write'); diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index edd9e77cb70..c7e07e39989 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -81,7 +81,7 @@ class Hook extends CommonObject */ /** - * @var array|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}> 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,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}> 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/phpstan.neon.dist b/phpstan.neon.dist index 78867274e30..c354dfd5d84 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -54,7 +54,6 @@ parameters: - '#(\$force_dolibarr_lib|\$dolibarr_main_db).*in empty\(\) is never defined.#' - '#Sprain\\SwissQrBill\\#' - '#Constructor of class .* has an unused parameter #' - - '#Default value of the parameter#' internalErrorsCountLimit: 50 cache: nodesByFileCountMax: 512 diff --git a/pyproject.toml b/pyproject.toml index 23f76292a93..39d126bd778 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" # `codespell` can be run as a standalone program from the CLI # with the appropriate default options. -skip = "*/.*/*,*/langs/*,*/build/exe/*,**.log,*.pdf,*dev/resources/*,*.phar,*.z,*.gz,*.sql,*.svg,*htdocs/includes/*,*/textiso.txt,*.js,*README-*,*build/rpm/*spec,*build/pad/*ml,*htdocs/includes/phpoffice/*,*htdocs/includes/tecnickcom/*,*dev/initdemo/removeconfdemo.sh,*dev/tools/codespell/*,*pyproject.toml,*build/exe/*,*fontawe*,*htdocs/theme/*/flags-sprite.inc.php,*dev/setup/codetemplates/codetemplates.xml,*/php.ini,*/html_cerfafr.*,*/lessc.class.php,*.asciidoc,*.xml,*opensurvey/css/style.css,*dev/tools/phan/stubs/*,*/documents" +skip = "*/.*/*,*/langs/*,*/build/exe/*,**.log,*.pdf,*dev/resources/*,*.phar,*.z,*.gz,*.sql,*.svg,*htdocs/includes/*,*/textiso.txt,*.js,*README-*,*build/rpm/*spec,*build/pad/*ml,*htdocs/includes/phpoffice/*,*htdocs/includes/tecnickcom/*,*dev/initdemo/removeconfdemo.sh,*dev/tools/codespell/*,*dev/trans*/ignore_translation_keys.lst,*pyproject.toml,*build/exe/*,*fontawe*,*htdocs/theme/*/flags-sprite.inc.php,*dev/setup/codetemplates/codetemplates.xml,*/php.ini,*/html_cerfafr.*,*/lessc.class.php,*.asciidoc,*.xml,*opensurvey/css/style.css,*dev/tools/phan/stubs/*,*/documents" check-hidden = true quiet-level=2 diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index bd3f7e45953..187db69db7c 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -53,7 +53,7 @@ if (isset($argv[2]) || !empty($argv[2])) { $login = ''; } -$max = 0; +$max = -1; if (isset($argv[3]) || !empty($argv[3])) { $max = $argv[3]; @@ -108,7 +108,7 @@ if (!empty($login)) { } // We get list of emailing id to process -$sql = "SELECT m.rowid"; +$sql = "SELECT m.rowid, m.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql .= " WHERE m.statut IN (1,2)"; if ($id != 'all') { @@ -122,12 +122,18 @@ if ($resql) { $j = 0; if ($num) { - for ($j = 0; $j < $num; $j++) { + for ($j = 0; $j < $num && $max != 0; $j++) { $obj = $db->fetch_object($resql); dol_syslog("Process mailing with id ".$obj->rowid); print "Process mailing with id ".$obj->rowid."\n"; + if ($obj->status == 1) { + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut = 2 WHERE rowid = ".((int) $obj->rowid); + $result_sql = $db->query($sql); + dol_syslog("Started mailing campaign ".$obj->rowid, LOG_DEBUG); + } + $emailing = new Mailing($db); $emailing->fetch($obj->rowid); @@ -154,7 +160,7 @@ if ($resql) { $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql2 .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".((int) $id); if (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && empty($max)) { - $sql2 .= " LIMIT " . getDolGlobalString('MAILING_LIMIT_SENDBYCLI'); + $sql2 .= " LIMIT " . getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'); } elseif (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && $max > 0) { $sql2 .= " LIMIT ".min(getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'), $max); } elseif ($max > 0) { @@ -188,6 +194,7 @@ if ($resql) { $now = dol_now(); $obj = $db->fetch_object($resql2); + $max--; // sendto en RFC2822 $sendto = str_replace(',', ' ', dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">"); @@ -408,25 +415,16 @@ if ($resql) { $i++; } } else { - $mesg = "Emailing id ".$id." has no recipient to target"; + //$mesg = "Emailing id ".$id." has no recipient to target"; print $mesg."\n"; dol_syslog($mesg, LOG_ERR); - } - // Loop finished, set global statut of mail - $statut = 2; - if (!$nbko) { - $statut = 3; - } + // Loop finished, set global statut of mail + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=3 WHERE rowid=".$obj->rowid; + $result_sql = $db->query($sql); - $sqlenddate = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".((int) $statut)." WHERE rowid=".((int) $id); - - dol_syslog("update global status", LOG_DEBUG); - print "Update status of emailing id ".$id." to ".$statut."\n"; - $resqlenddate = $db->query($sqlenddate); - if (!$resqlenddate) { - dol_print_error($db); - $error++; + dol_syslog("update global status", LOG_DEBUG); + print "Update status of emailing id ".$id." to ".$statut."\n"; } } else { dol_print_error($db); diff --git a/test/phpunit/CommonClassTest.class.php b/test/phpunit/CommonClassTest.class.php index 399f972863c..0db9b170871 100644 --- a/test/phpunit/CommonClassTest.class.php +++ b/test/phpunit/CommonClassTest.class.php @@ -23,7 +23,7 @@ * \file test/phpunit/CommonClassTest.php * \ingroup test * \brief PHPUnit test - * \remarks Class that extends all PHPunit tests. To share similare code between each test. + * \remarks Class that extends all PHPunit tests. To share similar code between each test. */ // Workaround for false security issue with main.inc.php on Windows in tests: diff --git a/test/phpunit/DoliDBTest.php b/test/phpunit/DoliDBTest.php index 7abc7557a91..5cc4cd695fe 100644 --- a/test/phpunit/DoliDBTest.php +++ b/test/phpunit/DoliDBTest.php @@ -48,6 +48,41 @@ $conf->global->MAIN_DISABLE_ALL_MAILS = 1; */ class DoliDBTest extends CommonClassTest { + /** + * testDDLUpdateField + * + * @return int + */ + public function testDDLCreateTable() + { + global $conf,$user,$langs,$db; + $conf = $this->savconf; + $user = $this->savuser; + $langs = $this->savlangs; + $db = $this->savdb; + + $namedic = MAIN_DB_PREFIX.'tmptesttabletoremove'; + + $res = $db->DDLDropTable($namedic); + + $columns = array( + 'rowid' => array('type' => 'integer', 'AUTO_INCREMENT PRIMARY KEY'), + 'code' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), + 'label' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'), + 'position' => array('type' => 'integer', 'null'=>'NULL'), + 'use_default' => array('type' => 'varchar', 'value' => 1, 'default'=>'1'), + 'active' => array('type' => 'integer') + ); + $primaryKey = 'rowid'; + + print __METHOD__.' db->type = '.$db->type."\n"; + + $res = $db->DDLCreateTable($namedic, $columns, $primaryKey, ""); + + $this->assertEquals(1, $res); + print __METHOD__." result=".$res."\n"; + } + /** * testDDLUpdateField * @@ -81,9 +116,10 @@ class DoliDBTest extends CommonClassTest print __METHOD__." result=".$result."\n"; // TODO Use $savtype and $savnull instead of hard coded - $field_desc = array('type' => 'varchar', 'value' => '16', 'null' => 'NOT NULL'); + $field_desc = array('type'=>'varchar', 'value'=>'16', 'null'=>'NOT NULL', 'default'=>'aaaabbbbccccdddd'); $result = $db->DDLUpdateField($db->prefix().'c_paper_format', 'code', $field_desc); + $this->assertEquals(1, $result); print __METHOD__." result=".$result."\n"; diff --git a/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index 081061a08ed..725216c6cd6 100644 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.php @@ -244,4 +244,45 @@ class Functions2LibTest extends CommonClassTest { $this->assertEquals($expected, get_string_between($string, $start, $end)); } + + + /** + * Dataprovider for numero_semaine + * + * @return array [ "1977/1/1 10:10:10", '53'], + 'day 2 - 1977' => [ "1977/1/1 10:10:10", '53'], + 'last day - 1977' => [ "1977/12/31 10:10:10", '52'], + 'day 1 - 1978' => [ "1978/1/1 10:10:10", '52'], + 'day 2 - 1978' => [ "1978/1/2 10:10:10", '01'], + 'day 1 - 1981' => [ "1981/1/1 10:10:10", '01'], + 'last day - 1981' => [ "1981/12/31 10:10:10", '53'], + 'day 1 - 1982' => [ "1982/1/1 10:10:10", '53'], + 'day 3 - 1982' => [ "1982/1/3 10:10:10", '53'], + 'day 4 - 1982' => [ "1982/1/4 10:10:10", '01'], + ]; + } + + + /** + * Test numero_semaine() + * + * @param string $time_str Time (string) to test + * @param int $expected_week Week expected + * + * @return void + * + * @dataProvider numeroSemaineDataProvider + */ + public function testNumeroSemaine($time_str, $expected_week) + { + $time = strtotime($time_str); + $str = date(DATE_ATOM, $time).PHP_EOL; + $this->assertEquals($expected_week, numero_semaine($time), "Computed week incorrect for $str"); + } } diff --git a/test/phpunit/RestAPIContactTest.php b/test/phpunit/RestAPIContactTest.php index 4af37c718e0..dd4173ab6ff 100644 --- a/test/phpunit/RestAPIContactTest.php +++ b/test/phpunit/RestAPIContactTest.php @@ -1,6 +1,7 @@ * Copyright (C) 2023 Alexandre Janniaux + * 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 @@ -229,7 +230,7 @@ class RestAPIContactTest extends CommonClassTest print_r($updateResponse); // Check if the updated fields match the changes you made - $this->assertTrue($updateResponse['firstname'] === $updateBody['firstname'], 'Update might have failed'); + $this->assertEquals($updateBody['firstname'], $updateResponse['firstname'], 'Update failed for request body: '.$updateRequestBody); // Deleting the Contact /*