diff --git a/.github/workflows/windows-ci.yaml b/.github/workflows/windows-ci.yaml index f8441c438fc..defb42e0148 100644 --- a/.github/workflows/windows-ci.yaml +++ b/.github/workflows/windows-ci.yaml @@ -103,6 +103,8 @@ jobs: 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 "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: Start web server @@ -144,6 +146,10 @@ jobs: curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}" 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 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 25688ef0ccb..60efdf1093b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,19 +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 +* 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) @@ -46,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) @@ -56,27 +63,41 @@ 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 ***** @@ -10102,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/SECURITY.md b/SECURITY.md index 0cc37b96ce6..02a015756cf 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -104,3 +104,5 @@ Scope is the web application (backoffice) and the APIs. * SSL/TLS best practices * Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC) * Physical or social engineering attempts or issues that require physical access to a victim’s computer/device +* Vulnerabilities of type XSS exploited by using javascript into a website page (with permission to edit website pages) or by using php code into a website page + using the permission to edit php code are not qualified, except if this allow to get higher privileges (being able to set javascript or php code is the expected behaviour). 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é trouvée et déplacée pour fonctionner avec la nouvelle version de Dolibarr. OldVersionFoundButFailedToMoveInNew=Une ancienne version de base a été trouvée mais ne peut être déplacée pour être utilisée avec la nouvelle version de Dolibarr. -DLLMissing=L'installation de votre Windows est incomplète. 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 après. +DLLMissing=L'installation de votre Windows est incomplète. 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 après. 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/tools/codespell/codespell-dict.txt b/dev/tools/codespell/codespell-dict.txt index c40c7608602..f6d51c0b68d 100644 --- a/dev/tools/codespell/codespell-dict.txt +++ b/dev/tools/codespell/codespell-dict.txt @@ -11,8 +11,10 @@ aplphanothtml->alphanohtml choosed->chosen 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 c71e990a467..0c84807010b 100644 --- a/dev/tools/codespell/codespell-ignore.txt +++ b/dev/tools/codespell/codespell-ignore.txt @@ -57,3 +57,4 @@ dur fonction espace methode +datee diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index 2c0fb95a96f..5fa92f8c13e 100644 --- a/dev/tools/codespell/codespell-lines-ignore.txt +++ b/dev/tools/codespell/codespell-lines-ignore.txt @@ -79,6 +79,7 @@ $object->periode = $dateperiod; $return .= '
'.$langs->trans("Payement").' : '.$this->type_payment.''; $sortfield = "datea"; + $sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; $sql .= " '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " , datee = ".(!empty($obj->datee) ? "'".$this->db->escape($obj->datee)."'" : "null"); $sql .= " AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)"; @@ -325,6 +326,8 @@ $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) { function checkES($IentOfi, $InumCta) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 68fc0c015e7..8c6c44e90f3 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,106 +9,84 @@ */ return [ // # Issue statistics: - // PhanPluginSuspiciousParamPosition : 45+ occurrences // PhanParamSignatureMismatch : 25+ occurrences + // PhanTypeMismatchReturnNullable : 20+ occurrences + // PhanPluginSuspiciousParamPosition : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences // PhanTypeArraySuspiciousNull : 10+ occurrences - // PhanTypeInvalidUnaryOperandNumeric : 8 occurrences + // PhanTypeMismatchReturn : 10+ occurrences // PhanRedefineFunctionInternal : 6 occurrences - // PhanPluginUnsafeEval : 5 occurrences - // PhanParamSuspiciousOrder : 4 occurrences // PhanParamTooMany : 4 occurrences - // PhanPluginSuspiciousParamOrder : 4 occurrences - // PhanUndeclaredFunctionInCallable : 4 occurrences + // PhanTypeMismatchPropertyProbablyReal : 2 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/class/adherent.class.php' => ['PhanTypeMismatchReturnNullable'], + 'htdocs/adherents/class/adherentstats.class.php' => ['PhanTypeMismatchReturnNullable'], 'htdocs/adherents/stats/geo.php' => ['PhanTypeArraySuspiciousNull'], 'htdocs/adherents/type.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/admin/receiptprinter.php' => ['PhanRedefineFunctionInternal'], - 'htdocs/admin/translation.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected'], 'htdocs/categories/viewcat.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/collab/index.php' => ['PhanParamTooMany'], - 'htdocs/comm/action/index.php' => ['PhanPluginSuspiciousParamPosition', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidUnaryOperandNumeric'], + 'htdocs/comm/action/class/actioncomm.class.php' => ['PhanTypeMismatchReturnNullable'], + 'htdocs/comm/action/index.php' => ['PhanTypeArraySuspiciousNull'], 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/comm/mailing/cibles.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/comm/mailing/info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/accounting-files.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/compta/bank/various_payment/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginSuspiciousParamPosition'], + 'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanTypeMismatchReturnNullable'], 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'], - 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany'], 'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/compta/sociales/document.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/sociales/info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/sociales/note.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/compta/tva/document.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/core/actions_massactions.inc.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/class/commondocgenerator.class.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/core/class/commonobject.class.php' => ['PhanPluginSuspiciousParamPosition'], - '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/class/html.formprojet.class.php' => ['PhanTypeMismatchReturnNullable'], + 'htdocs/core/class/smtps.class.php' => ['PhanTypeMismatchReturnNullable'], + 'htdocs/core/class/stats.class.php' => ['PhanTypeMismatchReturnNullable'], 'htdocs/core/db/mysqli.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/db/pgsql.class.php' => ['PhanParamSignatureMismatch'], - 'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch'], - 'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginSuspiciousParamPosition'], + 'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturnNullable'], 'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'], + 'htdocs/core/lib/date.lib.php' => ['PhanTypeMismatchReturnNullable'], 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp'], - 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'], + 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanRedefineFunctionInternal'], + 'htdocs/core/lib/functions2.lib.php' => ['PhanTypeMismatchReturnNullable'], + 'htdocs/core/lib/pdf.lib.php' => ['PhanTypeMismatchReturnNullable'], '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/import/import_xlsx.modules.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/core/modules/member/doc/pdf_standard.class.php' => ['PhanParamSignatureMismatch'], + 'htdocs/core/lib/website.lib.php' => ['PhanTypeMismatchReturnNullable'], + 'htdocs/core/modules/DolibarrModules.class.php' => ['PhanTypeMismatchReturnNullable'], '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/societe/modules_societe.class.php' => ['PhanTypeMismatchReturn'], + '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/fourn/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'], + '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/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/class/paymentloan.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/loan/document.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/note.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/payment/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/schedule.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/mrp/class/mo.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/product/admin/product_tools.php' => ['PhanNoopStringLiteral'], - 'htdocs/product/card.php' => ['PhanPluginSuspiciousParamPosition'], + 'htdocs/product/class/product.class.php' => ['PhanTypeMismatchReturn'], + 'htdocs/projet/class/project.class.php' => ['PhanTypeMismatchReturnNullable'], + 'htdocs/projet/class/projectstats.class.php' => ['PhanTypeMismatchReturnNullable'], + 'htdocs/projet/class/task.class.php' => ['PhanTypeMismatchReturnNullable'], '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/admin/stripe.php' => ['PhanDeprecatedFunction'], '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'], + 'htdocs/website/class/website.class.php' => ['PhanTypeMismatchReturnNullable'], 'internal' => ['PhanUndeclaredConstant'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 53dd0aa447b..21d410a9665 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', @@ -370,7 +371,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,10 +409,9 @@ return [ 'suppress_issue_types' => [ // Dolibarr uses a lot of internal deprecated stuff, not reporting 'PhanDeprecatedProperty', - 'PhanDeprecatedFunction', + // 'PhanDeprecatedFunction', //'PhanCompatibleNegativeStringOffset', - // Dolibarr has quite a few strange noop assignments like $abc=$abc; - 'PhanPluginDuplicateExpressionAssignment', + // 'PhanPluginDuplicateExpressionAssignment', // Nulls are likely mostly false positives 'PhanPluginConstantVariableNull', 'PhanTypeObjectUnsetDeclaredProperty', @@ -447,18 +447,18 @@ return [ 'PhanRedefinedClassReference', // 'PhanPluginNoCommentOnClass', // 'PhanPluginNotFullyQualifiedGlobalConstant', - 'PhanTypeMismatchDefault', + // 'PhanTypeMismatchDefault', // 'PhanPluginPHPDocHashComment', 'PhanPluginShortArrayList', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeInvalidDimOffset', // 'PhanPluginNoCommentOnProtectedProperty', // 'PhanPluginDescriptionlessCommentOnPublicMethod', - 'PhanPluginUnknownClosureParamType', - 'PhanPluginUnknownClosureReturnType', + // 'PhanPluginUnknownClosureParamType', + // 'PhanPluginUnknownClosureReturnType', // 'PhanPluginNoCommentOnProtectedMethod', // 'PhanTypeArraySuspicious', - 'PhanTypeMismatchPropertyProbablyReal', + // 'PhanTypeMismatchPropertyProbablyReal', // 'PhanPluginNoCommentOnPrivateMethod', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeInvalidLeftOperandOfAdd', @@ -466,13 +466,14 @@ return [ // 'PhanPluginNoCommentOnFunction', 'PhanPluginUnknownArrayFunctionParamType', // 'PhanPluginDescriptionlessCommentOnPublicProperty', - 'PhanPluginUnknownFunctionParamType', + // 'PhanPluginUnknownFunctionParamType', // Finds certain errors in PHPdoc typing 'PhanTypeSuspiciousStringExpression', - 'PhanPluginRedundantAssignment', + // 'PhanPluginRedundantAssignment', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeInvalidRightOperandOfNumericOp', - 'PhanPluginInlineHTML', + // 'PhanPluginInlineHTML', + // 'PhanPluginInlineHTMLTrailing', // 'PhanPluginUnknownFunctionReturnType', // 'PhanPluginDescriptionlessCommentOnProtectedProperty', 'PhanPluginRedundantAssignmentInGlobalScope', @@ -483,55 +484,54 @@ return [ 'PhanTypeInvalidPropertyName', 'PhanPluginDuplicateCatchStatementBody', 'PhanPluginUndeclaredVariableIsset', - 'PhanTypeInvalidUnaryOperandIncOrDec', + // 'PhanTypeInvalidUnaryOperandIncOrDec', // 'PhanPluginDescriptionlessCommentOnClass', 'PhanPluginEmptyStatementIf', - 'PhanPluginInlineHTMLTrailing', // 'PhanUndeclaredStaticMethod', // 'PhanPluginDescriptionlessCommentOnPrivateMethod', - 'PhanPluginPrintfIncompatibleArgumentType', + // 'PhanPluginPrintfIncompatibleArgumentType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanRedefineClass', 'PhanRedefineFunction', 'PhanTypeInvalidLeftOperandOfBitwiseOp', // 'PhanTypeMismatchDimAssignment', // 'PhanPluginDescriptionlessCommentOnProtectedMethod', - 'PhanPluginPrintfIncompatibleArgumentTypeWeak', - 'PhanUndeclaredVariableAssignOp', - 'PhanTypeExpectedObjectOrClassName', + // 'PhanPluginPrintfIncompatibleArgumentTypeWeak', + // 'PhanUndeclaredVariableAssignOp', + // 'PhanTypeExpectedObjectOrClassName', 'PhanEmptyFQSENInClasslike', - 'PhanTypeMismatchArgumentInternalReal', + // 'PhanTypeMismatchArgumentInternalReal', // 'PhanUnextractableAnnotationElementName', // 'PhanCommentParamWithoutRealParam', // 'PhanRedefinedExtendedClass', 'PhanTypeComparisonFromArray', 'PhanPluginConstantVariableBool', - 'PhanPluginPrintfVariableFormatString', + // 'PhanPluginPrintfVariableFormatString', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanEmptyForeach', 'PhanTypeInvalidRightOperandOfBitwiseOp', - 'PhanPluginDuplicateConditionalUnnecessary', + // 'PhanPluginDuplicateConditionalUnnecessary', // 'PhanTraitParentReference', 'PhanPluginBothLiteralsBinaryOp', // 'PhanTypeMismatchDeclaredParam', // 'PhanCommentDuplicateMagicMethod', // 'PhanParamSpecial1', - 'PhanPluginInlineHTMLLeading', - 'PhanPluginUseReturnValueInternalKnown', + // 'PhanPluginInlineHTMLLeading', + // 'PhanPluginUseReturnValueInternalKnown', // 'PhanRedefinedInheritedInterface', // 'PhanTypeComparisonToArray', 'PhanTypeConversionFromArray', // 'PhanTypeInvalidLeftOperandOfIntegerOp', // 'PhanTypeMismatchArgumentInternalProbablyReal', - 'PhanTypeMismatchBitwiseBinaryOperands', + // 'PhanTypeMismatchBitwiseBinaryOperands', 'PhanTypeMismatchDimEmpty', - 'PhanTypeSuspiciousEcho', - 'PhanNoopBinaryOperator', + // 'PhanTypeSuspiciousEcho', + // 'PhanNoopBinaryOperator', // 'PhanTypeInvalidBitwiseBinaryOperator', // 'PhanPluginDescriptionlessCommentOnFunction', - 'PhanPluginPHPDocInWrongComment', + // 'PhanPluginPHPDocInWrongComment', 'PhanRedefineClassInternal', // 'PhanTypeInvalidThrowsIsInterface', // 'PhanPluginRedundantAssignmentInLoop', @@ -550,15 +550,15 @@ return [ // 'PhanSyntaxReturnValueInVoid', // 'PhanTypeInstantiateTraitStaticOrSelf', // 'PhanUndeclaredInvokeInCallable', - 'PhanNoopProperty', - 'PhanNoopVariable', + // 'PhanNoopProperty', + // 'PhanNoopVariable', // 'PhanPluginPrintfUnusedArgument', // 'PhanSyntaxReturnExpectedValue', // 'PhanAccessClassInternal', // 'PhanCompatibleAccessMethodOnTraitDefinition', // 'PhanNoopSwitchCases', // 'PhanNoopTernary', - 'PhanNoopUnaryOperator', + // 'PhanNoopUnaryOperator', // 'PhanParamNameIndicatingUnusedInClosure', // 'PhanParamSignatureRealMismatchTooFewParametersInternal', // 'PhanPluginEmptyStatementSwitch', @@ -587,12 +587,12 @@ return [ 'PhanTypePossiblyInvalidDimOffset', // Also checks optional array keys and requires that they are checked for existence. 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty', - 'PhanPluginPrintfNotPercent', + // 'PhanPluginPrintfNotPercent', // Detects fishy stuff with '%' format and suggests %% 'PhanPossiblyUndeclaredGlobalVariable', // 'PhanPluginPossiblyStaticProtectedMethod', - 'PhanTypeMismatchReturn', + // 'PhanTypeMismatchReturn', // 'PhanPluginMoreSpecificActualReturnType', - 'PhanTypeMismatchReturnProbablyReal', + // 'PhanTypeMismatchReturnProbablyReal', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', // 'PhanPluginUnreachableCode', @@ -601,11 +601,11 @@ return [ 'PhanUndeclaredClassMethod', 'PhanUndeclaredMethod', 'PhanTypeMismatchArgumentProbablyReal', - 'PhanPluginDuplicateExpressionAssignmentOperation', - 'PhanTypeMismatchPropertyDefault', + 'PhanPluginDuplicateExpressionAssignmentOperation', // Suggestions for optimisation + // 'PhanTypeMismatchPropertyDefault', // 'PhanPluginAlwaysReturnMethod', // 'PhanPluginMissingReturnMethod', - 'PhanUndeclaredTypeReturnType', + // 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredClassProperty', 'PhanTypeArraySuspiciousNullable', // 'PhanPluginInconsistentReturnMethod', diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index b9e92619b06..739cd972d0a 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', @@ -368,6 +369,7 @@ return [ 'PhanPluginDuplicateConditionalTernaryDuplication', // 2750+ occurrences 'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences 'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning + 'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences ], // You can put relative paths to internal stubs in this config option. // Phan will continue using its detailed type annotations, 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..b91972b13c4 --- /dev/null +++ b/dev/translation/dynamic_translation_keys.lst @@ -0,0 +1,3687 @@ +# 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 + +# ticket +TicketAnswered + +# website_template +Message +Map +Reservation + +# Others +ACCOUNTING_ACCOUNT_CUSTOMER +ACCOUNTING_ACCOUNT_CUSTOMER_Desc +ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY +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 +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 +helpWithAi diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst new file mode 100644 index 00000000000..173355fe70a --- /dev/null +++ b/dev/translation/ignore_translation_keys.lst @@ -0,0 +1,1183 @@ +# 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 +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 +##################################################################### +##################################################################### +$minimum +AI_KEY_API_ +AddService +AnHelpMessage +Analytic +AnalyticLabel +BOOKCAL_MYPARAM10 +BOOKCAL_MYPARAM8 +BOOKCAL_MYPARAM9 +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 +France +Germany +Greece +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 +Italy +ItemID +JobApplications +JobPosition +Journal +Label Movement +Labels +Last +LedgerAccount +LocalTax1IsNotUsedExample +LocalTax1IsUsedExample +LocalTax2IsNotUsedExample +LocalTax2IsUsedExample +Logs +Lot/Série +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 +Spain +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/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index dbe02a3ff02..e14477b9158 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -191,10 +191,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]); + $sql = "SELECT MAX(".$db->sanitize($tabrowid[$id]).") as newid FROM ".$db->sanitize($tabname[$id]); $result = $db->query($sql); if ($result) { $obj = $db->fetch_object($result); 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..2f1b22cf778 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,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') { // delete // activate if ($action == $acts[0]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 1 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -342,19 +336,17 @@ 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"; - } + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 0 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -362,19 +354,17 @@ 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"; - } + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 1 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -382,19 +372,17 @@ 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"; - } + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 0 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -402,9 +390,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..8cb10b061e5 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 @@ -239,7 +240,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 +286,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 +301,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 +328,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/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..41214e14147 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -443,7 +443,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 @@ -547,7 +547,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 +690,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(price2num($accountingResult, 'MT'))); $accountingResultClassCSS = ' error'; } else { $accountingResultCredit = price(price2num($accountingResult, 'MT')); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index bbf41060a4c..7ac6bc27cea 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -484,7 +484,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; break; - } elseif (isset($object->date_validation) || $object->date_validation != '') { + } elseif (isset($object->date_validation) && $object->date_validation != '') { setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors'); $error++; break; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 40b7599040c..bb549a3bc6d 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -447,7 +447,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; break; - } elseif (isset($object->date_validation) || $object->date_validation != '') { + } elseif (isset($object->date_validation) && $object->date_validation != '') { setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors'); $error++; break; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index a240dca3387..601cb02bd38 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -14,6 +14,7 @@ * Copyright (C) 2020 Guillaume Alexandre * Copyright (C) 2022 Joachim Kueter * Copyright (C) 2022 Progiseize + * 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 @@ -277,7 +278,7 @@ class AccountancyExport 'ACCOUNTING_EXPORT_FORMAT' => 'csv', ), ), - 'cr'=> array( + 'cr' => array( '1' => $langs->trans("Unix"), '2' => $langs->trans("Windows") ), @@ -302,8 +303,6 @@ class AccountancyExport */ public function getMimeType($formatexportset) { - $mime = 'text/csv'; - switch ($formatexportset) { case self::$EXPORT_TYPE_FEC: $mime = 'text/tab-separated-values'; @@ -346,7 +345,7 @@ class AccountancyExport $exportFile = null; $exportFileName = ''; $exportFilePath = ''; - $exportFileFullName =''; + $exportFileFullName = ''; $downloadFileMimeType = ''; $downloadFileFullName = ''; $downloadFilePath = ''; @@ -944,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 @@ -1000,7 +999,7 @@ class AccountancyExport $invoice = new FactureFournisseur($this->db); $invoice->fetch($line->fk_doc); $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; - $objectDirPath.= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); + $objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); } $arrayofinclusion = array(); // If it is a supplier invoice, we want to use last uploaded file @@ -1466,7 +1465,7 @@ class AccountancyExport $objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output; } elseif ($line->doc_type == 'supplier_invoice') { $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; - $objectDirPath.= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); + $objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); } $arrayofinclusion = array(); // If it is a supplier invoice, we want to use last uploaded file @@ -1678,7 +1677,7 @@ class AccountancyExport $objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output; } elseif ($line->doc_type == 'supplier_invoice') { $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; - $objectDirPath.= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); + $objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); } $arrayofinclusion = array(); // If it is a supplier invoice, we want to use last uploaded file @@ -1789,7 +1788,7 @@ class AccountancyExport && $objectLines[$aIndex + 1]->piece_num == $line->piece_num && $aIndex - 1 < $aSize && $objectLines[$aIndex - 1]->piece_num == $line->piece_num - ) { + ) { $sammelBuchung = true; } diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 479887a5724..0a8e5a40845 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -770,11 +770,11 @@ class AccountingAccount extends CommonObject if ($factureDet->product_type == 1) { if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) $code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'); + // @phan-suppress-next-line PhanPluginRedundantAssignment $suggestedaccountingaccountbydefaultfor = ''; } else { if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT $code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'); - $suggestedaccountingaccountbydefaultfor = 'eecwithvat'; } elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number $code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'); $suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber'; @@ -789,6 +789,7 @@ class AccountingAccount extends CommonObject } elseif ($factureDet->product_type == 0) { if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) $code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'); + // @phan-suppress-next-line PhanPluginRedundantAssignment $suggestedaccountingaccountbydefaultfor = ''; } else { if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT 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..6a261a146cd 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1514,7 +1514,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 = '') { diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 1226ae9d167..b33efc256e3 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); @@ -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 ''; 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/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 1937924df3b..b5f319bb70c 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -316,12 +316,12 @@ 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,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), - 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'default' => 1, 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 12, 'index' => 1), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'default' => '1', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 12, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25), 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'showoncombobox' => 1), @@ -760,13 +760,13 @@ class Adherent extends CommonObject $this->lastname = trim($this->lastname) ? trim($this->lastname) : trim($this->lastname); $this->firstname = trim($this->firstname) ? trim($this->firstname) : trim($this->firstname); $this->gender = trim($this->gender); - $this->address = ($this->address ? $this->address : $this->address); - $this->zip = ($this->zip ? $this->zip : $this->zip); - $this->town = ($this->town ? $this->town : $this->town); - $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); - $this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id); - $this->note_public = ($this->note_public ? $this->note_public : $this->note_public); - $this->note_private = ($this->note_private ? $this->note_private : $this->note_private); + // $this->address = ($this->address ? $this->address : $this->address); + // $this->zip = ($this->zip ? $this->zip : $this->zip); + // $this->town = ($this->town ? $this->town : $this->town); + // $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + // $this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id); + // $this->note_public = ($this->note_public ? $this->note_public : $this->note_public); + // $this->note_private = ($this->note_private ? $this->note_private : $this->note_private); $this->url = $this->url ? clean_url($this->url, 0) : ''; $this->setUpperOrLowerCase(); // Check parameters diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 889f1212547..941a685d326 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2017 Regis Houssin * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2020 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 @@ -535,8 +536,6 @@ class Members extends DolibarrApi */ public function getSubscriptions($id) { - $obj_ret = array(); - if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) { throw new RestException(403); } diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 40aa0ab512a..c268ac3ab6e 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,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/adherents/ldap.php b/htdocs/adherents/ldap.php index edfa8adbb2f..f94cc476321 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -120,12 +120,13 @@ print '
'; print ''; // Login -print ''; +print ''; // If there is a link to the unencrypted password, we show the value in database here so we can compare because it is shown nowhere else +// This is for very old situation. Password are now encrypted and $object->pass is empty. if (getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD')) { print ''; - print ''; + print ''; print "\n"; } diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index d4efa349202..62a3a08aa49 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2011 Regis Houssin * Copyright (C) 2013 Juanjo Menent * 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 @@ -20,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"; @@ -40,7 +41,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''; echo ''; 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/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/fckeditor.php b/htdocs/admin/fckeditor.php index 5dc257a55d2..d11c3adf4ca 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2019 Christophe Battarel + * 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,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doleditor.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'fckeditor')); +$langs->loadLangs(array('admin', 'fckeditor', 'errors')); $action = GETPOST('action', 'aZ09'); // Possible modes are: @@ -221,12 +222,12 @@ if (empty($conf->use_javascript_ajax)) { if ($mode != 'Full_inline') { $uselocalbrowser = true; $readonly = ($mode == 'dolibarr_readonly' ? 1 : 0); - $editor = new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST) ? $conf->global->FCKEDITOR_TEST : 'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly); + $editor = new DolEditor('formtestfield', getDolGlobalString('FCKEDITOR_TEST', 'Test'), '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly); $editor->Create(); } else { // CKEditor inline enabled with the contenteditable="true" print '
'; - print $conf->global->FCKEDITOR_TEST; + print getDolGlobalString('FCKEDITOR_TEST'); print '
'; } print $form->buttonsSaveCancel("Save", '', null, 0, 'reposition'); 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/invoice.php b/htdocs/admin/invoice.php index a2f0282ba9f..fa0e810f33b 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -617,13 +617,14 @@ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) { // Hidden conf print '
'; print ''; print ''; + print ''; print '
'; print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.dol_escape_htmltag($object->login).' 
'.$langs->trans("LDAPFieldPasswordNotCrypted").''.$object->pass.''.dol_escape_htmltag($object->pass).'
'.dol_print_date($objectlink->dateh, 'day').''; if ($user->hasRight('adherent', 'lire')) { - $total = $total + $objectlink->amount; + $total += $objectlink->amount; echo price($objectlink->amount); } echo '
'; print ''; print ''; print ''; - print ''; + print ''; print "\n"; $listtype = array( @@ -659,6 +660,7 @@ print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice print ''; print ''; +print ''; print '
'; print '
'.$langs->trans("Type").''.$langs->trans("Name").'
'; @@ -667,17 +669,16 @@ print ''; print ''; -print ''; +print ''; print "\n"; print ''; print ""; print ""; print "
'; print ''; print $langs->trans("PaymentMode").'
".$langs->trans("SuggestPaymentByRIBOnAccount").""; if (isModEnabled('bank')) { - $sql = "SELECT rowid, label"; + $sql = "SELECT rowid, label, clos"; $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; - $sql .= " WHERE clos = 0"; - $sql .= " AND courant = 1"; + $sql .= " WHERE courant = 1"; $sql .= " AND entity IN (".getEntity('bank_account').")"; $resql = $db->query($sql); if ($resql) { @@ -687,15 +688,19 @@ if (isModEnabled('bank')) { print '"; + print ajax_combobox("rib"); } else { print ''.$langs->trans("NoActiveBankAccountDefined").''; } @@ -735,6 +740,8 @@ if ($resql) { } } print ""; +print ajax_combobox("chq", array(), 0, 0, 'resolve', -2); + print "
"; print ''; @@ -757,12 +764,13 @@ print "\n"; print ''; print ''; print ''; +print ''; print ''; print $langs->trans("ForceInvoiceDate"); print ''; print $form->selectyesno("forcedate", getDolGlobalInt('FAC_FORCE_DATE_VALIDATION', 0), 1); print ''; -print ''; +print ''; print "\n"; print ''; @@ -777,6 +785,7 @@ $htmltext .= ''; print '
'; print ''; print ''; +print ''; print ''; print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; $variablename = 'INVOICE_FREE_TEXT'; @@ -788,7 +797,7 @@ if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { print $doleditor->Create(); } print ''; -print ''; +print ''; print "\n"; print '
'; @@ -796,12 +805,13 @@ print ''; print '
'; print ''; print ''; +print ''; print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; print ''; print ''; -print ''; +print ''; print "\n"; print '
'; 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 ece8c531fc9..435fb37e1f6 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -9,6 +9,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Nicolas ZABOURI * 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 @@ -1253,36 +1254,36 @@ if ($mode == 'deploy') { $maxphp = @ini_get('upload_max_filesize'); // In unknown if (preg_match('/k$/i', $maxphp)) { $maxphp = preg_replace('/k$/i', '', $maxphp); - $maxphp = $maxphp * 1; + $maxphp *= 1; } if (preg_match('/m$/i', $maxphp)) { $maxphp = preg_replace('/m$/i', '', $maxphp); - $maxphp = $maxphp * 1024; + $maxphp *= 1024; } if (preg_match('/g$/i', $maxphp)) { $maxphp = preg_replace('/g$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024; + $maxphp *= 1024 * 1024; } if (preg_match('/t$/i', $maxphp)) { $maxphp = preg_replace('/t$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024 * 1024; + $maxphp *= 1024 * 1024 * 1024; } $maxphp2 = @ini_get('post_max_size'); // In unknown if (preg_match('/k$/i', $maxphp2)) { $maxphp2 = preg_replace('/k$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1; + $maxphp2 *= 1; } if (preg_match('/m$/i', $maxphp2)) { $maxphp2 = preg_replace('/m$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024; + $maxphp2 *= 1024; } if (preg_match('/g$/i', $maxphp2)) { $maxphp2 = preg_replace('/g$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024; + $maxphp2 *= 1024 * 1024; } if (preg_match('/t$/i', $maxphp2)) { $maxphp2 = preg_replace('/t$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; + $maxphp2 *= 1024 * 1024 * 1024; } // Now $max and $maxphp and $maxphp2 are in Kb $maxmin = $max; @@ -1317,7 +1318,7 @@ if ($mode == 'deploy') { print ' '; - print ''; + print ''; if (getDolGlobalString('MAIN_UPLOAD_DOC')) { if ($user->admin) { diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 20603909699..dd803f2ad71 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'propal', 'receptions', 'stocks', 'trips')); +$langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'propal', 'receptions', 'stocks', 'trips', 'orders')); if (!$user->admin) { accessforbidden(); 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/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/dbtable.php b/htdocs/admin/system/dbtable.php index c7e7c5baa5e..a47be52e386 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/filecheck.php b/htdocs/admin/system/filecheck.php index 57b9ea2c7d8..f54720e03df 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -4,6 +4,7 @@ * Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2015-2019 Frederic France * Copyright (C) 2017 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 @@ -83,7 +84,7 @@ $xmlshortfile = dol_sanitizeFileName(GETPOST('xmlshortfile', 'alpha') ? GETPOST( $xmlfile = DOL_DOCUMENT_ROOT.'/install/'.$xmlshortfile; if (!preg_match('/\.zip$/i', $xmlfile) && dol_is_file($xmlfile.'.zip')) { - $xmlfile = $xmlfile.'.zip'; + $xmlfile .= '.zip'; } // Remote file to compare to @@ -183,7 +184,7 @@ if (GETPOST('target') == 'remote') { libxml_disable_entity_loader(true); } - $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); + $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET); } else { $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; setEventMessages($errormsg, null, 'errors'); @@ -259,7 +260,7 @@ if (empty($error) && !empty($xml)) { $tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']); if (!in_array($tmprelativefilename, $file_list['insignature'])) { $md5newfile = @md5_file($valfile['fullname']); // Can fails if we don't have permission to open/read file - $file_list['added'][] = array('filename'=>$tmprelativefilename, 'md5'=>$md5newfile); + $file_list['added'][] = array('filename' => $tmprelativefilename, 'md5' => $md5newfile); } } diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index da70b1fbbec..349a0ead610 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2007 Rodolphe Quiedeville * 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 @@ -308,21 +309,37 @@ print ''; // sort list if ($sortfield == "name" && $sortorder == "asc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($a->name, $b->name); - }); + usort( + $moduleList, + /** @return int */ + function (stdClass $a, stdClass $b) { + return strcasecmp($a->name, $b->name); + } + ); } elseif ($sortfield == "name" && $sortorder == "desc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($b->name, $a->name); - }); + usort( + $moduleList, + /** @return int */ + static function (stdClass $a, stdClass $b) { + return strcasecmp($b->name, $a->name); + } + ); } elseif ($sortfield == "version" && $sortorder == "asc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($a->version, $b->version); - }); + usort( + $moduleList, + /** @return int */ + static function (stdClass $a, stdClass $b) { + return strcasecmp($a->version, $b->version); + } + ); } elseif ($sortfield == "version" && $sortorder == "desc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($b->version, $a->version); - }); + usort( + $moduleList, + /** @return int */ + static function (stdClass $a, stdClass $b) { + return strcasecmp($b->version, $a->version); + } + ); } elseif ($sortfield == "id" && $sortorder == "asc") { usort($moduleList, "compareIdAsc"); } elseif ($sortfield == "id" && $sortorder == "desc") { diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 36c64a826a6..3c410fbe0d4 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2016 Juanjo Menent * 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 @@ -53,36 +54,36 @@ if (isset($title)) { $maxphp = @ini_get('upload_max_filesize'); // In unknown if (preg_match('/k$/i', $maxphp)) { $maxphp = preg_replace('/k$/i', '', $maxphp); - $maxphp = $maxphp * 1; + $maxphp *= 1; } if (preg_match('/m$/i', $maxphp)) { $maxphp = preg_replace('/m$/i', '', $maxphp); - $maxphp = $maxphp * 1024; + $maxphp *= 1024; } if (preg_match('/g$/i', $maxphp)) { $maxphp = preg_replace('/g$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024; + $maxphp *= 1024 * 1024; } if (preg_match('/t$/i', $maxphp)) { $maxphp = preg_replace('/t$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024 * 1024; + $maxphp *= 1024 * 1024 * 1024; } $maxphp2 = @ini_get('post_max_size'); // In unknown if (preg_match('/k$/i', $maxphp2)) { $maxphp2 = preg_replace('/k$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1; + $maxphp2 *= 1; } if (preg_match('/m$/i', $maxphp2)) { $maxphp2 = preg_replace('/m$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024; + $maxphp2 *= 1024; } if (preg_match('/g$/i', $maxphp2)) { $maxphp2 = preg_replace('/g$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024; + $maxphp2 *= 1024 * 1024; } if (preg_match('/t$/i', $maxphp2)) { $maxphp2 = preg_replace('/t$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; + $maxphp2 *= 1024 * 1024 * 1024; } if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) { $langs->load("errors"); diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 0dbeab0db6d..fa6547f2eb0 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2020 Laurent Destailleur * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2017 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 @@ -50,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; @@ -247,7 +249,7 @@ if ($transvalue) { } -print '
entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">'; +print ''; if (isset($optioncss) && $optioncss != '') { print ''; } @@ -301,7 +303,9 @@ foreach ($modulesdir as $keydir => $tmpsearchdir) { } //var_dump($i.' - '.$keydir.' - '.$dir_lang_osencoded.' -> '.$moduledirname . ' / ' . $tmpfile.' -> '.$langkey); + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $result = $newlangfileonly->load($langkey, 0, 0, '', 1); // Load translation files only if ($result < 0) { print 'Failed to load language file '.$tmpfile.'
'."\n"; @@ -313,6 +317,7 @@ foreach ($modulesdir as $keydir => $tmpsearchdir) { } //print 'After loading lang '.$langkey.', newlang has '.count($newlang->tab_translate).' records
'."\n"; + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $result = $langsenfileonly->load($langkey, 0, 0, '', 1); // Load translation files only } $i++; @@ -396,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"; @@ -416,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.' '...; }*/ @@ -433,9 +438,9 @@ if ($mode == 'overwrite') { print '   '; print ''; } else { - print ''.img_edit().''; + print ''.img_edit().''; print '   '; - print ''.img_delete().''; + print ''.img_delete().''; } print ''; @@ -561,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 e06954b0422..d68b7c054ef 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -3,6 +3,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2021 Laurent Destailleur * Copyright (C) 2005-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 @@ -60,96 +61,96 @@ clearstatcache(); $workflowcodes = array( // Automatic creation - 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array( - 'family'=>'create', - 'position'=>10, - 'enabled'=>(isModEnabled("propal") && isModEnabled('order')), - 'picto'=>'order' + 'WORKFLOW_PROPAL_AUTOCREATE_ORDER' => array( + 'family' => 'create', + 'position' => 10, + 'enabled' => (isModEnabled("propal") && isModEnabled('order')), + 'picto' => 'order' ), - 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array( - 'family'=>'create', - 'position'=>20, - 'enabled'=>(isModEnabled('order') && isModEnabled('invoice')), - 'picto'=>'bill' + 'WORKFLOW_ORDER_AUTOCREATE_INVOICE' => array( + 'family' => 'create', + 'position' => 20, + 'enabled' => (isModEnabled('order') && isModEnabled('invoice')), + 'picto' => 'bill' ), 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array( - 'family'=>'create', - 'position'=>25, - 'enabled'=>(isModEnabled('ticket') && isModEnabled('intervention')), - 'picto'=>'ticket' + 'family' => 'create', + 'position' => 25, + 'enabled' => (isModEnabled('ticket') && isModEnabled('intervention')), + 'picto' => 'ticket' ), - 'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>'', 'enabled'=>((isModEnabled("propal") && isModEnabled('order')) || (isModEnabled('order') && isModEnabled('invoice')) || (isModEnabled('ticket') && isModEnabled('intervention')))), + 'separator1' => array('family' => 'separator', 'position' => 25, 'title' => '', 'enabled' => ((isModEnabled("propal") && isModEnabled('order')) || (isModEnabled('order') && isModEnabled('invoice')) || (isModEnabled('ticket') && isModEnabled('intervention')))), // Automatic classification of proposal - 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array( - 'family'=>'classify_proposal', - 'position'=>30, - 'enabled'=>(isModEnabled("propal") && isModEnabled('order')), - 'picto'=>'propal', - 'warning'=>'' + 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL' => array( + 'family' => 'classify_proposal', + 'position' => 30, + 'enabled' => (isModEnabled("propal") && isModEnabled('order')), + 'picto' => 'propal', + 'warning' => '' ), - 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array( - 'family'=>'classify_proposal', - 'position'=>31, - 'enabled'=>(isModEnabled("propal") && isModEnabled('invoice')), - 'picto'=>'propal', - 'warning'=>'' + 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL' => array( + 'family' => 'classify_proposal', + 'position' => 31, + 'enabled' => (isModEnabled("propal") && isModEnabled('invoice')), + 'picto' => 'propal', + 'warning' => '' ), // Automatic classification of order - 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated - 'family'=>'classify_order', - 'position'=>40, - 'enabled'=>(isModEnabled("shipping") && isModEnabled('order')), - 'picto'=>'order' + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING' => array( // when shipping validated + 'family' => 'classify_order', + 'position' => 40, + 'enabled' => (isModEnabled("shipping") && isModEnabled('order')), + 'picto' => 'order' ), - 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed - 'family'=>'classify_order', - 'position'=>41, - 'enabled'=>(isModEnabled("shipping") && isModEnabled('order')), - 'picto'=>'order' + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED' => array( // when shipping closed + 'family' => 'classify_order', + 'position' => 41, + 'enabled' => (isModEnabled("shipping") && isModEnabled('order')), + 'picto' => 'order' ), - 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( - 'family'=>'classify_order', - 'position'=>42, - 'enabled'=>(isModEnabled('invoice') && isModEnabled('order')), - 'picto'=>'order', - 'warning'=>'' + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER' => array( + 'family' => 'classify_order', + 'position' => 42, + 'enabled' => (isModEnabled('invoice') && isModEnabled('order')), + 'picto' => 'order', + 'warning' => '' ), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card. // Automatic classification supplier proposal - 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array( - 'family'=>'classify_supplier_proposal', - 'position'=>60, - 'enabled'=>(isModEnabled('supplier_proposal') && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), - 'picto'=>'supplier_proposal', - 'warning'=>'' + 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL' => array( + 'family' => 'classify_supplier_proposal', + 'position' => 60, + 'enabled' => (isModEnabled('supplier_proposal') && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), + 'picto' => 'supplier_proposal', + 'warning' => '' ), // Automatic classification supplier order - 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array( - 'family'=>'classify_supplier_order', - 'position'=>63, - 'enabled'=>(getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')), - 'picto'=>'supplier_order', - 'warning'=>'' + 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION' => array( + 'family' => 'classify_supplier_order', + 'position' => 63, + 'enabled' => (getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')), + 'picto' => 'supplier_order', + 'warning' => '' ), - 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array( - 'family'=>'classify_supplier_order', - 'position'=>64, - 'enabled'=>(getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')), - 'picto'=>'supplier_order', - 'warning'=>'' + 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED' => array( + 'family' => 'classify_supplier_order', + 'position' => 64, + 'enabled' => (getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')), + 'picto' => 'supplier_order', + 'warning' => '' ), - 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array( - 'family'=>'classify_supplier_order', - 'position'=>65, - 'enabled'=>(isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), - 'picto'=>'supplier_order', - 'warning'=>'' + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER' => array( + 'family' => 'classify_supplier_order', + 'position' => 65, + 'enabled' => (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), + 'picto' => 'supplier_order', + 'warning' => '' ), // Automatic classification shipping @@ -157,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 ), @@ -188,7 +189,7 @@ $workflowcodes = array( ), - 'separator2'=>array('family'=>'separator', 'position'=>400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))), + 'separator2' => array('family' => 'separator', 'position' => 400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))), // Automatic link ticket -> contract 'WORKFLOW_TICKET_LINK_CONTRACT' => array( @@ -212,9 +213,16 @@ if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['w } // remove not available workflows (based on activated modules and global defined keys) -$workflowcodes = array_filter($workflowcodes, function ($var) { - return $var['enabled']; -}); +$workflowcodes = array_filter( + $workflowcodes, + /** + * @param array{enabled:int<0,1>} $var + * @return bool + */ + static function ($var) { + 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 ee62b646604..83506888d74 100644 --- a/htdocs/ai/admin/custom_prompt.php +++ b/htdocs/ai/admin/custom_prompt.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Alice Adminson + * 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 @@ -80,8 +81,8 @@ $arrayofaifeatures = array( */ $functioncode = GETPOST('functioncode', 'alpha'); -$pre_prompt = GETPOST('prePrompt', 'alpha'); -$post_prompt = GETPOST('postPrompt', 'alpha'); +$pre_prompt = GETPOST('prePrompt'); +$post_prompt = GETPOST('postPrompt'); // get all configs in const AI $currentConfigurationsJson = getDolGlobalString('AI_CONFIGURATIONS_PROMPT'); @@ -126,10 +127,31 @@ if ($action == 'update' && !GETPOST('cancel')) { $action = 'edit'; } -if ($action == 'confirm_deleteproperty') { +if ($action == 'updatePrompts') { + $key = GETPOST('key', 'alpha'); + + $currentConfigurations[$key] = [ + 'prePrompt' => $pre_prompt, + 'postPrompt' => $post_prompt, + ]; + + $newConfigurationsJson = json_encode($currentConfigurations, JSON_UNESCAPED_UNICODE); + $result = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity); + if (!$error) { + $action = ''; + if ($result) { + header("Location: ".$_SERVER['PHP_SELF']); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + exit; + } else { + setEventMessages($langs->trans("ErrorUpdating"), null, 'errors'); + } + } +} + +if ($action == 'confirm_deleteproperty' && GETPOST('confirm') == 'yes') { $key = GETPOST('key', 'alpha'); - //var_dump($currentConfigurations[$key]);exit; if (isset($currentConfigurations[$key])) { unset($currentConfigurations[$key]); @@ -137,10 +159,10 @@ if ($action == 'confirm_deleteproperty') { $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'); } } } @@ -185,7 +207,7 @@ if ($action == 'deleteproperty') { } if ($action == 'edit') { - $out .= ''; + $out = ''; $out .= ''; $out .= ''; @@ -234,7 +256,7 @@ if ($action == 'edit') { $out .= 'pre-Prompt'; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''; @@ -242,14 +264,14 @@ if ($action == 'edit') { $out .= 'Post-prompt'; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= $form->buttonsSaveCancel("Add", ""); - + $out .= ''; $out .= '


'; print $out; @@ -269,19 +291,24 @@ if ($action == 'edit' || $action == 'create') { $out .= ''; $out .= ''; $out .= ''.$arrayofaifeatures[$key]['picto'].' '.$langs->trans($arrayofaifeatures[$key]['label']); - $out .= ''.img_edit().''; + $out .= ''.img_edit().''; $out .= ''.img_delete().''; $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= ''; + + $out .= '
'; + $out .= ''; + $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= 'pre-Prompt'; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''; @@ -289,15 +316,17 @@ if ($action == 'edit' || $action == 'create') { $out .= 'Post-prompt'; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; + $out .= '
'; + $out .= ''; $out .= ''; + $out .= '
'; } $out .= ''; $out .= ''; } - $out .= ''; $out .= ""; print $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 2d65256ad01..ad854743b20 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -68,10 +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) { + // 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('Check Config of Module').''; + 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_access.class.php b/htdocs/api/class/api_access.class.php index 82a60bc5116..8e4bdb0db9f 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2023 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 @@ -19,11 +20,16 @@ // Create the autoloader for Luracast require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php'; -call_user_func(function () { - $loader = Luracast\Restler\AutoLoader::instance(); - spl_autoload_register($loader); - return $loader; -}); +call_user_func( + /** + * @return Luracast\Restler\AutoLoader + */ + static function () { + $loader = Luracast\Restler\AutoLoader::instance(); + spl_autoload_register($loader); + return $loader; + } +); require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iAuthenticate.php'; require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iUseAuthentication.php'; diff --git a/htdocs/api/index.php b/htdocs/api/index.php index d55fe8d38d5..4b3385fe5ee 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2017 Regis Houssin * Copyright (C) 2021 Alexis LAURIER + * 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,11 +92,16 @@ if (!$res) { require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php'; -call_user_func(function () { - $loader = Luracast\Restler\AutoLoader::instance(); - spl_autoload_register($loader); - return $loader; -}); +call_user_func( + /** + * @return Luracast\Restler\AutoLoader + */ + static function () { + $loader = Luracast\Restler\AutoLoader::instance(); + spl_autoload_register($loader); + return $loader; + } +); require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php'; 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 a915dc1412a..3d62ba4c91a 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -94,38 +94,38 @@ 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,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"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'noteditable' => '0', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'validate' => '1', 'comment' => "Reference of object"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => '1',), - 'fk_asset_model' => array('type' => 'integer:AssetModel:asset/class/assetmodel.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label' => 'AssetModel', 'enabled' => '1', 'position' => 40, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => '1',), - 'qty' => array('type' => 'real', 'label' => 'Qty', 'enabled' => '1', 'position' => 50, 'notnull' => 1, 'visible' => 0, 'default' => '1', 'isameasure' => '1', 'css' => 'maxwidth75imp', 'validate' => '1',), - 'acquisition_type' => array('type' => 'smallint', 'label' => 'AssetAcquisitionType', 'enabled' => '1', 'position' => 60, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetAcquisitionTypeNew', '1' => 'AssetAcquisitionTypeOccasion'), 'validate' => '1',), - 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => '1', 'position' => 70, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetTypeIntangible', '1' => 'AssetTypeTangible', '2' => 'AssetTypeInProgress', '3' => 'AssetTypeFinancial'), 'validate' => '1',), - 'not_depreciated' => array('type' => 'boolean', 'label' => 'AssetNotDepreciated', 'enabled' => '1', 'position' => 80, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => '1',), - 'date_acquisition' => array('type' => 'date', 'label' => 'AssetDateAcquisition', 'enabled' => '1', 'position' => 90, 'notnull' => 1, 'visible' => 1,), - 'date_start' => array('type' => 'date', 'label' => 'AssetDateStart', 'enabled' => '1', 'position' => 100, 'notnull' => 0, 'visible' => -1,), - 'acquisition_value_ht' => array('type' => 'price', 'label' => 'AssetAcquisitionValueHT', 'enabled' => '1', 'position' => 110, 'notnull' => 1, 'visible' => 1, 'isameasure' => '1', 'validate' => '1',), - 'recovered_vat' => array('type' => 'price', 'label' => 'AssetRecoveredVAT', 'enabled' => '1', 'position' => 120, 'notnull' => 0, 'visible' => 1, 'isameasure' => '1', 'validate' => '1',), - 'reversal_date' => array('type' => 'date', 'label' => 'AssetReversalDate', 'enabled' => '1', 'position' => 130, 'notnull' => 0, 'visible' => 1,), - 'reversal_amount_ht' => array('type' => 'price', 'label' => 'AssetReversalAmountHT', 'enabled' => '1', 'position' => 140, 'notnull' => 0, 'visible' => 1, 'isameasure' => '1', 'validate' => '1',), - 'disposal_date' => array('type' => 'date', 'label' => 'AssetDisposalDate', 'enabled' => '1', 'position' => 200, 'notnull' => 0, 'visible' => -2,), - 'disposal_amount_ht' => array('type' => 'price', 'label' => 'AssetDisposalAmount', 'enabled' => '1', 'position' => 210, 'notnull' => 0, 'visible' => -2, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), - 'fk_disposal_type' => array('type' => 'sellist:c_asset_disposal_type:label:rowid::active=1', 'label' => 'AssetDisposalType', 'enabled' => '1', 'position' => 220, 'notnull' => 0, 'visible' => -2, 'index' => 1, 'validate' => '1',), - 'disposal_depreciated' => array('type' => 'boolean', 'label' => 'AssetDisposalDepreciated', 'enabled' => '1', 'position' => 230, 'notnull' => 0, 'default' => '0', 'visible' => -2, 'validate' => '1',), - 'disposal_subject_to_vat' => array('type' => 'boolean', 'label' => 'AssetDisposalSubjectToVat', 'enabled' => '1', 'position' => 240, 'notnull' => 0, 'default' => '0', 'visible' => -2, 'validate' => '1',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => '1',), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 301, 'notnull' => 0, 'visible' => 0, 'validate' => '1',), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 0,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => '1', 'position' => 1010, 'notnull' => -1, 'visible' => 0,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'default' => '0', 'visible' => 2, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'), 'validate' => '1',), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'noteditable' => 0, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "Reference of object"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => 1,), + 'fk_asset_model' => array('type' => 'integer:AssetModel:asset/class/assetmodel.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label' => 'AssetModel', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => 1,), + 'qty' => array('type' => 'real', 'label' => 'Qty', 'enabled' => 1, 'position' => 50, 'notnull' => 1, 'visible' => 0, 'default' => '1', 'isameasure' => 1, 'css' => 'maxwidth75imp', 'validate' => 1,), + 'acquisition_type' => array('type' => 'smallint', 'label' => 'AssetAcquisitionType', 'enabled' => 1, 'position' => 60, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetAcquisitionTypeNew', '1' => 'AssetAcquisitionTypeOccasion'), 'validate' => 1,), + 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetTypeIntangible', '1' => 'AssetTypeTangible', '2' => 'AssetTypeInProgress', '3' => 'AssetTypeFinancial'), 'validate' => 1,), + 'not_depreciated' => array('type' => 'boolean', 'label' => 'AssetNotDepreciated', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => 1,), + 'date_acquisition' => array('type' => 'date', 'label' => 'AssetDateAcquisition', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => 1,), + 'date_start' => array('type' => 'date', 'label' => 'AssetDateStart', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => -1,), + 'acquisition_value_ht' => array('type' => 'price', 'label' => 'AssetAcquisitionValueHT', 'enabled' => 1, 'position' => 110, 'notnull' => 1, 'visible' => 1, 'isameasure' => 1, 'validate' => 1,), + 'recovered_vat' => array('type' => 'price', 'label' => 'AssetRecoveredVAT', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 1, 'isameasure' => 1, 'validate' => 1,), + 'reversal_date' => array('type' => 'date', 'label' => 'AssetReversalDate', 'enabled' => 1, 'position' => 130, 'notnull' => 0, 'visible' => 1,), + 'reversal_amount_ht' => array('type' => 'price', 'label' => 'AssetReversalAmountHT', 'enabled' => 1, 'position' => 140, 'notnull' => 0, 'visible' => 1, 'isameasure' => 1, 'validate' => 1,), + 'disposal_date' => array('type' => 'date', 'label' => 'AssetDisposalDate', 'enabled' => 1, 'position' => 200, 'notnull' => 0, 'visible' => -2,), + 'disposal_amount_ht' => array('type' => 'price', 'label' => 'AssetDisposalAmount', 'enabled' => 1, 'position' => 210, 'notnull' => 0, 'visible' => -2, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'fk_disposal_type' => array('type' => 'sellist:c_asset_disposal_type:label:rowid::active=1', 'label' => 'AssetDisposalType', 'enabled' => 1, 'position' => 220, 'notnull' => 0, 'visible' => -2, 'index' => 1, 'validate' => 1,), + 'disposal_depreciated' => array('type' => 'boolean', 'label' => 'AssetDisposalDepreciated', 'enabled' => 1, 'position' => 230, 'notnull' => 0, 'default' => '0', 'visible' => -2, 'validate' => 1,), + 'disposal_subject_to_vat' => array('type' => 'boolean', 'label' => 'AssetDisposalSubjectToVat', 'enabled' => 1, 'position' => 240, 'notnull' => 0, 'default' => '0', 'visible' => -2, 'validate' => 1,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 301, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 0,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '0', 'visible' => 2, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'), 'validate' => 1,), ); public $rowid; public $ref; diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index 1be3533eedd..0aa62c55919 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,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 8315231fd76..8576e5ee37e 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -100,21 +100,21 @@ 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,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"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'validate' => '1'), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => '1',), - 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetTypeIntangible', '1' => 'AssetTypeTangible', '2' => 'AssetTypeInProgress', '3' => 'AssetTypeFinancial'), 'validate' => '1',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => '1',), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 301, 'notnull' => 0, 'visible' => 0, 'validate' => '1',), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'default' => '1', 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Enabled', '9' => 'Disabled'), 'validate' => '1',), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => 1,), + 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetTypeIntangible', '1' => 'AssetTypeTangible', '2' => 'AssetTypeInProgress', '3' => 'AssetTypeFinancial'), 'validate' => 1,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 301, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '1', 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Enabled', '9' => 'Disabled'), 'validate' => 1,), ); public $rowid; public $ref; 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 61954bfc936..b48f642c4c2 100644 --- a/htdocs/asset/tpl/accountancy_codes_view.tpl.php +++ b/htdocs/asset/tpl/accountancy_codes_view.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,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)) { @@ -58,7 +59,7 @@ if (empty($reshook)) { if (empty($assetdepreciationoptions->deprecation_options[$mode_key]) && $mode_key == "accelerated_depreciation") { continue; } - $width = ($mode_key == "economic")? "pull-left" : "pull-left"; + $width = "pull-left"; print '' . "\n"; print ''; foreach ($mode_info['fields'] as $field_key => $field_info) { 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 a98171ed1ea..c801d74505e 100644 --- a/htdocs/asset/tpl/depreciation_options_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_view.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,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)) { @@ -64,7 +65,7 @@ if (empty($reshook)) { $assetdepreciationoptions->setInfosForMode($mode_key, $class_type, true); - $width = ($mode_key == "economic")? "pull-left" : "pull-left"; + $width = "pull-left"; print '
'.$langs->trans($mode_info['label']).'
' . "\n"; print ''; $mode_info['fields'] = dol_sort_array($mode_info['fields'], 'position'); 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/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 9dbc437758c..6ee4e9c9ac7 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2006-2017 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 @@ -253,8 +254,6 @@ if (empty($reshook)) { } } - $i++; - // Build and output PDF if (!$error && $mode == 'label') { if (!count($arrayofrecords)) { diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 2166a0eb8cd..64f69ea390d 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -352,6 +352,7 @@ class BlockedLog global $langs, $cachedUser; if (empty($cachedUser)) { + // @phan-suppress-next-line PhanPluginRedundantAssignment $cachedUser = array(); } diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index c4db4c61421..5753ce0bc89 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017-2023 Laurent Destailleur * Copyright (C) 2019 Frédéric France * Copyright (C) 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 @@ -199,7 +200,7 @@ if (empty($reshook)) { } // We check if we're allowed to add this bom - $TParentBom=array(); + $TParentBom = array(); $object->getParentBomTreeRecursive($TParentBom); if ($bom_child_id > 0 && !empty($TParentBom) && in_array($bom_child_id, $TParentBom)) { $n_child = new BOM($db); @@ -306,7 +307,7 @@ $formfile = new FormFile($db); $title = $langs->trans('BOM'); -$help_url ='EN:Module_BOM'; +$help_url = 'EN:Module_BOM'; llxHeader('', $title, $help_url); // Part to create @@ -590,7 +591,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product'); - print '
+ print ' @@ -642,7 +643,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); - print ' + print ' diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index fda5dd93eeb..c49f4a4cc89 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -111,18 +111,18 @@ 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,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",), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => 1, 'index' => 1, 'position' => 5), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'noteditable' => 1, 'visible' => 4, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'comment' => "Reference of BOM", 'showoncombobox' => '1', 'csslist' => 'nowraponall'), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'noteditable' => 1, 'visible' => 4, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'comment' => "Reference of BOM", 'showoncombobox' => 1, 'csslist' => 'nowraponall'), 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'notnull' => 1, 'searchall' => 1, 'showoncombobox' => '2', 'autofocusoncreate' => 1, 'css' => 'minwidth300 maxwidth400', 'csslist' => 'tdoverflowmax200'), 'bomtype' => array('type' => 'integer', 'label' => 'Type', 'enabled' => 1, 'visible' => 1, 'position' => 33, 'notnull' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'Manufacturing', 1 => 'Disassemble'), 'css' => 'minwidth175', 'csslist' => 'minwidth175 center'), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), 'fk_product' => array('type' => 'integer:Product:product/class/product.class.php:1:((finished:is:null) or (finished:!=:0))', 'label' => 'Product', 'picto' => 'product', 'enabled' => 1, 'visible' => 1, 'position' => 35, 'notnull' => 1, 'index' => 1, 'help' => 'ProductBOMHelp', 'css' => 'maxwidth500', 'csslist' => 'tdoverflowmax100'), 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 60, 'notnull' => -1,), - 'qty' => array('type' => 'real', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'default' => 1, 'position' => 55, 'notnull' => 1, 'isameasure' => '1', 'css' => 'maxwidth50imp right'), + 'qty' => array('type' => 'real', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'default' => 1, 'position' => 55, 'notnull' => 1, 'isameasure' => 1, 'css' => 'maxwidth50imp right'), //'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'), 'duration' => array('type' => 'duration', 'label' => 'EstimatedDuration', 'enabled' => 1, 'visible' => -1, 'position' => 101, 'notnull' => -1, 'css' => 'maxwidth50imp', 'help' => 'EstimatedDurationDesc'), 'fk_warehouse' => array('type' => 'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label' => 'WarehouseForProduction', 'picto' => 'stock', 'enabled' => 1, 'visible' => -1, 'position' => 102, 'css' => 'maxwidth500', 'csslist' => 'tdoverflowmax100'), @@ -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() { @@ -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",), @@ -1722,12 +1722,12 @@ class BOMLine extends CommonObjectLine 'fk_product' => array('type' => 'integer:Product:product/class/product.class.php', 'label' => 'Product', 'enabled' => 1, 'visible' => 1, 'position' => 20, 'notnull' => 1, 'index' => 1,), 'fk_bom_child' => array('type' => 'integer:BOM:bom/class/bom.class.php', 'label' => 'BillOfMaterials', 'enabled' => 1, 'visible' => -1, 'position' => 40, 'notnull' => -1,), 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 60, 'notnull' => -1,), - 'qty' => array('type' => 'double(24,8)', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'position' => 100, 'notnull' => 1, 'isameasure' => '1',), - 'qty_frozen' => array('type' => 'smallint', 'label' => 'QuantityFrozen', 'enabled' => 1, 'visible' => 1, 'default' => 0, 'position' => 105, 'css' => 'maxwidth50imp', 'help' => 'QuantityConsumedInvariable'), - 'disable_stock_change' => array('type' => 'smallint', 'label' => 'DisableStockChange', 'enabled' => 1, 'visible' => 1, 'default' => 0, 'position' => 108, 'css' => 'maxwidth50imp', 'help' => 'DisableStockChangeHelp'), - 'efficiency' => array('type' => 'double(24,8)', 'label' => 'ManufacturingEfficiency', 'enabled' => 1, 'visible' => 0, 'default' => 1, 'position' => 110, 'notnull' => 1, 'css' => 'maxwidth50imp', 'help' => 'ValueOfEfficiencyConsumedMeans'), + 'qty' => array('type' => 'double(24,8)', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'position' => 100, 'notnull' => 1, 'isameasure' => 1,), + 'qty_frozen' => array('type' => 'smallint', 'label' => 'QuantityFrozen', 'enabled' => 1, 'visible' => 1, 'default' => '0', 'position' => 105, 'css' => 'maxwidth50imp', 'help' => 'QuantityConsumedInvariable'), + 'disable_stock_change' => array('type' => 'smallint', 'label' => 'DisableStockChange', 'enabled' => 1, 'visible' => 1, 'default' => '0', 'position' => 108, 'css' => 'maxwidth50imp', 'help' => 'DisableStockChangeHelp'), + 'efficiency' => array('type' => 'double(24,8)', 'label' => 'ManufacturingEfficiency', 'enabled' => 1, 'visible' => 0, 'default' => '1', 'position' => 110, 'notnull' => 1, 'css' => 'maxwidth50imp', 'help' => 'ValueOfEfficiencyConsumedMeans'), 'fk_unit' => array('type' => 'integer', 'label' => 'Unit', 'enabled' => 1, 'visible' => 1, 'position' => 120, 'notnull' => -1,), - 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => 0, 'position' => 200, 'notnull' => 1,), + 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => '0', 'position' => 200, 'notnull' => 1,), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,), 'fk_default_workstation' => array('type' => 'integer', 'label' => 'DefaultWorkstation', 'enabled' => 1, 'visible' => 1, 'notnull' => 0, 'position' => 1050) ); 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..dd16dfb720e 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -136,44 +136,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 +149,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 +159,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 +175,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 +207,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 c131598facf..3582ea707ec 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -112,28 +112,28 @@ 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,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"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 20, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax150', 'cssview' => 'wordbreak', 'help' => "BookcalLabelAvailabilityHelp", 'showoncombobox' => '2', 'validate' => '1',), - 'fk_bookcal_calendar' => array('type' => 'integer:Calendar:bookcal/class/calendar.class.php:1', 'label' => 'Calendar', 'enabled' => '1', 'position' => 25, 'notnull' => 1, 'visible' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax100'), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => '1',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 0,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => '1', 'position' => 1010, 'notnull' => -1, 'visible' => 0,), - 'start' => array('type' => 'date', 'label' => 'Start Date', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'searchall' => 1,), - 'end' => array('type' => 'date', 'label' => 'End Date', 'enabled' => '1', 'position' => 45, 'notnull' => 1, 'visible' => 1, 'searchall' => 1,), - 'duration' => array('type' => 'integer', 'label' => 'DurationOfRange', 'enabled' => '1', 'position' => 47, 'notnull' => 1, 'visible' => 1, 'default' => '30', 'css' => 'width50 right'), - 'startHour' => array('type' => 'integer', 'label' => 'Start Hour', 'enabled' => '1', 'position' => 46, 'notnull' => 1, 'visible' => 1,), - 'endHour' => array('type' => 'integer', 'label' => 'End Hour', 'enabled' => '1', 'position' => 46.5, 'notnull' => 1, 'visible' => 1,), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => '1', 'position' => 2000, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Closed'), 'default' => 1, 'validate' => '1'), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 20, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax150', 'cssview' => 'wordbreak', 'help' => "BookcalLabelAvailabilityHelp", 'showoncombobox' => 2, 'validate' => 1,), + 'fk_bookcal_calendar' => array('type' => 'integer:Calendar:bookcal/class/calendar.class.php:1', 'label' => 'Calendar', 'enabled' => 1, 'position' => 25, 'notnull' => 1, 'visible' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax100'), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => 1,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 0,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), + 'start' => array('type' => 'date', 'label' => 'Start Date', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'searchall' => 1,), + 'end' => array('type' => 'date', 'label' => 'End Date', 'enabled' => 1, 'position' => 45, 'notnull' => 1, 'visible' => 1, 'searchall' => 1,), + 'duration' => array('type' => 'integer', 'label' => 'DurationOfRange', 'enabled' => 1, 'position' => 47, 'notnull' => 1, 'visible' => 1, 'default' => '30', 'css' => 'width50 right'), + 'startHour' => array('type' => 'integer', 'label' => 'Start Hour', 'enabled' => 1, 'position' => 46, 'notnull' => 1, 'visible' => 1,), + 'endHour' => array('type' => 'integer', 'label' => 'End Hour', 'enabled' => 1, 'position' => 46.5, 'notnull' => 1, 'visible' => 1,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 2000, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Closed'), 'default' => '1', 'validate' => 1), ); public $rowid; public $label; @@ -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)."'"; diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index f4777bfa003..539ef39e5ed 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -112,25 +112,25 @@ 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,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"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'validate' => '1', 'comment' => "Reference of object", 'css' => 'width100'), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 0, 'visible' => 1, 'alwayseditable' => '1', 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1',), - 'visibility' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Owner', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'picto' => 'user', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), - 'type' => array('type' => 'integer', 'label' => 'Type', 'enabled' => '1', 'position' => 42, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'Customer', '1' => 'Supplier', '3' => 'Other'),), - 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'picto' => 'company', 'enabled' => 'isModEnabled("societe")', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150', 'help' => "ThirdPartyBookCalHelp", 'validate' => '1',), - 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1', 'label' => 'Project', 'picto' => 'project', 'enabled' => 'isModEnabled("project")', 'position' => 52, 'notnull' => -1, 'visible' => -1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150', 'validate' => '1',), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => '1',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax150',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2, 'csslist' => 'tdoverflowmax150',), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => '1', 'position' => 2000, 'notnull' => 1, 'default' => 0, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Closed'), 'validate' => '1',), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'right', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "Reference of object", 'css' => 'width100'), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => 1, 'alwayseditable' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,), + 'visibility' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Owner', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'picto' => 'user', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), + 'type' => array('type' => 'integer', 'label' => 'Type', 'enabled' => 1, 'position' => 42, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'Customer', '1' => 'Supplier', '3' => 'Other'),), + 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'picto' => 'company', 'enabled' => 'isModEnabled("societe")', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150', 'help' => "ThirdPartyBookCalHelp", 'validate' => 1,), + 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1', 'label' => 'Project', 'picto' => 'project', 'enabled' => 'isModEnabled("project")', 'position' => 52, 'notnull' => -1, 'visible' => -1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150', 'validate' => 1,), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => 1,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax150',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2, 'csslist' => 'tdoverflowmax150',), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 2000, 'notnull' => 1, 'default' => '0', 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Closed'), 'validate' => 1,), ); public $rowid; public $ref; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 62bbc69953d..57365ce5f50 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2024 Frédéric France * 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 @@ -255,7 +256,7 @@ class Categorie extends CommonObject public $type; /** - * @var array Categories table in memory + * @var array Categories table in memory */ public $cats = array(); @@ -969,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,picto:string,multilangs?: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) { @@ -1009,7 +1010,7 @@ class Categorie extends CommonObject $nbtotalofrecords = $this->db->num_rows($result); if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; - $offset = 0; + $offset = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } } @@ -1138,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) { @@ -1221,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 = $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]); @@ -1244,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/categories/viewcat.php b/htdocs/categories/viewcat.php index efcd10ddbb9..a277b9b03c8 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -102,7 +102,7 @@ if ($confirm == 'no') { } } -$parameters = array(); +$parameters = array('type' => $type, 'id' => $id, 'label' => $label); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Remove element from category if ($id > 0 && $removeelem > 0 && $action == 'unlink') { @@ -1355,6 +1355,10 @@ if ($type == Categorie::TYPE_TICKET) { } } +// Note that $action and $object may have been modified by some hooks +$parameters = array('type' => $type, 'id' => $id, 'label' => $label); +$reshook = $hookmanager->executeHooks('addMoreCategoriesList', $parameters, $object, $action); + // End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index f5d96eec190..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(); } @@ -426,12 +426,6 @@ if (empty($reshook) && $action == 'add') { } } - if (!$error && getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - if (GETPOST("doneby") > 0) { - $object->userdoneid = GETPOSTINT("doneby"); - } - } - $object->note_private = trim(GETPOST("note", "restricthtml")); if (GETPOSTISSET("contactid")) { @@ -877,12 +871,6 @@ if (empty($reshook) && $action == 'update') { $object->transparency = $transparency; // We set transparency on event (even if we can also store it on each user, standard says this property is for event) // TODO store also transparency on owner user - if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - if (GETPOST("doneby")) { - $object->userdoneid = GETPOSTINT("doneby"); - } - } - // Check parameters if (GETPOSTISSET('actioncode') && !GETPOST('actioncode', 'aZ09')) { // actioncode is '0' $error++; @@ -1230,16 +1218,6 @@ if ($action == 'create') { setdatefields(); }); - $("#selectcomplete").change(function() { - console.log("we change the complete status - set the doneby"); - if ($("#selectcomplete").val() == 100) { - if ($("#doneby").val() <= 0) $("#doneby").val(\''.((int) $user->id).'\'); - } - if ($("#selectcomplete").val() == 0) { - $("#doneby").val(-1); - } - }); - $("#actioncode").change(function() { if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired"); else $("#dateend").removeClass("fieldrequired"); @@ -1444,13 +1422,6 @@ if ($action == 'create') { print ''; print ''; - // Done by - if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - print '
'; - } - // Location if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) { print ''; @@ -1995,13 +1966,6 @@ if ($id > 0) { }*/ print ''; - // Realised by - if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - print ''; - } - // Location if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) { print ''; @@ -2427,17 +2391,6 @@ if ($id > 0) { */ print ' '; - // Done by - if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - print ''; - } - // Categories if (isModEnabled('category')) { print ''; @@ -1023,20 +1023,20 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1); $morehtmlref .= ''; - $morehtmlright = ''; + $morehtmlstatus = ''; $nbtry = $nbok = 0; if ($object->status == 2 || $object->status == 3) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); - $morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail; + $morehtmlstatus .= ' ('.$nbtry.'/'.$object->nbemail; if ($nbko) { - $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlstatus .= ' - '.$nbko.' '.$langs->trans("Error"); } - $morehtmlright .= ')   '; + $morehtmlstatus .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; @@ -1345,20 +1345,20 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1); $morehtmlref .= '
'; - $morehtmlright = ''; + $morehtmlstatus = ''; $nbtry = $nbok = 0; if ($object->status == 2 || $object->status == 3) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); - $morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail; + $morehtmlstatus .= ' ('.$nbtry.'/'.$object->nbemail; if ($nbko) { - $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlstatus .= ' - '.$nbko.' '.$langs->trans("Error"); } - $morehtmlright .= ')   '; + $morehtmlstatus .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; @@ -1491,6 +1491,7 @@ if ($action == 'create') { print '
'; print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + $object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT'); + + print ''; } print ''; + } - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + $object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT'); + + print ''; } + print ''; } print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 41fd6253113..69d3e5b59c9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -281,18 +281,6 @@ class Propal extends CommonObject public $labelStatus = array(); public $labelStatusShort = array(); - // Multicurrency - /** - * @var int ID - */ - public $fk_multicurrency; - - public $multicurrency_code; - public $multicurrency_tx; - public $multicurrency_total_ht; - public $multicurrency_total_tva; - public $multicurrency_total_ttc; - /** * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') @@ -320,11 +308,11 @@ 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,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), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 20), 'ref_client' => array('type' => 'varchar(255)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 22), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'visible' => 0, 'position' => 40), @@ -673,7 +661,6 @@ class Propal extends CommonObject // Clean vat code $reg = array(); $vat_src_code = ''; - $reg = array(); if (preg_match('/\((.*)\)/', $txtva, $reg)) { $vat_src_code = $reg[1]; $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. @@ -2474,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 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 1f13f844c5c..bc36be00042 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -782,6 +782,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 @@ -2804,20 +2805,24 @@ if ($action == 'create' && $usercancreate) { print ''; print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + $object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT'); + + print ''; } print ''; + } - // Amount Local Taxes - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; + // Amount Local Taxes + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + $object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT'); + + print ''; } + print ''; } print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b7d2e37c24d..8f89a1bb336 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -253,20 +253,6 @@ class Commande extends CommonOrder */ public $lines = array(); - // Multicurrency - /** - * @var int Currency ID - */ - public $fk_multicurrency; - - /** - * @var string multicurrency code - */ - public $multicurrency_code; - public $multicurrency_tx; - public $multicurrency_total_ht; - public $multicurrency_total_tva; - public $multicurrency_total_ttc; //! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...) public $module_source; @@ -311,11 +297,11 @@ 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,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), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 25), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'visible' => 0, 'position' => 26), 'ref_client' => array('type' => 'varchar(255)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 28), @@ -1317,8 +1303,8 @@ class Commande extends CommonOrder { global $conf, $hookmanager; - dol_include_once('/multicurrency/class/multicurrency.class.php'); - dol_include_once('/core/class/extrafields.class.php'); + require_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; $error = 0; @@ -2438,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) @@ -2449,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); } @@ -2459,7 +2446,6 @@ class Commande extends CommonOrder * @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 */ public function setDiscount($user, $remise, $notrigger = 0) { diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 2adbd25a7d0..2046845b8db 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 @@ -1107,7 +1108,7 @@ if ($resql) { // Payment term if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { print ''; } // Payment mode 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 ""; for ($annee = $year_start; $annee <= $year_end; $annee++) { - $case = sprintf("%04s-%02s", $annee, $mois); + $case = sprintf("%04d-%02d", $annee, $mois); print ''; print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + $object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT'); + + print ''; } print ''; - - if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; - } } + if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + $object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT'); + + print ''; + } + print ''; + } // Add the revenue stamp if ($selleruserevenustamp) { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 447d0d9f5da..bb7a8ab2ace 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -172,12 +172,12 @@ 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,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), 'titre' => array('type' => 'varchar(100)', 'label' => 'Titre', 'enabled' => 1, 'showoncombobox' => 1, 'visible' => -1, 'position' => 15), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 25), 'subtype' => array('type' => 'smallint(6)', 'label' => 'InvoiceSubtype', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 30), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 35), @@ -1590,7 +1590,7 @@ class FactureRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1609,7 +1609,7 @@ class FactureRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1628,7 +1628,7 @@ class FactureRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1650,7 +1650,7 @@ class FactureRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 20483623722..9b3e6733698 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -194,6 +194,7 @@ class Facture extends CommonInvoice public $date_pointoftax; + /** * @var int Situation cycle reference number */ @@ -290,12 +291,12 @@ 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,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), 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 5), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), 'ref_client' => array('type' => 'varchar(255)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 10), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 12), 'type' => array('type' => 'smallint(6)', 'label' => 'Type', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 15), @@ -458,8 +459,8 @@ class Facture extends CommonInvoice $this->ref_client = trim($this->ref_client); - $this->note = (isset($this->note) ? trim($this->note) : trim($this->note_private)); // deprecated - $this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note_private)); + $this->note_private = (isset($this->note_private) ? trim($this->note_private) : ''); + $this->note = (isset($this->note) ? trim($this->note) : $this->note_private); // deprecated $this->note_public = trim($this->note_public); if (!$this->cond_reglement_id) { $this->cond_reglement_id = 0; @@ -524,8 +525,8 @@ class Facture extends CommonInvoice // Define some dates $originaldatewhen = $_facrec->date_when; - $nextdatewhen = null; - $previousdaynextdatewhen = null; + $nextdatewhen = null; // @phan-suppress-current-line PhanPluginRedundantAssignment + $previousdaynextdatewhen = null; // @phan-suppress-current-line PhanPluginRedundantAssignment if ($originaldatewhen) { $nextdatewhen = dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency); $previousdaynextdatewhen = dol_time_plus_duree($nextdatewhen, -1, 'd'); @@ -4413,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); } @@ -4423,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) { diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 13a119e35b5..63e01dac397 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -91,7 +91,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'); diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 33ec278f646..2371f6ff59a 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018 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 @@ -314,7 +314,9 @@ if ($object->id > 0) { } $author = new User($db); - if ($object->fk_user_author) { + if (!empty($object->user_creation_id)) { + $author->fetch($object->user_creation_id); + } elseif (!empty($object->fk_user_author)) { $author->fetch($object->fk_user_author); } 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/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 0594855dce2..d60aa17ce3b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -68,12 +68,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; 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/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 7e149cc435c..e3a3eb07439 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -83,6 +83,9 @@ class BonPrelevement extends CommonObject public $factures = array(); + /** + * @var array + */ public $methodes_trans = array(); public $invoice_in_error = array(); @@ -145,23 +148,23 @@ 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,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,), - 'ref' => array('type' => 'varchar(12)', 'label' => 'Ref', 'enabled' => '1', 'position' => 15, 'notnull' => 0, 'visible' => -1, 'csslist' => 'tdoverflowmax150', 'showoncombobox' => '1',), - 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 25, 'notnull' => 0, 'visible' => -1,), - 'amount' => array('type' => 'double(24,8)', 'label' => 'Amount', 'enabled' => '1', 'position' => 30, 'notnull' => 0, 'visible' => -1,), - 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => '1', 'position' => 500, 'notnull' => 0, 'visible' => -1, 'arrayofkeyval' => array(0 => 'Wait', 1 => 'Transfered', 2 => 'Credited')), - 'credite' => array('type' => 'smallint(6)', 'label' => 'Credite', 'enabled' => '1', 'position' => 40, 'notnull' => 0, 'visible' => -1,), - 'note' => array('type' => 'text', 'label' => 'Note', 'enabled' => '1', 'position' => 45, 'notnull' => 0, 'visible' => -1,), - 'date_trans' => array('type' => 'datetime', 'label' => 'Datetrans', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => -1,), - 'method_trans' => array('type' => 'smallint(6)', 'label' => 'Methodtrans', 'enabled' => '1', 'position' => 55, 'notnull' => 0, 'visible' => -1,), - 'fk_user_trans' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkusertrans', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), - 'date_credit' => array('type' => 'datetime', 'label' => 'Datecredit', 'enabled' => '1', 'position' => 65, 'notnull' => 0, 'visible' => -1,), - 'fk_user_credit' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkusercredit', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), - 'type' => array('type' => 'varchar(16)', 'label' => 'Type', 'enabled' => '1', 'position' => 75, 'notnull' => 0, 'visible' => -1,), - 'fk_bank_account' => array('type' => 'integer', 'label' => 'Fkbankaccount', 'enabled' => '1', 'position' => 80, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx',), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 0,), + 'ref' => array('type' => 'varchar(12)', 'label' => 'Ref', 'enabled' => 1, 'position' => 15, 'notnull' => 0, 'visible' => -1, 'csslist' => 'tdoverflowmax150', 'showoncombobox' => 1,), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 25, 'notnull' => 0, 'visible' => -1,), + 'amount' => array('type' => 'double(24,8)', 'label' => 'Amount', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => -1,), + 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'position' => 500, 'notnull' => 0, 'visible' => -1, 'arrayofkeyval' => array(0 => 'Wait', 1 => 'Transfered', 2 => 'Credited')), + 'credite' => array('type' => 'smallint(6)', 'label' => 'Credite', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => -1,), + 'note' => array('type' => 'text', 'label' => 'Note', 'enabled' => 1, 'position' => 45, 'notnull' => 0, 'visible' => -1,), + 'date_trans' => array('type' => 'datetime', 'label' => 'Datetrans', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => -1,), + 'method_trans' => array('type' => 'smallint(6)', 'label' => 'Methodtrans', 'enabled' => 1, 'position' => 55, 'notnull' => 0, 'visible' => -1,), + 'fk_user_trans' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkusertrans', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), + 'date_credit' => array('type' => 'datetime', 'label' => 'Datecredit', 'enabled' => 1, 'position' => 65, 'notnull' => 0, 'visible' => -1,), + 'fk_user_credit' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkusercredit', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), + 'type' => array('type' => 'varchar(16)', 'label' => 'Type', 'enabled' => 1, 'position' => 75, 'notnull' => 0, 'visible' => -1,), + 'fk_bank_account' => array('type' => 'integer', 'label' => 'Fkbankaccount', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx',), ); public $rowid; public $ref; @@ -171,6 +174,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; @@ -316,7 +322,7 @@ class BonPrelevement extends CommonObject if ($resql) { $num = $this->db->num_rows($resql); } else { - $result = -1; + $result = -1; // @phan-suppress-current-line PhanPluginRedundantAssignment } } else { /* @@ -1649,7 +1655,7 @@ class BonPrelevement extends CommonObject dol_syslog("adnotiff: ".$sql); if ($this->db->query($sql)) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } else { $result = -1; dol_syslog(get_class($this)."::addNotification Error $result"); @@ -2136,7 +2142,7 @@ class BonPrelevement extends CommonObject * @param string $row_cc pl.number AS cc, Not used for SEPA * @param string $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, diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 00934b0f0e6..a6b326ac456 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -6,6 +6,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2019 Markus Welters + * 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 @@ -241,6 +242,7 @@ if ($type == 'bank-transfer') { llxHeader('', $title); +// @phan-suppress-next-line PhanPluginSuspiciousParamPosition $head = bon_prelevement_prepare_head($bprev, $bprev->nbOfInvoiceToPay($type), $bprev->nbOfInvoiceToPay($type, 'salary')); if ($type) { print dol_get_fiche_head($head, (!GETPOSTISSET('sourcetype') ? 'invoice' : 'salary'), $langs->trans("Invoices"), -1, $bprev->picto); 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 ''; +} + print "
'.$langs->trans($mode_info['label']).'
'.$langs->trans("ActionDoneBy").''; - print $form->select_dolusers(GETPOSTISSET("doneby") ? GETPOSTINT("doneby") : (!empty($object->userdoneid) && $percent == 100 ? $object->userdoneid : 0), 'doneby', 1); - print '
'.$langs->trans("Location").'
'.$langs->trans("ActionDoneBy").''; - print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1); - print '
'.$langs->trans("Location").'
'.$langs->trans("ActionDoneBy").''; - if ($object->userdoneid > 0) { - $tmpuser = new User($db); - $tmpuser->fetch($object->userdoneid); - print $tmpuser->getNomUrl(1); - } - print '
'.$langs->trans("Categories").''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 62b813d8eb1..f4f77bcaa9d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -6,7 +6,8 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -240,11 +241,6 @@ class ActionComm extends CommonObject */ public $userownerid; - /** - * @var int Id of user that has done the event. Used only if AGENDA_ENABLE_DONEBY is set. - */ - public $userdoneid; - /** * @var int[] Array of contact ids */ @@ -312,7 +308,7 @@ class ActionComm extends CommonObject public $icalname; /** - * @var string Ical color + * @var int<0,3> Ical color */ public $icalcolor; @@ -493,7 +489,6 @@ class ActionComm extends CommonObject } $userownerid = $this->userownerid; - $userdoneid = $this->userdoneid; // Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...). if (empty($this->userassigned) || count($this->userassigned) == 0 || !is_array($this->userassigned)) { @@ -543,7 +538,6 @@ class ActionComm extends CommonObject $sql .= "fk_contact,"; $sql .= "fk_user_author,"; $sql .= "fk_user_action,"; - $sql .= "fk_user_done,"; $sql .= "label,percent,priority,fulldayevent,location,"; $sql .= "transparency,"; $sql .= "fk_element,"; @@ -582,7 +576,6 @@ class ActionComm extends CommonObject $sql .= ((isset($this->contact_id) && $this->contact_id > 0) ? ((int) $this->contact_id) : "null").", "; // deprecated, use ->socpeopleassigned $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", "; - $sql .= ($userdoneid > 0 ? $userdoneid : "null").", "; $sql .= "'".$this->db->escape($this->label)."', "; $sql .= "'".$this->db->escape($this->percentage)."', "; $sql .= "'".$this->db->escape($this->priority)."', "; @@ -811,7 +804,7 @@ class ActionComm extends CommonObject $sql .= " a.fk_soc,"; $sql .= " a.fk_project,"; $sql .= " a.fk_user_author, a.fk_user_mod,"; - $sql .= " a.fk_user_action, a.fk_user_done,"; + $sql .= " a.fk_user_action,"; $sql .= " a.fk_contact, a.percent as percentage,"; $sql .= " a.fk_element as elementid, a.elementtype,"; $sql .= " a.priority, a.fulldayevent, a.location, a.transparency,"; @@ -1161,16 +1154,9 @@ class ActionComm extends CommonObject $this->fk_project = 0; } - // Check parameters - if ($this->percentage == 0 && $this->userdoneid > 0) { - $this->error = "ErrorCantSaveADoneUserWithZeroPercentage"; - return -1; - } - $socid = (($this->socid > 0) ? $this->socid : 0); $contactid = (($this->contact_id > 0) ? $this->contact_id : 0); $userownerid = ($this->userownerid ? $this->userownerid : 0); - $userdoneid = ($this->userdoneid ? $this->userdoneid : 0); // If a type_id is set, we must also have the type_code set if ($this->type_id > 0) { @@ -1208,7 +1194,6 @@ class ActionComm extends CommonObject $sql .= ", transparency = '".$this->db->escape($this->transparency)."'"; $sql .= ", fk_user_mod = ".((int) $user->id); $sql .= ", fk_user_action = ".($userownerid > 0 ? ((int) $userownerid) : "null"); - $sql .= ", fk_user_done = ".($userdoneid > 0 ? ((int) $userdoneid) : "null"); if (!empty($this->fk_element)) { $sql .= ", fk_element=".($this->fk_element ? ((int) $this->fk_element) : "null"); } @@ -1431,7 +1416,7 @@ class ActionComm extends CommonObject } $sql .= " AND a.entity IN (".getEntity('agenda').")"; if (!$user->hasRight('agenda', 'allactions', 'read')) { - $sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id); + $sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id); $sql .= " OR ar.fk_element = ".((int) $user->id); $sql .= ")"; } @@ -1578,7 +1563,7 @@ class ActionComm extends CommonObject $statusType = 'status9'; if ($percent == -1 && !$hidenastatus) { - $statusType = 'status9'; + $statusType = 'status9'; // @phan-suppress-current-line PhanPluginRedundantAssignment } if ($percent == 0) { $statusType = 'status1'; @@ -2003,7 +1988,6 @@ class ActionComm extends CommonObject $buildfile = true; $login = ''; $logina = ''; - $logind = ''; $logint = ''; $eventorganization = ''; @@ -2354,9 +2338,6 @@ class ActionComm extends CommonObject if ($logint) { $more = $langs->transnoentities("ActionsToDoBy").' '.$logint; } - if ($logind) { - $more = $langs->transnoentities("ActionsDoneBy").' '.$logind; - } if ($eventorganization) { $langs->load("eventorganization"); $title = $langs->transnoentities("OrganizedEvent").(empty($eventarray[0]['label']) ? '' : ' '.$eventarray[0]['label']); diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index cf86e744f70..1c8dd2b5b95 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,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",), @@ -86,7 +86,7 @@ class ActionCommReminder extends CommonObject 'fk_user' => array('type' => 'integer', 'label' => 'User', 'visible' => -1, 'enabled' => 1, 'position' => 65, 'notnull' => 1, 'index' => 1,), 'offsetvalue' => array('type' => 'integer', 'label' => 'OffsetValue', 'visible' => 1, 'enabled' => 1, 'position' => 56, 'notnull' => 1,), 'offsetunit' => array('type' => 'varchar(1)', 'label' => 'OffsetUnit', 'visible' => 1, 'enabled' => 1, 'position' => 57, 'notnull' => 1, 'comment' => "y, m, d, w, h, i",), - 'status' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 58, 'notnull' => 1, 'default' => 0, 'index' => 0, 'arrayofkeyval' => array('0' => 'ToDo', '1' => 'Done')), + 'status' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 58, 'notnull' => 1, 'default' => '0', 'index' => 0, 'arrayofkeyval' => array('0' => 'ToDo', '1' => 'Done')), 'lasterror' => array('type' => 'varchar(128)', 'label' => 'LastError', 'visible' => -1, 'enabled' => 1, 'position' => 59, 'index' => 0), 'fk_actioncomm' => array('type' => 'integer', 'label' => 'Project', 'visible' => 1, 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'index' => 1,), 'fk_email_template' => array('type' => 'integer', 'label' => 'EmailTemplate', 'visible' => 1, 'enabled' => 1, 'position' => 80, 'notnull' => 0), diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index bc6f454539a..d308ce7bd1c 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -192,9 +192,21 @@ class CActionComm $nump = $this->db->num_rows($resql); if ($nump) { $idforallfornewmodule = 96; - $TSystem = array(); - $TSystemAuto = array(); - $TModule = array(); + $TSystem = array( + 'id' => [], + 'code' => [], + 'all' => [] + ); + $TSystemAuto = array( + 'id' => [], + 'code' => [], + 'all' => [] + ); + $TModule = array( + 'id' => [], + 'code' => [], + 'all' => [] + ); $i = 0; while ($i < $nump) { $obj = $this->db->fetch_object($resql); @@ -319,8 +331,8 @@ class CActionComm } if ($onlyautoornot > 0 && preg_match('/^module/', $obj->type) && $obj->module) { - $TModule['code'][$obj->code] .= ' ('.$langs->trans("Module").': '.$obj->module.')'; - $TModule['all'][$obj->code]['label'] .= ' ('.$langs->trans("Module").': '.$obj->module.')'; + array_key_exists($obj->code, $TModule['code']) ? ($TModule['code'][$obj->code] .= ' ('.$langs->trans("Module").': '.$obj->module.')') : ($TModule['code'][$obj->code] = ' ('.$langs->trans("Module").': '.$obj->module.')'); + array_key_exists($obj->code, $TModule['all']) ? ($TModule['all'][$obj->code]['label'] .= ' ('.$langs->trans("Module").': '.$obj->module.')') : ($TModule['all'][$obj->code]['label'] = ' ('.$langs->trans("Module").': '.$obj->module.')'); } } $i++; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 68e6b4d7169..f2427e17501 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -302,8 +302,8 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) { 'src' => getDolUserString($source), 'name' => dol_string_nohtmltag(getDolUserString($name)), 'offsettz' => (int) (empty($user->conf->$offsettz) ? 0 : $user->conf->$offsettz), - // @phan-suppress-next-line PhanPluginSuspiciousParamPosition 'color' => dol_string_nohtmltag(getDolUserString($color)), + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition 'default' => dol_string_nohtmltag(getDolUserString($default)), 'buggedfile' => dol_string_nohtmltag(isset($user->conf->buggedfile) ? $user->conf->buggedfile : '') ); @@ -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 @@ -1489,7 +1493,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 = ''; @@ -1789,7 +1793,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 +1804,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; } @@ -1950,7 +1958,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; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index eff2e4b3708..408b64c6fc9 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -724,16 +724,13 @@ $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 - $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 559530a6873..9c512bfc047 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -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 '
'; // 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/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 95ffc1f0c38..4b36bba8cda 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2023 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2014 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 @@ -278,21 +279,21 @@ if ($object->fetch($id) >= 0) { $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1); $morehtmlref .= ''; - $morehtmlright = ''; + $morehtmlstatus = ''; $nbtry = $nbok = 0; if ($object->status == $object::STATUS_SENTPARTIALY || $object->status == $object::STATUS_SENTCOMPLETELY) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); $nbok = ($nbtry - $nbko); - $morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail; + $morehtmlstatus .= ' ('.$nbtry.'/'.$object->nbemail; if ($nbko) { - $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlstatus .= ' - '.$nbko.' '.$langs->trans("Error"); } - $morehtmlright .= ')   '; + $morehtmlstatus .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; @@ -364,6 +365,7 @@ if ($object->fetch($id) >= 0) { $nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere'));//.' '.$langs->trans("NoTargetYet").''; } if ($text) { + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition print $form->textwithpicto($nbemail, $text, 1, 'warning'); } else { print $nbemail; diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 0bf7e9cb4ad..08aaad90c2a 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -64,20 +64,20 @@ if ($object->fetch($id) >= 0) { $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1); $morehtmlref .= '
'; - $morehtmlright = ''; + $morehtmlstatus = ''; $nbtry = $nbok = 0; if ($object->status == 2 || $object->status == 3) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); - $morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail; + $morehtmlstatus .= ' ('.$nbtry.'/'.$object->nbemail; if ($nbko) { - $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlstatus .= ' - '.$nbko.' '.$langs->trans("Error"); } - $morehtmlright .= ')   '; + $morehtmlstatus .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '

'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e62067bd89a..6d3048b8e65 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2903,19 +2903,23 @@ if ($action == 'create') { print '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . '' . price($object->total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '' . price($object->multicurrency_total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . '' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
'; - $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 '".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B")." '; if (isset($decaiss[$case]) && $decaiss[$case] > 0) { diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e871b6dd754..67a067854f1 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,13 +307,13 @@ 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,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), 'ref' => array('type' => 'varchar(12)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 25), 'label' => array('type' => 'varchar(30)', 'label' => 'Label', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 30), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 35, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 35, 'index' => 1), 'bank' => array('type' => 'varchar(60)', 'label' => 'Bank', 'enabled' => 1, 'visible' => -1, 'position' => 40), 'code_banque' => array('type' => 'varchar(128)', 'label' => 'Code banque', 'enabled' => 1, 'visible' => -1, 'position' => 45), 'code_guichet' => array('type' => 'varchar(6)', 'label' => 'Code guichet', 'enabled' => 1, 'visible' => -1, 'position' => 50), @@ -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 7e54567fc47..6e3a2f28c67 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,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/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index ae720d63423..0eeab1735c3 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023 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 @@ -286,9 +287,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) { if (GETPOSTISSET("clone_sens")) { $object->sens = GETPOSTINT("clone_sens"); - } else { - $object->sens = $object->sens; - } + } // else { $object->sens = $object->sens; } if (GETPOSTISSET("clone_amount")) { $object->amount = GETPOSTFLOAT("clone_amount"); @@ -615,9 +614,9 @@ if ($id) { $morehtmlref .= ''; $linkback = ''.$langs->trans("BackToList").''; - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 83bafc6aaad..7c717d7ede0 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.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 @@ -128,7 +129,8 @@ if ($object->id) { $morehtmlref .= '
'; $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + $morehtmlstatus = $morehtmlright; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index 80705447223..27a8ce3a27b 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.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 @@ -88,7 +89,8 @@ if (isModEnabled('project')) { $morehtmlref .= '
'; $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); +$morehtmlstatus = $morehtmlright; +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index fe4d5a15f77..74cce92938d 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García * Copyright (C) 2018 Andreu Bisquerra + * 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,7 +69,7 @@ if ($contextpage == 'takepos') { $_GET['optioncss'] = 'print'; } -$arrayofpaymentmode = array('cash'=>'Cash', 'cheque'=>'Cheque', 'card'=>'CreditCard'); +$arrayofpaymentmode = array('cash' => 'Cash', 'cheque' => 'Cheque', 'card' => 'CreditCard'); $arrayofposavailable = array(); if (isModEnabled('cashdesk')) { @@ -180,7 +181,7 @@ if ($action == "start") { $db->commit(); $action = "view"; } else { - $db->rollback; + $db->rollback(); $action = "view"; } } diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 83b0a56e563..bf6a7310720 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -8,6 +8,7 @@ * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2018 Andreu Bisquerra + * 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 @@ -59,13 +60,13 @@ $sortorder = 'ASC'; $sortfield = 'b.datev,b.dateo,b.rowid'; $arrayfields = array( - 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1), - 'b.num_chq'=>array('label'=>$langs->trans("Number"), 'checked'=>1), - 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1), - 'cp.code'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), - 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600), - 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), + 'b.rowid' => array('label' => $langs->trans("Ref"), 'checked' => 1), + 'b.dateo' => array('label' => $langs->trans("DateOperationShort"), 'checked' => 1), + 'b.num_chq' => array('label' => $langs->trans("Number"), 'checked' => 1), + 'ba.ref' => array('label' => $langs->trans("BankAccount"), 'checked' => 1), + 'cp.code' => array('label' => $langs->trans("PaymentMode"), 'checked' => 1), + 'b.debit' => array('label' => $langs->trans("Debit"), 'checked' => 1, 'position' => 600), + 'b.credit' => array('label' => $langs->trans("Credit"), 'checked' => 1, 'position' => 605), ); $syear = $object->year_close; @@ -209,7 +210,7 @@ if ($resql) { $transactionspertype = array(); $amountpertype = array(); - $totalarray = array(); + $totalarray = array('nbfield' => 0, 'pos' => array()); while ($i < $num) { $objp = $db->fetch_object($resql); diff --git a/htdocs/compta/facture/agenda-rec.php b/htdocs/compta/facture/agenda-rec.php index 542dfd8f6c1..3636c91fce7 100644 --- a/htdocs/compta/facture/agenda-rec.php +++ b/htdocs/compta/facture/agenda-rec.php @@ -175,9 +175,9 @@ if ($object->id > 0) { } $morehtmlref .= '
'; - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; @@ -211,19 +211,19 @@ if ($object->id > 0) { //$out.=""; } - $morehtmlright = ''; + $morehtmlstatus = ''; //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; - //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$morehtmlstatus .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; - //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + //$morehtmlstatus .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); if (isModEnabled('agenda')) { /* if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + $morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } else { - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); + $morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); } */ } @@ -245,8 +245,8 @@ if ($object->id > 0) { $cachekey = 'count_events_facture_'.$object->id; $nbEvent = dol_getcache($cachekey); - print_barre_liste($langs->trans("ActionsOnBillRec").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); - //print_barre_liste($langs->trans("ActionsOnBill"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnBillRec").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlstatus, '', 0, 1, 1); + //print_barre_liste($langs->trans("ActionsOnBill"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlstatus, '', 0, 1, 1); // List of all actions $filters = array(); diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 59318f1a753..3502f31d822 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1282,9 +1282,9 @@ if ($action == 'create') { } $morehtmlref .= '
'; - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f01432b7c25..86898548291 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1274,7 +1274,7 @@ if (empty($reshook)) { $line->fk_parent_line = $fk_parent_line; $line->subprice = -$line->subprice; // invert price for object - $line->pa_ht = $line->pa_ht; // we chose to have buy/cost price always positive, so no revert of sign here + // $line->pa_ht = $line->pa_ht; // we chose to have buy/cost price always positive, so no revert of sign here $line->total_ht = -$line->total_ht; $line->total_tva = -$line->total_tva; $line->total_ttc = -$line->total_ttc; @@ -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; @@ -5014,21 +5015,24 @@ if ($action == 'create') { print '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
'.$langs->trans("NoRecordFound").'
"; 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 e81d5b80e5d..d91ce98999e 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2016-2024 Frédéric France * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -192,7 +193,7 @@ class ChargeSociales extends CommonObject $this->paye = $obj->paye; $this->periode = $this->db->jdate($obj->period); $this->period = $this->db->jdate($obj->period); - $this->import_key = $this->import_key; + $this->import_key = $obj->import_key; $this->db->free($resql); @@ -405,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) { @@ -653,7 +654,7 @@ class ChargeSociales 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/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/document.php b/htdocs/compta/sociales/document.php index c66056c47ca..0666335cc4d 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -142,9 +142,9 @@ if ($object->id) { $object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index 24181ae4b7b..e6ad4953129 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -111,8 +111,8 @@ $linkback = ''; print '
'; diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php index 2f5487497f6..53c6fe187e6 100644 --- a/htdocs/compta/sociales/note.php +++ b/htdocs/compta/sociales/note.php @@ -116,9 +116,9 @@ if ($id > 0 || !empty($ref)) { //$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; 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 d3f0886eae9..863eb956f33 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 f45cc80e909..1776fe56a77 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; @@ -180,7 +189,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; @@ -206,11 +215,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) { @@ -237,7 +246,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) { @@ -248,8 +257,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 { @@ -365,7 +374,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; @@ -539,12 +548,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; @@ -578,7 +587,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/document.php b/htdocs/compta/tva/document.php index f2670861833..b9cf49d5dff 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -126,8 +126,8 @@ if ($object->id) { $linkback = '
'.$langs->trans("BackToList").''; - $morehtmlright = ''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + $morehtmlstatus = ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; 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/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..1a11ac4f65a 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -52,7 +52,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'); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9b204deacf1..1c800456b76 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -98,11 +98,11 @@ 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,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'), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => 3, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => 3, 'notnull' => 1, 'position' => 30, 'index' => 1), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 3, 'position' => 35), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => 3, 'position' => 40), 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 45, 'showoncombobox' => 1, 'searchall' => 1), @@ -604,7 +604,7 @@ class Contact extends CommonObject $this->fax = trim($this->fax); $this->zip = (empty($this->zip) ? '' : trim($this->zip)); $this->town = (empty($this->town) ? '' : trim($this->town)); - $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + $this->country_id = (empty($this->country_id) || $this->country_id < 0) ? 0 : $this->country_id; if (empty($this->statut)) { $this->statut = 0; } 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 ff741101419..4d411b5a2b9 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -764,7 +764,7 @@ if (empty($reshook)) { $fk_unit = GETPOST('unit', 'alpha'); // update price_ht with discount - // TODO Use object->updateline instead objedtline->update + // TODO Use object->updateline instead objectline->update $price_ht = price2num(GETPOST('elprice'), 'MU'); $remise_percent = price2num(GETPOST('elremise_percent'), '', 2); @@ -789,7 +789,7 @@ if (empty($reshook)) { $objectline->user_closing_id = $user->id; //$objectline->fk_fournprice = $fk_fournprice; $objectline->pa_ht = $pa_ht; - $objectline->rang = $objectline->rang; + // $objectline->rang = $objectline->rang; if ($fk_unit > 0) { $objectline->fk_unit = GETPOST('unit'); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 99662fd0273..6110150e731 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,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), @@ -251,10 +257,11 @@ class Contrat extends CommonObject 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'ref_customer' => array('type' => 'varchar(50)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 25, 'searchall' => 1), 'ref_supplier' => array('type' => 'varchar(50)', 'label' => 'RefSupplier', 'enabled' => 1, 'visible' => -1, 'position' => 26, 'searchall' => 1), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), '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) /** @@ -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++; } } @@ -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,11 +3148,11 @@ 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), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), 'qty' => array('type' => 'integer', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 35, 'isameasure' => 1), 'total_ht' => array('type' => 'integer', 'label' => 'AmountHT', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 36, 'isameasure' => 1), @@ -3129,7 +3171,7 @@ class ContratLigne extends CommonObjectLine 'fk_user_ouverture' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserStartingService', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), 'fk_user_cloture' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserClosingService', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'position' => 500, 'arrayofkeyval' => array(0 => 'Draft', 4 => 'Open', 5 => 'Closed')), - 'rang' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'position' => 500, 'default' => 0) + 'rang' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'position' => 500, 'default' => '0') ); // END MODULEBUILDER PROPERTIES @@ -3467,19 +3509,6 @@ class ContratLigne extends CommonObjectLine if (empty($this->remise_percent)) { $this->remise_percent = 0; } - // For backward compatibility - if (empty($this->date_start)) { - $this->date_start = $this->date_start; - } - if (empty($this->date_start_real)) { - $this->date_start_real = $this->date_start_real; - } - if (empty($this->date_end)) { - $this->date_end = $this->date_end; - } - if (empty($this->date_end_real)) { - $this->date_end_real = $this->date_end_real; - } // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva 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_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 9649ef6252c..94f77a2111c 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1040,6 +1040,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' $objecttmp = new $objectclass($db); $nbok = 0; + $nbignored = 0; $TMsg = array(); //$toselect could contain duplicate entries, cf https://github.com/Dolibarr/dolibarr/issues/26244 @@ -1081,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 { @@ -1200,6 +1202,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { } if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd) { + $nbok = 0; $db->begin(); $affecttag_type = GETPOST('affecttag_type', 'alpha'); @@ -1221,7 +1224,6 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd } //For each valid categ type set common categ - $nbok = 0; if (!empty($to_affecttag_type_array)) { foreach ($to_affecttag_type_array as $categ_type) { $contcats = GETPOST('contcats_' . $categ_type, 'array'); @@ -1256,6 +1258,7 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd } if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoadd) { + $nbok = 0; $db->begin(); if (GETPOSTISSET('pricerate')) { $pricepercentage = GETPOSTINT('pricerate'); @@ -1300,6 +1303,7 @@ if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoa } if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiontoadd) { + $nbok = 0; $db->begin(); $supervisortoset = GETPOST('supervisortoset'); if (!empty($supervisortoset)) { @@ -1335,6 +1339,7 @@ if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiont } if (!$error && ($action == 'affectuser' && $confirm == 'yes') && $permissiontoadd) { + $nbok = 0; $db->begin(); $usertoaffect = GETPOST('usertoaffect'); 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/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_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/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index 09df79556bb..ddb3b12185b 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2021 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 @@ -110,7 +111,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes } - $line = 0; + $line = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $this->info_box_contents[$line][] = array( 'td' => 'class=""', 'text' => $langs->trans("Year"), diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 2bd85fa349e..78c04ba5e88 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -81,19 +81,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 +109,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) */ @@ -198,7 +203,7 @@ class CMailFile } } if (empty($this->sendmode)) { - $this->sendmode = (getDolGlobalString('MAIN_MAIL_SENDMODE') ? $conf->global->MAIN_MAIL_SENDMODE : 'mail'); + $this->sendmode = getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'); } // Add a Feedback-ID. Must be used for stats on spam report only. @@ -287,7 +292,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; } @@ -579,12 +584,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); @@ -727,11 +735,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() { @@ -1119,7 +1128,7 @@ class CMailFile $result = $this->smtps->getErrors(); // applicative error code (not SMTP error code) if (empty($this->error) && empty($result)) { dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG); - $res = true; + $res = true; // @phan-suppress-current-line PhanPluginRedundantAssignment } else { if (empty($this->error)) { $this->error = $result; @@ -1536,7 +1545,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; @@ -1974,6 +1983,10 @@ class CMailFile // 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'); + } + if ($images_dir && !dol_is_dir($images_dir)) { dol_mkdir($images_dir, DOL_DATA_ROOT); } @@ -1996,7 +2009,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 +2031,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 65c23b44c50..4e34d9a284f 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2012 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 @@ -207,7 +208,7 @@ class CSMSFile // Send sms method not correctly defined // -------------------------------------- $this->error = 'Bad value for MAIN_SMS_SENDMODE constant'; - $res = false; + $res = false; // @phan-suppress-current-line PhanPluginRedundantAssignment } } else { $this->error = 'No sms sent. Feature is disabled by option MAIN_DISABLE_ALL_SMS'; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index b80ce304f94..251442a9b72 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -5,8 +5,9 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Marcos García * Copyright (C) 2016-2023 Charlene Benke - * Copyright (C) 2018-2023 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Josep Lluís Amador + * 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 @@ -232,6 +233,9 @@ abstract class CommonDocGenerator ); // Retrieve extrafields if (is_array($user->array_options) && count($user->array_options)) { + if (empty($extrafields->attributes[$user->table_element])) { + $extrafields->fetch_name_optionals_label($user->table_element); + } $array_user = $this->fill_substitutionarray_with_extrafields($user, $array_user, $extrafields, 'myuser', $outputlangs); } return $array_user; @@ -1488,9 +1492,17 @@ abstract class CommonDocGenerator if (!empty($fields)) { // Sort extrafields by rank - uasort($fields, function ($a, $b) { - return ($a->rank > $b->rank) ? 1 : -1; - }); + uasort( + $fields, + /** + * @param stdClass $a + * @param stdClass $b + * @return int<-1,1> + */ + static function ($a, $b) { + return ($a->rank > $b->rank) ? 1 : -1; + } + ); // define some HTML content with style $html .= !empty($params['style']) ? '' : ''; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index a32425ceef4..a4843eff0ba 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2023 Nick Fragoulis * 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 @@ -269,7 +270,7 @@ abstract class CommonInvoice extends CommonObject if ($multicurrency < 0) { $this->sumpayed = $obj->amount; $this->sumpayed_multicurrency = $obj->multicurrency_amount; - return array('alreadypaid'=>(float) $obj->amount, 'alreadypaid_multicurrency'=>(float) $obj->multicurrency_amount); + return array('alreadypaid' => (float) $obj->amount, 'alreadypaid_multicurrency' => (float) $obj->multicurrency_amount); } elseif ($multicurrency) { $this->sumpayed_multicurrency = $obj->multicurrency_amount; return (float) $obj->multicurrency_amount; @@ -436,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'; @@ -477,7 +482,7 @@ abstract class CommonInvoice extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $tmp = array('amount'=>$obj->amount, 'type'=>$obj->code, 'date'=>$obj->datep, 'num'=>$obj->num, 'ref'=>$obj->ref); + $tmp = array('amount' => $obj->amount, 'type' => $obj->code, 'date' => $obj->datep, 'num' => $obj->num, 'ref' => $obj->ref); if (!empty($field3)) { $tmp['ref_ext'] = $obj->ref_ext; } @@ -511,9 +516,9 @@ abstract class CommonInvoice extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); if ($multicurrency) { - $retarray[] = array('amount'=>$obj->multicurrency_amount, 'type'=>$obj->type, 'date'=>$obj->date, 'num'=>'0', 'ref'=>$obj->ref); + $retarray[] = array('amount' => $obj->multicurrency_amount, 'type' => $obj->type, 'date' => $obj->date, 'num' => '0', 'ref' => $obj->ref); } else { - $retarray[] = array('amount'=>$obj->amount, 'type'=>$obj->type, 'date'=>$obj->date, 'num'=>'', 'ref'=>$obj->ref); + $retarray[] = array('amount' => $obj->amount, 'type' => $obj->type, 'date' => $obj->date, 'num' => '', 'ref' => $obj->ref); } $i++; } @@ -1312,9 +1317,9 @@ abstract class CommonInvoice extends CommonObject if ($foundalternativestripeaccount) { if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage - $customer = \Stripe\Customer::retrieve(array('id'=>"$foundalternativestripeaccount", 'expand[]'=>'sources')); + $customer = \Stripe\Customer::retrieve(array('id' => "$foundalternativestripeaccount", 'expand[]' => 'sources')); } else { - $customer = \Stripe\Customer::retrieve(array('id'=>"$foundalternativestripeaccount", 'expand[]'=>'sources'), array("stripe_account" => $stripeacc)); + $customer = \Stripe\Customer::retrieve(array('id' => "$foundalternativestripeaccount", 'expand[]' => 'sources'), array("stripe_account" => $stripeacc)); } } else { $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0); @@ -1500,7 +1505,7 @@ abstract class CommonInvoice extends CommonObject $description = 'Failed to find or use your payment mode (no payment mode for this customer id)'; $stripefailurecode = 'BADPAYMENTMODE'; $stripefailuremessage = 'Failed to find or use your payment mode (no payment mode for this customer id)'; - $postactionmessages = []; + $postactionmessages = []; // @phan-suppress-current-line PhanPluginRedundantAssignment $object = $this; 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 d7c2f99e635..285e3915a79 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,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; @@ -504,6 +504,16 @@ abstract class CommonObject */ public $multicurrency_total_ttc; + /** + * @var float Multicurrency total localta1 + */ + public $multicurrency_total_localtax1; // not in database + + /** + * @var float Multicurrency total localtax2 + */ + public $multicurrency_total_localtax2; // not in database + /** * @var string * @see SetDocModel() @@ -720,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; /** @@ -782,8 +792,8 @@ abstract class CommonObject /** * @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(); @@ -4195,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; @@ -4597,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') { @@ -5714,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; @@ -7368,7 +7300,7 @@ abstract class CommonObject } $out = ' '; } elseif ($type == 'select') { // combo list - $out = ''; + $out = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); @@ -7400,7 +7332,7 @@ abstract class CommonObject $out .= $tmpselect; $out .= ''; } elseif ($type == 'sellist') { - $out = ''; + $out = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); @@ -7594,7 +7526,7 @@ abstract class CommonObject $value_arr = explode(',', $value); $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, '', 0, $morecss, 0, '100%'); } elseif ($type == 'radio') { - $out = ''; + $out = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment foreach ($param['options'] as $keyopt => $valopt) { $out .= ' '; @@ -8945,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() { @@ -9775,6 +9707,7 @@ abstract class CommonObject foreach ($fieldvalues as $k => $v) { $keys[$k] = $k; $value = $this->fields[$k]; + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $values[$k] = $this->quote($v, $value); // May return string 'NULL' if $value is null } @@ -10077,7 +10010,9 @@ abstract class CommonObject foreach ($fieldvalues as $k => $v) { $keys[$k] = $k; $value = $this->fields[$k]; + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $values[$k] = $this->quote($v, $value); + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $tmp[] = $k.'='.$this->quote($v, $this->fields[$k]); } @@ -10454,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/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 1a0f1f15ed0..92a84376184 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 Cedric Salvador + * 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 @@ -167,8 +168,6 @@ abstract class CommonObjectLine extends CommonObject $langs->load('products'); - $label_type = 'label'; - $label_type = 'label'; if ($type == 'short') { $label_type = 'short_label'; diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index de216b0c47c..9a47a8843e8 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -87,11 +87,11 @@ 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,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), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'type' => array('type' => 'varchar(10)', 'label' => 'Type', 'enabled' => 1, 'visible' => -1, 'position' => 20), 'user_id' => array('type' => 'integer', 'label' => 'Userid', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 25), 'page' => array('type' => 'varchar(255)', 'label' => 'RelativeURL', 'enabled' => 1, 'visible' => -1, 'position' => 30), diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index dc7dc9a278e..bd4a8b48c74 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2021 Gaëtan MAISON + * 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 @@ -200,7 +201,7 @@ class DolEditor htmlEncodeOutput: '.dol_escape_js($htmlencode_force).', allowedContent: '.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is own when allowedContent is false */ extraAllowedContent: \'a[target];div{float,display}\', /* Add the style float and display into div to default other allowed tags */ - disallowedContent: '.($disallowAnyContent ? '\'\'' : '\'\'').', /* Tags that are not allowed */ + disallowedContent: \'\', /* Tags that are not allowed */ fullPage: '.($fullpage ? 'true' : 'false').', /* if true, the html, header and body tags are kept */ toolbar: \''.dol_escape_js($this->toolbarname).'\', toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').', @@ -280,8 +281,8 @@ class DolEditor $out .= ' diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index bb8c4fb9c3a..0853edc8955 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -29,7 +29,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/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 04d75f0e844..75f92eda0cf 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2018 Laurent Destailleur * Copyright (C) 2012-2021 Regis Houssin * Copyright (C) 2018-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 @@ -27,7 +28,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); } global $action, $form, $langs; @@ -46,7 +47,7 @@ if ($action == 'delete') { $title = ''.$langs->trans("DefineHereComplementaryAttributes", empty($textobject) ? '' : $textobject).'
'."\n"; //if ($action != 'create' && $action != 'edit') { $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('NewAttribute'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=create', '', (($action != 'create' && $action != 'edit') ? 1 : 1)); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewAttribute'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=create', '', 1); /*} else { $newcardbutton = ''; }*/ diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 225707f0828..a4c13f5cd4f 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France */ /* * @@ -274,7 +275,7 @@ if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { $socstatic = new Societe($db); $elementtype = $socstatic->table_element; // fetch optionals attributes and labels - dol_include_once('/core/class/extrafields.class.php'); + require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype); foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) { 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/login.tpl.php b/htdocs/core/tpl/login.tpl.php index b2072e48eed..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 @@ -204,7 +204,7 @@ if ($disablenofollow) { } ?> -" name="username" class="flat input-icon-user minwidth150" value="" tabindex="1" autofocus="autofocus" /> +" name="username" class="flat input-icon-user minwidth150" value="" tabindex="1" autofocus="autofocus" autocapitalize="off" autocomplete="on" spellcheck="false" autocorrect="off" /> 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 7a190498efe..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 @@ -150,7 +150,7 @@ if (!empty($disablenofollow)) {
-" id="username" name="username" class="flat input-icon-user minwidth150" value="" tabindex="1" /> +" id="username" name="username" class="flat input-icon-user minwidth150" value="" tabindex="1" autocapitalize="off" autocomplete="on" spellcheck="false" autocorrect="off" />
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..1edea428b6f 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -52,7 +52,7 @@ 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 @@ -62,7 +62,7 @@ class InterfaceWorkflowManager 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->workflow) || empty($conf->workflow->enabled)) { return 0; // Module not active, we do nothing diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index d759ceef970..4d6a062e38b 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2023 William Mead * Copyright (C) 2023 Christian Foellmann * 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 @@ -55,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: @@ -76,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 @@ -172,7 +173,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array($object->id => $object->id); - $object->socid = $object->socid; + // $object->socid = $object->socid; } elseif ($action == 'CONTACT_MODIFY') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "companies")); @@ -189,7 +190,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array($object->id => $object->id); - $object->socid = $object->socid; + // $object->socid = $object->socid; } elseif ($action == 'CONTRACT_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "contracts")); 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 273b560fa27..08a24e1fc63 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014-2016 Jean-François Ferry * 2016 Christophe Battarel * 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 @@ -48,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 @@ -58,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; @@ -265,7 +266,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $error_msg = $langs->trans('Error'). ': '; $error_msg .= $langs->transnoentities('TicketWrongContact'); setEventMessages($error_msg, [], 'errors'); - $ok = 0; + $ok = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment break; } } diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index d42c2c92264..7178f29654c 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 @@ -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()); @@ -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; 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/core/website.inc.php b/htdocs/core/website.inc.php index 9a340050d22..4708d12e929 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -263,3 +263,22 @@ if (!defined('USEDOLIBARREDITOR') && empty($website->status)) { print '


'.$weblangs->trans("SorryWebsiteIsCurrentlyOffLine").'
'; exit; } + + +// Get session info and obfuscate session cookie and other variables +$prefix = dol_getprefix(''); +$sessionname = 'DOLSESSID_'.$prefix; +//$savsessionid = $_COOKIE[$sessionname]; + +$_COOKIE[$sessionname] = 'obfuscatedcookie'; +unset($conf->file->instance_unique_id); + +unset($dolibarr_main_instance_unique_id); +unset($dolibarr_main_db_host); +unset($dolibarr_main_db_port); +unset($dolibarr_main_db_name); +unset($dolibarr_main_db_user); +unset($dolibarr_main_db_pass); +unset($$dolibarr_main_db_type); +unset($dolibarr_main_document_root); +unset($dolibarr_main_document_root_alt); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 621de20afa6..a761b7ffd4a 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -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/cron/list.php b/htdocs/cron/list.php index 8aa30543b4a..4e14d503f1e 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2021 Laurent Destailleur * 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 @@ -379,8 +380,8 @@ if ($action == 'delete' && empty($toselect)) { // Used when we make a delete on $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'enable'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("CronStatusActiveBtn"), - 'disable'=>img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans("CronStatusInactiveBtn"), + 'enable' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("CronStatusActiveBtn"), + 'disable' => img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans("CronStatusInactiveBtn"), ); if ($user->hasRight('cron', 'delete')) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); @@ -471,7 +472,7 @@ print '
'; print ''; print ''; print ''; // Action column @@ -607,9 +608,9 @@ if ($num > 0) { $s = ''; if ($obj->unitfrequency == "60") { - $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('MinuteShort') : $langs->trans('MinuteShort')); + $s = ($obj->frequency)." ".$langs->trans('MinuteShort'); } elseif ($obj->unitfrequency == "3600") { - $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('HourShort') : $langs->trans('HourShort')); + $s = ($obj->frequency)." ".$langs->trans('HourShort'); } elseif ($obj->unitfrequency == "86400") { $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('DurationDays') : $langs->trans('DurationDay')); } elseif ($obj->unitfrequency == "604800") { @@ -659,7 +660,7 @@ if ($num > 0) { print ''; 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 f4fad036d8d..4ccc4510355 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -1,6 +1,7 @@ * Copyright (C) 2019 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 @@ -92,69 +93,76 @@ $tmpDir = $conf->dav->multidir_output[$entity]; // We need root dir, not a dir t // Authentication callback function -$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) { - global $user, $conf; - global $dolibarr_main_authentication, $dolibarr_auto_user; +$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 bool True if login ok, false if not + */ + static function ($username, $password) { + global $user, $conf; + global $dolibarr_main_authentication, $dolibarr_auto_user; - if (empty($user->login)) { - dol_syslog("Failed to authenticate to DAV, login is not provided", LOG_WARNING); - return false; - } - if ($user->socid > 0) { - dol_syslog("Failed to authenticate to DAV, user is an external user", LOG_WARNING); - return false; - } - if ($user->login != $username) { - dol_syslog("Failed to authenticate to DAV, login does not match the login of loaded user", LOG_WARNING); - return false; - } - - // Authentication mode - if (empty($dolibarr_main_authentication)) { - $dolibarr_main_authentication = 'dolibarr'; - } - - // Authentication mode: forceuser - if ($dolibarr_main_authentication == 'forceuser') { - if (empty($dolibarr_auto_user)) { - $dolibarr_auto_user = 'auto'; - } - if ($dolibarr_auto_user != $username) { - dol_syslog("Warning: your instance is set to use the automatic forced login '".$dolibarr_auto_user."' that is not the requested login. DAV usage is forbidden in this mode."); + if (empty($user->login)) { + dol_syslog("Failed to authenticate to DAV, login is not provided", LOG_WARNING); return false; } + if ($user->socid > 0) { + dol_syslog("Failed to authenticate to DAV, user is an external user", LOG_WARNING); + return false; + } + if ($user->login != $username) { + dol_syslog("Failed to authenticate to DAV, login does not match the login of loaded user", LOG_WARNING); + return false; + } + + // Authentication mode + if (empty($dolibarr_main_authentication)) { + $dolibarr_main_authentication = 'dolibarr'; + } + + // Authentication mode: forceuser + if ($dolibarr_main_authentication == 'forceuser') { + if (empty($dolibarr_auto_user)) { + $dolibarr_auto_user = 'auto'; + } + if ($dolibarr_auto_user != $username) { + dol_syslog("Warning: your instance is set to use the automatic forced login '".$dolibarr_auto_user."' that is not the requested login. DAV usage is forbidden in this mode."); + return false; + } + } + + $authmode = explode(',', $dolibarr_main_authentication); + $entity = (GETPOSTINT('entity') ? GETPOSTINT('entity') : (!empty($conf->entity) ? $conf->entity : 1)); + + if (checkLoginPassEntity($username, $password, $entity, $authmode, 'dav') != $username) { + return false; + } + + // Check if user status is enabled + if ($user->statut != $user::STATUS_ENABLED) { + // Status is disabled + dol_syslog("The user has been disabled."); + return false; + } + + // Check if session was unvalidated by a password change + if (($user->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION["dol_logindate"])) { + // Session is no more valid + dol_syslog("The user has a date for session invalidation = ".$user->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions."); + return false; + } + + // Check date validity + if ($user->isNotIntoValidityDateRange()) { + // User validity dates are no more valid + dol_syslog("The user login has a validity between [".$user->datestartvalidity." and ".$user->dateendvalidity."], current date is ".dol_now()); + return false; + } + + return true; } - - $authmode = explode(',', $dolibarr_main_authentication); - $entity = (GETPOSTINT('entity') ? GETPOSTINT('entity') : (!empty($conf->entity) ? $conf->entity : 1)); - - if (checkLoginPassEntity($username, $password, $entity, $authmode, 'dav') != $username) { - return false; - } - - // Check if user status is enabled - if ($user->statut != $user::STATUS_ENABLED) { - // Status is disabled - dol_syslog("The user has been disabled."); - return false; - } - - // Check if session was unvalidated by a password change - if (($user->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION["dol_logindate"])) { - // Session is no more valid - dol_syslog("The user has a date for session invalidation = ".$user->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions."); - return false; - } - - // Check date validity - if ($user->isNotIntoValidityDateRange()) { - // User validity dates are no more valid - dol_syslog("The user login has a validity between [".$user->datestartvalidity." and ".$user->dateendvalidity."], current date is ".dol_now()); - return false; - } - - return true; -}); +); $authBackend->setRealm(constant('DOL_APPLICATION_TITLE').' - WebDAV'); @@ -211,7 +219,7 @@ if (isset($baseUri)) { if ((!getDolGlobalString('DAV_ALLOW_PUBLIC_DIR') || !preg_match('/'.preg_quote(DOL_URL_ROOT.'/dav/fileserver.php/public', '/').'/', $_SERVER["PHP_SELF"])) && !preg_match('/^sabreAction=asset&assetName=[a-zA-Z0-9%\-\/]+\.(png|css|woff|ico|ttf)$/', $_SERVER["QUERY_STRING"]) // URL for Sabre browser resources - ) { +) { //var_dump($_SERVER["QUERY_STRING"]);exit; $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend)); } @@ -239,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/DolPhpCollector.php b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php index c4ff10dbc61..8adc2a3814d 100644 --- a/htdocs/debugbar/class/DataCollector/DolPhpCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php @@ -76,18 +76,26 @@ class PhpCollector extends DataCollector implements Renderable /** * Returns a list of messages ordered by their timestamp. * - * @return array A list of messages ordered by time. + * @return array A list of messages ordered by time. */ public function getMessages() { $messages = $this->messages; - usort($messages, function ($itemA, $itemB) { - if ($itemA['time'] === $itemB['time']) { - return 0; + usort( + $messages, + /** + * @param array{time:int} $itemA Message A information + * @param array{time:int} $itemB Message B information + * @return int<-1,1> -1 if Item A before Item B, 0 if same, 1 if later. + */ + static function ($itemA, $itemB) { + if ($itemA['time'] === $itemB['time']) { + return 0; + } + return $itemA['time'] < $itemB['time'] ? -1 : 1; } - return $itemA['time'] < $itemB['time'] ? -1 : 1; - }); + ); return $messages; } diff --git a/htdocs/debugbar/class/autoloader.php b/htdocs/debugbar/class/autoloader.php index a093315172a..bb1bc7880d7 100644 --- a/htdocs/debugbar/class/autoloader.php +++ b/htdocs/debugbar/class/autoloader.php @@ -1,35 +1,43 @@ + */ /** * Simple autoloader, so we don't need Composer just for this. */ -spl_autoload_register(function ($class) { - if (preg_match('/^DebugBar/', $class)) { - $file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - //var_dump($class.' - '.file_exists($file).' - '.$file); - if (file_exists($file)) { - require_once $file; - return true; +spl_autoload_register( + /** + * @param string $class Class to load + * @return bool If class could be loaded + */ + static function ($class) { + if (preg_match('/^DebugBar/', $class)) { + $file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; + //var_dump($class.' - '.file_exists($file).' - '.$file); + if (file_exists($file)) { + require_once $file; + return true; + } + return false; } - return false; - } - if (preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) { - $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - //var_dump($class.' - '.file_exists($file).' - '.$file); - if (file_exists($file)) { - require_once $file; - return true; + if (preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) { + $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; + //var_dump($class.' - '.file_exists($file).' - '.$file); + if (file_exists($file)) { + require_once $file; + return true; + } + return false; } - return false; - } - if (preg_match('/^'.preg_quote('Symfony\Component\VarDumper', '/').'/', $class)) { - $class = preg_replace('/'.preg_quote('Symfony\Component\VarDumper', '/').'/', '', $class); - $file = DOL_DOCUMENT_ROOT.'/includes/symfony/var-dumper/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - require_once $file; - return true; + if (preg_match('/^'.preg_quote('Symfony\Component\VarDumper', '/').'/', $class)) { + $class = preg_replace('/'.preg_quote('Symfony\Component\VarDumper', '/').'/', '', $class); + $file = DOL_DOCUMENT_ROOT.'/includes/symfony/var-dumper/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; + if (file_exists($file)) { + require_once $file; + return true; + } + return false; } - return false; + return true; } - return true; -}); +); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index b4d139a0120..d57a25e96ba 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++; } } @@ -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 c3bce69d1db..4bdcaa4a853 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2019 Thibault FOUCART * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2021 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 @@ -382,11 +383,11 @@ class Don extends CommonObject $now = dol_now(); // Clean parameters - $this->address = ($this->address > 0 ? $this->address : $this->address); - $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); - $this->town = ($this->town > 0 ? $this->town : $this->town); - $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); - $this->country = ($this->country ? $this->country : $this->country); + // $this->address = ($this->address > 0 ? $this->address : $this->address); + // $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); + // $this->town = ($this->town > 0 ? $this->town : $this->town); + // $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + // $this->country = ($this->country ? $this->country : $this->country); $this->amount = (float) price2num($this->amount); // Check parameters @@ -499,11 +500,11 @@ class Don extends CommonObject $error = 0; // Clean parameters - $this->address = ($this->address > 0 ? $this->address : $this->address); - $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); - $this->town = ($this->town > 0 ? $this->town : $this->town); - $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); - $this->country = ($this->country ? $this->country : $this->country); + // $this->address = ($this->address > 0 ? $this->address : $this->address); + // $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); + // $this->town = ($this->town > 0 ? $this->town : $this->town); + // $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + // $this->country = ($this->country ? $this->country : $this->country); $this->amount = (float) price2num($this->amount); // Check parameters diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 518529630fb..da23932c66b 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -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,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), @@ -2385,7 +2385,7 @@ class EmailCollector extends CommonObject $operationslog .= '
We have this data to search thirdparty: id='.$idtouseforthirdparty.', email='.$emailtouseforthirdparty.', name='.$nametouseforthirdparty.', name_alias='.$namealiastouseforthirdparty; $tmpobject = new stdClass(); - $tmpobject->element == 'generic'; + $tmpobject->element = 'generic'; $tmpobject->id = $idtouseforthirdparty; $tmpobject->name = $nametouseforthirdparty; $tmpobject->name_alias = $namealiastouseforthirdparty; @@ -2618,7 +2618,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 +2645,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 +2653,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); @@ -3075,19 +3067,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++; @@ -3363,7 +3353,7 @@ class EmailCollector extends CommonObject if (empty($mode) && empty($error)) { $res = imap_mail_move($connection, $imapemail, $targetdir, CP_UID); if ($res == false) { - $errorforemail++; + // $errorforemail++; // Not in loop, not needed, not initialised $this->error = imap_last_error(); $this->errors[] = $this->error; @@ -3521,7 +3511,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 dc5e4a44c49..85c9ad7dc83 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,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 10d937cd866..0089e5f0b6c 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,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",), @@ -93,7 +93,7 @@ class EmailCollectorFilter extends CommonObject 'fk_user_creat' => array('type' => 'integer', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -2, 'position' => 510, 'notnull' => 1, 'foreignkey' => 'llx_user.rowid',), 'fk_user_modif' => array('type' => 'integer', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'position' => 511, 'notnull' => -1,), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '1', 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')), ); public $rowid; public $fk_emailcollector; diff --git a/htdocs/emailcollector/lib/emailcollector.lib.php b/htdocs/emailcollector/lib/emailcollector.lib.php index 3549f20a5a5..b60768fb5c3 100644 --- a/htdocs/emailcollector/lib/emailcollector.lib.php +++ b/htdocs/emailcollector/lib/emailcollector.lib.php @@ -1,6 +1,5 @@ +/* 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,7 +30,7 @@ */ function emailcollectorPrepareHead($object) { - global $db, $langs, $conf; + global $langs, $conf; $langs->load("emailcollector@emailcollector"); @@ -123,7 +122,7 @@ function getAttachments($jk, $mbox) $fpos = 2; $attachments = array(); $nb = count($parts); - if ($parts && $nb) { + if ($nb && !empty($parts)) { for ($i = 1; $i < $nb; $i++) { $part = $parts[$i]; diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index e46a547045b..683a8d016fe 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -112,25 +112,25 @@ 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,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"), - 'ref' => array('type' => 'integer', 'label' => 'Ref', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax150', 'help' => "OrganizationEvenLabelName", 'showoncombobox' => '1', 'autofocusoncreate' => 1), + 'id' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'integer', 'label' => 'Ref', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax150', 'help' => "OrganizationEvenLabelName", 'showoncombobox' => 1, 'autofocusoncreate' => 1), 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1:(t.usage_organize_event:=:1)', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'position' => 52, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'picto' => 'project', 'css' => 'maxwidth500', 'csslist' => 'tdoverflowmax100'), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'enabled' => '$conf->societe->enabled', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'help' => "OrganizationEventLinkToThirdParty", 'picto' => 'company', 'csslist' => 'tdoverflowmax100', 'css' => 'maxwidth500'), - 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3), - 'fk_action' => array('type' => "sellist:c_actioncomm:libelle:id::(module:LIKE:'%@eventorganization')", 'label' => 'Format', 'enabled' => '1', 'position' => 60, 'notnull' => 1, 'visible' => 1, 'css' => 'width100', 'csslist' => 'tdoverflowmax100'), - 'datep' => array('type' => 'datetime', 'label' => 'DateStart', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '2',), - 'datep2' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => '1', 'position' => 71, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '3',), - 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2, 'csslist' => 'nowraponall'), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2, 'csslist' => 'nowraponall'), - 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax100'), - 'fk_user_mod' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2, 'csslist' => 'tdoverflowmax100'), - 'num_vote' => array('type' => 'smallint', 'label' => 'NbVotes', 'enabled' => '1', 'position' => 800, 'notnull' => -1, 'visible' => 5, 'default' => '0', 'index' => 0), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'EvntOrgDraft', '1' => 'EvntOrgSuggested', '2' => 'EvntOrgConfirmed', '3' => 'EvntOrgNotQualified', '4' => 'EvntOrgDone', '9' => 'EvntOrgCancelled'),), + 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3), + 'fk_action' => array('type' => "sellist:c_actioncomm:libelle:id::(module:LIKE:'%@eventorganization')", 'label' => 'Format', 'enabled' => 1, 'position' => 60, 'notnull' => 1, 'visible' => 1, 'css' => 'width100', 'csslist' => 'tdoverflowmax100'), + 'datep' => array('type' => 'datetime', 'label' => 'DateStart', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '2',), + 'datep2' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'position' => 71, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '3',), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2, 'csslist' => 'nowraponall'), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2, 'csslist' => 'nowraponall'), + 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax100'), + 'fk_user_mod' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2, 'csslist' => 'tdoverflowmax100'), + 'num_vote' => array('type' => 'smallint', 'label' => 'NbVotes', 'enabled' => 1, 'position' => 800, 'notnull' => -1, 'visible' => 5, 'default' => '0', 'index' => 0), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'EvntOrgDraft', '1' => 'EvntOrgSuggested', '2' => 'EvntOrgConfirmed', '3' => 'EvntOrgNotQualified', '4' => 'EvntOrgDone', '9' => 'EvntOrgCancelled'),), ); public $rowid; public $id; diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 02fcb8b350f..7b898c6cc12 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -100,32 +100,32 @@ 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,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"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'comment' => "Reference of object"), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'comment' => "Reference of object"), //'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'position' => 20, 'notnull' => 1, 'visible' => 0, 'index' => 1, 'picto' => 'project', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'email' => array('type' => 'mail', 'label' => 'EmailAttendee', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'autofocusoncreate' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax150'), - 'firstname' => array('type' => 'varchar(100)', 'label' => 'Firstname', 'enabled' => '1', 'position' => 31, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax125'), - 'lastname' => array('type' => 'varchar(100)', 'label' => 'Lastname', 'enabled' => '1', 'position' => 32, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax125'), + 'email' => array('type' => 'mail', 'label' => 'EmailAttendee', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'autofocusoncreate' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax150'), + 'firstname' => array('type' => 'varchar(100)', 'label' => 'Firstname', 'enabled' => 1, 'position' => 31, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax125'), + 'lastname' => array('type' => 'varchar(100)', 'label' => 'Lastname', 'enabled' => 1, 'position' => 32, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax125'), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'position' => 40, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'help' => "OrganizationEventLinkToThirdParty", 'picto' => 'company', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'email_company' => array('type' => 'mail', 'label' => 'EmailCompany', 'enabled' => '1', 'position' => 41, 'notnull' => 0, 'visible' => -2, 'searchall' => 1), - 'date_subscription' => array('type' => 'datetime', 'label' => 'DateOfRegistration', 'enabled' => '1', 'position' => 56, 'notnull' => 1, 'visible' => 1, 'showoncombobox' => '1',), + 'email_company' => array('type' => 'mail', 'label' => 'EmailCompany', 'enabled' => 1, 'position' => 41, 'notnull' => 0, 'visible' => -2, 'searchall' => 1), + 'date_subscription' => array('type' => 'datetime', 'label' => 'DateOfRegistration', 'enabled' => 1, 'position' => 56, 'notnull' => 1, 'visible' => 1, 'showoncombobox' => 1,), 'fk_invoice' => array('type' => 'integer:Facture:compta/facture/class/facture.class.php', 'label' => 'Invoice', 'enabled' => 'isModEnabled("invoice")', 'position' => 57, 'notnull' => 0, 'visible' => 1, 'index' => 0, 'picto' => 'bill', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'amount' => array('type' => 'price', 'label' => 'AmountPaid', 'enabled' => '1', 'position' => 57, 'notnull' => 0, 'visible' => 1, 'default' => 'null', 'isameasure' => '1', 'help' => "AmountOfRegistrationPaid",), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 3,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 3,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2, 'css' => 'nowraponall'), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => -1, 'visible' => -2), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 0,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => '1', 'position' => 1010, 'notnull' => -1, 'visible' => 0,), - 'ip' => array('type' => 'varchar(250)', 'label' => 'IPAddress', 'enabled' => '1', 'position' => 900, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'default' => 0, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'),), + 'amount' => array('type' => 'price', 'label' => 'AmountPaid', 'enabled' => 1, 'position' => 57, 'notnull' => 0, 'visible' => 1, 'default' => 'null', 'isameasure' => 1, 'help' => "AmountOfRegistrationPaid",), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 3,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 3,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2, 'css' => 'nowraponall'), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => -1, 'visible' => -2), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 0,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), + 'ip' => array('type' => 'varchar(250)', 'label' => 'IPAddress', 'enabled' => 1, 'position' => 900, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'default' => '0', 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'),), ); public $rowid; public $ref; diff --git a/htdocs/eventorganization/conferenceorboothattendee_note.php b/htdocs/eventorganization/conferenceorboothattendee_note.php index 99768a9b738..66caf29a247 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_note.php +++ b/htdocs/eventorganization/conferenceorboothattendee_note.php @@ -1,6 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- + * 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 @@ -22,59 +23,12 @@ * \brief Tab for notes on ConferenceOrBoothAttendee */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; - $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; -dol_include_once('/eventorganization/class/conferenceorboothattendee.class.php'); -dol_include_once('/eventorganization/lib/eventorganization_conferenceorboothattendee.lib.php'); +require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php'; +require_once DOL_DOCUMENT_ROOT . '/eventorganization/lib/eventorganization_conferenceorboothattendee.lib.php'; // Load translation files required by the page $langs->loadLangs(array('eventorganization', 'companies')); diff --git a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php index b0efb0602c5..f4d88699fe1 100644 --- a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php +++ b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.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 @@ -114,7 +115,7 @@ function conferenceorboothPrepareHead($object, $with_project = 0) /** * Prepare array of tabs for ConferenceOrBooth Project tab * - * @param $object Project Project + * @param Project $object Project * @return array */ function conferenceorboothProjectPrepareHead($object) @@ -190,7 +191,7 @@ function conferenceorboothProjectPrepareHead($object) * Prepare array of tabs for ConferenceOrBoothAttendees * * @param ConferenceOrBoothAttendee $object ConferenceOrBoothAttendee - * @return array Array of tabs + * @return array> Array of tabs */ function conferenceorboothAttendeePrepareHead($object) { 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 6742c84011b..90da7555450 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2014-2017 Francis Appels * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2016-2022 Ferran Marcet + * Copyright (C) 2016-2024 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Lenin Rivas @@ -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,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(); @@ -921,7 +921,7 @@ class Expedition extends CommonObject if (isModEnabled('stock') && !empty($orderline->fk_product)) { $fk_product = $orderline->fk_product; - if (!($entrepot_id > 0) && !getDolGlobalString('STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS')) { + if (!($entrepot_id > 0) && !getDolGlobalString('STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS') && !(getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES') && $line->product_type == Product::TYPE_SERVICE)) { $langs->load("errors"); $this->error = $langs->trans("ErrorWarehouseRequiredIntoShipmentLine"); return -1; @@ -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 */ diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 913f069ff61..7e3edde6355 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -774,7 +774,7 @@ if ($object->id > 0 || !empty($object->ref)) { 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 .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; $sql .= " WHERE cfd.fk_commandefourndet = ".(int) $objp->rowid;*/ $sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot,"; 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/card.php b/htdocs/expensereport/card.php index 83e2df9364c..d9d609822a8 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2023 Alexandre Spangaro * Copyright (C) 2017 Ferran Marcet - * 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 @@ -69,6 +69,7 @@ $comments = GETPOST('comments', 'restricthtml'); $fk_c_type_fees = GETPOSTINT('fk_c_type_fees'); $socid = GETPOSTINT('socid') ? GETPOSTINT('socid') : GETPOSTINT('socid_id'); +/** @var User $user */ $childids = $user->getAllChildIds(1); if (getDolGlobalString('EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH')) { @@ -951,7 +952,7 @@ if (empty($reshook)) { if ($action == "confirm_setdraft" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->hasRight('expensereport', 'creer')) { $object = new ExpenseReport($db); $object->fetch($id); - if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { + if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid || in_array($object->fk_user_author, $childids)) { $result = $object->setStatut(0); if ($result > 0) { @@ -1537,7 +1538,7 @@ if ($action == 'create') { $result = $object->fetch($id, $ref); if ($result > 0) { - if (!in_array($object->fk_user_author, $user->getAllChildIds(1))) { + if (!in_array($object->fk_user_author, $childids)) { if (!$user->hasRight('expensereport', 'readall') && !$user->hasRight('expensereport', 'lire_tous') && (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || !$user->hasRight('expensereport', 'writeall_advance'))) { print load_fiche_titre($langs->trans('TripCard'), '', 'trip'); @@ -2710,7 +2711,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'editline') { * Afficher : "Enregistrer" / "Modifier" / "Supprimer" */ if ($user->hasRight('expensereport', 'creer') && $object->status == ExpenseReport::STATUS_DRAFT) { - if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || $user->hasRight('expensereport', 'writeall_advance')) { + if (in_array($object->fk_user_author, $childids) || $user->hasRight('expensereport', 'writeall_advance')) { // Modify print ''; @@ -2751,7 +2752,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'editline') { * Afficher : "Valider" / "Refuser" / "Supprimer" */ if ($object->status == ExpenseReport::STATUS_VALIDATED) { - if (in_array($object->fk_user_author, $user->getAllChildIds(1))) { + if (in_array($object->fk_user_author, $childids)) { // set draft print ''; } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 464ca7edf60..3ccf90c0255 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Laurent Destailleur - * Copyright (C) 2020 Frédéric France + * Copyright (C) 2020-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 @@ -107,7 +107,7 @@ class ExpenseReports extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @return array Array of Expense Report objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '', $properties = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = '', $sqlfilters = '', $properties = '') { if (!DolibarrApiAccess::$user->hasRight('expensereport', 'lire')) { throw new RestException(403); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index a62d4dc04f2..7fc5a866eec 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -6,6 +6,7 @@ * Copyright (c) 2018-2024 Frédéric France * Copyright (C) 2016-2020 Ferran Marcet * 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 @@ -72,8 +73,14 @@ class ExpenseReport extends CommonObject */ public $line; + /** + * @var int|string + */ public $date_debut; + /** + * @var int|string + */ public $date_fin; /** @@ -86,6 +93,9 @@ class ExpenseReport extends CommonObject */ public $fk_user; + /** + * @var int ID + */ public $user_approve_id; /** @@ -103,12 +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; @@ -116,6 +146,9 @@ class ExpenseReport extends CommonObject // ACTIONS // Create + /** + * @var int|string + */ public $date_create; /** @@ -129,16 +162,41 @@ class ExpenseReport extends CommonObject public $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for. // Update + /** + * @var int|string + */ public $date_modif; + + /** + * @var int ID + */ public $fk_user_modif; // Refus + /** + * @var int|string + */ public $date_refuse; + + /** + * @var string + */ public $detail_refuse; + + /** + * @var int ID + */ public $fk_user_refuse; // Annulation + /** + * @var int|string + */ public $date_cancel; + + /** + * @var string + */ public $detail_cancel; /** @@ -169,37 +227,36 @@ class ExpenseReport extends CommonObject * @var int ID of User making validation */ public $fk_user_valid; + + /** + * @var string Firstname Lastname + */ public $user_valid_infos; // Approve + /** + * @var int|string + */ public $date_approve; - public $fk_user_approve; // User that has approved - // Paiement - public $user_paid_infos; + /** + * @var int ID User that has approved + */ + public $fk_user_approve; public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject) public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) + /** + * @var array + */ public $labelStatus = array(); + + /** + * @var array + */ public $labelStatusShort = array(); - // Multicurrency - /** - * @var int Currency ID - */ - public $fk_multicurrency; - - /** - * @var string multicurrency code - */ - public $multicurrency_code; - public $multicurrency_tx; - public $multicurrency_total_ht; - public $multicurrency_total_tva; - public $multicurrency_total_ttc; - - /** * Draft status */ @@ -617,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 @@ -846,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)) { @@ -881,7 +938,7 @@ class ExpenseReport extends CommonObject */ public function initAsSpecimen() { - global $user, $langs, $conf; + global $user, $langs; $now = dol_now(); @@ -944,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'); @@ -1047,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,'; @@ -1753,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 = ''; @@ -1867,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 @@ -1878,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); @@ -1990,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'); @@ -2066,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; @@ -2288,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<0,1> Return integer <0 if KO, >0 if OK */ public function deleteLine($rowid, $fuser = '', $notrigger = 0) { @@ -2434,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)) { @@ -2491,7 +2544,7 @@ class ExpenseReport extends CommonObject */ public function loadStateBoard() { - global $conf, $user; + global $user; $this->nb = array(); @@ -3001,7 +3054,7 @@ class ExpenseReportLine extends CommonObjectLine */ public function insert($notrigger = 0, $fromaddline = false) { - global $user, $conf; + global $user; $error = 0; @@ -3143,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 438bf4af1c2..14727b498e7 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -72,12 +72,12 @@ 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,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' => true) - ,'fk_c_exp_tax_cat' => array('type' => 'integer', 'index' => true) - ,'fk_range' => array('type' => 'integer', 'index' => true) + 'rowid' => array('type' => 'integer', 'index' => 1) + ,'fk_c_exp_tax_cat' => array('type' => 'integer', 'index' => 1) + ,'fk_range' => array('type' => 'integer', 'index' => 1) ,'coef' => array('type' => 'double') ,'ikoffset' => array('type' => 'double') ); diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index a2fdaa4d3d8..7c640527055 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -110,10 +110,10 @@ 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,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' => true) + 'rowid' => array('type' => 'integer', 'index' => 1) ,'dates' => array('type' => 'date') ,'datee' => array('type' => 'date') ,'amount' => array('type' => 'double') diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index ddec220d12f..5f1c0858959 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (c) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * 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 @@ -35,13 +36,34 @@ class ExpenseReportStats extends Stats */ public $table_element; + /** + * @var int ID + */ public $socid; + + /** + * @var int ID + */ public $userid; + /** + * @var string + */ public $from; + + /** + * @var string + */ public $field; + + /** + * @var string + */ public $where; + /** + * @var string + */ private $datetouse = 'date_valid'; @@ -120,7 +142,7 @@ class ExpenseReportStats extends Stats $sql .= $this->db->order('dm', 'DESC'); $res = $this->_getNbByMonth($year, $sql, $format); - //var_dump($res);print '
'; + return $res; } @@ -142,7 +164,7 @@ class ExpenseReportStats extends Stats $sql .= $this->db->order('dm', 'DESC'); $res = $this->_getAmountByMonth($year, $sql, $format); - //var_dump($res);print '
'; + return $res; } diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 09ea23d79c1..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 @@ -56,9 +57,22 @@ class PaymentExpenseReport extends CommonObject */ public $fk_expensereport; + /** + * @var int|string + */ public $datec = ''; + + /** + * @var int|string + */ public $datep = ''; + /** + * @var float|int + */ public $amount; // Total amount of payment + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -87,7 +101,14 @@ class PaymentExpenseReport extends CommonObject */ public $fk_user_modif; + /** + * @var string + */ public $type_code; + + /** + * @var string + */ public $type_label; /** @@ -139,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; @@ -168,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) { @@ -286,7 +307,6 @@ class PaymentExpenseReport extends CommonObject public function update($user = null, $notrigger = 0) { // phpcs:enable - global $conf, $langs; $error = 0; // Clean parameters @@ -295,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; @@ -316,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').","; @@ -334,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(); @@ -372,7 +385,6 @@ class PaymentExpenseReport extends CommonObject public function delete($user, $notrigger = 0) { // phpcs:enable - global $conf, $langs; $error = 0; $this->db->begin(); @@ -503,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; @@ -532,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; @@ -686,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 88cd5ecb2d0..c1f474af0db 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 @@ -517,9 +518,9 @@ while ($i < $imaxinloop) { if ($objp->bid) { $accountstatic->fetch($objp->bid); - $paymentexpensereportstatic->fk_bank = $accountstatic->getNomUrl(1); + $paymentexpensereportstatic->fk_bank = $accountstatic->id; } else { - $paymentexpensereportstatic->fk_bank = null; + $paymentexpensereportstatic->fk_bank = 0; } $userstatic->id = $objp->userid; 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/card-rec.php b/htdocs/fichinter/card-rec.php index 8e7aad352be..4c71562da9b 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -10,6 +10,7 @@ * Copyright (C) 2016-2018 Charlie Benke * Copyright (C) 2018-2021 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 @@ -730,9 +731,7 @@ if ($action == 'create') { // Show product and description if (isset($object->lines[$i]->product_type)) { $type = $object->lines[$i]->product_type; - } else { - $object->lines[$i]->fk_product_type; - } + } // else { $object->lines[$i]->fk_product_type; } // Try to enhance type detection using date_start and date_end for free lines when type // was not saved. if (!empty($objp->date_start)) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 010427ab2a4..f5b57037c0d 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 @@ -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/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 ff496ac9673..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 @@ -61,6 +62,66 @@ if (defined('DOL_INC_FOR_VERSION_ERROR')) { return; } + +/** + * Replace session_start() + * + * @return void + */ +function dol_session_start() +{ + session_start(); +} + +/** + * Replace session_regenerate_id() + * + * @return bool True if success, false if failed + */ +function dol_session_regenerate_id() +{ + return session_regenerate_id(); +} + +/** + * Destroy and recreate a new session without losing content. + * Not used yet. + * + * @param $sessionname string Session name + * @return void + */ +function dol_session_rotate($sessionname = '') +{ + $oldsessionid = session_id(); + + // Backup the current session + $session_backup = $_SESSION; + + // Set current session to expire in 1 minute + $_SESSION['OBSOLETE'] = true; + $_SESSION['EXPIRES'] = time() + 60; + + // Close the current session + session_write_close(); + + // Set a new session id and start the session + session_name($sessionname); + dol_session_start(); + + // Restore the previous session backup + $_SESSION = $session_backup; + + // Clean up + unset($session_backup); + unset($_SESSION['OBSOLETE']); + unset($_SESSION['EXPIRES']); + + $newsessionid = session_id(); + //var_dump("oldsessionid=".$oldsessionid." - newsessionid=".$newsessionid); +} + + + // Define vars $conffiletoshowshort = "conf.php"; // Define localization of conf file @@ -76,7 +137,7 @@ $conffiletoshow = "htdocs/conf/conf.php"; // --- End of part replaced by Dolibarr packager makepack-dolibarr // Include configuration -$result = @include_once $conffile; // Keep @ because with some error reporting this break the redirect done when file not found +$result = @include_once $conffile; // Keep @ because with some error reporting mode, this breaks the redirect done when file is not found // Disable some not used PHP stream $listofwrappers = stream_get_wrappers(); @@ -236,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; @@ -329,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.'/')); @@ -357,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 a1be6fa35f8..add091dd124 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1361,7 +1361,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " WHERE rowid = ".((int) $this->id); if ($this->db->query($sql)) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment if ($error == 0) { // Call trigger @@ -1413,7 +1413,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::cancel", LOG_DEBUG); if ($this->db->query($sql)) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Call trigger $result = $this->call_trigger('ORDER_SUPPLIER_CANCEL', $user); @@ -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 @@ -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,7 +2251,7 @@ 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 = "INSERT INTO ".$this->db->prefix()."receptiondet_batch"; $sql .= " (fk_commande, fk_product, qty, fk_entrepot, fk_user, datec, fk_commandefourndet, 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"); @@ -2499,7 +2499,7 @@ class CommandeFournisseur extends CommonOrder $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 .= " 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 .= " AND cfd.fk_product = p.rowid"; @@ -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"); @@ -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') @@ -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,'; } diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index ce869f06617..911ddd01eef 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -57,7 +57,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine /** * @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 $table_element = 'receptiondet_batch'; //!< Name of table without prefix where object is stored public $lines = array(); /** diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 39fcd70e101..900ee4d014a 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -190,13 +190,13 @@ 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,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), 'titre' => array('type' => 'varchar(100)', 'label' => 'Titre', 'enabled' => 1, 'showoncombobox' => 1, 'visible' => -1, 'position' => 15), 'ref_supplier' => array('type' => 'varchar(180)', 'label' => 'RefSupplier', 'enabled' => 1, 'showoncombobox' => 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), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 30), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 35), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 40), @@ -1575,7 +1575,7 @@ class FactureFournisseurRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1594,7 +1594,7 @@ class FactureFournisseurRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1613,7 +1613,7 @@ class FactureFournisseurRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1635,7 +1635,7 @@ class FactureFournisseurRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 5130c4ad2bd..beb2a0d3564 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 @@ -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; @@ -2313,13 +2314,13 @@ class FactureFournisseur extends CommonInvoice * @param double $txlocaltax2 LocalTax2 Rate * @param double $qty Quantity * @param int $idproduct Id produit - * @param double $price_base_type HT or TTC + * @param string $price_base_type HT or TTC * @param int $info_bits Miscellaneous information of line * @param int $type Type of line (0=product, 1=service) * @param double $remise_percent Percentage discount of the line * @param int $notrigger Disable triggers - * @param integer $date_start Date start of service - * @param integer $date_end Date end of service + * @param int|string $date_start Date start of service + * @param int|string $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 double $pu_devise Amount in currency @@ -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/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 6b4574ed2a9..90da456e660 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -668,7 +668,7 @@ 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 .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch 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 .= " GROUP BY l.rowid, cfd.fk_product"; @@ -1171,7 +1171,7 @@ 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 .= " ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cd ON cd.rowid = cfd.fk_commandefourndet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; if ($conf->reception->enabled) { 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 d8f899d7bb1..a5dc3d0eba1 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1184,9 +1184,9 @@ if ($action == 'create') { } $morehtmlref .= ''; - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 97f21ccb533..db8b2f6c8e6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -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.php b/htdocs/fourn/facture/list.php index 642b4612358..4772ddea4e8 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'); @@ -932,10 +933,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 +1596,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/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/holiday/card.php b/htdocs/holiday/card.php index 895d96d6966..bf2ff8f4fe4 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -524,8 +524,11 @@ if (empty($reshook)) { } $typeleaves = $object->getTypes(1, -1); - $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code']) != $typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); - + if (empty($typeleaves[$object->fk_type])) { + $labeltoshow = $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type); + } else { + $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code']) != $typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); + } if ($object->halfday == 2) { $starthalfdaykey = "Afternoon"; $endhalfdaykey = "Morning"; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c12032028e6..e5afa1e524a 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Juanjo Menent * 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 @@ -1306,7 +1307,7 @@ class Holiday extends CommonObject } // We found a record, user is on holiday by default, so is not available is true. - $isavailablemorning = true; + $isavailablemorning = true; // @phan-suppress-current-line PhanPluginRedundantAssignment foreach ($arrayofrecord as $record) { if ($timestamp == $record['date_start'] && $record['halfday'] == 2) { continue; @@ -1317,7 +1318,7 @@ class Holiday extends CommonObject $isavailablemorning = false; break; } - $isavailableafternoon = true; + $isavailableafternoon = true; // @phan-suppress-current-line PhanPluginRedundantAssignment foreach ($arrayofrecord as $record) { if ($timestamp == $record['date_end'] && $record['halfday'] == 2) { continue; @@ -1366,8 +1367,12 @@ class Holiday extends CommonObject // show type for this record only in ajax to not overload lists if (!$nofetch && !empty($this->fk_type)) { $typeleaves = $this->getTypes(1, -1); - $labeltoshow = (($typeleaves[$this->fk_type]['code'] && $langs->trans($typeleaves[$this->fk_type]['code']) != $typeleaves[$this->fk_type]['code']) ? $langs->trans($typeleaves[$this->fk_type]['code']) : $typeleaves[$this->fk_type]['label']); - $datas['type'] = '
'.$langs->trans("Type") . ': ' . (empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved", $this->fk_type) : $labeltoshow); + if (empty($typeleaves[$this->fk_type])) { + $labeltoshow = $langs->trans("TypeWasDisabledOrRemoved", $this->fk_type); + } else { + $labeltoshow = (($typeleaves[$this->fk_type]['code'] && $langs->trans($typeleaves[$this->fk_type]['code']) != $typeleaves[$this->fk_type]['code']) ? $langs->trans($typeleaves[$this->fk_type]['code']) : $typeleaves[$this->fk_type]['label']); + } + $datas['type'] = '
'.$langs->trans("Type") . ': ' . $labeltoshow; } if (isset($this->halfday) && !empty($this->date_debut) && !empty($this->date_fin)) { $listhalfday = array( diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 06eb51043b1..7bf46c30b86 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -30,8 +30,7 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluationdet.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + /** * Class for Evaluation @@ -104,24 +103,24 @@ 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,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"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 4, 'noteditable' => '1', 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2',), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3,), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 0,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'default' => 0, 'visible' => 5, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '6' => 'Closed'),), - 'date_eval' => array('type' => 'date', 'label' => 'DateEval', 'enabled' => '1', 'position' => 502, 'notnull' => 1, 'visible' => 1,), - 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'Employee', 'enabled' => '1', 'position' => 504, 'notnull' => 1, 'visible' => 1, 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'fk_job' => array('type' => 'integer:Job:/hrm/class/job.class.php', 'label' => 'JobProfile', 'enabled' => '1', 'position' => 505, 'notnull' => 1, 'visible' => 1, 'picto' => 'jobprofile', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 4, 'noteditable' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Reference of object"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2',), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '0', 'visible' => 5, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '6' => 'Closed'),), + 'date_eval' => array('type' => 'date', 'label' => 'DateEval', 'enabled' => 1, 'position' => 502, 'notnull' => 1, 'visible' => 1,), + 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'Employee', 'enabled' => 1, 'position' => 504, 'notnull' => 1, 'visible' => 1, 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'fk_job' => array('type' => 'integer:Job:/hrm/class/job.class.php', 'label' => 'JobProfile', 'enabled' => 1, 'position' => 505, 'notnull' => 1, 'visible' => 1, 'picto' => 'jobprofile', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), ); public $rowid; public $ref; @@ -322,8 +321,7 @@ class Evaluation extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -920,8 +918,7 @@ class Evaluation extends CommonObject $result = $objectline->fetchAll('ASC', '', 0, 0, '(fk_evaluation:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -1022,36 +1019,6 @@ class Evaluation extends CommonObject return $result; } - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - /** * Return clicable link of object (with eventually picto) * diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index f0f2612d0c1..ad7c91c86d9 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -28,10 +28,9 @@ */ // Put here all includes required by your class file -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + /** * Class for EvaluationLine @@ -103,19 +102,19 @@ 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,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"), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'fk_skill' => array('type' => 'integer:Skill:hrm/class/skill.class.php:1', 'label' => 'Skill', 'enabled' => '1', 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), - 'fk_evaluation' => array('type' => 'integer:Evaluation:hrm/class/evaluation.class.php:1', 'label' => 'Evaluation', 'enabled' => '1', 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), - 'rankorder' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => '1', 'position' => 4, 'notnull' => 1, 'visible' => 1,), - 'required_rank' => array('type' => 'integer', 'label' => 'requiredRank', 'enabled' => '1', 'position' => 5, 'notnull' => 1, 'visible' => 1,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'fk_skill' => array('type' => 'integer:Skill:hrm/class/skill.class.php:1', 'label' => 'Skill', 'enabled' => 1, 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), + 'fk_evaluation' => array('type' => 'integer:Evaluation:hrm/class/evaluation.class.php:1', 'label' => 'Evaluation', 'enabled' => 1, 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), + 'rankorder' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'position' => 4, 'notnull' => 1, 'visible' => 1,), + 'required_rank' => array('type' => 'integer', 'label' => 'requiredRank', 'enabled' => 1, 'position' => 5, 'notnull' => 1, 'visible' => 1,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), ); public $rowid; public $date_creation; @@ -288,8 +287,7 @@ class EvaluationLine extends CommonObjectLine $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -890,8 +888,7 @@ class EvaluationLine extends CommonObjectLine $result = $objectline->fetchAll('ASC', 'position', 0, 0, '(fk_evaluationdet:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -992,37 +989,4 @@ class EvaluationLine extends CommonObjectLine return $result; } - - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } } - - -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index c0ec08939d4..e1a355b54cd 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -29,8 +29,7 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + /** * Class for Job @@ -102,19 +101,19 @@ 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,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"), - 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Label of object"), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 21, 'notnull' => 0, 'visible' => 1,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => 2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => 2,), - 'deplacement' => array('type' => 'select', 'required' => 1,'label' => 'NeedBusinessTravels', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array(0 => "No", 1 => "Yes"), 'default' => 0), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 71, 'notnull' => 0, 'visible' => 0,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Label of object"), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 21, 'notnull' => 0, 'visible' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => 2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => 2,), + 'deplacement' => array('type' => 'select', 'required' => 1,'label' => 'NeedBusinessTravels', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array(0 => "No", 1 => "Yes"), 'default' => '0'), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 71, 'notnull' => 0, 'visible' => 0,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), ); public $rowid; public $ref; @@ -148,7 +147,7 @@ class Job extends CommonObject // public $class_element_line = 'Jobline'; // /** - // * @var array List of child tables. To test if we can delete object. + // * @var string[] List of child tables. To test if we can delete object. // */ protected $childtables = array('hrm_evaluation', 'hrm_job_user'); @@ -292,8 +291,7 @@ class Job extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -928,8 +926,7 @@ class Job extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, '(fk_job:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -1031,36 +1028,6 @@ class Job extends CommonObject return $result; } - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - /** * Return clicable link of object (with eventually picto) * @@ -1097,6 +1064,7 @@ class Job extends CommonObject $return .= '
'; return $return; } + /** * function for get required skills associate to job object * @param int $id Id of object diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index f15e98131ca..f96cb1539a2 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -29,8 +29,6 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for Position @@ -102,24 +100,24 @@ 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,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"), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'css' => 'left', 'comment' => "Id"), //'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), 'fk_contrat' => array('type' => 'integer:Contrat:contrat/class/contrat.class.php', 'label' => 'fk_contrat', 'enabled' => 'isModEnabled("contract")', 'position' => 50, 'notnull' => 0, 'visible' => 0,), - 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0:(t.statut:=:1)', 'label' => 'Employee', 'enabled' => '1', 'position' => 55, 'notnull' => 1, 'visible' => 1, 'default' => 0, 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'fk_job' => array('type' => 'integer:Job:/hrm/class/job.class.php', 'label' => 'JobProfile', 'enabled' => '1', 'position' => 56, 'notnull' => 1, 'visible' => 1, 'picto' => 'jobprofile', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'date_start' => array('type' => 'date', 'label' => 'DateStart', 'enabled' => '1', 'position' => 101, 'notnull' => 1, 'visible' => 1,), - 'date_end' => array('type' => 'date', 'label' => 'DateEnd', 'enabled' => '1', 'position' => 102, 'notnull' => 0, 'visible' => 1,), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 120, 'notnull' => 0, 'visible' => 3,), + 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0:(t.statut:=:1)', 'label' => 'Employee', 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'fk_job' => array('type' => 'integer:Job:/hrm/class/job.class.php', 'label' => 'JobProfile', 'enabled' => 1, 'position' => 56, 'notnull' => 1, 'visible' => 1, 'picto' => 'jobprofile', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'date_start' => array('type' => 'date', 'label' => 'DateStart', 'enabled' => 1, 'position' => 101, 'notnull' => 1, 'visible' => 1,), + 'date_end' => array('type' => 'date', 'label' => 'DateEnd', 'enabled' => 1, 'position' => 102, 'notnull' => 0, 'visible' => 1,), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 3,), 'abort_comment' => array('type' => 'varchar(255)', 'label' => 'AbandonmentComment', 'enabled' => 'getDolGlobalInt("HRM_JOB_POSITON_ENDING_COMMENT")', 'position' => 502, 'notnull' => 0, 'visible' => 1,), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 151, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 152, 'notnull' => 0, 'visible' => 0,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 151, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 152, 'notnull' => 0, 'visible' => 0,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), ); public $rowid; public $ref; @@ -301,8 +299,7 @@ class Position extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -970,8 +967,7 @@ class Position extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, '(fk_position:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -1088,36 +1084,6 @@ class Position extends CommonObject return $result; } - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - /** * Return clicable link of object (with eventually picto) * diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index aefd68a0bea..256956d55de 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -29,8 +29,6 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for Skill @@ -108,22 +106,22 @@ 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,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"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2',), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'required_level' => array('type' => 'integer', 'label' => 'requiredLevel', 'enabled' => '1', 'position' => 50, 'notnull' => 1, 'visible' => 0,), - 'date_validite' => array('type' => 'integer', 'label' => 'date_validite', 'enabled' => '1', 'position' => 52, 'notnull' => 1, 'visible' => 0,), - 'temps_theorique' => array('type' => 'double(24,8)', 'label' => 'temps_theorique', 'enabled' => '1', 'position' => 54, 'notnull' => 1, 'visible' => 0,), - 'skill_type' => array('type' => 'integer', 'label' => 'SkillType', 'enabled' => '1', 'position' => 55, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'css' => 'minwidth200', 'arrayofkeyval' => array('0' => 'TypeKnowHow', '1' => 'TypeHowToBe', '9' => 'TypeKnowledge'), 'default' => 0), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 71, 'notnull' => 0, 'visible' => 0,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2,), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'required_level' => array('type' => 'integer', 'label' => 'requiredLevel', 'enabled' => 1, 'position' => 50, 'notnull' => 1, 'visible' => 0,), + 'date_validite' => array('type' => 'integer', 'label' => 'date_validite', 'enabled' => 1, 'position' => 52, 'notnull' => 1, 'visible' => 0,), + 'temps_theorique' => array('type' => 'double(24,8)', 'label' => 'temps_theorique', 'enabled' => 1, 'position' => 54, 'notnull' => 1, 'visible' => 0,), + 'skill_type' => array('type' => 'integer', 'label' => 'SkillType', 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'css' => 'minwidth200', 'arrayofkeyval' => array('0' => 'TypeKnowHow', '1' => 'TypeHowToBe', '9' => 'TypeKnowledge'), 'default' => '0'), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 71, 'notnull' => 0, 'visible' => 0,), ); public $rowid; public $label; @@ -261,7 +259,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; @@ -271,9 +269,10 @@ class Skill extends CommonObject if ($result <= 0) { $error++; } + $i++; } - if (! $error) { + if (!$error) { $this->db->commit(); setEventMessage($langs->trans('SkillCreated'), $i); @@ -351,8 +350,7 @@ class Skill extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -414,8 +412,7 @@ class Skill extends CommonObject if (is_array($this->lines)) { return (count($this->lines) > 0) ? $this->lines : array(); } elseif ($this->lines < 0) { - $this->errors = array_merge($this->errors, $skilldet->errors); - $this->error = $skilldet->error; + $this->setErrorsFromObject($skilldet); return $this->lines; } return []; @@ -969,8 +966,7 @@ class Skill extends CommonObject $result = $objectline->fetchAll('ASC', 'rankorder', 0, 0, '(fk_skill:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -1072,36 +1068,6 @@ class Skill extends CommonObject return $result; } - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - /** * @param int $code number of code label * @return int|string diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 83ccae8c5ab..12258e08025 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -29,8 +29,6 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for Skilldet @@ -102,15 +100,15 @@ 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,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"), - 'fk_skill' => array('type' => 'integer:Skill:/hrm/class/skill.class.php', 'label' => 'fk_skill', 'enabled' => '1', 'position' => 5, 'notnull' => 1, 'visible' => 0,), - 'rankorder' => array('type' => 'integer', 'label' => 'rank', 'enabled' => '1', 'position' => 10, 'notnull' => 0, 'visible' => 2,), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 1,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => 0,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'fk_skill' => array('type' => 'integer:Skill:/hrm/class/skill.class.php', 'label' => 'fk_skill', 'enabled' => 1, 'position' => 5, 'notnull' => 1, 'visible' => 0,), + 'rankorder' => array('type' => 'integer', 'label' => 'rank', 'enabled' => 1, 'position' => 10, 'notnull' => 0, 'visible' => 2,), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 1,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => 0,), ); public $rowid; public $fk_skill; @@ -283,8 +281,7 @@ class Skilldet extends CommonObjectLine $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -959,34 +956,4 @@ class Skilldet extends CommonObjectLine return $result; } - - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } } diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 245a6d8ba6c..4c599235f72 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -104,18 +104,18 @@ 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,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"), - 'fk_skill' => array('type' => 'integer:Skill:hrm/class/skill.class.php:1', 'label' => 'Skill', 'enabled' => '1', 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), - 'rankorder' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => '1', 'position' => 4, 'notnull' => 1, 'visible' => 1, 'default' => 0), - 'fk_object' => array('type' => 'integer', 'label' => 'object', 'enabled' => '1', 'position' => 5, 'notnull' => 1, 'visible' => 0,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'objecttype' => array('type' => 'varchar(128)', 'label' => 'objecttype', 'enabled' => '1', 'position' => 6, 'notnull' => 1, 'visible' => 0,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'fk_skill' => array('type' => 'integer:Skill:hrm/class/skill.class.php:1', 'label' => 'Skill', 'enabled' => 1, 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), + 'rankorder' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'position' => 4, 'notnull' => 1, 'visible' => 1, 'default' => '0'), + 'fk_object' => array('type' => 'integer', 'label' => 'object', 'enabled' => 1, 'position' => 5, 'notnull' => 1, 'visible' => 0,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'objecttype' => array('type' => 'varchar(128)', 'label' => 'objecttype', 'enabled' => 1, 'position' => 6, 'notnull' => 1, 'visible' => 0,), ); public $rowid; public $fk_skill; @@ -309,8 +309,7 @@ class SkillRank extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -1033,51 +1032,4 @@ class SkillRank extends CommonObject return $result; } - - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - - /** - * @param array $val - * @param string $key - * @param string $value - * @param string $moreparam - * @param string $keysuffix - * @param string $keyprefix - * @param string $morecss - * @return string - */ - // public function showOutputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '') - // { - // if ($key == "rank") { - // return displayRankInfos($this); - // } else return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); - // } } diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index a75965f797e..8286c7f0cf4 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -4,6 +4,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * 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 @@ -278,6 +279,7 @@ $fk_usergroup1 = GETPOST('fk_usergroup1'); print dol_get_fiche_end(); llxFooter(); +$db->close(); @@ -357,10 +359,10 @@ function rate(&$TMergedSkills, $field) } /** - * return a html ul list of skills + * return a html ul list of skills * - * @param array $TMergedSkills skill list for display - * @return string (ul list in html ) + * @param array $TMergedSkills skill list for display + * @return string (ul list in html ) */ function skillList(&$TMergedSkills) { 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/hrm/lib/hrm_evaluation.lib.php b/htdocs/hrm/lib/hrm_evaluation.lib.php index d4b99471087..a84aa3b0a3b 100644 --- a/htdocs/hrm/lib/hrm_evaluation.lib.php +++ b/htdocs/hrm/lib/hrm_evaluation.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * 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 @@ -28,7 +29,7 @@ * Prepare array of tabs for Evaluation * * @param Evaluation $object Evaluation - * @return array Array of tabs + * @return array> Array of tabs */ function evaluationPrepareHead($object) { @@ -129,7 +130,7 @@ function GetLegendSkills() } /** - * @param $obj object object need to handle + * @param object $obj Object needed to be represented * @return string */ function getRankOrderResults($obj) @@ -163,8 +164,9 @@ function getRankOrderResults($obj) /** * Grouped rows with same ref in array - * @param array $objects all rows getted by sql - * @return array |int + * + * @param object[] $objects all rows retrieve from sql query + * @return array|int Object by groiup, -1 if error (empty or bad argument) */ function getGroupedEval($objects) { diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index c7a0e1bd988..a1e71528361 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -4,6 +4,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * 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 @@ -481,6 +482,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $rslt = $db->query($sqlEval); $numEval = $db->num_rows($sqlEval); + $page = 0; print_barre_liste($langs->trans("Evaluations"), $page, $_SERVER["PHP_SELF"], '', '', '', '', $numEval, $numEval, $evaltmp->picto, 0); print '
'; @@ -547,6 +549,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print dol_get_fiche_end(); - - llxFooter(); } + +llxFooter(); +$db->close(); diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 8abfb691119..871030cb774 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -7,6 +7,7 @@ * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2021 Charlene Benke * 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 @@ -140,24 +141,39 @@ if (php_sapi_name() === "cli" && (float) PHP_VERSION > 7.0) { case 'config': $conffile = $arg; $conffiletoshow = $arg; - break; + break; case 'h': case 'help': usage($argv[0], "Usage:"); - exit(0); + exit(0); } } // Parse the arguments to find the options. - $args_options = array_filter(array_slice($argv, 0, $rest_index), function ($arg) { - return strlen($arg) >= 2 && $arg[0] == '-'; - }); - $parsed_options = array_map(function ($arg) { - if (strlen($arg) > 1) { - return "--" . $arg; + $args_options = array_filter( + array_slice($argv, 0, $rest_index), + /** + * @param string $arg + * @return bool + */ + static function ($arg) { + return strlen($arg) >= 2 && $arg[0] == '-'; } - return "-" . $arg; - }, array_keys($opts)); + ); + $parsed_options = array_map( + /** + * Previx option with '-' for single characters and -- for more than single characters + * @param string $arg + * @return string + */ + static function ($arg) { + if (strlen($arg) > 1) { + return "--" . $arg; + } + return "-" . $arg; + }, + array_keys($opts) + ); // Find options (dash-prefixed) that were not parsed. $unknown_options = array_diff($args_options, $parsed_options); @@ -301,7 +317,7 @@ if (constant('DOL_DATA_ROOT') === null) { $lockfile = '../../documents/install.lock'; $upgradeunlockfile = '../../documents/upgrade.unlock'; } -$islocked=false; +$islocked = false; if (@file_exists($lockfile) || @file_exists($lockfile2)) { if (!defined('ALLOWED_IF_UPGRADE_UNLOCK_FOUND') || (! @file_exists($upgradeunlockfile) && ! @file_exists($upgradeunlockfile2))) { // If this is a dangerous install page (ALLOWED_IF_UPGRADE_UNLOCK_FOUND not defined) or 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 4f50ee95936..acd230f65cb 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; @@ -268,3 +269,13 @@ ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_tms (tms); ALTER TABLE llx_element_element MODIFY COLUMN sourcetype VARCHAR(64) NOT NULL; 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; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 54eac887362..eccb6f49fe8 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -17,7 +17,7 @@ -- along with this program. If not, see . -- -- --- Table of events and actions (past and to do). +-- Table of events and actions (past and to do). -- This is also the table to track events on other Dolibarr objects. -- ======================================================================== @@ -31,7 +31,7 @@ create table llx_actioncomm datep2 datetime, -- date end fk_action integer, -- type of action (optional link with id in llx_c_actioncomm or null) - code varchar(50) NULL, -- code of action for automatic action ('AC_OTH_AUTO' for automatic actions, 'AC_EMAILIN_AUTO' for email input, 'AC_xxx' for manual action...) + code varchar(50) NULL, -- code of action for automatic action ('AC_OTH_AUTO' for automatic actions, 'AC_EMAILIN_AUTO' for email input, 'AC_xxx' for manual action...) datec datetime, -- date creation tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date @@ -43,7 +43,6 @@ create table llx_actioncomm fk_contact integer, fk_parent integer NOT NULL default 0, fk_user_action integer, -- user id of owner of action (note that users assigned to event are stored into table 'actioncomm_resources') - fk_user_done integer, -- user id of user that has made action (deprecated) transparency integer, -- transparency (ical standard). used to say if user assigned to event are busy or not by event. This field may be deprecated if we want to store transparency for each assigned user, moved into table llx_actioncomm_resources. @@ -56,9 +55,9 @@ create table llx_actioncomm label varchar(255) NOT NULL, -- label/title of event or topic of email note mediumtext, -- private note of event or content of email - + calling_duration integer, -- when event is a phone call, duration of phone call - + email_subject varchar(255), -- when event was an email, we store here the subject. content is stored into note. email_msgid varchar(255), -- when event was an email, we store here the msgid email_from varchar(255), -- when event was an email, we store here the from @@ -68,7 +67,7 @@ create table llx_actioncomm email_tobcc varchar(255), -- when event was an email, we store here the email_tobcc errors_to varchar(255), -- when event was an email, we store here the erros_to reply_to varchar(255), -- when event was an email, we store here the reply_to - + recurid varchar(128), -- used to store event id to link each other all the repeating event record. It can be the 'iCalUID' as in RFC5545 (an id similar for all the same serie) recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO' recurdateend datetime, -- no more recurring event after this date 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_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_product_association.key.sql b/htdocs/install/mysql/tables/llx_product_association.key.sql index 9eb9fdd457b..c9dca6e611e 100644 --- a/htdocs/install/mysql/tables/llx_product_association.key.sql +++ b/htdocs/install/mysql/tables/llx_product_association.key.sql @@ -20,3 +20,4 @@ ALTER TABLE llx_product_association ADD UNIQUE INDEX uk_product_association (fk_product_pere, fk_product_fils); ALTER TABLE llx_product_association ADD INDEX idx_product_association_fils (fk_product_fils); + diff --git a/htdocs/install/mysql/tables/llx_product_association.sql b/htdocs/install/mysql/tables/llx_product_association.sql index f97e2aa6a0b..55ce8cc9d78 100644 --- a/htdocs/install/mysql/tables/llx_product_association.sql +++ b/htdocs/install/mysql/tables/llx_product_association.sql @@ -24,6 +24,7 @@ create table llx_product_association fk_product_fils integer NOT NULL DEFAULT 0, -- id du sous-produit qty double NULL, incdec integer DEFAULT 1, -- when set to 1 changing stock of product will change stock of linked product too - rang integer DEFAULT 0 + rang integer DEFAULT 0, + import_key varchar(14) DEFAULT NULL )ENGINE=innodb; 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..0c92a0d8302 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_commandefourndet (fk_commandefourndet); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_receptiondet_batch.sql similarity index 96% rename from htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql rename to htdocs/install/mysql/tables/llx_receptiondet_batch.sql index 6bbaea61c45..3f3db04b8cb 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_receptiondet_batch.sql @@ -14,17 +14,17 @@ -- 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_product integer, 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..cda890c6f69 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.sql @@ -49,5 +49,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..553796f7c6f 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1484,10 +1484,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_commandefourndet, 0) = 0'; $db->begin(); $resql_dispatch = $db->query($sql_dispatch); $n_processed_rows = 0; @@ -1527,7 +1527,7 @@ 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 = 'UPDATE '.MAIN_DB_PREFIX.'receptiondet_batch'; $sql_attach .= ' SET fk_commandefourndet = '.((int) $obj_line->rowid).', qty = '.((float) $qty_for_line); $sql_attach .= ' WHERE rowid = '.((int) $obj_dispatch->rowid); $first_iteration = false; @@ -1549,7 +1549,7 @@ 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 = 'INSERT INTO '.MAIN_DB_PREFIX.'receptiondet_batch'; $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.")"; } diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index ffd1ff7b54e..85e77bbbd79 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2005-2011 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 @@ -951,67 +952,67 @@ function write_conf_file($conffile) fwrite($fp, "\n"); if (empty($force_dolibarr_lib_FPDF_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_FPDF_PATH = ''; + $force_dolibarr_lib_FPDF_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_FPDF_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_FPDF_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_TCPDF_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_TCPDF_PATH = ''; + $force_dolibarr_lib_TCPDF_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_TCPDF_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_TCPDF_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_FPDI_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_FPDI_PATH = ''; + $force_dolibarr_lib_FPDI_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_FPDI_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_FPDI_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_TCPDI_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_TCPDI_PATH = ''; + $force_dolibarr_lib_TCPDI_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_TCPDI_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_TCPDI_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_GEOIP_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_GEOIP_PATH = ''; + $force_dolibarr_lib_GEOIP_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_GEOIP_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_GEOIP_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_NUSOAP_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_NUSOAP_PATH = ''; + $force_dolibarr_lib_NUSOAP_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_NUSOAP_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_NUSOAP_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_ODTPHP_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_ODTPHP_PATH = ''; + $force_dolibarr_lib_ODTPHP_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_ODTPHP_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_ODTPHP_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) { fwrite($fp, '//'); - $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = ''; + $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_ODTPHP_PATHTOPCLZIP="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_js_CKEDITOR)) { fwrite($fp, '//'); - $force_dolibarr_js_CKEDITOR = ''; + $force_dolibarr_js_CKEDITOR = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_js_CKEDITOR=\''.dol_escape_php($force_dolibarr_js_CKEDITOR, 1).'\';'); fwrite($fp, "\n"); if (empty($force_dolibarr_js_JQUERY)) { fwrite($fp, '//'); - $force_dolibarr_js_JQUERY = ''; + $force_dolibarr_js_JQUERY = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_js_JQUERY=\''.dol_escape_php($force_dolibarr_js_JQUERY, 1).'\';'); fwrite($fp, "\n"); if (empty($force_dolibarr_js_JQUERY_UI)) { fwrite($fp, '//'); - $force_dolibarr_js_JQUERY_UI = ''; + $force_dolibarr_js_JQUERY_UI = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_js_JQUERY_UI=\''.dol_escape_php($force_dolibarr_js_JQUERY_UI, 1).'\';'); fwrite($fp, "\n"); @@ -1020,13 +1021,13 @@ function write_conf_file($conffile) fwrite($fp, "\n"); if (empty($force_dolibarr_font_DOL_DEFAULT_TTF)) { fwrite($fp, '//'); - $force_dolibarr_font_DOL_DEFAULT_TTF = ''; + $force_dolibarr_font_DOL_DEFAULT_TTF = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_font_DOL_DEFAULT_TTF=\''.dol_escape_php($force_dolibarr_font_DOL_DEFAULT_TTF, 1).'\';'); fwrite($fp, "\n"); if (empty($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD)) { fwrite($fp, '//'); - $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = ''; + $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.dol_escape_php($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD, 1).'\';'); fwrite($fp, "\n"); diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 7f2dfc0f0cd..60055abf65e 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -417,7 +417,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 ".(!$ok && empty($_GET["ignoreerrors"]))." dirmodule=".$dirmodule); + $nonext = (!$ok && empty($_GET["ignoreerrors"])) ? 2 : 0; if ($dirmodule) { $nonext = 1; diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index 3611ae2c51e..132163b1f89 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -113,20 +113,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"))), ); /* @@ -360,7 +360,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 +415,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 +473,7 @@ if (!empty($arrayfields['customerorsupplier']['checked'])) { if (!empty($arrayfields['i.fk_product_type']['checked'])) { print ''; } @@ -480,7 +483,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 +535,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 bd4aeec2174..21168aea09f 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -99,26 +99,26 @@ 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,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"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'visible' => 5, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", "csslist" => "nowraponall", "showoncombobox" => 1), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 20, 'index' => 1), - 'question' => array('type' => 'text', 'label' => 'Question', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax300', 'copytoclipboard' => 1, 'tdcss' => 'titlefieldcreate nowraponall'), - 'lang' => array('type' => 'varchar(6)', 'label' => 'Language', 'enabled' => '1', 'position' => 40, 'notnull' => 0, 'visible' => 1, 'tdcss' => 'titlefieldcreate nowraponall', "csslist" => "tdoverflowmax100"), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => 2,), - 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 0,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserCreation', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => '1', 'position' => 512, 'notnull' => 0, 'visible' => -2,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => '1', 'position' => 1010, 'notnull' => -1, 'visible' => 0,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'visible' => 5, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", "csslist" => "nowraponall", "showoncombobox" => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 20, 'index' => 1), + 'question' => array('type' => 'text', 'label' => 'Question', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax300', 'copytoclipboard' => 1, 'tdcss' => 'titlefieldcreate nowraponall'), + 'lang' => array('type' => 'varchar(6)', 'label' => 'Language', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => 1, 'tdcss' => 'titlefieldcreate nowraponall', "csslist" => "tdoverflowmax100"), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => 2,), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 0,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserCreation', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'position' => 512, 'notnull' => 0, 'visible' => -2,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), //'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'), 'fk_c_ticket_category' => array('type' => 'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label' => 'SuggestedForTicketsInGroup', 'enabled' => 'isModEnabled("ticket")', 'position' => 520, 'notnull' => 0, 'visible' => -1, 'help' => 'YouCanLinkArticleToATicketCategory', 'csslist' => 'minwidth200 tdoverflowmax250'), - 'answer' => array('type' => 'html', 'label' => 'Solution', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 3, 'searchall' => 1, 'csslist' => 'tdoverflowmax300', 'copytoclipboard' => 1, 'tdcss' => 'titlefieldcreate nowraponall'), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'visible' => 5, 'default' => 0, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Obsolete'),), + 'answer' => array('type' => 'html', 'label' => 'Solution', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 3, 'searchall' => 1, 'csslist' => 'tdoverflowmax300', 'copytoclipboard' => 1, 'tdcss' => 'titlefieldcreate nowraponall'), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 5, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Obsolete'),), ); public $rowid; public $ref; @@ -189,7 +189,7 @@ class KnowledgeRecord extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs; + global $langs; $this->db = $db; 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/admin.lang b/htdocs/langs/en_US/admin.lang index 576180c6371..ed6431ff1d6 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -88,6 +88,8 @@ SearchString=Search string NotAvailableWhenAjaxDisabled=Not available when Ajax disabled AllowToSelectProjectFromOtherCompany=On document of a third party, can choose a project linked to another third party TimesheetPreventAfterFollowingMonths=Prevent recording time spent after the following number of months +PROJECT_DISPLAY_LINKED_BY_CONTACT=Display project linked by a common contact +PROJECT_DISPLAY_LINKED_BY_CONTACT_help=That option add a new list on Project tab with all projects linked to that thirdparty via a contact relationship JavascriptDisabled=JavaScript disabled UsePreviewTabs=Use preview tabs ShowPreview=Show preview @@ -1664,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. @@ -2450,3 +2452,4 @@ VideoGeneration=Video generation AudioText=Audio - Text AIPromptForFeatures=AI custom prompts for features EnterAnIP=Enter an IP address +ConvertInto=Convert into 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/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 3290d9a2251..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. @@ -374,7 +376,7 @@ WarningModuleNeedRefresh = Module %s has been disabled. Don't forget to e WarningPermissionAlreadyExist=Existing permissions for this object WarningGoOnAccountancySetupToAddAccounts=If this list is empty, go into menu %s - %s - %s to load or create accounts for your chart of account. WarningCorrectedInvoiceNotFound=Corrected invoice not found -WarningCommentNotFound=Please check placement of start and end comments for %s section in file %s before submitting your action +WarningCommentNotFound=Warning: Can't find the start and/or end comments for the section %s into the file %s WarningAlreadyReverse=Stock movement already reversed SwissQrOnlyVIR = SwissQR invoice can only be added on invoices set to be paid with credit transfer payments. @@ -412,3 +414,4 @@ ThisIdNotDefined=Id not defined OperNotDefined=Payment method not defined ErrorThisContactXIsAlreadyDefinedAsThisType=%s is already defined as contact for this type. ErrorThisGroupIsAlreadyDefinedAsThisType=The contacts with this group are already defined as contact for this type. +EmptyMessageNotAllowedError=Empty Message Not Allowed Error 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/help.lang b/htdocs/langs/en_US/help.lang index 17a6104d59a..88a1b006591 100644 --- a/htdocs/langs/en_US/help.lang +++ b/htdocs/langs/en_US/help.lang @@ -21,3 +21,4 @@ LinkToGoldMember=You can call one of the trainers preselected by Dolibarr for yo PossibleLanguages=Supported languages SubscribeToFoundation=Help the Dolibarr project, subscribe to the foundation SeeOfficalSupport=For official Dolibarr support in your language:
%s +AIProcessingPleaseWait=AI interrogation in progress, please wait... \ No newline at end of file diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index d2e29b3941a..da25fc5a5f9 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -191,3 +191,5 @@ 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/main.lang b/htdocs/langs/en_US/main.lang index 95042a5cc24..f519e098d01 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -562,6 +562,7 @@ New=New Discount=Discount Unknown=Unknown General=General +Dimensions=Dimensions Size=Size OriginalSize=Original size RotateImage=Rotate 90° diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index c59c4271710..9ff542d9799 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -165,7 +165,7 @@ BadValueForType=Bad value for type %s DefinePropertiesFromExistingTable=Define the fields/properties from an existing table DefinePropertiesFromExistingTableDesc=If a table in the database (for the object to create) already exists, you can use it to define the properties of the object. DefinePropertiesFromExistingTableDesc2=Keep empty if the table does not exist yet. The code generator will use different kinds of fields to build an example of table that you can edit later. -GeneratePermissions=I want to manage permissions on this object +GeneratePermissions=I want to manage permissions on this object GeneratePermissionsHelp=If you check this, some code will be added to manage permissions to read, write and delete record of the objects PermissionDeletedSuccesfuly=Permission has been successfully removed PermissionUpdatedSuccesfuly=Permission has been successfully updated @@ -173,6 +173,7 @@ PermissionAddedSuccesfuly=Permission has been successfully added MenuDeletedSuccessfuly=Menu has been successfully deleted MenuAddedSuccessfuly=Menu has been successfully added MenuUpdatedSuccessfuly=Menu has been successfully updated +AddAPIsForThisObject=Add APIs for this object ApiObjectDeleted=API for object %s has been successfully deleted CRUDRead=Read CRUDCreateWrite=Create or Update @@ -181,8 +182,8 @@ DictionariesCreated=Dictionary %s created successfully DictionaryDeleted=Dictionary %s removed successfully PropertyModuleUpdated=Property %s has been update successfully InfoForApiFile=* When you generate file for the first time then all methods will be created for each object.
* When you click in remove you just remove all methods for the selected object. -SetupFile=Page for module setup +SetupFile=Page for module setup EmailingSelectors=Emails selectors EmailingSelectorDesc=You can generate and edit here the class files to provide new email target selectors for the mass emailing module EmailingSelectorFile=Emails selector file -NoEmailingSelector=No emails selector file \ No newline at end of file +NoEmailingSelector=No emails selector file 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/projects.lang b/htdocs/langs/en_US/projects.lang index f0d303285d4..3b0ec6edb3d 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -142,6 +142,7 @@ DoNotShowMyTasksOnly=See also tasks not assigned to me ShowMyTasksOnly=View only tasks assigned to me TaskRessourceLinks=Contacts of task ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party +ProjectsLinkedToThisThirdParty=Projects having a contact that is a contact of the third party NoTasks=No tasks for this project LinkedToAnotherCompany=Linked to other third party TaskIsNotAssignedToUser=Task not assigned to user. Use button '%s' to assign task now. 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/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 2857c585ba4..3750b9bab8a 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -88,6 +88,8 @@ SearchString=Chaîne de recherche NotAvailableWhenAjaxDisabled=Non disponible quand Ajax est désactivé AllowToSelectProjectFromOtherCompany=Sur les éléments d'un tiers, autorise la sélection d'un projet lié à un autre tiers TimesheetPreventAfterFollowingMonths=Empêcher l'enregistrement du temps consacré après le nombre de mois suivant +PROJECT_DISPLAY_LINKED_BY_CONTACT=Afficher les projets liés par un contact +PROJECT_DISPLAY_LINKED_BY_CONTACT_help=Cette option permet d'ajouter la liste de tous les projets dans lesquels un des contact du tiers est rattaché JavascriptDisabled=Javascript désactivé UsePreviewTabs=Afficher les onglets "Aperçu" ShowPreview=Afficher aperçu 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/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 962372b874b..d5d1f2ce01c 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -142,6 +142,7 @@ DoNotShowMyTasksOnly=Voir aussi les tâches qui ne me sont pas affectées ShowMyTasksOnly=Ne voir que les tâches qui me sont affectées TaskRessourceLinks=Contacts de la tâche ProjectsDedicatedToThisThirdParty=Projets dédiés à ce tiers +ProjectsLinkedToThisThirdParty=Projets liés à ce tiers par un contact commun NoTasks=Aucune tâche pour ce projet LinkedToAnotherCompany=Liés à autre société TaskIsNotAssignedToUser=Tâche non assignée à l'utilisateur. Utilisez le bouton '%s' pour assigner la tâche maintenant. diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 17fd78aa8c1..803717ae085 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -258,7 +258,7 @@ if (empty($reshook)) { $form = new Form($db); $formproject = new FormProjets($db); -$morehtmlright = ''; +$morehtmlstatus = ''; $outputlangs = $langs; if (isModEnabled('accounting')) { $formaccounting = new FormAccounting($db); @@ -474,7 +474,7 @@ if ($id > 0) { $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; 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/loan/document.php b/htdocs/loan/document.php index 1b6f586bb58..74b96bf0877 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 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 @@ -140,7 +141,8 @@ if ($object->id) { $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + $morehtmlstatus = $morehtmlright; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/loan/info.php b/htdocs/loan/info.php index 436caf903d2..b437a73b845 100644 --- a/htdocs/loan/info.php +++ b/htdocs/loan/info.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 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 @@ -102,7 +103,8 @@ $morehtmlref .= '
'; $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); +$morehtmlstatus = $morehtmlright; +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/loan/note.php b/htdocs/loan/note.php index 27a9d0bc70b..62d84a1adbc 100644 --- a/htdocs/loan/note.php +++ b/htdocs/loan/note.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Frederic France * Copyright (C) 2016-2023 Alexandre Spangaro * Copyright (C) 2017 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 @@ -129,7 +130,8 @@ if ($id > 0) { $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + $morehtmlstatus = $morehtmlright; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 2afeb25b322..31b71d49a3d 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -103,9 +103,9 @@ if ($action == 'delete') { $linkback = ''; $morehtmlref = ''; -$morehtmlright = ''; +$morehtmlstatus = ''; -dol_banner_tab($payment, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); +dol_banner_tab($payment, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index 1864c309298..ae61486bcfe 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -185,9 +185,9 @@ if (isModEnabled('project')) { } $morehtmlref .= '
'; -$morehtmlright = ''; +$morehtmlstatus = ''; -dol_banner_tab($object, 'loanid', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); +dol_banner_tab($object, 'loanid', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); ?> "; if ($nbofsuggested > 0) { + $quantityToBeDelivered = 0; echo "
".$langs->trans("SearchIntoBatch").": $nbofsuggested

  '; -print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Scheduled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); +print $form->selectarray('search_status', array('0' => $langs->trans("Disabled"), '1' => $langs->trans("Scheduled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print ' '; if (!empty($datelastresult) && ($datelastresult >= $datelastrun)) { $nbseconds = max($datelastresult - $datelastrun, 1); - print $nbseconds.' '.($nbseconds > 1 ? $langs->trans("SecondShort") : $langs->trans("SecondShort")); + print $nbseconds.' '.$langs->trans("SecondShort"); } print '
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 '
"; foreach ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch as $dbatch) { // $dbatch is instance of Productbatch $batchStock = + $dbatch->qty; // To get a numeric @@ -1604,6 +1605,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 .= '
* Copyright (C) 2018 Ferran Marcet * 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 @@ -189,7 +190,7 @@ $butactionbg = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!ge $textbutaction = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXTBTNACTION') ? $textbutaction : $conf->global->THEME_ELDY_TEXTBTNACTION) : (empty($user->conf->THEME_ELDY_TEXTBTNACTION) ? $textbutaction : $user->conf->THEME_ELDY_TEXTBTNACTION); $fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_FONT_SIZE1') ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1); $fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_FONT_SIZE2') ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE2) : (empty($user->conf->THEME_ELDY_FONT_SIZE2) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE2); -$heightrow = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_USECOMOACTROW') ? '155%' : '300%') : (!getDolGlobalString('THEME_ELDY_USECOMOACTROW') ? '155%' : '300%'); +$heightrow = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_USECOMOACTROW') ? '155%' : '300%') : (empty($user->conf->THEME_ELDY_USECOMOACTROW) ? '155%' : '300%'); // Hover color $colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_HOVER)); $colorbacklinepairchecked = ((!isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_CHECKED)); diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index e1d69443c5a..129015d839b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -7,6 +7,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * 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 @@ -194,7 +195,7 @@ $butactionbg = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!ge $textbutaction = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXTBTNACTION') ? $textbutaction : $conf->global->THEME_ELDY_TEXTBTNACTION) : (empty($user->conf->THEME_ELDY_TEXTBTNACTION) ? $textbutaction : $user->conf->THEME_ELDY_TEXTBTNACTION); $fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_FONT_SIZE1') ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1); $fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_FONT_SIZE2') ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE2) : (empty($user->conf->THEME_ELDY_FONT_SIZE2) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE2); -$heightrow = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_USECOMOACTROW') ? '155%' : '300%') : (!getDolGlobalString('THEME_ELDY_USECOMOACTROW') ? '155%' : '300%'); +$heightrow = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_USECOMOACTROW') ? '155%' : '300%') : (empty($user->conf->THEME_ELDY_USECOMOACTROW) ? '155%' : '300%'); // Hover color $colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'edf4fb' : $conf->global->THEME_ELDY_USE_HOVER)); @@ -2994,78 +2995,78 @@ div.mainmenu.menu { 'name of class for div') + // Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div') - $moduletomainmenu = array( - 'user'=>'', 'syslog'=>'', 'societe'=>'companies', 'projet'=>'project', 'propale'=>'commercial', 'commande'=>'commercial', - 'produit'=>'products', 'service'=>'products', 'stock'=>'products', - 'don'=>'accountancy', 'tax'=>'accountancy', 'banque'=>'accountancy', 'facture'=>'accountancy', 'compta'=>'accountancy', 'accounting'=>'accountancy', 'adherent'=>'members', 'import'=>'tools', 'export'=>'tools', 'mailing'=>'tools', - 'contrat'=>'commercial', 'ficheinter'=>'commercial', 'ticket'=>'ticket', 'deplacement'=>'commercial', - 'fournisseur'=>'companies', - 'barcode'=>'', 'fckeditor'=>'', 'categorie'=>'', - ); - $mainmenuused = 'home'; - foreach ($conf->modules as $val) { - $mainmenuused .= ','.(isset($moduletomainmenu[$val]) ? $moduletomainmenu[$val] : $val); - } - $mainmenuusedarray = array_unique(explode(',', $mainmenuused)); - - $generic = 1; - // Put here list of menu entries when the div.mainmenu.menuentry was previously defined - $divalreadydefined = array('home', 'companies', 'products', 'mrp', 'commercial', 'externalsite', 'accountancy', 'project', 'tools', 'members', 'agenda', 'ftp', 'holiday', 'hrm', 'bookmark', 'cashdesk', 'takepos', 'ecm', 'geoipmaxmind', 'gravatar', 'clicktodial', 'paypal', 'stripe', 'webservices', 'website'); - // Put here list of menu entries we are sure we don't want - $divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition'); - foreach ($mainmenuusedarray as $val) { - if (empty($val) || in_array($val, $divalreadydefined)) { - continue; - } - if (in_array($val, $divnotrequired)) { - continue; - } - //print "XXX".$val; - - $found = 0; - $url = ''; - $constformoduleicon = 'MAIN_MODULE_'.strtoupper($val).'_ICON'; - $iconformodule = getDolGlobalString($constformoduleicon); - if ($iconformodule) { - if (preg_match('/^fa\-/', $iconformodule)) { - // This is a fa icon - } else { - $url = dol_buildpath('/'.$val.'/img/'.$iconformodule.'.png', 1); + $moduletomainmenu = array( + 'user' => '', 'syslog' => '', 'societe' => 'companies', 'projet' => 'project', 'propale' => 'commercial', 'commande' => 'commercial', + 'produit' => 'products', 'service' => 'products', 'stock' => 'products', + 'don' => 'accountancy', 'tax' => 'accountancy', 'banque' => 'accountancy', 'facture' => 'accountancy', 'compta' => 'accountancy', 'accounting' => 'accountancy', 'adherent' => 'members', 'import' => 'tools', 'export' => 'tools', 'mailing' => 'tools', + 'contrat' => 'commercial', 'ficheinter' => 'commercial', 'ticket' => 'ticket', 'deplacement' => 'commercial', + 'fournisseur' => 'companies', + 'barcode' => '', 'fckeditor' => '', 'categorie' => '', + ); + $mainmenuused = 'home'; + foreach ($conf->modules as $val) { + $mainmenuused .= ','.(isset($moduletomainmenu[$val]) ? $moduletomainmenu[$val] : $val); } - $found = 1; - } else { - // Search img file in module dir - foreach ($conf->file->dol_document_root as $dirroot) { - if (file_exists($dirroot."/".$val."/img/".$val.".png")) { - $url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); + $mainmenuusedarray = array_unique(explode(',', $mainmenuused)); + + $generic = 1; + // Put here list of menu entries when the div.mainmenu.menuentry was previously defined + $divalreadydefined = array('home', 'companies', 'products', 'mrp', 'commercial', 'externalsite', 'accountancy', 'project', 'tools', 'members', 'agenda', 'ftp', 'holiday', 'hrm', 'bookmark', 'cashdesk', 'takepos', 'ecm', 'geoipmaxmind', 'gravatar', 'clicktodial', 'paypal', 'stripe', 'webservices', 'website'); + // Put here list of menu entries we are sure we don't want + $divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition'); + foreach ($mainmenuusedarray as $val) { + if (empty($val) || in_array($val, $divalreadydefined)) { + continue; + } + if (in_array($val, $divnotrequired)) { + continue; + } + //print "XXX".$val; + + $found = 0; + $url = ''; + $constformoduleicon = 'MAIN_MODULE_'.strtoupper($val).'_ICON'; + $iconformodule = getDolGlobalString($constformoduleicon); + if ($iconformodule) { + if (preg_match('/^fa\-/', $iconformodule)) { + // This is a fa icon + } else { + $url = dol_buildpath('/'.$val.'/img/'.$iconformodule.'.png', 1); + } $found = 1; - break; + } else { + // Search img file in module dir + foreach ($conf->file->dol_document_root as $dirroot) { + if (file_exists($dirroot."/".$val."/img/".$val.".png")) { + $url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); + $found = 1; + break; + } + } + } + + // Output entry for menu icon in CSS + if (!$found) { + print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; + print 'div.mainmenu.'.$val.' span::before {'."\n"; + print 'content: "\f249";'."\n"; + print '}'."\n"; + $generic++; + } else { + if ($url) { + print "div.mainmenu.".$val." {\n"; + print " background-image: url(".$url.");\n"; + print " background-position-y: 3px;\n"; + print " filter: saturate(0);\n"; + print "}\n"; + } else { + print '/* icon for module '.$val.' is a fa icon */'."\n"; + } } } - } - - // Output entry for menu icon in CSS - if (!$found) { - print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; - print 'div.mainmenu.'.$val.' span::before {'."\n"; - print 'content: "\f249";'."\n"; - print '}'."\n"; - $generic++; - } else { - if ($url) { - print "div.mainmenu.".$val." {\n"; - print " background-image: url(".$url.");\n"; - print " background-position-y: 3px;\n"; - print " filter: saturate(0);\n"; - print "}\n"; - } else { - print '/* icon for module '.$val.' is a fa icon */'."\n"; - } - } - } - // End of part to add more div class css + // End of part to add more div class css } // End test if $dol_hide_topmenu?> diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 037ec5c57c4..db416fb7742 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1536,6 +1536,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 '
'; diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index 820cc281c89..e4bcccb7e5e 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -98,11 +98,11 @@ 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,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), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'position' => 15, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'position' => 15, 'index' => 1), 'code' => array('type' => 'varchar(32)', 'label' => 'Code', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 20), 'pos' => array('type' => 'integer', 'label' => 'Pos', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 25), 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 30, 'showoncombobox' => 1), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 0769e98d05e..3d231680b21 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; @@ -3008,10 +3008,24 @@ 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 = ''; + // @TODO + // Retrieve source References to do $references .= (empty($references) ? '' : ' ').Source References + // If No References is set, use the In-Reply-To for $references .= (empty($references) ? '' : ' ').Source In-reply-To + $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 { @@ -3082,7 +3096,7 @@ class Ticket extends CommonObject if ($mode == 'opened') { $status = 'openall'; //$delay_warning = $conf->ticket->warning_delay; - $delay_warning = 0; + $delay_warning = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $label = $langs->trans("MenuListNonClosed"); $labelShort = $langs->trans("MenuListNonClosed"); } diff --git a/htdocs/ticket/tpl/linkedobjectblock.tpl.php b/htdocs/ticket/tpl/linkedobjectblock.tpl.php index e4ccd67308c..cebcaf46494 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"; diff --git a/htdocs/user/agenda.php b/htdocs/user/agenda.php index 7c692bb9ba4..229c299a2e7 100644 --- a/htdocs/user/agenda.php +++ b/htdocs/user/agenda.php @@ -89,7 +89,7 @@ if (($object->id != $user->id) && !$user->hasRight('user', 'user', 'lire')) { accessforbidden(); } -$parameters = array('id' => $userId); +$parameters = array('id' => $id); $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'); @@ -195,7 +195,7 @@ if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || // Try to know count of actioncomm from cache require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_events_user_'.$object->id; - //$nbEvent = dol_getcache($cachekey); // TODO Add nb into badge in menu so we can get it from cache also here + $nbEvent = dol_getcache($cachekey); $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); if (!empty($conf->dol_optimize_smallscreen)) { diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index ac40da2c6df..230344118c6 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2020 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 @@ -446,8 +447,6 @@ class Users extends DolibarrApi throw new RestException(403); } - $obj_ret = array(); - $user = new User($this->db); $result = $user->fetch($id); if (!$result) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fd6b5d6dc3a..5e26283544a 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 @@ -1187,15 +1190,17 @@ class User extends CommonObject { global $conf; + $alreadyloaded = false; + if (empty($forcereload)) { if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag]) { // Rights for this module are already loaded, so we leave - return; + $alreadyloaded = true; } if (!empty($this->all_permissions_are_loaded)) { // We already loaded all rights for this user, so we leave - return; + $alreadyloaded = true; } } @@ -1209,211 +1214,213 @@ class User extends CommonObject // Get permission of users + Get permissions of groups - // First user permissions - $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; - $sql .= " FROM ".$this->db->prefix()."user_rights as ur,"; - $sql .= " ".$this->db->prefix()."rights_def as r"; - $sql .= " WHERE r.id = ur.fk_id"; - if (getDolGlobalString('MULTICOMPANY_BACKWARD_COMPATIBILITY')) { - // on old version, we use entity defined into table r only - $sql .= " AND r.entity IN (0,".(isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? "1," : "").$conf->entity.")"; - } else { - // On table r=rights_def, the unique key is (id, entity) because id is hard coded into module descriptor and insert during module activation. - // So we must include the filter on entity on both table r. and ur. - $sql .= " AND r.entity = ".((int) $conf->entity)." AND ur.entity = ".((int) $conf->entity); - } - $sql .= " AND ur.fk_user= ".((int) $this->id); - $sql .= " AND r.perms IS NOT NULL"; - if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled - } - if ($moduletag) { - $sql .= " AND r.module = '".$this->db->escape($moduletag)."'"; - } - - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - - if ($obj) { - $module = $obj->module; - $perms = $obj->perms; - $subperms = $obj->subperms; - - if (!empty($perms)) { - if (!empty($module)) { - if (!isset($this->rights->$module) || !is_object($this->rights->$module)) { - $this->rights->$module = new stdClass(); - } - if (!empty($subperms)) { - if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { - $this->rights->$module->$perms = new stdClass(); - } - if (empty($this->rights->$module->$perms->$subperms)) { - $this->nb_rights++; - } - $this->rights->$module->$perms->$subperms = 1; - } else { - if (empty($this->rights->$module->$perms)) { - $this->nb_rights++; - } - $this->rights->$module->$perms = 1; - } - } - } - } - $i++; - } - $this->db->free($resql); - } - - // Now permissions of groups - $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; - $sql .= " FROM ".$this->db->prefix()."usergroup_rights as gr,"; - $sql .= " ".$this->db->prefix()."usergroup_user as gu,"; - $sql .= " ".$this->db->prefix()."rights_def as r"; - $sql .= " WHERE r.id = gr.fk_id"; - // A very strange business rules. Must be same than into user->getrights() user/perms.php and user/group/perms.php - if (getDolGlobalString('MULTICOMPANY_BACKWARD_COMPATIBILITY')) { - if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { - $sql .= " AND gu.entity IN (0,".$conf->entity.")"; + if (!$alreadyloaded) { + // First user permissions + $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; + $sql .= " FROM ".$this->db->prefix()."user_rights as ur,"; + $sql .= " ".$this->db->prefix()."rights_def as r"; + $sql .= " WHERE r.id = ur.fk_id"; + if (getDolGlobalString('MULTICOMPANY_BACKWARD_COMPATIBILITY')) { + // on old version, we use entity defined into table r only + $sql .= " AND r.entity IN (0,".(isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? "1," : "").$conf->entity.")"; } else { - $sql .= " AND r.entity = ".((int) $conf->entity); + // On table r=rights_def, the unique key is (id, entity) because id is hard coded into module descriptor and insert during module activation. + // So we must include the filter on entity on both table r. and ur. + $sql .= " AND r.entity = ".((int) $conf->entity)." AND ur.entity = ".((int) $conf->entity); + } + $sql .= " AND ur.fk_user= ".((int) $this->id); + $sql .= " AND r.perms IS NOT NULL"; + if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { + $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled + } + if ($moduletag) { + $sql .= " AND r.module = '".$this->db->escape($moduletag)."'"; } - } else { - $sql .= " AND gr.entity = ".((int) $conf->entity); // Only groups created in current entity - // The entity on the table usergroup_user should be useless and should never be used because it is already into gr and r. - // but when using MULTICOMPANY_TRANSVERSE_MODE, we may insert record that make rubbish result due to duplicate record of - // other entities, so we are forced to add a filter here - $sql .= " AND gu.entity IN (0,".$conf->entity.")"; - $sql .= " AND r.entity = ".((int) $conf->entity); // Only permission of modules enabled in current entity - } - // End of strange business rule - $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; - $sql .= " AND gu.fk_user = ".((int) $this->id); - $sql .= " AND r.perms IS NOT NULL"; - if ($moduletag) { - $sql .= " AND r.module = '".$this->db->escape($moduletag)."'"; - } - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); - if ($obj) { - $module = $obj->module; - $perms = $obj->perms; - $subperms = $obj->subperms; + if ($obj) { + $module = $obj->module; + $perms = $obj->perms; + $subperms = $obj->subperms; - if (!empty($perms)) { - if (!empty($module)) { - if (!isset($this->rights->$module) || !is_object($this->rights->$module)) { - $this->rights->$module = new stdClass(); - } - if (!empty($subperms)) { - if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { - $this->rights->$module->$perms = new stdClass(); + if (!empty($perms)) { + if (!empty($module)) { + if (!isset($this->rights->$module) || !is_object($this->rights->$module)) { + $this->rights->$module = new stdClass(); } - if (empty($this->rights->$module->$perms->$subperms)) { - $this->nb_rights++; - } - $this->rights->$module->$perms->$subperms = 1; - } else { - if (empty($this->rights->$module->$perms)) { - $this->nb_rights++; - } - // if we have already define a subperm like this $this->rights->$module->level1->level2 with llx_user_rights, we don't want override level1 because the level2 can be not define on user group - if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { + if (!empty($subperms)) { + if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { + $this->rights->$module->$perms = new stdClass(); + } + if (empty($this->rights->$module->$perms->$subperms)) { + $this->nb_rights++; + } + $this->rights->$module->$perms->$subperms = 1; + } else { + if (empty($this->rights->$module->$perms)) { + $this->nb_rights++; + } $this->rights->$module->$perms = 1; } } } } + $i++; } - $i++; + $this->db->free($resql); } - $this->db->free($resql); - } - // Force permission on user for admin - if (!empty($this->admin)) { - if (empty($this->rights->user->user)) { - $this->rights->user->user = new stdClass(); - } - $listofpermtotest = array('lire', 'creer', 'password', 'supprimer', 'export'); - foreach ($listofpermtotest as $permtotest) { - if (empty($this->rights->user->user->$permtotest)) { - $this->rights->user->user->$permtotest = 1; - $this->nb_rights++; + // Now permissions of groups + $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; + $sql .= " FROM ".$this->db->prefix()."usergroup_rights as gr,"; + $sql .= " ".$this->db->prefix()."usergroup_user as gu,"; + $sql .= " ".$this->db->prefix()."rights_def as r"; + $sql .= " WHERE r.id = gr.fk_id"; + // A very strange business rules. Must be same than into user->getrights() user/perms.php and user/group/perms.php + if (getDolGlobalString('MULTICOMPANY_BACKWARD_COMPATIBILITY')) { + if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { + $sql .= " AND gu.entity IN (0,".$conf->entity.")"; + } else { + $sql .= " AND r.entity = ".((int) $conf->entity); } + } else { + $sql .= " AND gr.entity = ".((int) $conf->entity); // Only groups created in current entity + // The entity on the table usergroup_user should be useless and should never be used because it is already into gr and r. + // but when using MULTICOMPANY_TRANSVERSE_MODE, we may insert record that make rubbish result due to duplicate record of + // other entities, so we are forced to add a filter here + $sql .= " AND gu.entity IN (0,".$conf->entity.")"; + $sql .= " AND r.entity = ".((int) $conf->entity); // Only permission of modules enabled in current entity } - if (empty($this->rights->user->self)) { - $this->rights->user->self = new stdClass(); + // End of strange business rule + $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; + $sql .= " AND gu.fk_user = ".((int) $this->id); + $sql .= " AND r.perms IS NOT NULL"; + if ($moduletag) { + $sql .= " AND r.module = '".$this->db->escape($moduletag)."'"; } - $listofpermtotest = array('creer', 'password'); - foreach ($listofpermtotest as $permtotest) { - if (empty($this->rights->user->self->$permtotest)) { - $this->rights->user->self->$permtotest = 1; - $this->nb_rights++; + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + + if ($obj) { + $module = $obj->module; + $perms = $obj->perms; + $subperms = $obj->subperms; + + if (!empty($perms)) { + if (!empty($module)) { + if (!isset($this->rights->$module) || !is_object($this->rights->$module)) { + $this->rights->$module = new stdClass(); + } + if (!empty($subperms)) { + if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { + $this->rights->$module->$perms = new stdClass(); + } + if (empty($this->rights->$module->$perms->$subperms)) { + $this->nb_rights++; + } + $this->rights->$module->$perms->$subperms = 1; + } else { + if (empty($this->rights->$module->$perms)) { + $this->nb_rights++; + } + // if we have already define a subperm like this $this->rights->$module->level1->level2 with llx_user_rights, we don't want override level1 because the level2 can be not define on user group + if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { + $this->rights->$module->$perms = 1; + } + } + } + } + } + $i++; } + $this->db->free($resql); } - // Add test on advanced permissions - if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - if (empty($this->rights->user->user_advance)) { - $this->rights->user->user_advance = new stdClass(); + + // Force permission on user for admin + if (!empty($this->admin)) { + if (empty($this->rights->user->user)) { + $this->rights->user->user = new stdClass(); } - $listofpermtotest = array('readperms', 'write'); + $listofpermtotest = array('lire', 'creer', 'password', 'supprimer', 'export'); foreach ($listofpermtotest as $permtotest) { - if (empty($this->rights->user->user_advance->$permtotest)) { - $this->rights->user->user_advance->$permtotest = 1; + if (empty($this->rights->user->user->$permtotest)) { + $this->rights->user->user->$permtotest = 1; $this->nb_rights++; } } - if (empty($this->rights->user->self_advance)) { - $this->rights->user->self_advance = new stdClass(); + if (empty($this->rights->user->self)) { + $this->rights->user->self = new stdClass(); } - $listofpermtotest = array('readperms', 'writeperms'); + $listofpermtotest = array('creer', 'password'); foreach ($listofpermtotest as $permtotest) { - if (empty($this->rights->user->self_advance->$permtotest)) { - $this->rights->user->self_advance->$permtotest = 1; + if (empty($this->rights->user->self->$permtotest)) { + $this->rights->user->self->$permtotest = 1; $this->nb_rights++; } } - if (empty($this->rights->user->group_advance)) { - $this->rights->user->group_advance = new stdClass(); - } - $listofpermtotest = array('read', 'readperms', 'write', 'delete'); - foreach ($listofpermtotest as $permtotest) { - if (empty($this->rights->user) || empty($this->rights->user->group_advance->$permtotest)) { - $this->rights->user->group_advance->$permtotest = 1; - $this->nb_rights++; + // Add test on advanced permissions + if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { + if (empty($this->rights->user->user_advance)) { + $this->rights->user->user_advance = new stdClass(); + } + $listofpermtotest = array('readperms', 'write'); + foreach ($listofpermtotest as $permtotest) { + if (empty($this->rights->user->user_advance->$permtotest)) { + $this->rights->user->user_advance->$permtotest = 1; + $this->nb_rights++; + } + } + if (empty($this->rights->user->self_advance)) { + $this->rights->user->self_advance = new stdClass(); + } + $listofpermtotest = array('readperms', 'writeperms'); + foreach ($listofpermtotest as $permtotest) { + if (empty($this->rights->user->self_advance->$permtotest)) { + $this->rights->user->self_advance->$permtotest = 1; + $this->nb_rights++; + } + } + if (empty($this->rights->user->group_advance)) { + $this->rights->user->group_advance = new stdClass(); + } + $listofpermtotest = array('read', 'readperms', 'write', 'delete'); + foreach ($listofpermtotest as $permtotest) { + if (empty($this->rights->user) || empty($this->rights->user->group_advance->$permtotest)) { + $this->rights->user->group_advance->$permtotest = 1; + $this->nb_rights++; + } } } } - } - // For backward compatibility - if (isset($this->rights->propale) && !isset($this->rights->propal)) { - $this->rights->propal = $this->rights->propale; - } - if (isset($this->rights->propal) && !isset($this->rights->propale)) { - $this->rights->propale = $this->rights->propal; - } + // For backward compatibility + if (isset($this->rights->propale) && !isset($this->rights->propal)) { + $this->rights->propal = $this->rights->propale; + } + if (isset($this->rights->propal) && !isset($this->rights->propale)) { + $this->rights->propale = $this->rights->propal; + } - if (!$moduletag) { - // If the module was not define, then everything is loaded. - // Therefore, we can consider that the permissions are cached - // because they were all loaded for this user instance. - $this->all_permissions_are_loaded = 1; - } else { - // If the module is defined, we flag it as loaded into cache - $this->_tab_loaded[$moduletag] = 1; + if (!$moduletag) { + // If the module was not define, then everything is loaded. + // Therefore, we can consider that the permissions are cached + // because they were all loaded for this user instance. + $this->all_permissions_are_loaded = 1; + } else { + // If the module is defined, we flag it as loaded into cache + $this->_tab_loaded[$moduletag] = 1; + } } } @@ -3092,7 +3099,7 @@ class User extends CommonObject if ($option == 'xxx') { $linkstart = ''; - $linkend = ''; + $linkend = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } if ($option == 'nolink') { @@ -3631,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() @@ -3660,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() { @@ -3755,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) @@ -3772,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 = $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]); } } @@ -3832,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/ldap.php b/htdocs/user/ldap.php index ab95f1ad25e..328e14910ae 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -1,6 +1,7 @@ - * Copyright (C) 2006-2021 Regis Houssin +/* Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2006-2021 Regis Houssin + * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +34,7 @@ $langs->loadLangs(array('users', 'admin', 'companies', 'ldap')); $id = GETPOSTINT('id'); $action = GETPOST('action', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'userldap'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?: 'userldap'; // To manage different context of search // Security check $socid = 0; @@ -125,6 +126,7 @@ print ''; if (getDolGlobalString('LDAP_SERVER_TYPE') == "activedirectory") { $ldap = new Ldap(); $result = $ldap->connectBind(); + $userSID = ''; if ($result > 0) { $userSID = $ldap->getObjectSid($object->login); } @@ -204,6 +206,7 @@ if ($result > 0) { $ldap->unbind(); } else { + print '
'; setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/user/messaging.php b/htdocs/user/messaging.php index f28ee2aa0cc..319a00e9f5e 100644 --- a/htdocs/user/messaging.php +++ b/htdocs/user/messaging.php @@ -6,6 +6,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Marcos García + * 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 @@ -50,6 +51,8 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); } +$id = GETPOSTINT('userid') ? GETPOSTINT('userid') : GETPOSTINT('id'); +$ref = GETPOST('ref', 'alpha'); $search_rowid = GETPOST('search_rowid'); $search_agenda_label = GETPOST('search_agenda_label'); @@ -74,6 +77,9 @@ if (!$sortorder) { $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); + if ($result <= 0) { + accessforbidden('User not found'); + } $object->getrights(); } @@ -81,18 +87,17 @@ if ($id > 0 || !empty($ref)) { $hookmanager->initHooks(array('agendathirdparty', 'globalcard')); // Security check -$userid = GETPOSTINT('userid') ? GETPOSTINT('userid') : GETPOSTINT('id'); if ($user->id) { - $userId = $user->id; + $id = $user->id; } -$result = $object->fetch($userid); -if ($result <= 0) { - accessforbidden('User not found'); +// Security check +$socid = 0; +if ($user->socid > 0) { + $socid = $user->socid; } - -$result = restrictedArea($user, 'user', $userId, '&user'); - +$feature2 = (($socid && $user->hasRight('user', 'self', 'creer')) ? '' : 'user'); +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); /* @@ -153,7 +158,7 @@ $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->tra dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin, 'rowid', 'ref', $morehtmlref); -$object->info($userid); +$object->info($id); print '
'; @@ -196,7 +201,7 @@ if (isModEnabled('agenda')) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allaactions', 'read'))) { print '
'; - $param = '&userid='.urlencode((string) ($userid)); + $param = '&userid='.urlencode((string) ($id)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -208,7 +213,7 @@ if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || // Try to know count of actioncomm from cache require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_events_user_'.$object->id; - //$nbEvent = dol_getcache($cachekey); // TODO Add nb into badge in menu so we can get it from cache also here + $nbEvent = dol_getcache($cachekey); // TODO Add nb into badge in menu so we can get it from cache also here $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); if (!empty($conf->dol_optimize_smallscreen)) { diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index b4c16a23b95..255a1428386 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -98,14 +98,14 @@ 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,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"), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), 'ref' => array('type' => 'varchar(255)', 'label' => 'Ref', 'visible' => 1, 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'css' => 'width200'), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'ExternalRef', 'enabled' => 1, 'visible' => 0, 'position' => 20, 'searchall' => 1), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'help' => "", 'showoncombobox' => '1',), - 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => 0, 'position' => 40, 'notnull' => 1,), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'help' => "", 'showoncombobox' => 1,), + 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => '0', 'position' => 40, 'notnull' => 1,), ); /** diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index 4b04d46a375..a6ddfcd9570 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -76,14 +76,14 @@ 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,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"), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), 'fk_product_attribute' => array('type' => 'integer:ProductAttribute:variants/class/ProductAttribute.class.php', 'label' => 'ProductAttribute', 'enabled' => 1, 'visible' => 0, 'position' => 10, 'notnull' => 1, 'index' => 1,), 'ref' => array('type' => 'varchar(255)', 'label' => 'Ref', 'visible' => 1, 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'css' => ''), - 'value' => array('type' => 'varchar(255)', 'label' => 'Value', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'help' => "", 'showoncombobox' => '1',), - 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => 0, 'position' => 200, 'notnull' => 1,), + 'value' => array('type' => 'varchar(255)', 'label' => 'Value', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'help' => "", 'showoncombobox' => 1,), + 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => '0', 'position' => 200, 'notnull' => 1,), ); public $id; public $fk_product_attribute; diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 25d69eaeac9..4e40c36a553 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2016 Marcos García * Copyright (C) 2018 Juanjo Menent * 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 @@ -292,13 +293,13 @@ class ProductCombination global $conf; $sql = "SELECT pac.rowid, pac.fk_product_parent, pac.fk_product_child, pac.variation_price, pac.variation_price_percentage, pac.variation_ref_ext, pac.variation_weight"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_attribute_combination AS pac"; + $sql .= " FROM ".MAIN_DB_PREFIX."product_attribute_combination AS pac"; if ($sort_by_ref) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product AS p ON p.rowid = pac.fk_product_child"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product AS p ON p.rowid = pac.fk_product_child"; } - $sql.= " WHERE pac.fk_product_parent = ".((int) $fk_product_parent)." AND pac.entity IN (".getEntity('product').")"; + $sql .= " WHERE pac.fk_product_parent = ".((int) $fk_product_parent)." AND pac.entity IN (".getEntity('product').")"; if ($sort_by_ref) { - $sql.= $this->db->order('p.ref', 'ASC'); + $sql .= $this->db->order('p.ref', 'ASC'); } $query = $this->db->query($sql); @@ -614,7 +615,7 @@ class ProductCombination * Retrieves the combination that matches the given features. * * @param int $prodid Id of parent product - * @param array $features Format: [$attr] => $attr_val + * @param array $features Format: [$attr] => $attr_val * @return false|ProductCombination False if not found */ public function fetchByProductCombination2ValuePairs($prodid, array $features) @@ -626,9 +627,16 @@ class ProductCombination $prodcomb2val = new ProductCombination2ValuePair($this->db); $prodcomb = new ProductCombination($this->db); - $features = array_filter($features, function ($v) { - return !empty($v); - }); + $features = array_filter( + $features, + /** + * @param mixed $v Feature information of a product. + * @return bool + */ + static function ($v) { + return !empty($v); + } + ); foreach ($features as $attr => $attr_val) { $actual_comp[$attr] = $attr_val; @@ -729,7 +737,7 @@ class ProductCombination $this->db->begin(); - $price_impact = array(1=>0); // init level price impact + $price_impact = array(1 => 0); // init level price impact $forced_refvar = trim($forced_refvar); @@ -877,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/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 011b8b31606..4b6db01486a 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -101,23 +101,23 @@ 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,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"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 4, 'noteditable' => '1', 'index' => 1, 'searchall' => 1, 'validate' => '1', 'comment' => "Reference of object"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1',), - 'url' => array('type' => 'varchar(255)', 'label' => 'Url', 'enabled' => '1', 'position' => 50, 'notnull' => 1, 'visible' => 1,), - 'trigger_codes' => array('type' => 'text', 'label' => 'TriggerCodes', 'enabled' => '1', 'position' => 55, 'notnull' => 1, 'visible' => 1, 'help' => "TriggerCodeInfo",), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => '1',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => '1', 'position' => 2000, 'notnull' => 1, 'default' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled'), 'validate' => '1',), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 4, 'noteditable' => 1, 'index' => 1, 'searchall' => 1, 'validate' => 1, 'comment' => "Reference of object"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,), + 'url' => array('type' => 'varchar(255)', 'label' => 'Url', 'enabled' => 1, 'position' => 50, 'notnull' => 1, 'visible' => 1,), + 'trigger_codes' => array('type' => 'text', 'label' => 'TriggerCodes', 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'visible' => 1, 'help' => "TriggerCodeInfo",), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => 1,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 2000, 'notnull' => 1, 'default' => '1', 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled'), 'validate' => 1,), ); public $rowid; public $ref; 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 '
'.$langs->trans("ErrorFailedToReadLDAP").'
'; +// 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/html.formlistwebportal.class.php b/htdocs/webportal/class/html.formlistwebportal.class.php index 524c4e99548..ac7fc81679b 100644 --- a/htdocs/webportal/class/html.formlistwebportal.class.php +++ b/htdocs/webportal/class/html.formlistwebportal.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2023-2024 Patrice Andreani * 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 @@ -300,7 +301,7 @@ class FormListWebPortal $sql .= " FROM " . $this->db->prefix() . $object->table_element . " as t"; // Add table from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $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) { @@ -343,7 +344,7 @@ class FormListWebPortal // $sql .= natural_search(array_keys($fieldstosearchall), $search_all); //} // Add where from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -422,7 +423,7 @@ class FormListWebPortal } } // Add $param from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; diff --git a/htdocs/webportal/class/webportalinvoice.class.php b/htdocs/webportal/class/webportalinvoice.class.php index 5212a7e433f..ddb7e7bec8a 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,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 d09568cf5f5..c4954e4886d 100644 --- a/htdocs/webportal/class/webportalmember.class.php +++ b/htdocs/webportal/class/webportalmember.class.php @@ -113,12 +113,12 @@ 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,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,), - 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'default' => 1, 'enabled' => 1, 'visible' => 5, 'notnull' => 1, 'position' => 12, 'index' => 1, 'showonheader' => 1,), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1,), + 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'default' => '1', 'enabled' => 1, 'visible' => 5, 'notnull' => 1, 'position' => 12, 'index' => 1, 'showonheader' => 1,), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1,), 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 4, 'position' => 30, 'showonheader' => 1,), 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 4, 'position' => 35, 'showonheader' => 1,), diff --git a/htdocs/webportal/class/webportalorder.class.php b/htdocs/webportal/class/webportalorder.class.php index a1ca6bd5270..e9cd8757b61 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -98,11 +98,11 @@ 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,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,), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1,), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1,), 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 2, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 25,), 'date_commande' => array('type' => 'date', 'label' => 'Date', 'enabled' => 1, 'visible' => 2, 'position' => 60,), 'date_livraison' => array('type' => 'date', 'label' => 'DateDeliveryPlanned', 'enabled' => 1, 'visible' => 2, 'position' => 70,), diff --git a/htdocs/webportal/class/webportalpartnership.class.php b/htdocs/webportal/class/webportalpartnership.class.php index 7a0146072dd..78b87cc04dd 100644 --- a/htdocs/webportal/class/webportalpartnership.class.php +++ b/htdocs/webportal/class/webportalpartnership.class.php @@ -97,11 +97,11 @@ 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,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",), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 5, 'noteditable' => '1', 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object", 'showonheader' => 1,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id",), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 5, 'noteditable' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Reference of object", 'showonheader' => 1,), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'position' => 15, 'notnull' => 1, 'visible' => -2, 'default' => '1', 'index' => 1,), 'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php:0:(active:=:1)', 'label' => 'Type', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 5, 'csslist' => '',), diff --git a/htdocs/webportal/class/webportalpropal.class.php b/htdocs/webportal/class/webportalpropal.class.php index 2c6a973ec66..c49d8bfd686 100644 --- a/htdocs/webportal/class/webportalpropal.class.php +++ b/htdocs/webportal/class/webportalpropal.class.php @@ -98,12 +98,12 @@ 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,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",), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1,), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'validate' => '1', 'comment' => "Reference of object",), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id",), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1,), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "Reference of object",), 'datep' => array('type' => 'date', 'label' => 'Date', 'enabled' => 1, 'visible' => 2, 'position' => 60,), 'fin_validite' => array('type' => 'date', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => 2, 'position' => 65,), 'total_ht' => array('type' => 'price', 'label' => 'TotalHT', 'enabled' => 1, 'visible' => 2, 'position' => 125, 'isameasure' => 1,), 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_category.php b/htdocs/webservices/server_category.php index 6e3e66bc205..a062c5c9361 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.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 @@ -77,11 +78,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'), ) ); @@ -95,16 +96,16 @@ $server->wsdl->addComplexType( 'all', '', array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'id_mere' => array('name'=>'id_mere', 'type'=>'xsd:string'), - 'label' => array('name'=>'label', 'type'=>'xsd:string'), - 'description' => array('name'=>'description', 'type'=>'xsd:string'), - 'socid' => array('name'=>'socid', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:string'), - 'visible' => array('name'=>'visible', 'type'=>'xsd:string'), - 'dir'=> array('name'=>'dir', 'type'=>'xsd:string'), - 'photos' => array('name'=>'photos', 'type'=>'tns:PhotosArray'), - 'filles' => array('name'=>'filles', 'type'=>'tns:FillesArray') + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'id_mere' => array('name' => 'id_mere', 'type' => 'xsd:string'), + 'label' => array('name' => 'label', 'type' => 'xsd:string'), + 'description' => array('name' => 'description', 'type' => 'xsd:string'), + 'socid' => array('name' => 'socid', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:string'), + 'visible' => array('name' => 'visible', 'type' => 'xsd:string'), + 'dir' => array('name' => 'dir', 'type' => 'xsd:string'), + 'photos' => array('name' => 'photos', 'type' => 'tns:PhotosArray'), + 'filles' => array('name' => 'filles', 'type' => 'tns:FillesArray') ) ); @@ -119,14 +120,14 @@ $server->wsdl->addComplexType( 'SOAP-ENC:Array', array(), array( - array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:categorie[]') + array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:categorie[]') ), 'tns:categorie' ); - /* - * Image of product - */ +/* + * Image of product +*/ $server->wsdl->addComplexType( 'PhotosArray', 'complexType', @@ -143,9 +144,9 @@ $server->wsdl->addComplexType( ) ); - /* - * An image - */ +/* + * An image +*/ $server->wsdl->addComplexType( 'image', 'complexType', @@ -153,10 +154,10 @@ $server->wsdl->addComplexType( 'all', '', array( - 'photo' => array('name'=>'photo', 'type'=>'xsd:string'), - 'photo_vignette' => array('name'=>'photo_vignette', 'type'=>'xsd:string'), - 'imgWidth' => array('name'=>'imgWidth', 'type'=>'xsd:string'), - 'imgHeight' => array('name'=>'imgHeight', 'type'=>'xsd:string') + 'photo' => array('name' => 'photo', 'type' => 'xsd:string'), + 'photo_vignette' => array('name' => 'photo_vignette', 'type' => 'xsd:string'), + 'imgWidth' => array('name' => 'imgWidth', 'type' => 'xsd:string'), + 'imgHeight' => array('name' => 'imgHeight', 'type' => 'xsd:string') ) ); @@ -170,8 +171,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'), ) ); @@ -187,9 +188,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getCategory', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'categorie'=>'tns:categorie'), + array('result' => 'tns:result', 'categorie' => 'tns:categorie'), $ns, $ns.'#getCategory', $styledoc, @@ -232,7 +233,7 @@ function getCategory($authentication, $id) if (!$error) { $fuser->getrights(); - $nbmax = 10; + $nbmax = 10; // @phan-suppress-current-line PhanPluginRedundantAssignment if ($fuser->hasRight('categorie', 'lire')) { $categorie = new Categorie($db); $result = $categorie->fetch($id); @@ -260,13 +261,13 @@ function getCategory($authentication, $id) $pdir = get_exdir($child_cat->id, 2, 0, 0, $categorie, 'category').$child_cat->id."/photos/"; $dir = $dir.'/'.$pdir; $cat['filles'][] = array( - 'id'=>$child_cat->id, + 'id' => $child_cat->id, 'id_mere' => $categorie->id_mere, - 'label'=>$child_cat->label, - 'description'=>$child_cat->description, - 'socid'=>$child_cat->socid, + 'label' => $child_cat->label, + 'description' => $child_cat->description, + 'socid' => $child_cat->socid, //'visible'=>$child_cat->visible, - 'type'=>$child_cat->type, + 'type' => $child_cat->type, 'dir' => $pdir, 'photos' => $child_cat->liste_photos($dir, $nbmax) ); @@ -275,8 +276,8 @@ function getCategory($authentication, $id) // Create $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'categorie'=> $cat + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'categorie' => $cat ); } else { $error++; @@ -291,7 +292,7 @@ function getCategory($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; diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 52267436a8d..b0f7f2372fd 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.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'), ) ); @@ -97,8 +98,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'), ) ); @@ -110,34 +111,34 @@ $server->wsdl->addComplexType( 'all', '', array( - 'element' => array('name'=>'element', 'type'=>'xsd:string'), - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'lastname' => array('name'=>'lastname', 'type'=>'xsd:string'), - 'firstname' => array('name'=>'firstname', 'type'=>'xsd:string'), - 'note' => array('name'=>'note', 'type'=>'xsd:string'), - 'email' => array('name'=>'email', 'type'=>'xsd:string'), - 'signature' => array('name'=>'signature', 'type'=>'xsd:string'), - 'office_phone' => array('name'=>'office_phone', 'type'=>'xsd:string'), - 'office_fax' => array('name'=>'office_fax', 'type'=>'xsd:string'), - 'user_mobile' => array('name'=>'user_mobile', 'type'=>'xsd:string'), - 'admin' => array('name'=>'admin', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), - 'pass_indatabase' => array('name'=>'pass_indatabase', 'type'=>'xsd:string'), - 'pass_indatabase_crypted' => array('name'=>'pass_indatabase_crypted', 'type'=>'xsd:string'), - 'datec' => array('name'=>'datec', 'type'=>'xsd:dateTime'), - 'datem' => array('name'=>'datem', 'type'=>'xsd:dateTime'), - 'fk_thirdparty' => array('name'=>'fk_thirdparty', 'type'=>'xsd:string'), - 'fk_contact' => array('name'=>'fk_contact', 'type'=>'xsd:string'), - 'fk_member' => array('name'=>'fk_member', 'type'=>'xsd:string'), - 'datelastlogin' => array('name'=>'datelastlogin', 'type'=>'xsd:dateTime'), - 'datepreviouslogin' => array('name'=>'datepreviouslogin', 'type'=>'xsd:dateTime'), - 'statut' => array('name'=>'statut', 'type'=>'xsd:string'), - 'photo' => array('name'=>'photo', 'type'=>'xsd:string'), - 'lang' => array('name'=>'lang', 'type'=>'xsd:string'), - 'entrepots' => array('name'=>'entrepots', 'type'=>'xsd:string'), + 'element' => array('name' => 'element', 'type' => 'xsd:string'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), + 'note' => array('name' => 'note', 'type' => 'xsd:string'), + 'email' => array('name' => 'email', 'type' => 'xsd:string'), + 'signature' => array('name' => 'signature', 'type' => 'xsd:string'), + 'office_phone' => array('name' => 'office_phone', 'type' => 'xsd:string'), + 'office_fax' => array('name' => 'office_fax', 'type' => 'xsd:string'), + 'user_mobile' => array('name' => 'user_mobile', 'type' => 'xsd:string'), + 'admin' => array('name' => 'admin', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), + 'pass_indatabase' => array('name' => 'pass_indatabase', 'type' => 'xsd:string'), + 'pass_indatabase_crypted' => array('name' => 'pass_indatabase_crypted', 'type' => 'xsd:string'), + 'datec' => array('name' => 'datec', 'type' => 'xsd:dateTime'), + 'datem' => array('name' => 'datem', 'type' => 'xsd:dateTime'), + 'fk_thirdparty' => array('name' => 'fk_thirdparty', 'type' => 'xsd:string'), + 'fk_contact' => array('name' => 'fk_contact', 'type' => 'xsd:string'), + 'fk_member' => array('name' => 'fk_member', 'type' => 'xsd:string'), + 'datelastlogin' => array('name' => 'datelastlogin', 'type' => 'xsd:dateTime'), + 'datepreviouslogin' => array('name' => 'datepreviouslogin', 'type' => 'xsd:dateTime'), + 'statut' => array('name' => 'statut', 'type' => 'xsd:string'), + 'photo' => array('name' => 'photo', 'type' => 'xsd:string'), + 'lang' => array('name' => 'lang', 'type' => 'xsd:string'), + 'entrepots' => array('name' => 'entrepots', 'type' => 'xsd:string'), //'rights' => array('name'=>'rights','type'=>'xsd:string'), - 'canvas' => array('name'=>'canvas', 'type'=>'xsd:string') + 'canvas' => array('name' => 'canvas', 'type' => 'xsd:string') ) ); @@ -149,10 +150,10 @@ $server->wsdl->addComplexType( 'all', '', array( - 'name' => array('name'=>'name', 'type'=>'xsd:string'), - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'datec' => array('name'=>'datec', 'type'=>'xsd:string'), - 'nb' => array('name'=>'nb', 'type'=>'xsd:string') + 'name' => array('name' => 'name', 'type' => 'xsd:string'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'datec' => array('name' => 'datec', 'type' => 'xsd:string'), + 'nb' => array('name' => 'nb', 'type' => 'xsd:string') ) ); @@ -164,42 +165,42 @@ $server->wsdl->addComplexType( 'SOAP-ENC:Array', array(), array( - array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:group[]') + array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:group[]') ), 'tns:group' ); $thirdpartywithuser_fields = array( // For thirdparty and contact - 'name' => array('name'=>'name', 'type'=>'xsd:string'), - 'firstname' => array('name'=>'firstname', 'type'=>'xsd:string'), - 'name_thirdparty' => array('name'=>'name_thirdparty', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'client' => array('name'=>'client', 'type'=>'xsd:string'), - 'fournisseur' => array('name'=>'fournisseur', 'type'=>'xsd:string'), - 'address' => array('name'=>'address', 'type'=>'xsd:string'), - 'zip' => array('name'=>'zip', 'type'=>'xsd:string'), - 'town' => array('name'=>'town', 'type'=>'xsd:string'), - 'country_id' => array('name'=>'country_id', 'type'=>'xsd:string'), - 'country_code' => array('name'=>'country_code', 'type'=>'xsd:string'), - 'phone' => array('name'=>'phone', 'type'=>'xsd:string'), - 'phone_mobile' => array('name'=>'phone_mobile', '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'), - 'tva_assuj' => array('name'=>'tva_assuj', 'type'=>'xsd:string'), - 'tva_intra' => array('name'=>'tva_intra', 'type'=>'xsd:string'), + 'name' => array('name' => 'name', 'type' => 'xsd:string'), + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), + 'name_thirdparty' => array('name' => 'name_thirdparty', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'client' => array('name' => 'client', 'type' => 'xsd:string'), + 'fournisseur' => array('name' => 'fournisseur', 'type' => 'xsd:string'), + 'address' => array('name' => 'address', 'type' => 'xsd:string'), + 'zip' => array('name' => 'zip', 'type' => 'xsd:string'), + 'town' => array('name' => 'town', 'type' => 'xsd:string'), + 'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'), + 'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'), + 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), + 'phone_mobile' => array('name' => 'phone_mobile', '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'), + 'tva_assuj' => array('name' => 'tva_assuj', 'type' => 'xsd:string'), + 'tva_intra' => array('name' => 'tva_intra', 'type' => 'xsd:string'), // For user - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'group_id' => array('name'=>'group_id', 'type'=>'xsd:string') + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'group_id' => array('name' => 'group_id', 'type' => 'xsd:string') ); $elementtype = 'socpeople'; @@ -221,7 +222,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie $type = 'xsd:string'; } - $extrafield_array['contact_options_'.$key] = array('name'=>'contact_options_'.$key, 'type'=>$type); + $extrafield_array['contact_options_'.$key] = array('name' => 'contact_options_'.$key, 'type' => $type); } } @@ -247,9 +248,9 @@ $server->wsdl->addComplexType( 'all', '', array( - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), ) ); @@ -267,9 +268,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getUser', // 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', 'user'=>'tns:user'), + array('result' => 'tns:result', 'user' => 'tns:user'), $ns, $ns.'#getUser', $styledoc, @@ -280,9 +281,9 @@ $server->register( $server->register( 'getListOfGroups', // Entry values - array('authentication'=>'tns:authentication'), + array('authentication' => 'tns:authentication'), // Exit values - array('result'=>'tns:result', 'groups'=>'tns:GroupsArray'), + array('result' => 'tns:result', 'groups' => 'tns:GroupsArray'), $ns, $ns.'#getListOfGroups', $styledoc, @@ -293,9 +294,9 @@ $server->register( $server->register( 'createUserFromThirdparty', // Entry values - array('authentication'=>'tns:authentication', 'thirdpartywithuser'=>'tns:thirdpartywithuser'), + array('authentication' => 'tns:authentication', 'thirdpartywithuser' => 'tns:thirdpartywithuser'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#createUserFromThirdparty', $styledoc, @@ -306,9 +307,9 @@ $server->register( $server->register( 'setUserPassword', // Entry values - array('authentication'=>'tns:authentication', 'shortuser'=>'tns:shortuser'), + array('authentication' => 'tns:authentication', 'shortuser' => 'tns:shortuser'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#setUserPassword', $styledoc, @@ -363,8 +364,8 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') if ($result > 0) { // Create $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'user'=>array( + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'user' => array( 'id' => $user->id, 'lastname' => $user->lastname, 'firstname' => $user->firstname, @@ -406,7 +407,7 @@ function getUser($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; @@ -454,7 +455,7 @@ function getListOfGroups($authentication) $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); - $arraygroups[] = array('id'=>$obj->rowid, 'name'=>$obj->name, 'datec'=>$obj->datec, 'nb'=>$obj->nb); + $arraygroups[] = array('id' => $obj->rowid, 'name' => $obj->name, 'datec' => $obj->datec, 'nb' => $obj->nb); $i++; } } else { @@ -466,13 +467,13 @@ function getListOfGroups($authentication) if ($error) { $objectresp = array( - 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), - 'groups'=>$arraygroups + 'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel), + 'groups' => $arraygroups ); } else { $objectresp = array( - 'result'=>array('result_code' => 'OK', 'result_label' => ''), - 'groups'=>$arraygroups + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'groups' => $arraygroups ); } @@ -648,8 +649,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) if (!$error) { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>'SUCCESS'), 'id'=>$socid_return); - $error = 0; + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => 'SUCCESS'), 'id' => $socid_return); } } else { $error++; @@ -672,7 +672,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) if ($error) { $db->rollback(); $objectresp = array( - 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel) + 'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel) ); } @@ -728,7 +728,7 @@ function setUserPassword($authentication, $shortuser) $errorlabel = 'Error when changing password'; } else { $objectresp = array( - 'result'=>array('result_code' => 'OK', 'result_label' => ''), + 'result' => array('result_code' => 'OK', 'result_label' => ''), ); } } else { @@ -746,7 +746,7 @@ function setUserPassword($authentication, $shortuser) if ($error) { $objectresp = array( - 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel) + 'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel) ); } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 47d572654be..e77e4b5b3c9 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1075,15 +1075,16 @@ class Website extends CommonObject $i++; } + $line = '-- File generated by Dolibarr '.DOL_VERSION.' --;'."\n"; + $line .= "\n"; + fwrite($fp, $line); + foreach ($listofpages as $pageid => $objectpageold) { $oldpageid = $objectpageold->id; $allaliases = $objectpageold->pageurl; $allaliases .= ($objectpageold->aliasalt ? ','.$objectpageold->aliasalt : ''); - $line = '-- File generated by Dolibarr '.DOL_VERSION.' -- '.dol_print_date(dol_now('gmt'), 'standard', 'gmt').' UTC --;'."\n"; - $line .= "\n"; - if (!getDolGlobalInt('WEBSITE_EXPORT_KEEP_FILES_OF_PAGES')) { // We don't need to keep the PHP files of pages and aliases (they are regenerated at import) so we remove them. You can ask to keep them in the export // Delete the pageX.tpl.php page dol_delete_file($conf->website->dir_temp.'/'.$website->ref.'/containers/page'.$objectpageold->id.'.tpl.php', 0, 0, 0, null, false, 0); @@ -1098,13 +1099,12 @@ class Website extends CommonObject } // This comment syntax is important, it is parsed by import to get information on page ID and all aliases to regenerate - $line .= '-- Page ID '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; // newid start at 1, 2... + $line = '-- Page ID '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; // newid start at 1, 2... $line .= "\n"; fwrite($fp, $line); // Warning: We must keep llx_ here. It is a generic SQL. $line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, lang, image, keywords, status, date_creation, tms, import_key, grabbed_from, type_container, htmlheader, content, author_alias, allowed_in_frames)'; - $line .= " VALUES("; $line .= $objectpageold->newid."__+MAX_llx_website_page__, "; $line .= ($objectpageold->newfk_page ? $this->db->escape($objectpageold->newfk_page)."__+MAX_llx_website_page__" : "null").", "; @@ -1170,7 +1170,7 @@ class Website extends CommonObject fwrite($fp, $line); } - $line .= "\n"; + fwrite($fp, "\n"); } $line = "\n-- For Dolibarr v14+ --;\n"; @@ -1180,6 +1180,7 @@ class Website extends CommonObject fwrite($fp, $line); fclose($fp); + dolChmod($filesql); // Build zip file @@ -1244,7 +1245,8 @@ class Website extends CommonObject $arrayreplacement['__LOGO_MINI_KEY__'] = $this->db->escape($mysoc->logo_mini); $arrayreplacement['__LOGO_KEY__'] = $this->db->escape($mysoc->logo); - // Copy containers + + // Copy containers directory dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/containers', $conf->website->dir_output.'/'.$object->ref, 0, 1); // Overwrite if exists // Make replacement into css and htmlheader file @@ -1262,8 +1264,17 @@ class Website extends CommonObject $error++; } - dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/image/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/image/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists - dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/js/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/js/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists + $result = dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/image/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/image/'.$object->ref, 0, 1); + if ($result < 0) { + $this->errors[] = 'Failed to copy files into '.$conf->website->dir_output.'/'.$object->ref.'/medias/image/'.$object->ref.'.'; + return -5; + } + + $result = dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/js/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/js/'.$object->ref, 0, 1); + if ($result < 0) { + $this->errors[] = 'Failed to copy files into '.$conf->website->dir_output.'/'.$object->ref.'/medias/js/'.$object->ref.'.'; + return -5; + } $sqlfile = $conf->website->dir_temp."/".$object->ref.'/website_pages.sql'; @@ -1288,7 +1299,7 @@ class Website extends CommonObject $objectpagestatic = new WebsitePage($this->db); - // Make replacement of IDs + // Regenerate the php files for pages $fp = fopen($sqlfile, "r"); if ($fp) { while (!feof($fp)) { @@ -1296,18 +1307,30 @@ class Website extends CommonObject // Warning fgets with second parameter that is null or 0 hang. $buf = fgets($fp, 65000); - if (preg_match('/^-- Page ID (\d+)\s[^\s]+\s(\d+).*Aliases\s(.*)\s--;/i', $buf, $reg)) { + $newid = 0; + + // Scan the line + 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); $aliasesarray = explode(',', $reg[3]); - dol_syslog("Found ID ".$oldid." to replace with ID ".$newid." and shortcut aliases to create: ".$reg[3]); + 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); + //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)) { + // 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[2]); + } + + if ($newid) { $objectpagestatic->fetch($newid); - // The move is not enough, so we regenerate pageX.tpl.php + // We regenerate the pageX.tpl.php $filetpl = $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php'; $result = dolSavePageContent($filetpl, $object, $objectpagestatic); if (!$result) { @@ -1346,7 +1369,7 @@ class Website extends CommonObject } } - // Regenerate index page to point to the new index page + // Regenerate the index.php page to point to the new index page $pathofwebsite = $conf->website->dir_output.'/'.$object->ref; dolSaveIndexPage($pathofwebsite, $pathofwebsite.'/index.php', $pathofwebsite.'/page'.$object->fk_default_home.'.tpl.php', $pathofwebsite.'/wrapper.php', $object); @@ -1684,173 +1707,20 @@ class Website extends CommonObject // Export on target sources $resultarray = dol_uncompress($pathtotmpzip, $destdir); + // Remove the file README and LICENSE from the $destdir (already into the containers directory) + dol_delete_file($destdir.'/README.md'); + dol_delete_file($destdir.'/LICENSE'); + + // Remove non required files (will be re-generated during the import) + dol_delete_file($destdir.'/containers/index.php'); + dol_delete_file($destdir.'/containers/master.inc.php'); + if (!empty($resultarray)) { setEventMessages("Error, failed to unzip the export into target dir", null, 'errors'); } else { setEventMessages("Website content written into ".$destdirrel, null, 'mesgs'); } - /* - $sourcedir = $conf->website->dir_output."/".$website->ref; - - // Get array with hash of files (for the last sync) - $fichierEtat = $sourcedir . '/filelist-'.dol_sanitizeFileName($destdir).'.txt'; - $etatPrecedent = $this->checkPreviousState($fichierEtat); - - // Get list of all source files of the website - $arraySourcedir = dol_dir_list($sourcedir); - - // Get list of modified files - $modifications = []; - foreach ($arraySourcedir as $file) { - if (substr($file['name'], -4) === '.old') { - continue; - } - $hashActuel = hash_file('md5', $file['fullname']); - - // Check whether the file is new or has been modified - if (!isset($etatPrecedent[$file['name']]) || $etatPrecedent[$file['name']] !== $hashActuel) { - $modifications[] = $file; - } - - $etatPrecedent[$file['name']] = $hashActuel; // we store he new hash to record it later on disk. - } - - $arraydestdir = dol_dir_list($destdir, "all", 1); - $differences = []; - $names = array_column($arraydestdir, 'name'); - $namesSource = array_column($arraySourcedir, 'name'); - - if (count($modifications) > 1) { - foreach ($modifications as $fichierModifie) { - $nomFichierModifie = $fichierModifie['name']; - if ($nomFichierModifie == basename($fichierEtat)) { - continue; - } - $success = 0; - - //check if it is a new file - if ((!preg_match('/^page\d+\.tpl\.php$/', $nomFichierModifie)) && (!in_array($nomFichierModifie, $names))) { - if (file_exists($fichierModifie['fullname']) && dol_is_dir($destdir.'/containers')) { - $cp = dol_copy($fichierModifie['fullname'], $destdir.'/containers/'.$nomFichierModifie, '0664'); - if ($cp > 0) { - if (file_exists($destdir.'/containers/'.$nomFichierModifie)) { - $tabnumpage = array(); - foreach ($arraydestdir as $fileDest) { - if ($this->extractNumberFromFilename($fileDest['name']) !== -1) { - $tabnumpage[] = $this->extractNumberFromFilename($fileDest['name']); - } - } - $getContentSource = file_get_contents($destdir.'/containers/'.$nomFichierModifie); - $nextpage = max($tabnumpage) + 1; - $chaineModifiee = preg_replace('/page\d+\.tpl\.php/', 'page' . $nextpage . '.tpl.php', $getContentSource); - $write = file_put_contents($destdir.'/containers/'.$nomFichierModifie, $chaineModifiee); - if ($write !== false) { - if (!touch($destdir.'/containers/'."page" . $nextpage . ".tpl.php")) { - setEventMessages("Please check permission to create page" . $nextpage . ".tpl.php in template ".$website->name_template."", null, 'errors'); - } - $filesFound = ''; - foreach ($arraySourcedir as $file) { - if ($file['name'] == $nomFichierModifie) { - $fileContent = file_get_contents($file['fullname']); - $matches = array(); - if (preg_match("/page\d+\.tpl\.php/", $fileContent, $matches)) { - $filesFound = $matches[0]; - break; - } - } - } - foreach ($arraySourcedir as $file) { - if ($file['name'] == $filesFound) { - if (!is_writable($file['fullname'])) { - dolChmod($file['fullname'], '0664'); - } - $diff = $this->showDifferences(file_get_contents($destdir.'/containers/'."page" . $nextpage . ".tpl.php"), file_get_contents($file['fullname']), array($nextpage,$this->extractNumberFromFilename($file['name']))); - if ($diff != -1) { - $replace = $this->replaceLineUsingNum($destdir.'/containers/'."page" . $nextpage . ".tpl.php", $diff); - if ($replace !== false) { - setEventMessages("Copy file page".$nextpage.".tpl.php in template ".$this->name_template." with success", null, 'warnings'); - } - } - } - } - } - } - - $this->saveState($etatPrecedent, $fichierEtat); - setEventMessages("file ".$nomFichierModifie." was created in template ".$website->name_template."", null, 'warnings'); - - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website->ref); - exit(); - } - } else { - setEventMessages("Error, target dir containers not found", null, 'errors'); - $error = 1; - break; - } - } - - // Find the corresponding file in the destination folder - if (!$error && in_array($nomFichierModifie, $namesSource)) { - foreach ($arraydestdir as $destFile) { - if ($destFile['name'] == $nomFichierModifie) { - $sourceContent = file_get_contents($fichierModifie['fullname']); - $destContent = file_get_contents($destFile['fullname']); - - if ($sourceContent !== $destContent) { - $differences[$nomFichierModifie] = $this->showDifferences($destContent, $sourceContent); - if (count($differences[$nomFichierModifie]) > 0) { - $result = $this->replaceLineUsingNum($destFile['fullname'], $differences[$nomFichierModifie]); - if ($result >= 0) { - setEventMessages("file ".$nomFichierModifie." was modified in template ".$website->name_template."", null, 'warnings'); - } else { - if ($result == -2) { - setEventMessages("No permissions to write into file ".$destdirrel.'/'.$nomFichierModifie." from the current website ".$website->name_template."", null, 'errors'); - - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website->ref); - exit(); - } - setEventMessages("file ".$nomFichierModifie." was not modified", null, 'errors'); - } - } - } - } - - if (preg_match('/page(\d+)\.tpl\.php/', $nomFichierModifie)) { - $differences[$nomFichierModifie] = $this->compareFichierModifie($sourcedir, $destdir, $fichierModifie); - if (count($differences[$nomFichierModifie]) > 0) { - $result = $this->replaceLineUsingNum($differences[$nomFichierModifie]['file_destination']['fullname'], $differences[$nomFichierModifie]); - if ($result !== false) { - if ($result == -2) { - setEventMessages("No permissions to write into file ".$destdirrel.'/'.$differences[$nomFichierModifie]['file_destination']['name']." from the current website ".$website->name_template."", null, 'errors'); - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website->ref); - exit(); - } - $success++; - } - } - } - } - } - } - if ($success > 0) { - // Save the state file filelist.txt - $this->saveState($etatPrecedent, $fichierEtat); - setEventMessages("file ".$differences[$nomFichierModifie]['file_destination']['name']." was modified in template ".$website->name_template."", null, 'warnings'); - - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website->ref); - exit(); - } - } else { - setEventMessages("No file has been modified", null, 'errors'); - } - - // save state file - if (!$error) { - $this->saveState($etatPrecedent, $fichierEtat); - } - */ - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website->ref); exit(); } @@ -1918,38 +1788,6 @@ class Website extends CommonObject return file_put_contents($pathname, serialize($etat)); } - /** - * create file for save state of all files in folder - * - * @param string $sourcedir path of folder - * @return void - */ - /* - public function initFilesStatus($sourcedir) - { - $fichierEtat = $sourcedir . '/filelist-lastwrite-doctemplates.txt'; - - $etatPrecedent = $this->checkPreviousState($fichierEtat); - - // for first save state when create file - if (empty($etatPrecedent)) { - $arraySourcedir = dol_dir_list($sourcedir, "files"); - $etatFichiers = []; - - foreach ($arraySourcedir as $file) { - // Ignore .old files and the status file itself - if (substr($file['name'], -4) === '.old' || $file['name'] === basename($fichierEtat)) { - continue; - } - - $hashActuel = hash_file('md5', $file['fullname']); - $etatFichiers[$file['name']] = $hashActuel; - } - $this->saveState($etatFichiers, $fichierEtat); - } - } - */ - /** * Compare two files has not same name but same content * @param string $dossierSource filepath of folder source diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index f7d8829bd71..2da0b7f5390 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,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'), @@ -178,7 +178,7 @@ class WebsitePage extends CommonObject //'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000), 'fk_website' => array('type' => 'integer', 'label' => 'WebsiteId', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 40, 'searchall' => 0, 'foreignkey' => 'websitepage.rowid'), 'fk_page' => array('type' => 'integer', 'label' => 'ParentPageId', 'enabled' => 1, 'visible' => 1, 'notnull' => -1, 'position' => 45, 'searchall' => 0, 'foreignkey' => 'website.rowid'), - 'allowed_in_frames' => array('type' => 'integer', 'label' => 'AllowedInFrames', 'enabled' => 1, 'visible' => -1, 'position' => 48, 'searchall' => 0, 'default' => 0), + 'allowed_in_frames' => array('type' => 'integer', 'label' => 'AllowedInFrames', 'enabled' => 1, 'visible' => -1, 'position' => 48, 'searchall' => 0, 'default' => '0'), 'htmlheader' => array('type' => 'html', 'label' => 'HtmlHeader', 'enabled' => 1, 'visible' => 0, 'position' => 50, 'searchall' => 0), 'content' => array('type' => 'mediumtext', 'label' => 'Content', 'enabled' => 1, 'visible' => 0, 'position' => 51, 'searchall' => 0), 'grabbed_from' => array('type' => 'varchar(255)', 'label' => 'GrabbedFrom', 'enabled' => 1, 'visible' => 1, 'index' => 1, 'position' => 400, 'comment' => 'URL page content was grabbed from'), diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 31b79d9722e..d64888743cb 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1,6 +1,7 @@ * Copyright (C) 2020 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 @@ -682,7 +683,7 @@ if ($action == 'adddir' && $permtouploadfile) } */ -// Add site +// Add a website if ($action == 'addsite' && $usercanedit) { $db->begin(); @@ -747,6 +748,8 @@ if ($action == 'addsite' && $usercanedit) { } } +'@phan-var-force int $error'; + // Add page/container if ($action == 'addcontainer' && $usercanedit) { dol_mkdir($pathofwebsite); @@ -761,6 +764,7 @@ if ($action == 'addcontainer' && $usercanedit) { $grabimagesinto = GETPOST('grabimagesinto', 'alpha'); include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + // The include seems to break typing on variables if (empty($urltograb)) { $error++; @@ -1151,7 +1155,17 @@ if ($action == 'addcontainer' && $usercanedit) { $substitutionarray = array(); $substitutionarray['__WEBSITE_CREATE_BY__'] = $user->getFullName($langs); - // Define id of page the new page is translation of + // Define id of the page the new page is translation of + /* + if ($objectpage->lang == $object->lang) { + // If + $pageidfortranslation = (GETPOSTINT('pageidfortranslation') > 0 ? GETPOSTINT('pageidfortranslation') : 0); + if ($pageidfortranslation > 0) { + // We must update the page $pageidfortranslation to set fk_page = $object->id. + // But what if page $pageidfortranslation is already linked to another ? + } + } else { + */ $pageidfortranslation = (GETPOSTINT('pageidfortranslation') > 0 ? GETPOSTINT('pageidfortranslation') : 0); if ($pageidfortranslation > 0) { // Check if the page we are translation of is already a translation of a source page. if yes, we will use source id instead @@ -1162,6 +1176,7 @@ if ($action == 'addcontainer' && $usercanedit) { } } $objectpage->fk_page = $pageidfortranslation; + //} $sample = GETPOST('sample', 'alpha'); if (empty($sample)) { @@ -2402,6 +2417,22 @@ if ($usercanedit && (($action == 'updatesource' || $action == 'updatecontent' || } } +if ($action == 'deletelang' && $usercanedit) { + $sql = "UPDATE ".MAIN_DB_PREFIX."website_page SET fk_page = NULL"; + $sql .= " WHERE rowid = ".GETPOSTINT('deletelangforid'); + //$sql .= " AND fk_page = ".((int) $objectpage->id); + + $resql = $db->query($sql); + if (!$resql) { + setEventMessages($db->lasterror(), null, 'errors'); + } else { + $objectpage->fk_page = null; + } + + $action = 'editmeta'; +} + + // Export site if ($action == 'exportsite' && $user->hasRight('website', 'export')) { $fileofzip = $object->exportWebSite(); @@ -3366,7 +3397,7 @@ if (!GETPOST('hide_websitemenu')) { // Edit CKEditor if (getDolGlobalInt('WEBSITE_ALLOW_CKEDITOR')) { - print ''.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "CKEditor" : "CKEditor")).''; + print ''.dol_escape_htmltag("CKEditor").''; } print ''; @@ -4356,7 +4387,9 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties if ($i > 0) { $tmpstring .= '
'; } - $tmpstring .= $tmppage->getNomUrl(1).' ('.$tmppage->lang.')'; + $tmpstring .= $tmppage->getNomUrl(1).' '.picto_from_langcode($tmppage->lang).' '.$tmppage->lang; + // Button unlink + $tmpstring .= ' id).'">'.img_picto($langs->trans("Remove"), 'unlink').''; $translatedby++; $i++; } @@ -4372,17 +4405,27 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties dol_print_error($db); } } - if (empty($translatedby) && ($action == 'editmeta' || $action == 'createcontainer' || $objectpage->fk_page > 0)) { + if ((empty($translatedby) || ($objectpage->lang != $object->lang)) && ($action == 'editmeta' || $action == 'createcontainer' || $objectpage->fk_page > 0)) { $sourcepage = new WebsitePage($db); - $result = $sourcepage->fetch($objectpage->fk_page); - if ($result == 0) { - // not found, we can reset value to clean database - } elseif ($result > 0) { + $result = 1; + if ($objectpage->fk_page > 0) { + $result = $sourcepage->fetch($objectpage->fk_page); + if ($result == 0) { + // not found, we can reset value to clean database + // TODO + } + } + if ($result >= 0) { + if ($translatedby) { + print '
'; + } $translationof = $objectpage->fk_page; print ''.$langs->trans('ThisPageIsTranslationOf').' '; - print $formwebsite->selectContainer($website, 'pageidfortranslation', ($translationof ? $translationof : -1), 1, $action, 'minwidth300', array($objectpage->id)); + print $sourcepage->getNomUrl(2).' '.$formwebsite->selectContainer($website, 'pageidfortranslation', ($translationof ? $translationof : -1), 1, $action, 'minwidth300', array($objectpage->id)); if ($translationof > 0 && $sourcepage->lang) { - print $sourcepage->getNomUrl(2).' ('.$sourcepage->lang.')'; + print picto_from_langcode($sourcepage->lang).' '.$sourcepage->lang; + // Button unlink + print ' id).'">'.img_picto($langs->trans("Remove"), 'unlink').''; } } } @@ -5157,6 +5200,12 @@ if ((empty($action) || $action == 'preview' || $action == 'createfromclone' || $ //var_dump($filetpl); $filephp = $filetpl; + + // Get session info and obfuscate session cookie + $savsessionname = session_name(); + $savsessionid = $_COOKIE[$savsessionname]; + $_COOKIE[$savsessionname] = 'obfuscatedcookie'; + ob_start(); try { $res = include $filephp; @@ -5168,6 +5217,9 @@ if ((empty($action) || $action == 'preview' || $action == 'createfromclone' || $ } $newcontent = ob_get_contents(); ob_end_clean(); + + // Restore data + $_COOKIE[$savsessionname] = $savsessionid; } // Change the contenteditable to "true" or "false" when mode Edit Inline is on or off diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index 8a3e195f0fd..f7542c226f1 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -96,25 +96,25 @@ 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,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"), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'position' => 5, 'notnull' => 1, 'default' => '1', 'index' => 1), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'noteditable' => '0', 'default' => '', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object", 'csslist' => 'nowraponall'), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax125', 'showoncombobox' => '2',), - 'type' => array('type' => 'varchar(8)', 'label' => 'Type', 'enabled' => '1', 'position' => 32, 'default' => 1, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('HUMAN' => 'Human', 'MACHINE' => 'Machine', 'BOTH' => 'HumanMachine'),), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 0,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2, 'csslist' => 'nowraponall'), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2, 'csslist' => 'nowraponall'), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 512, 'notnull' => -1, 'visible' => -2,), - 'nb_operators_required' => array('type' => 'integer', 'label' => 'NbOperatorsRequired', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), - 'thm_operator_estimated' => array('type' => 'double', 'help' => 'THMOperatorEstimatedHelp','label' => 'THMOperatorEstimated', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), - 'thm_machine_estimated' => array('type' => 'double', 'help' => 'THMMachineEstimatedHelp', 'label' => 'THMMachineEstimated', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'default' => 1, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled'),), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 1, 'noteditable' => 0, 'default' => '', 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Reference of object", 'csslist' => 'nowraponall'), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax125', 'showoncombobox' => '2',), + 'type' => array('type' => 'varchar(8)', 'label' => 'Type', 'enabled' => 1, 'position' => 32, 'default' => '1', 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('HUMAN' => 'Human', 'MACHINE' => 'Machine', 'BOTH' => 'HumanMachine'),), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2, 'csslist' => 'nowraponall'), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2, 'csslist' => 'nowraponall'), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 512, 'notnull' => -1, 'visible' => -2,), + 'nb_operators_required' => array('type' => 'integer', 'label' => 'NbOperatorsRequired', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), + 'thm_operator_estimated' => array('type' => 'double', 'help' => 'THMOperatorEstimatedHelp','label' => 'THMOperatorEstimated', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), + 'thm_machine_estimated' => array('type' => 'double', 'help' => 'THMMachineEstimatedHelp', 'label' => 'THMMachineEstimated', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'default' => '1', 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled'),), ); /** diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 853bba00724..83a326ead04 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -36,7 +36,7 @@ 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,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'), diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index 54e342ba09a..290b6d34714 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -35,7 +35,7 @@ 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,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'), diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index b1057e8f2db..edd9e77cb70 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,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( @@ -101,7 +101,7 @@ class Hook extends CommonObject 'enabled' => 1, 'visible' => 0, 'notnull' => 1, - 'default' => 1, + 'default' => '1', 'index' => 1, 'position' => 20, ), @@ -178,7 +178,7 @@ class Hook extends CommonObject 'enabled' => 1, 'visible' => 1, 'notnull' => 1, - 'default' => 0, + 'default' => '0', 'index' => 1, 'position' => 1000, 'arrayofkeyval' => 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/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index 1d987d5aac5..725216c6cd6 100644 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.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 @@ -205,4 +206,83 @@ class Functions2LibTest extends CommonClassTest print __METHOD__." for ".$ip." result=".$result."\n"; $this->assertEquals(2, $result, $ip); } + + + /** + * Dataprovider for testGetStringBetween + * + * @return array [ "STARTcontentEND", "START", "END", "content"], + 'start does not match' => [ "ScontentEND", "START", "END", ""], + 'end does not match' => [ "STARTcontentN", "START", "END", ""], + 'no match' => [ "content", "START", "END", ""], + 'end before start' => [ "ENDcontentSTART", "START", "END", ""], + 'end inside start' => [ "BAB", "BA", "AB", ""], + 'multiple matches' => [ "BAcontentABBAdoneAB", "BA", "AB", "content"], + ]; + } + + + /** + * Test get_string_between() + * + * @param string $string String to search in. + * @param string $start String indicating start + * @param string $end String indicating end + * @param string $expected Expected result + * + * @return void + * + * @dataProvider stringBetweenDataProvider + */ + public function testGetStringBetween($string, $start, $end, $expected) + { + $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 /*