diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index ef974d9e76329..1eae1b063b040 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,20 +1,21 @@ How to contribute to Dolibarr ============================= -Send a Bug reports or a Feature request +Submit a Bug report or a Feature request --------------------------------------- -*Note*: **GitHub Issues is not a support forum.** If you have questions about Dolibarr / need help on using the software, please use [the forums](https://www.dolibarr.org/forum.php). Forums exist in different languages. +*Note*: **GitHub Issues is not a support forum.** +If you have questions about Dolibarr or need help on using the software, please use [the forums](https://www.dolibarr.org/forum.php). Forums exist in different languages. -Issues to inform about a bug or a development trouble, like requests for a new feature, are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues). -Default **language here is English**. So please prepare your contributions in English (we recommand using an online translation service if you don't know English). +Issues to inform about a bug or a development trouble and requests for a new feature, are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues). +Default **language here is English**. So please prepare your contributions in English (we recommend using an online translation service if you don't speak English). -1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem. +1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if anyone else has already reported your issue. 2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request. 3. Tell us the version you are using! (look at /htdocs/admin/system/dolibarr.php? and check if you are using the latest version) 4. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging information whenever possible). 5. Delete unnecessary submissions. -6. **Check your Message at Preview before sending.** +6. **Check your Message at Preview before submitting.** @@ -23,12 +24,12 @@ Default **language here is English**. So please prepare your contributions in En Submit code --------------------- -This process describes how a Developer can submit code to the project so it can be analysezd and validated by the Merger (we call this a Pull Request). +This process describes how a Developer can submit code to the project so it can be analyzed and validated by the PR Maintainer (we call this a Pull Request). Definition: -- The Developer: is the human knowing the development language of the application that want to change some part of the code by making changement on the sources of the project. -- The Merger: is the human knowing the development and check that the code submitted for approbation is correct to validate it, in other word, the Merger is the approbator of commits. -- The Releaser: is the human that validates that there a freeze/beta version is ok to be released officialy as a stable version. +- Developer: is the human knowing the development language of the application that wants to change some part of the code by modifying the sources of the project. +- PR Maintainer: is the human knowing the development language and code who checks that the code submitted for approbation is correct to validate it, in other words, the PR Maintainer is the approbator of commits. +- Release Maintainer: is the human that validates that a freeze/beta version is ok to be released officially as a stable version. ### Basic workflow @@ -42,15 +43,16 @@ As the Developer: 5. Commit and push your changes. 6. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). -As the Merger: +As the PR Maintainer: -7. The Merger will check and say if he approves or not the commits. During this step, the Merger can modify your own code to make it valid for appobation or ask you to make the change yourself. For this the Merger may add commits himself. Depending on the tools used (can be done from github directly orfrom an IDE), such commits may be done directly after having validating your PR (for example to complete it). +7. The PR Maintainer will check and decide if he approves or not the commits. During this step, the PR Maintainer can modify your own code to make it valid for approbation or ask you to make the change yourself. For this the PR Maintainer may add commits to a PR. Depending on the tools used (can be done from github directly or from an IDE), such commits may be done directly after validating your PR (for example to complete it). -Note: Of course, the Merger, does not need to ask to himself if he is ok to validate a commit he did himself. This is a reason why the Merger can validate commits he did directly without passing by the approbation process described for the Developer. +As the Release Maintainer: -As the Releaser: +8. A tag will be added to take a snapshot of the code with all the changes approved by PR Maintainers, when ready to do a release. -8. A tag will be added to take a photo of the code will all the changes approved by the Merger, when he decide to do a release. + +Note: Project leader(Master Yoda and BDFL) retains all above roles and can directly commit to the project without a PR. Of course anyone can check commit history and comment! @@ -59,21 +61,23 @@ As the Releaser: Unless you're fixing a bug, all pull requests should be made against the *develop* branch. -If you're fixing a bug, it is preferred that you cook your fix and pull request it against an oldest version affected. +If you're fixing a bug, it is preferred that you make a pull request against the oldest version affected. -We recommend to push it into N - 2 for N the latest version available, if not possible into version N - 1, and finally into develop. -This is just a recommendation, currently, if you push a bug fix on a very old version, it is still merged and propagated into higher versions. +We recommend to push it into N - 2 where N is the latest version available, if not possible into version N - 1, and finally into develop. The rule N - 2 is just a tip if you don't know which version to choose to get the best compromise between ease of correction and number of potential beneficiaries of the correction. +If you push a bug fix on a very old version it is still going to be merged and propagated into newer versions(choose wisely because old versions depend on old deprecated/unsupported versions of PHP and external libraries). + + ### General rules - As the Developer, please don't edit the ChangeLog file. This file is generated from all commit messages during the release process by the Project releaser. -- As the Developer: Do not submit changes into files xx_XX/afile.lang. They are language files and are updated automatically by sync from Transifex. If you need to add a new language file, just add it for the en_US language. +- As the Developer: Do not submit changes into files xx_XX/afile.lang. They are language files and are updated/synced automatically from Transifex. If you need to add a new language file, just add it for the en_US language. -- As the Releaser: The releaser will decide to make a new release as soon as the planning of the release is reached and the code in the branch to release reach the status "No more known serious bug known". +- As the Release Maintainer: The Release Maintainer will decide to make a new release as soon as the planning of the release is reached and the code in the branch to release reach the status of "No more known serious bugs". @@ -135,9 +139,9 @@ FIX|Fix #456 Short description (where #456 is number of bug fix, if it exists. I or CLOSE|Close #456 Short description (where #456 is number of feature request, if it exists. In upper case to appear into ChangeLog) or -NEW|New|QUAL|Qual|PERF|Perf Short description (In upper case to appear into ChangeLog, use this if you add a feature not tracked, otherwise use CLOSE #456) +NEW|New|QUAL|Qual|PERF|Perf Short description (In upper case to appear into ChangeLog, use this if you add a feature not tracked, otherwise use CLOSE #xxx) or -Short description (when the commit is not introducing feature nor closing a bug) +Short description (when the commit is not introducing a feature nor closing a bug) Long description (Can span across multiple lines). @@ -154,11 +158,11 @@ a process to follow to optimize the chance to have PRs merged efficiently... * When submitting a pull request, use same rule as [Commits](#commits) for the message. If your pull request only contains 1 commit, GitHub will be smart enough to fill it for you. Otherwise, please be a bit verbose about what you're providing. -* A screenshot will be always required for any PR of change/addition of a GUI behaviour. +* A screenshot will be always required for any PR of change/addition of a GUI behavior. Also, some code changes need a prior approbation: -* if you want to include a new external library (into htdocs/includes directory), please ask before to the core project manager (mention @dolibarr-jedi in your issue) to see if such a library can be accepted. +* if you want to include a new external library (into htdocs/includes directory), please contact the core project manager first (mention @dolibarr-jedi in your issue) to see if such a library can be accepted. * if you add new tables or fields, you MUST first submit a standalone PR with the data structure changes you plan to add/modify (and only data structure changes). Start development only once this data structure has been accepted. @@ -166,12 +170,12 @@ Once a PR has been submitted, you may need to wait for its integration. It is co If the label of PR start with "Draft" or "WIP" (Work In Progress), it will not be analyzed for merging until you change the label of the PR (but it can be analyzed for discussion). -If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration. +If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several months later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration. -If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet. -In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the tag ask you. The majority of open PR are waiting an action of the author of the PR. +If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explains why your PR has not been integrated yet. +In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the tag asks you. The majority of open PRs are waiting an action of the author of the PR. -Statistics on Dolibarr project shows that 95% of submitted PR are reviewed and tagged. Average answer delay is also one of the best among Open source projects (just few days before having the Answer Tag set). This is one of the most important ratio of answered PR in Open Source world for a major project. Don't expect the core team to reach the 100%. +Statistics on Dolibarr project shows that 95% of submitted PRs are reviewed and tagged. Average answer delay is also one of the best among Open source projects (just few days before having the Answer Tag set). This is one of the most important ratio of answered PRs in Open Source world for a major project. Don't expect the core team to reach 100%. A so high ratio is very rare on a so popular project and with the increasing popularity of Dolibarr, this ratio will probably decrease in future to a more common level. @@ -186,9 +190,9 @@ All other translations are managed online at [Transifex](https://www.transifex.c Translations done on transifex are available in the next major release. -Note: Sometimes, the source text (English) is modified. In such a case, the translation is reset. Transifex assume that if the original source +Note: Sometimes, the source text (English) is modified. In such a case, the translation is reset. Transifex assumes that if the original source has changed, the translation is surely no more correct so must be done again. But old translation is not lost and you can use the tab "History" -to retrieve all old translation of a source text, and restore the translation in one click with no need to retranslate it if there is no need to. +to retrieve all old translations of a source text and restore the translation in one click with no need to retranslate it if there is no need to. ### Resources diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 7f55003741613..9dbdf1b5ee4e8 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -61,19 +61,22 @@ jobs: - name: Restore cache id: cache uses: actions/cache/restore@v4 + env: + HASH: ${{ hashFiles('htdocs/install/**') }} + KEY_ROOT: ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }} with: # See https://github.com/actions/cache/issues/1275#issuecomment-1925217178 enableCrossOsArchive: true path: | - db_init.sql - db_init.sql.md5 - key: ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }}-${{ env.CACHE_KEY_PART - }}-${{ github.run_id }} + ./db_init.sql + ./db_init.sql.md5 + key: ${{ env.KEY_ROOT }}-${{ env.HASH }}-${{ env.CACHE_KEY_PART }}-${{ github.run_id }} restore-keys: | - ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }}-${{ env.CACHE_KEY_PART }}- - ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }}-${{ github.head_ref }}- - ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }}-${{ github.base_ref }}- - ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }}- + ${{ env.KEY_ROOT }}-${{ env.HASH }}-${{ env.CACHE_KEY_PART }}- + ${{ env.KEY_ROOT }}-${{ env.HASH }}-${{ github.head_ref }}- + ${{ env.KEY_ROOT }}-${{ env.HASH }}-${{ github.base_ref }}- + ${{ env.KEY_ROOT }}-${{ env.HASH }}- + ${{ env.KEY_ROOT }}- - name: Create local php.ini with open_basedir restrictions shell: cmd @@ -183,4 +186,6 @@ jobs: # See https://github.com/actions/cache/issues/1275#issuecomment-1925217178 enableCrossOsArchive: true key: ${{ steps.cache.outputs.cache-primary-key }} - path: db_init.* + path: | + ./db_init.sql + ./db_init.sql.md5 diff --git a/.gitignore b/.gitignore index 2964b1ead0f0a..830429de679d7 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ htdocs/includes/php-parallel-lint/ htdocs/includes/sebastian/ htdocs/includes/squizlabs/ htdocs/includes/webmozart/ +htdocs/install/install.forced.php htdocs/.well-known/apple-developer-merchantid-domain-association /factory/ /output/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 328005d7a4d9c..45eb0d85dc76c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: (?x)^( htdocs/includes/ckeditor/.*|(\.[^/]*/.*))$ repos: # Several miscellaneous checks and fix (on yaml files, end of files fix) - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: # This hook tests the name of the branch and return an error if the name is # 'develop' or an official version 'x.y' @@ -177,7 +177,7 @@ repos: # Check format of yaml files - repo: https://github.com/adrienverge/yamllint.git - rev: v1.33.0 + rev: v1.35.1 hooks: - id: yamllint args: @@ -187,7 +187,7 @@ repos: # Execute codespell to fix typo errors (setup of codespell into dev/tools/codespell/) - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell # Due to a current limitation of configuration files, @@ -230,14 +230,14 @@ repos: # Check some shell scripts - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.9.0.6 + rev: v0.10.0.1 hooks: - id: shellcheck args: [-W, "100"] # Check sql file syntax - repo: https://github.com/sqlfluff/sqlfluff - rev: 3.0.4 + rev: 3.1.0 hooks: - id: sqlfluff-lint stages: [pre-commit, manual] # manual needed for ci diff --git a/ChangeLog b/ChangeLog index 5c321be8fb197..fbe7c1522bf2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -316,6 +316,77 @@ The following changes may create regressions for some external modules, but were * The signature of method fetch() of class CompanyBankAccount has been modified to match the signature of method Account->fetch() +***** ChangeLog for 19.0.3 compared to 19.0.2 ***** +FIX: #29403 HRM - Unable to delete a skill in a job Profile (#29779) +FIX: #29439 incomplete API return (#29796) +FIX: #29756 Sql error on comment search (#29761) +FIX: #29780 Restore filtes when using "back to list" +FIX: #30010 : Use conf TICKET_MESSAGE_MAIL_INTRO instead of translation key (#30081) +FIX: #30274 : Add the include before executing dolibarr_set_const (#30320) +FIX: #30467 +FIX: #30576 - Salary payment - Date of the payment is not displayed (#30592) +FIX: Accountancy - Avoid space on FEC name file (#29716) +FIX: Accountancy - Generate entries of expense report with localtax (#30411) +FIX: ASSET: annual depreciation starting year (Again ;-)) #26084 (#30040) +FIX: Backport page inventory.php from v18 to fix pagination bugs causing data loss (#29688) +FIX: back to page on error in contact card (#29627) +FIX: Bad calculation of $nbtotalofrecord (#30183) +FIX: Bad count of total of supplie rinvoice into the list +FIX: Better compatibility when objectdesc is not valid, and warnings +FIX: broken pdf preview when multicompany sharing (#30188) +FIX: compatibility with MULTICOMPANY_TRANSVERSE_MODE (#30599) +FIX: Conflict with autoload (#30399) +FIX: Display the real_PMP on inventory when its value is equal to 0 (#22291) +FIX: Error mesg show untranslated extrafield name (#30227) +FIX: executeHooks $object default value (#29647) +FIX: expedition PDF models using units labels (#30358) +FIX: Extrafield intshowzero in list (#29789) +FIX: Extrafields always been delete and re insert for categories (#29781) +FIX: extrafields on Organized events was broken +FIX: fatal error on loading pictures in attached documents of an event (#30553) +FIX: for country type (#29745) +FIX: group by qty in product margin tab (#29853) +FIX: init total amounts in margin module (#29854) +FIX: issue to get the right files exported in Quadratrus export.php (#30004) +FIX: lang output for sales representative on PDF (#30469) +FIX: langs in common docgenerator (#29774) +FIX: langs overwrite (#29630) +FIX: lettering (auto) for invoice deposit with company discount (#29633) +FIX: missing $object and $action for hook parameters (#30484) +FIX: Missing $param in hook call for list +FIX: Missing expense report picto in list (#29917) +FIX: Missing expense report picto in menu (#29908) +FIX: Missing the description in tooltip when option show in tooltip on +FIX: mo cloning (#29686) +FIX: modification date from label in accounting bookkeeping list (#30038) +FIX: move porpale ref pdf cornas (#29989) +FIX: Not qualified lines for reception (#29473) +FIX: on change ref for bank account attachment are lost (#30529) +FIX: orders to bill menu (#30179) +FIX: Page expands when ticket messages are too long (#29785) +FIX: parameter name (#29666) +FIX: PHP8 warning if $conf->reception is checked the old fashion way (#29697) +FIX: PHP 8 warning on output of successful cronjob (#29922) +FIX: PHP exception on getSpecialCode (#29646) +FIX: php warning if cookie doesn’t exist (#29723) +FIX: pos: invoice date incorrectly set because of timezome mismatches (reverts #36e91da) (#30184) +FIX: public project form return an error if SOCIETE_EMAIL_UNIQUE (#29942) +FIX: REPLENISH MANY FOURN WHEN ORDER ALREADY CREATE (#29710) +FIX: Supplier Order search on date valid (#30448) +FIX: Ternary operator condition is always true/false (#29649) +FIX: to avoid error during upgrade with pgsql (#30443) +FIX: transfer in accountancy for expense reports. +FIX: uninitialised var (#29728) +FIX: - Unknown Character on HTML (#30257) +FIX: Unsigned propal having signing date (#29825) +FIX: Update asset.class.php +FIX: update date_echeance of supplier invoices when we update invoice date in the past (#29886) +FIX: User List - Function is show in wrong column when module HRM enabled (#30186) +FIX: var name error and remove useless code (#30601) +FIX: Warning: Undefined property: PropaleLigne::$situation_percent in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/core/lib/pdf.lib.php on line 2442 (#30033) +FIX: wrong value for duration unit (#30261) +FIX: The ZAR currency must show the R before the amount + ***** ChangeLog for 19.0.2 compared to 19.0.1 ***** FIX: $object->oldcopy may be a stdClass and not original object FIX: 16.0 - parent company gets emptied when updating a third party from the card in edit mode (#28269) @@ -1643,7 +1714,7 @@ NEW: Add link to create an element from the category page NEW: add margin infos to takepos invoice lines NEW: Add max size send for "backup and link to mail" option NEW: Add method httponly_accessforbidden() -NEW: Add more advices into the Setup security page +NEW: Add more advice into the Setup security page NEW: Add new global variable for keeping the previous signature information on proposal (case of reopening a proposal) NEW: Add objectLink on shipment NEW: Add option --force on CLI cron_run_jobs.php @@ -3061,8 +3132,8 @@ NEW: add option in Workflow module to set a shipment as closed for Admins -NEW: Add a security center page with all information and advices related to the security of your instance -NEW: Add a performance center page with all information and advices related to the performance of your instance +NEW: Add a security center page with all information and advice related to the security of your instance +NEW: Add a performance center page with all information and advice related to the performance of your instance Modules NEW: Module Recruitment is now stable @@ -7080,7 +7151,7 @@ NEW: Add index and constraints keys on supplier proposal detail table NEW: Add phpunit to check the engine is defined into sql create files. NEW: Add project and Hook to Loan NEW: Add REST API to push a file. -NEW: Allow extrafields list select to be dependands on other standard list and not only other extrafields list +NEW: Allow extrafields list select to be dependent on other standard list and not only other extrafields list NEW: Architecture to manage search criteria persistence (using save_lastsearch_values=1 on exit links and restore_lastsearch_values=1 in entry links) NEW: data files are now also parsed by phpunit for sql syntax NEW: Hook to allow inserting custom product head #6001 @@ -8104,7 +8175,7 @@ NEW: The clicktodial module is now able to provide link "tel:" on phone numbers. NEW: The conditional IF into ODT templates works also on not defined var so we can show data only if defined. Close #3819 NEW: The free text in PDF footers can now be a HTML content. So the WYSIWYG editor is on by default to edit it into module setup. NEW: The thirdparties tabs, the contacts tabs and the members tabs are now presented using a new "top banner", saving space and using a same way to show address, status and navigation arrows. -NEW: Thumbs for statistics on main page are fully clicable (not only link inside the thumb) +NEW: Thumbs for statistics on main page are fully clickable (not only link inside the thumb) NEW: Translate extrafield's labels. NEW: Use new select2 component for juridical status, country and state selection. NEW: When creating order, proposal or invoice from thirdparty card, the project is asked during creation. A link to create project if it does not exists is also available. @@ -8703,7 +8774,7 @@ NEW: [ task #851 ] Add a new field: Commercial name NEW: [ task #977 ] New option to manage product unit Migrated code from GPCSolutions/dolibarr:3.2-units branch and adapted for 3.8 with some improvements NEW: The line where mouse is over can be highlight with option THEME_ELDY_USE_HOVER (on by default) NEW: The notification module accept keyword __SUPERVISOR__ to send notification to supervisor of user. -NEW: Thumbs for statistics on main page are fully clicable (not only link inside the thumb) +NEW: Thumbs for statistics on main page are fully clickable (not only link inside the thumb) NEW: Title of page project contains project ref and label NEW: update skeleton and class builder NEW: Use new select2 component for juridical status, country and state selection. @@ -9854,7 +9925,7 @@ For users: prices, radio). - New: [ task #798 ] Add range limit date on product/services as it is done on order and invoice. -- New: [ task #814 ] Add extrafield feature for projects ands tasks. +- New: [ task #814 ] Add extrafield feature for projects and tasks. - New: [ task #770 ] Add ODT document generation for Projects module. - New: [ task #741 ] Add intervention box. - New: [ task #826 ] Optional increase stock when deleting an invoice already validated. diff --git a/README.md b/README.md index 0012573bd0868..b81d632a7283d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5521/badge)](https://bestpractices.coreinfrastructure.org/projects/5521) -Dolibarr ERP & CRM is a modern software package that helps manage your organization's activities (contacts, suppliers, invoices, orders, stocks, agenda…). +Dolibarr ERP & CRM is a modern software package that helps manage your organization's activities (contacts, quotes, invoices, orders, stocks, agenda, human resources, ecm, manufacturing…). It's an Open-Source Software suite (written in PHP with JavaScript enhancements) designed for small, medium or large companies, foundations and freelancers. @@ -29,7 +29,9 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git ## INSTALLING -### Simple setup +There is a lot of different solutions to install Dolibarr. + +### Using packages If you have low technical skills and you're looking to install Dolibarr ERP/CRM with just a few clicks, you can use one of the packaged versions: @@ -39,7 +41,7 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM Releases can be downloaded from [official website](https://www.dolibarr.org/). -### Recommended and generic setup +### Using the generic step by step setup (recommended) You can use any web server supporting PHP (Apache, Nginx, ...) and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version: @@ -69,7 +71,11 @@ You can use any web server supporting PHP (Apache, Nginx, ...) and a supported d - Follow the installer instructions;;; -### SaaS/Cloud Setup +### Using Docker images + +Dolibarr is also available as a [Docker image](https://hub.docker.com/r/dolibarr/dolibarr). Installation instructions are available [here](https://github.com/Dolibarr/dolibarr-docker). + +### Using ready to use SaaS/Cloud offers If you lack the time to install it yourself, consider exploring commercial 'ready-to-use' Cloud offerings (refer to https://saas.dolibarr.org). Keep in mind that this third option comes with associated costs. diff --git a/build/docker-dev/README.md b/build/docker-dev/README.md index 6daf6d6bd5c13..66358bf2bbe47 100644 --- a/build/docker-dev/README.md +++ b/build/docker-dev/README.md @@ -2,7 +2,7 @@ The docker-compose.yml file is a sample of a config file to use to build and run Dolibarr in the current workspace with Docker. This docker image is intended for development usage. -For production usage you should consider other contributor reference like https://hub.docker.com/r/tuxgasy/dolibarr +For production usage you should consider other contributor reference like https://hub.docker.com/r/dolibarr/dolibarr Before build/run, define the variable HOST_USER_ID as following: diff --git a/build/docker/README.md b/build/docker/README.md index 03932387ee9d9..dc6147ef85533 100644 --- a/build/docker/README.md +++ b/build/docker/README.md @@ -1,7 +1,17 @@ # How to use it ? +This directory is experimental. Scope of its used is not clear and not documented. +If you are looking for a process to run Dolibarr as an official Docker image, you can find it on https://hub.docker.com/r/dolibarr/dolibarr + + +# For experimental dev - TO REMOVE. + +But if you want to execute the version of Dolibarr that is into this current directory as a docker process, you can do it with this commands. + export HOST_USER_ID=$(id -u) export HOST_GROUP_ID=$(id -g) export MYSQL_ROOT_PWD=$(tr -dc A-Za-z0-9 approvalPrompt?'approval_prompt='.$this->approvalPrompt.'&':'').'access_type='.$this->accessType; + return new Uri($url); + } + + JS JSGANTT: ----------- diff --git a/dev/resources/iso-normes/Accountancy-format_Ebp_txt.pdf b/dev/resources/iso-normes/accountancy/Accountancy-format_Ebp_txt.pdf similarity index 100% rename from dev/resources/iso-normes/Accountancy-format_Ebp_txt.pdf rename to dev/resources/iso-normes/accountancy/Accountancy-format_Ebp_txt.pdf diff --git a/dev/resources/iso-normes/Accountancy-format_Winfic-eWinfic-WinSisCompta.pdf b/dev/resources/iso-normes/accountancy/Accountancy-format_Winfic-eWinfic-WinSisCompta.pdf similarity index 100% rename from dev/resources/iso-normes/Accountancy-format_Winfic-eWinfic-WinSisCompta.pdf rename to dev/resources/iso-normes/accountancy/Accountancy-format_Winfic-eWinfic-WinSisCompta.pdf diff --git "a/dev/resources/iso-normes/format_FEC - Lien_outil_de_test_agr\303\251\303\251.pdf" "b/dev/resources/iso-normes/accountancy/format_FEC - Lien_outil_de_test_agr\303\251\303\251.pdf" similarity index 100% rename from "dev/resources/iso-normes/format_FEC - Lien_outil_de_test_agr\303\251\303\251.pdf" rename to "dev/resources/iso-normes/accountancy/format_FEC - Lien_outil_de_test_agr\303\251\303\251.pdf" diff --git a/dev/resources/iso-normes/format_FEC - fie example.txt b/dev/resources/iso-normes/accountancy/format_FEC - fie example.txt similarity index 88% rename from dev/resources/iso-normes/format_FEC - fie example.txt rename to dev/resources/iso-normes/accountancy/format_FEC - fie example.txt index 4285a9403a524..d7d3f1abecf51 100644 --- a/dev/resources/iso-normes/format_FEC - fie example.txt +++ b/dev/resources/iso-normes/accountancy/format_FEC - fie example.txt @@ -1,16 +1,16 @@ JOURNALCODE JOURNALLIB ECRITURENUM ECRITUREDATE COMPTENUM COMPTELIB COMPAUXNUM COMPAUXLIB PIECEREF PIECEDATE ECRITURELIB DEBIT CREDIT ECRITURELET DATELET VALIDDATE MONTANTDEVISE IDEVISE -Banque Banque 17293 20170109 401PPRO PUBLI-PROV L08 20170109 PPRO domiciliation 1TR 187,20 0,00 20170109 -Banque Banque 17293 20170109 5121CRA CR AGRICOLE L08 20170109 PPRO domiciliation 1TR 0,00 187,20 20170109 -Banque Banque 17295 20170109 401ORPA ORANGE PARIS Report 20170109 ORPA adsl par 12 96,00 0,00 20170109 -Banque Banque 17295 20170109 5121CRA CR AGRICOLE Report 20170109 ORPA adsl par 12 0,00 96,00 20170109 -Banque Banque 17302 20170105 401ORVI ORANGE VEBRON INTERNET Report 20170105 ORVI adsl veb 12 26,00 0,00 20170109 -Banque Banque 17302 20170105 5121CRA CR AGRICOLE Report 20170105 ORVI adsl veb 12 0,00 26,00 20170109 -Fournisseurs Fournisseurs 17305 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170119 -Fournisseurs Fournisseurs 17305 20170119 622200 Courtages s/ ventes A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119 -Banque Banque 17306 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170119 -Banque Banque 17306 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119 -Banque Banque 17307 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170131 -Banque Banque 17307 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170131 +Banque Banque 17293 20170109 401PPRO PUBLI-PROV L08 20170109 PPRO domiciliation 1TR 187,20 0,00 20170109 +Banque Banque 17293 20170109 5121CRA CR AGRICOLE L08 20170109 PPRO domiciliation 1TR 0,00 187,20 20170109 +Banque Banque 17295 20170109 401ORPA ORANGE PARIS Report 20170109 ORPA adsl par 12 96,00 0,00 20170109 +Banque Banque 17295 20170109 5121CRA CR AGRICOLE Report 20170109 ORPA adsl par 12 0,00 96,00 20170109 +Banque Banque 17302 20170105 401ORVI ORANGE VEBRON INTERNET Report 20170105 ORVI adsl veb 12 26,00 0,00 20170109 +Banque Banque 17302 20170105 5121CRA CR AGRICOLE Report 20170105 ORVI adsl veb 12 0,00 26,00 20170109 +Fournisseurs Fournisseurs 17305 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170119 +Fournisseurs Fournisseurs 17305 20170119 622200 Courtages s/ ventes A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119 +Banque Banque 17306 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170119 +Banque Banque 17306 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119 +Banque Banque 17307 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170131 +Banque Banque 17307 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170131 diff --git a/dev/resources/iso-normes/format_FEC.pdf b/dev/resources/iso-normes/accountancy/format_FEC.pdf similarity index 100% rename from dev/resources/iso-normes/format_FEC.pdf rename to dev/resources/iso-normes/accountancy/format_FEC.pdf diff --git a/dev/resources/iso-normes/accountancy/import-ofx-format.txt b/dev/resources/iso-normes/accountancy/import-ofx-format.txt new file mode 100644 index 0000000000000..8ba29403a46a2 --- /dev/null +++ b/dev/resources/iso-normes/accountancy/import-ofx-format.txt @@ -0,0 +1,2 @@ +OFX is an old Financial format: +See https://stackoverflow.com/questions/15735330/how-to-parse-a-ofx-version-1-0-2-file-in-php diff --git a/dev/resources/iso-normes/qr-bar-codes/QR code for invoices.txt b/dev/resources/iso-normes/qr-bar-codes/QR code for invoices.txt index a749aa293308f..d84486d27e90e 100644 --- a/dev/resources/iso-normes/qr-bar-codes/QR code for invoices.txt +++ b/dev/resources/iso-normes/qr-bar-codes/QR code for invoices.txt @@ -11,6 +11,7 @@ List of QR Code format we found on some invoices ------------------------------------------ https://en.wikipedia.org/wiki/EPC_QR_code#Generators +Experimental support can be enabled in Dolibarr by setting INVOICE_ADD_EPC_QR_CODE = 1 * For ZATCA QR Code format (Saudi Arabia). Used when INVOICE_ADD_ZATCA_QR_CODE is set @@ -19,10 +20,14 @@ https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a-fatoora-compliant-qr-code -Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php +Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php -* FOR QR-Bill in switzerland - Facture-QR -Syntax of QR Code - See file ig-qr-bill-v2.2-fr.pdf (more doc on https://www.swiss-qr-invoice.org/downloads/) -Syntax of complentary field named "structured information of invoice S1": https://www.swiss-qr-invoice.org/downloads/qr-bill-s1-syntax-fr.pdf +* FOR QR-Bill in switzerland - Facture-QR or QR-Facture +------------------------------------------------------- +- Syntax of QR Code - See file ig-qr-bill-v2.2-fr.pdf (more doc on https://www.swiss-qr-invoice.org/downloads/) +- Syntax of complementary field named "structured information of invoice S1": https://www.swiss-qr-invoice.org/downloads/qr-bill-s1-syntax-fr.pdf To test/validate: https://www.swiss-qr-invoice.org/validator/ + +Experimental support to show the QR code can be enabled in dolibarr by setting INVOICE_ADD_SWISS_QR_CODE = 1. +If setting value to "bottom", the complete top banner can be added at bottom of invoice PDF. Note: an external PHP library may be requested at first PDF generation. diff --git a/dev/resources/iso-normes/qr-bar-codes/ig-qr-bill-v2.2-fr.pdf b/dev/resources/iso-normes/qr-bar-codes/ig-qr-bill-v2.2-fr.pdf index 92e071f99dbdd..f7fe64b79b557 100644 Binary files a/dev/resources/iso-normes/qr-bar-codes/ig-qr-bill-v2.2-fr.pdf and b/dev/resources/iso-normes/qr-bar-codes/ig-qr-bill-v2.2-fr.pdf differ diff --git a/dev/resources/iso-normes/fichier_norme_AFB-CFONB.pdf b/dev/resources/iso-normes/transfer-bank-afb-confb/fichier_norme_AFB-CFONB.pdf similarity index 100% rename from dev/resources/iso-normes/fichier_norme_AFB-CFONB.pdf rename to dev/resources/iso-normes/transfer-bank-afb-confb/fichier_norme_AFB-CFONB.pdf diff --git a/dev/resources/iso-normes/sepa/pain.001.001.03.xsd b/dev/resources/iso-normes/transfer-bank-sepa/pain.001.001.03.xsd similarity index 100% rename from dev/resources/iso-normes/sepa/pain.001.001.03.xsd rename to dev/resources/iso-normes/transfer-bank-sepa/pain.001.001.03.xsd diff --git a/dev/resources/iso-normes/sepa/pain.008.001.02.xsd b/dev/resources/iso-normes/transfer-bank-sepa/pain.008.001.02.xsd similarity index 100% rename from dev/resources/iso-normes/sepa/pain.008.001.02.xsd rename to dev/resources/iso-normes/transfer-bank-sepa/pain.008.001.02.xsd diff --git a/dev/resources/iso-normes/sepa/sample-credit-transfer.xml b/dev/resources/iso-normes/transfer-bank-sepa/sample-credit-transfer.xml similarity index 100% rename from dev/resources/iso-normes/sepa/sample-credit-transfer.xml rename to dev/resources/iso-normes/transfer-bank-sepa/sample-credit-transfer.xml diff --git a/dev/resources/iso-normes/sepa/sample-direct-debit.xml b/dev/resources/iso-normes/transfer-bank-sepa/sample-direct-debit.xml similarity index 100% rename from dev/resources/iso-normes/sepa/sample-direct-debit.xml rename to dev/resources/iso-normes/transfer-bank-sepa/sample-direct-debit.xml diff --git a/dev/resources/iso-normes/sepa/text.txt b/dev/resources/iso-normes/transfer-bank-sepa/text.txt similarity index 76% rename from dev/resources/iso-normes/sepa/text.txt rename to dev/resources/iso-normes/transfer-bank-sepa/text.txt index dfa55834e580b..edf4820b42db4 100644 --- a/dev/resources/iso-normes/sepa/text.txt +++ b/dev/resources/iso-normes/transfer-bank-sepa/text.txt @@ -2,11 +2,11 @@ https://en.wikipedia.org/wiki/Single_Euro_Payments_Area https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html https://www.europeanpaymentscouncil.eu/about-sepa -Spec for credit transfer: +Spec for credit transfer: https://docs.oracle.com/cd/E39124_01/doc.91/e60210/fields_sepa_pay_file_appx.htm#EOAEL00515 To validate a SEPA file: xmllint --schema pain.001.001.03.xsd T200801.xml --noout -To test a SEPA file: -https://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa +To test a SEPA file: +https://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa diff --git a/dev/resources/iso-normes/xmlexport.txt b/dev/resources/iso-normes/xmlexport.txt deleted file mode 100644 index 370c6a638f80d..0000000000000 --- a/dev/resources/iso-normes/xmlexport.txt +++ /dev/null @@ -1 +0,0 @@ -See specification at http://www.ofx.net \ No newline at end of file diff --git a/dev/setup/pre-commit/README.md b/dev/setup/pre-commit/README.md index e610a55c4114f..9ebe65c8a58ae 100644 --- a/dev/setup/pre-commit/README.md +++ b/dev/setup/pre-commit/README.md @@ -94,4 +94,4 @@ CI also runs pre-commit to help maintain code quality. Note: Code for precommits are saved into: -.cache/pre-commit/repoyXXXXX/py_env-python3/lib/pythonX.Y/site-packages/pre_commit_hooks/no_commit_to_branch.py +.cache/pre-commit/repo*/py_env-python3/lib/python*/site-packages/pre_commit_hooks/no_commit_to_branch.py diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index 6f71492b32d79..bb768d9da1781 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -98,7 +98,7 @@ } // PHPSTAN setup -$PHPSTANLEVEL = 4; +$PHPSTANLEVEL = 6; // PHAN setup. Configuration is required, otherwise phan is disabled. $PHAN_CONFIG = "{$path}phan/config_extended.php"; @@ -745,7 +745,7 @@ $html .= <<
Thumbs of most active contributors

-Dolibarr +Dolibarr
END; diff --git a/dev/tools/codespell/codespell-ignore.txt b/dev/tools/codespell/codespell-ignore.txt index ddc0936a3abf4..e0450f0c643b0 100644 --- a/dev/tools/codespell/codespell-ignore.txt +++ b/dev/tools/codespell/codespell-ignore.txt @@ -1,5 +1,5 @@ # List of words codespell will ignore -# one per line, case-sensitive (when not lowercase) +# one per line, must be in lower case. # PROVid provid @@ -7,11 +7,16 @@ provid # PostgreSQL postgresql +# ZAR currency +zar + # Name of contributores noe udo tim +ConfirmActionXxx + # Inside email ba blacklist @@ -83,3 +88,4 @@ datee # other blacklists +confirmactionxxx diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index c04c6d0446d19..e2acab0de5389 100644 --- a/dev/tools/codespell/codespell-lines-ignore.txt +++ b/dev/tools/codespell/codespell-lines-ignore.txt @@ -1,12 +1,6 @@ - || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <= dol_now() - || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee $objMod->dictionaries = $objMod->{"dictionnaries"}; // For backward compatibility - if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee) // dates filter is defined - $datee = $langs->trans("Unknown"); - $datee = dol_print_date($objectligne->date_end, 'day', false, $outputlangs, true); - $txt .= $outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee.''; if (empty($objMod->dictionaries) && !empty($objMod->{"dictionnaries"})) { - print 'id.'">'; + print 'id.'&token='.newToken().'">'; $object->date_ech = $object->periode; $object->periode = $object->date_ech; $reponsesadd = str_split($obj->reponses); @@ -16,182 +10,97 @@ // $object->periode = dol_get_last_day(year of $object->date_ech - 1m, month or $object->date_ech -1m) //$pice = ''; //$typea = ($objp->typea == 'birth') ? $picb : $pice; - print ''; - $date = $overview[0]->udate; + print ''; $dateemail = dol_stringtotime((string) $overview[0]->udate, 'gmt'); - $dateb = $this->db->jdate($data[$j]->datea); - $link->datea = $this->db->jdate($obj->datea); $object->periode = $newdateperiod; - $out .= dol_print_date($file->datea, 'dayhour'); $pice = ''; - $taskstatic->date_end = $this->db->jdate($objp->datee); - $tmp = $element->getSumOfAmount($idofelementuser ? $elementuser : '', $dates, $datee); - $tmpprojtime = $element->getSumOfAmount($idofelementuser ? $elementuser : '', $dates, $datee); // $element is a task. $elementuser may be empty $typea = ($data[$j]->typea == 'birth') ? $picb : $pice; - //var_dump("$key, $tablename, $datefieldname, $dates, $datee"); GETPOSTINT("mouvement"), dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." from=".$overview[0]->from." to=".$overview[0]->to." subject=".$overview[0]->subject); - if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) { jQuery("#mouvement option").removeAttr("selected").change(); jQuery("#mouvement option[value=0]").attr("selected","selected").trigger("change"); jQuery("#mouvement option[value=1]").attr("selected","selected").trigger("change"); jQuery("#mouvement").trigger("change"); - print ''; - $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); - $TFirstDay[reset($TWeek)] = 1; $action = 'transfert'; - $addform .= ''; $date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); $newfiletmp = preg_replace('/\.od(s|t)/i', '', $newfile); $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $object->period = dol_time_plus_duree($object->periode, 1, 'm'); $object->periode = dol_time_plus_duree($object->periode, 1, 'm'); - $project_static->date_end = $this->db->jdate($obj->datee); - $projectstatic->date_end = $db->jdate($objp->datee); - $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek); - $taskstatic->datee = $lines[$i]->date_end; // deprecated $this->category->childs[] = $this->_cleanObjectDatas($cat); - $this->date_approbation = $this->db->jdate($obj->datea); - $this->date_approval = $this->db->jdate($obj->datea); - $this->date_approve = $this->db->jdate($obj->datea); - $this->datea = $this->db->jdate($obj->datea); - $this->datee = $this->db->jdate($obj->datee); $this->periode = $this->db->jdate($obj->period); $tmp = array('id_users' => $obj->id_users, 'nom' => $obj->name, 'reponses' => $obj->reponses); $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0, 1); // Disable hook for the moment //si les reponses ne concerne pas la colonne effacée, on concatenate GETPOST("mouvement", 'alpha'), GETPOSTINT("mouvement"), - foreach ($TWeek as $weekIndex => $weekNb) { - if (count($arrayfields) > 0 && !empty($arrayfields['t.datee']['checked'])) { if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled"); - print ''.$langs->trans("TransferStock").''; - print ''.dol_print_date($link->datea, "dayhour", "tzuser").''; + print ''.$langs->trans("TransferStock").''; $action = 'transfert'; $date_com = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); $date_next_execution = (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear); - $datee = dol_get_last_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') ? GETPOSTINT('monthtoexport') : 12); $datesubscription = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $ensemblereponses = $obj->reponses; $field = preg_replace('/(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:).*$/', '', $tmpcrit); // the name of the field $newcrit = preg_replace('/(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:)/', '', $tmpcrit); - $object->datee = $datee; $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)"; - $sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")"; - $sql .= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'"; - $sql .= " AND er.datee >= '".$this->db->idate($date)."'"; - $sql .= " ORDER BY pt.datee ASC, pt.dateo ASC"; - $sql .= " t.datec, t.dateo, t.datee, t.tms,"; - $sql .= " t.dateo, t.datee, t.planned_workload, t.rang,"; - $sql .= ", datee = ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); - $sql .= "SELECT u.rowid, u.firstname, u.lastname, u.dateemployment as datea, date_format(u.dateemployment, '%d') as daya, 'employment' as typea, u.email, u.statut as status"; - $sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress"; - $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth as datea, date_format(u.birth, '%d') as daya, 'birth' as typea, u.email, u.statut as status"; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses, date_creation)'; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses, ip, date_creation)'; $sql = 'SELECT s.reponses'; $sql2 .= " SET reponses = '".$db->escape($newcar)."'"; - $taskstatic->datee = $db->jdate($obj->date_end); $this->category->childs = array(); - $this->datea = dol_now(); $tmpcrit = preg_replace('/^.*(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:)/', '\1', $tmpcrit); // the condition after the name of the field - 'datee' => $date_end, // mise a jour des reponses utilisateurs dans la base - if (!empty($arrayfields['t.datee']['checked'])) { if ($user->hasRight('stock', 'mouvement', 'lire')) { if (empty($reyear) || empty($remonth) || empty($reday)) { jQuery("#mouvement").change(function() { preg_match('/:([!<>=\s]+|in|notin|like|notlike):/', $tmpcrit, $reg); print $form->selectDate($object->periode, 'period', 0, 0, 0, 'charge', 1); - print ''.$langs->trans("TransferStock").''; + print ''.$langs->trans("TransferStock").''; print ''.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).''; print ''.dol_print_date($db->jdate($obj->periode), 'day').''; print ''.$langs->trans("AddIn").''; print dol_print_date($object->periode, "day"); - $TWeek[$week_number] = $week_number; + "sme", $action = 'transfert'; $cle_rib = strtolower(checkES($rib, $CCC)); $date_com = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); + $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOSTINT('remonth') ? dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')) : -1); $datefrom = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); $datesubscription = dol_mktime(0, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); - $datetouse = ($this->date_end > 0) ? $this->date_end : ((isset($this->datee) && $this->datee > 0) ? $this->datee : 0); - $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet'); $ensemblereponses = $obj->reponses; $head[$h][1] = $langs->trans("Referers"); $head[$tab][1] = $langs->trans("Referers"); $out .= "".$langs->trans("Referer").": ".(isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT) : '')."
\n"; $reday = GETPOSTINT('reday'); - $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_modification, p.budget_amount"; - $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_modification, p.budget_amount'; $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($this->datea)."'"; - $sql .= " datee=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null').","; - $sql .= " f.date_approval as datea,"; - $sql .= " f.date_approve as datea,"; - $sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; - $sql .= " t.datee as date_end,"; - $sql .= " t.dateo as date_start, t.datee as date_end"; - $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; - $sql .= " tms, dateo as date_start, datee as date_end, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; $sql .= ", '".$this->db->idate($this->periode)."'"; $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode as period, cs.import_key"; - $sql .= ", datea = '".$this->db->idate(dol_now())."'"; - $sql .= ", datee"; $sql .= ", periode='".$this->db->idate($this->periode)."'"; - $sql = "INSERT INTO ".$this->db->prefix()."links (entity, datea, url, label, objecttype, objectid)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)"; - $sql = "SELECT SUM(duree) as total_duration, min(date) as dateo, max(date) as datee "; $sql = "SELECT id_users, nom as name, id_sondage, reponses"; $sql = "SELECT id_users, nom as name, reponses"; - $sql = "SELECT p.rowid, p.fk_statut as status, p.fk_opp_status, p.datee as datee"; - $sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".$this->db->prefix()."links"; - $sql = 'SELECT c.rowid, date_creation as datec, tms as datem, date_valid as date_validation, date_approve as datea, date_approve2 as datea2,'; $test = ""; // Same $test = '/javas:cript/google.com'; $this->periode = $this->date_creation + 3600 * 24 * 30; $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Referers'); $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Referers'); $title = $langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime"); - 'datee' => $datee - 'datee' =>array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>1, 'position'=>35), - 'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - ,'datee'=>array('type'=>'date') // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - echo dol_print_date($rule->datee, 'day'); - foreach ($TWeek as $weekNb) { if (!empty($arrayfields['cs.periode']['checked'])) { - if (!empty($arrayfields['p.datee']['checked'])) { - if ($datee > 0) { if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) { if ($user->hasRight('stock', 'mouvement', 'creer')) { if (GETPOSTISSET("reday") && GETPOSTISSET("remonth") && GETPOSTISSET("reyear")) { - if (count($arrayfields) > 0 && !empty($arrayfields['t.datee']['checked'])) { - if (empty($datee)) { if (empty($reyear) || empty($remonth) || empty($reday)) { - if (empty($this->datea)) { - if (in_array('01', $TWeek) && in_array('52', $TWeek) && $weekNb == '01') { - print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); - print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', 0, 0, 0, '', 1, 0); - print $object->datee ? dol_print_date($object->datee, 'daytext') : ' '; print ''; print ''.$langs->trans("AddIn").''; - print ''.$langs->trans("Datee").''; - print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", '', $param, '', $sortfield, $sortorder, 'center '); - * @param string $datee End date (ex 23:59:59) * @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing. - $TWeek = array(); $date = $obj->periode; - $datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - $datee = dol_stringtotime($dateerfc); $datepaid = dol_mktime(12, 0, 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); $datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $datepaye = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); @@ -201,55 +110,31 @@ $head[$h][1] = $langs->trans('Referers'); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', $tmpval); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', $val); - $morewherefilterarray[] = " t.datee <= '".$db->idate($search_date_end_end)."'"; - $morewherefilterarray[] = " t.datee >= '".$db->idate($search_date_end_start)."'"; $opensurveysondage->mail_admin = $_SESSION['adresse']; $pdf->SetXY($savx, $savy); - $projectstatic->datee = $db->jdate($obj->projectdatee); $reday = GETPOST('reday'); $savy = $pdf->getY(); $somethingshown = $formactions->showactions($object, 'mouvement', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= " AND cs.periode <= '".$db->idate($search_date_limit_end)."'"; $sql .= " AND cs.periode >= '".$db->idate($search_date_limit_start)."'"; - $sql .= " AND p.datee <= '".$db->idate($search_date_end_end)."'"; - $sql .= " AND p.datee >= '".$db->idate($search_date_end_start)."'"; - $sql .= " AND t.datee <= '".$db->idate($search_datelimit_end)."'"; - $sql .= " AND t.datee >= '".$db->idate($search_datelimit_start)."'"; - $sql .= " GROUP BY p.ref, p.title, p.rowid, p.fk_statut, p.fk_opp_status, p.public, p.dateo, p.datee, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; - $sql .= " GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,"; $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; - $sql .= " ORDER BY t.dateo DESC, t.rowid DESC, t.datee DESC"; $sql .= " SET reponses = '".$db->escape($nouveauchoix)."'"; $sql .= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode as period, cs.date_ech, cs.amount as total,"; - $sql .= " t.datec, t.dateo, t.datee, t.tms,"; - $sql .= " t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo as date_start, t.datee as date_end, SUM(tasktime.element_duration) as timespent"; - $sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.public, p.dateo as projdate_start, p.datee as projdate_end,"; $sql.= " ".MAIN_DB_PREFIX."notify_def as nd,"; $sql.= " AND nd.fk_action = ad.rowid"; $sql.= " WHERE u.rowid = nd.fk_user"; $sql.= " nd.rowid, ad.code, ad.label"; - $sql2 .= " p.dateo, p.datee,"; - $sql2 .= " s.logo, s.email, s.entity, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee"; $title = $langs->trans('Batch')." ".$shortlabel." - ".$langs->trans('Referers'); - $totalforvisibletasks = projectLinesPerMonth($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $isavailable, 0, $TWeek); $value = preg_replace('/([a-z\.]+)\s*([!<>=]+|in|notin|like|notlike)\s*/', '\1:\2:', $value); // Clean string 'x < 10' into 'x:<:10' so we can then explode on space to get all AND tests to do 'cs.periode' => array('label' => "PeriodEndDate", 'checked' => 1, 'position' => 50), - 't.datee'=>array('label'=>"Deadline", 'checked'=>1, 'position'=>101), - 't.datee'=>array('label'=>"Deadline", 'checked'=>1, 'position'=>5), // Ligne de la periode d'analyse du rapport // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - //$datee=$now - //$dates=dol_time_plus_duree($datee, -1, 'y'); TaskItem(pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt)

- foreach ($TWeek as $weekNb) { - foreach ($TWeek as $week_number) { - if (!empty($arrayfields['t.datee']['checked'])) { if ($action == "transfert") { if ($object->id > 0 && $action == 'addin') { if (GETPOST('reday')) { if (GETPOSTINT("reyear") && GETPOSTINT("remonth") && GETPOSTINT("reday")) { - print $form->selectDate($datee, 'datee', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print ''; print ''."\n"; print ''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").')'; print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "cs.periode", "", $param, '', $sortfield, $sortorder, 'center '); select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth, - print ''; - print ''.$langs->trans("TransferStock").''; - print ''.$langs->trans("TransferStock").''; - print 'id.'&token='.newToken().'">'; - print ''.$langs->trans("TransferStock").''; diff --git a/dev/tools/dolibarr-mysql2pgsql.pl b/dev/tools/dolibarr-mysql2pgsql.pl index 17dda3cb48b23..5e7d87d1234f5 100755 --- a/dev/tools/dolibarr-mysql2pgsql.pl +++ b/dev/tools/dolibarr-mysql2pgsql.pl @@ -157,7 +157,7 @@ print OUT "\\c ". $1; next; } - if ($create_sql ne "") { # we are inside create table statement so lets process datatypes + if ($create_sql ne "") { # we are inside create table statement so let's process datatypes if (/\);/i) { # end of create table sequence $create_sql =~ s/,$//g; # strip last , inside create table diff --git a/dev/tools/dolibarr-postgres2mysql.php b/dev/tools/dolibarr-postgres2mysql.php index 9b7bed014f777..85beb64f0ed45 100644 --- a/dev/tools/dolibarr-postgres2mysql.php +++ b/dev/tools/dolibarr-postgres2mysql.php @@ -3,6 +3,7 @@ /* * Copyright (C) 2005-2011 James Grant Lightbox Technologies Inc. * Copyright (C) 2020 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 @@ -419,7 +420,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) // in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string'), but could also be (number, E'string'); so we can't search for the previous ' // ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character - // at a time, and that's just stupid, so lets just hope this doesn't appear anywhere in the actual data + // at a time, and that's just stupid, so let's just hope this doesn't appear anywhere in the actual data $after = str_replace(" (E'", " ('", $after); $after = str_replace(", E'", ", '", $after); @@ -439,7 +440,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) // in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string') // ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character - // at a time, and that's just stupid, so lets just hope this doesn't appear anywhere in the actual data + // at a time, and that's just stupid, so let's just hope this doesn't appear anywhere in the actual data $after = str_replace(" (E'", " ('", $after); $after = str_replace(", E'", ", '", $after); @@ -457,7 +458,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) // in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string') // ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character - // at a time, and that's just stupid, so lets just hope this doesn't appear anywhere in the actual data + // at a time, and that's just stupid, so let's just hope this doesn't appear anywhere in the actual data // after the first line, we only need to check for it in the middle, not at the beginning of an insert (because the beginning will be on the first line) // $after=str_replace(" (E'","' ('",$after); @@ -497,7 +498,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $reg2 = array(); if (preg_match('/ALTER TABLE ([^\s]+)/', $pkey, $reg2)) { if (empty($arrayofprimaryalreadyintabledef[$reg2[1]])) { - // looks like we have a single line PRIMARY KEY definition, lets go ahead and add it + // looks like we have a single line PRIMARY KEY definition, let's go ahead and add it $output .= str_replace("\n", "", $pkey); // the postgres and mysql syntax for this is (at least, in the example im looking at) // identical, so we can just add it as is. diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 44143cc402d20..aae5bb17da591 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,29 +9,28 @@ */ return [ // # Issue statistics: - // PhanPluginUnknownPropertyType : 2060+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 1350+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 1230+ occurrences - // PhanPluginUnknownObjectMethodCall : 1060+ occurrences - // PhanUndeclaredProperty : 920+ occurrences - // PhanPluginUnknownArrayMethodParamType : 750+ occurrences - // PhanUndeclaredGlobalVariable : 730+ occurrences - // PhanPluginUnknownArrayMethodReturnType : 610+ occurrences - // PhanPossiblyUndeclaredVariable : 410+ occurrences - // PhanPluginDuplicateExpressionAssignmentOperation : 290+ occurrences - // PhanTypeMismatchProperty : 290+ occurrences - // PhanPluginUnknownArrayFunctionParamType : 190+ occurrences - // PhanTypeMismatchArgumentNullableInternal : 160+ occurrences + // PhanPluginUnknownPropertyType : 1790+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 1310+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 1090+ occurrences + // PhanUndeclaredProperty : 810+ occurrences + // PhanPluginUnknownObjectMethodCall : 750+ occurrences + // PhanUndeclaredGlobalVariable : 720+ occurrences + // PhanPluginUnknownArrayMethodParamType : 610+ occurrences + // PhanPluginUnknownArrayMethodReturnType : 530+ occurrences + // PhanPossiblyUndeclaredVariable : 360+ occurrences + // PhanPluginUnknownArrayFunctionReturnType : 230+ occurrences + // PhanTypeMismatchProperty : 220+ occurrences + // PhanPluginUnknownArrayFunctionParamType : 170+ occurrences // PhanTypeExpectedObjectPropAccess : 150+ occurrences - // PhanTypeInvalidLeftOperandOfNumericOp : 130+ occurrences - // PhanUndeclaredMethod : 120+ occurrences + // PhanTypeMismatchArgumentNullableInternal : 150+ occurrences + // PhanPluginUnknownArrayPropertyType : 110+ occurrences + // PhanPluginUndeclaredVariableIsset : 70+ occurrences // PhanPluginEmptyStatementIf : 65+ occurrences // PhanRedefineFunction : 55+ occurrences - // PhanTypeMismatchDimFetch : 50+ occurrences - // PhanTypeSuspiciousNonTraversableForeach : 35+ occurrences - // PhanPossiblyNullTypeMismatchProperty : 25+ occurrences - // PhanEmptyForeach : 20+ occurrences - // PhanRedefinedClassReference : 20+ occurrences + // PhanTypeMismatchDimFetch : 45+ occurrences + // PhanTypeSuspiciousNonTraversableForeach : 45+ occurrences + // PhanPossiblyNullTypeMismatchProperty : 20+ occurrences + // PhanEmptyForeach : 15+ occurrences // PhanTypeComparisonFromArray : 15+ occurrences // PhanTypeExpectedObjectPropAccessButGotNull : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences @@ -40,92 +39,77 @@ return [ // PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences // PhanPluginSuspiciousParamPosition : 10+ occurrences // PhanTypeMismatchDimFetchNullable : 10+ occurrences - // PhanEmptyFQSENInClasslike : 5 occurrences // PhanInvalidFQSENInClasslike : 4 occurrences - // PhanParamTooMany : 4 occurrences - // PhanRedefineClass : 3 occurrences - // PhanTypeConversionFromArray : 3 occurrences + // PhanPluginDuplicateArrayKey : 4 occurrences + // PhanEmptyFQSENInClasslike : 3 occurrences + // PhanUndeclaredMethod : 3 occurrences + // PhanParamTooMany : 2 occurrences // PhanAccessMethodProtected : 1 occurrence - // PhanAccessPropertyStaticAsNonStatic : 1 occurrence - // PhanParamSignatureMismatch : 1 occurrence - // PhanPluginRedundantReturnComment : 1 occurrence - // PhanPluginWhitespaceTrailing : 1 occurrence - // PhanTypeArraySuspiciousNull : 1 occurrence - // PhanTypeMismatchReturn : 1 occurrence - // PhanUndeclaredVariableAssignOp : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ 'htdocs/accountancy/admin/productaccount.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/accountancy/bookkeeping/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/accountancy/bookkeeping/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/accountancy/bookkeeping/listbyaccount.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/accountancy/class/accountancycategory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/accountancy/class/accountancycategory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/accountancy/class/accountancyimport.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/accountancy/class/accountingaccount.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/accountancy/class/accountingjournal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/accountancy/class/bookkeeping.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/accountancy/class/accountingaccount.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/accountancy/class/accountingjournal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/accountancy/class/api_accountancy.class.php' => ['PhanPluginUnknownArrayPropertyType'], + 'htdocs/accountancy/class/bookkeeping.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/accountancy/class/lettering.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/accountancy/customer/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/accountancy/journal/bankjournal.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/accountancy/journal/expensereportsjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/accountancy/journal/purchasesjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/accountancy/journal/sellsjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/accountancy/journal/sellsjournal.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/accountancy/journal/variousjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/accountancy/supplier/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/accountancy/tpl/export_journal.tpl.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/adherents/admin/member.php' => ['PhanParamTooMany', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredMethod'], - 'htdocs/adherents/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/adherents/canvas/actions_adherentcard_common.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeSuspiciousNonTraversableForeach'], - 'htdocs/adherents/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/adherents/class/adherent.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/adherents/class/adherent_type.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/adherents/class/adherentstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/adherents/admin/member.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/adherents/canvas/actions_adherentcard_common.class.php' => [/* Traverses Adherent as array, ignore */ 'PhanTypeSuspiciousNonTraversableForeach'], + 'htdocs/adherents/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/adherents/class/adherent.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/adherents/class/adherent_type.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/adherents/class/adherentstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/adherents/class/api_members.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/adherents/class/api_subscriptions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/adherents/class/subscription.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/adherents/class/subscription.class.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/adherents/list.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/adherents/note.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/adherents/stats/geo.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/adherents/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/adherents/subscription.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/adherents/subscription/list.php' => ['PhanEmptyForeach'], - 'htdocs/adherents/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/adherents/type.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/admin/agenda_extsites.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/agenda_other.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/admin/agenda_reminder.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/admin/bank.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/admin/agenda_other.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], + 'htdocs/admin/agenda_reminder.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/admin/bank.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/bank_extrafields.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/bankline_extrafields.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/barcode.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/admin/bom.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], - 'htdocs/admin/chequereceipts.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], + 'htdocs/admin/barcode.php' => ['PhanPluginUnknownObjectMethodCall'], + 'htdocs/admin/bom.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/admin/chequereceipts.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/company.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/admin/contract.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], + 'htdocs/admin/contract.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/admin/delais.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetch'], - 'htdocs/admin/delivery.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], + 'htdocs/admin/delivery.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/admin/dict.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/admin/dolistore/class/dolistore.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/admin/ecm.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/emailcollector_card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredMethod'], 'htdocs/admin/emailcollector_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/eventorganization.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/expedition.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredMethod'], - 'htdocs/admin/expensereport.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], - 'htdocs/admin/expensereport_rules.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/admin/expensereport.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/admin/expensereport_rules.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/external_rss.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull'], 'htdocs/admin/fckeditor.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/fichinter.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], + 'htdocs/admin/fichinter.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/admin/geoipmaxmind.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/admin/holiday.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], - 'htdocs/admin/hrm.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], + 'htdocs/admin/holiday.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/admin/ihm.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/invoice.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], + 'htdocs/admin/invoice.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/invoice_situation.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/admin/knowledgemanagement.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], 'htdocs/admin/ldap_groups.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/ldap_users.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/admin/loan.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -134,29 +118,23 @@ return [ 'htdocs/admin/mails_senderprofile_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/mails_templates.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/menus.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/menus/edit.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], + 'htdocs/admin/menus/edit.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/admin/modulehelp.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDimFetchNullable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/admin/modules.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], - 'htdocs/admin/mrp.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], + 'htdocs/admin/modules.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/admin/mrp.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/admin/mrp_extrafields.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/admin/multicurrency.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/oauthlogintokens.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/admin/order.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredMethod'], - 'htdocs/admin/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], + 'htdocs/admin/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/pdf.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/perms.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/admin/propal.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], + 'htdocs/admin/propal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/admin/receiptprinter.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable'], - 'htdocs/admin/reception_setup.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredMethod'], 'htdocs/admin/security.php' => ['PhanUndeclaredProperty'], 'htdocs/admin/security_file.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/spip.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/admin/stock.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], - 'htdocs/admin/stocktransfer.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredMethod'], - 'htdocs/admin/supplier_invoice.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], - 'htdocs/admin/supplier_order.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], - 'htdocs/admin/supplier_payment.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], - 'htdocs/admin/supplier_proposal.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/admin/supplier_invoice.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/admin/supplier_order.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/admin/supplier_payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/admin/supplier_proposal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/admin/syslog.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/admin/system/constall.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/admin/system/database-tables.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -166,28 +144,26 @@ return [ 'htdocs/admin/system/phpinfo.php' => ['PhanPluginUnknownArrayFunctionParamType'], 'htdocs/admin/system/security.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/admin/taxes.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/admin/ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], + 'htdocs/admin/ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/admin/tools/export_files.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/tools/listsessions.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/admin/translation.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/admin/user.php' => ['PhanUndeclaredMethod'], - 'htdocs/admin/usergroup.php' => ['PhanUndeclaredMethod'], - 'htdocs/admin/webhook.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/admin/webhook.php' => ['PhanEmptyForeach'], 'htdocs/admin/website.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/admin/workstation.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], + 'htdocs/admin/workstation.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/ai/lib/ai.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/api/class/api.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/api/class/api_access.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], 'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/api/class/api_setup.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/api/class/api_setup.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/asset/admin/setup.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], - 'htdocs/asset/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/asset/admin/setup.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/asset/class/asset.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/asset/class/assetaccountancycodes.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], - 'htdocs/asset/class/assetmodel.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/asset/class/assetaccountancycodes.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], + 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanPluginUnknownArrayPropertyType'], + 'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'], 'htdocs/asset/depreciation.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/asset/disposal.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/asset/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -195,38 +171,41 @@ return [ 'htdocs/asset/model/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/tpl/accountancy_codes_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/tpl/depreciation_options_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/asset/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/asset/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/asterisk/wrapper.php' => ['PhanRedefineFunction'], - 'htdocs/barcode/codeinit.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/barcode/codeinit.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/blockedlog/admin/blockedlog_list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/blockedlog/ajax/block-info.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/blockedlog/ajax/check_signature.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/blockedlog/class/blockedlog.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], - 'htdocs/bom/bom_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/blockedlog/class/blockedlog.class.php' => ['PhanTypeSuspiciousNonTraversableForeach'], + 'htdocs/blockedlog/lib/blockedlog.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/bom/bom_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/bom/bom_document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/bom/bom_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bom/class/api_boms.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/bom/class/bom.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/bom/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/bom/class/bom.class.php' => ['PhanPluginUnknownArrayMethodParamType'], + 'htdocs/bom/lib/bom.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/bom/tpl/objectline_create.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/bom/tpl/objectline_edit.tpl.php' => ['PhanTypeExpectedObjectPropAccessButGotNull', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/bom/tpl/objectline_view.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/bom/tpl/objectline_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/bookcal/availabilities_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/bookcal/availabilities_document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/bookcal/availabilities_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/bookcal/availabilities_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bookcal/booking_list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/bookcal/calendar_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/bookcal/calendar_document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/bookcal/calendar_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/bookcal/class/availabilities.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/bookcal/class/calendar.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/bookcal/calendar_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/bookcal/class/availabilities.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredMethod', /* Missing getNextValue class, ignored */ 'PhanUndeclaredProperty'], + 'htdocs/bookcal/class/calendar.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredMethod', /* Missing getNextValue class, ignored */ 'PhanUndeclaredProperty'], + 'htdocs/bookcal/lib/bookcal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/bookcal/lib/bookcal_availabilities.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/bookcal/lib/bookcal_calendar.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/bookmarks/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bookmarks/class/bookmark.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/categories/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/categories/class/categorie.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeConversionFromArray', 'PhanTypeMismatchProperty'], + 'htdocs/categories/class/categorie.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchProperty'], 'htdocs/categories/edit.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch'], 'htdocs/categories/index.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/info.php' => ['PhanTypeMismatchDimFetch'], @@ -236,74 +215,73 @@ return [ 'htdocs/collab/index.php' => ['PhanParamTooMany', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull'], 'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/class/actioncommreminder.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/comm/action/class/api_agendaevents.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchProperty'], - 'htdocs/comm/action/class/ical.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/comm/action/class/api_agendaevents.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchProperty'], + 'htdocs/comm/action/class/cactioncomm.class.php' => ['PhanPluginUnknownArrayPropertyType'], + 'htdocs/comm/action/class/ical.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/comm/action/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/comm/action/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], + 'htdocs/comm/action/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/info.php' => ['PhanUndeclaredProperty'], - 'htdocs/comm/action/list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/comm/action/pertype.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch'], - 'htdocs/comm/action/peruser.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/comm/action/list.php' => ['PhanTypeMismatchProperty'], + 'htdocs/comm/action/pertype.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch'], + 'htdocs/comm/action/peruser.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeComparisonFromArray'], 'htdocs/comm/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/comm/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/comm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/comm/mailing/cibles.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/comm/mailing/class/advtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], + 'htdocs/comm/mailing/class/advtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/comm/mailing/class/html.formadvtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/comm/mailing/class/mailing.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/comm/mailing/index.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/comm/propal/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/comm/propal/card.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/comm/mailing/class/mailing.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], + 'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'], + 'htdocs/comm/propal/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/comm/propal/class/propal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/comm/propal/class/propalestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/comm/propal/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/comm/propal/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/comm/propal/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/commande/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/comm/propal/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/commande/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/commande/class/api_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/commande/class/commande.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], + 'htdocs/commande/class/commande.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/commande/class/commandestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/commande/customer.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/commande/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/commande/list_det.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/commande/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/commande/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/compta/accounting-files.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/bank/account_statement_document.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/compta/bank/annuel.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/bank/annuel.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/bank/bankentries_list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/bank/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/bank/class/account.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/compta/bank/class/account.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/class/api_bankaccounts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/bank/class/bankcateg.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/compta/bank/class/paymentvarious.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/compta/bank/graph.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/bank/line.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/bank/releve.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/bank/transfer.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/bank/graph.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/bank/line.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/bank/releve.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/compta/bank/transfer.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/bank/treso.php' => ['PhanTypeMismatchProperty'], 'htdocs/compta/bank/various_payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], - 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/cashcontrol/class/cashcontrol.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/compta/charges/index.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/deplacement/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/deplacement/class/deplacement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/compta/deplacement/class/deplacementstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/compta/deplacement/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/facture/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/facture/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/deplacement/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginEmptyStatementIf'], + 'htdocs/compta/facture/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/compta/facture/class/facture.class.php' => ['PhanEmptyForeach', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/compta/facture/class/facturestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeInvalidLeftOperandOfNumericOp'], + 'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/compta/facture/class/facturestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/compta/facture/class/paymentterm.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/facture/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/invoicetemplate_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -312,51 +290,50 @@ return [ 'htdocs/compta/facture/prelevement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/tpl/linkedobjectblock.tpl.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], - 'htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/compta/journal/purchasesjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/compta/journal/sellsjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], + 'htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], + 'htdocs/compta/journal/purchasesjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/compta/journal/sellsjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/localtax/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/localtax/class/localtax.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/localtax/clients.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/localtax/index.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanRedefineFunction'], - 'htdocs/compta/localtax/list.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/localtax/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/localtax/index.php' => ['PhanRedefineFunction'], + 'htdocs/compta/localtax/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetch'], - 'htdocs/compta/paiement/card.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/compta/paiement/cheque/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/paiement/cheque/class/remisecheque.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanUndeclaredMethod'], + 'htdocs/compta/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/compta/paiement/cheque/card.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/compta/paiement/cheque/class/remisecheque.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod'], 'htdocs/compta/paiement/cheque/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement/class/cpaiement.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/paiement/class/paiement.class.php' => ['PhanEmptyForeach', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/paiement/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/paiement/rapport.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/paiement_charge.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/paiement_vat.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/payment_sc/card.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], - 'htdocs/compta/payment_vat/card.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/paiement_vat.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/payment_vat/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], + 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], 'htdocs/compta/prelevement/class/rejetprelevement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], 'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/demandes.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/factures.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/prelevement/line.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeConversionFromArray'], + 'htdocs/compta/prelevement/line.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/orders_list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/stats.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/resultat/clientfourn.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/resultat/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/compta/resultat/result.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], + 'htdocs/compta/resultat/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/compta/resultat/result.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/sociales/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/compta/sociales/class/cchargesociales.class.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/compta/sociales/class/cchargesociales.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/compta/sociales/class/chargesociales.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/sociales/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/sociales/info.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/sociales/payments.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/compta/sociales/list.php' => ['PhanPluginUndeclaredVariableIsset'], + 'htdocs/compta/sociales/payments.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/byratecountry.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/compta/stats/cabyprodserv.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/stats/cabyuser.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/casoc.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], + 'htdocs/compta/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/supplier_turnover.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/supplier_turnover_by_prodserv.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/stats/supplier_turnover_by_thirdparty.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -365,26 +342,25 @@ return [ 'htdocs/compta/tva/class/tva.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/tva/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/tva/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/tva/index.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/tva/index.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/tva/info.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/tva/list.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/compta/tva/payments.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/tva/quadri_detail.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/contact/canvas/actions_contactcard_common.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach'], + 'htdocs/contact/canvas/actions_contactcard_common.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach'], 'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/contact/class/contact.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/contact/class/contact.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/contact/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/perso.php' => ['PhanTypeMismatchProperty'], 'htdocs/contrat/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contrat/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/contrat/class/api_contracts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/contrat/class/contrat.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], + 'htdocs/contrat/class/contrat.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contrat/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contrat/messaging.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contrat/services_list.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contrat/ticket.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/contrat/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/contrat/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/core/actions_builddoc.inc.php' => ['PhanUndeclaredProperty'], 'htdocs/core/actions_comments.inc.php' => ['PhanUndeclaredGlobalVariable'], @@ -392,9 +368,9 @@ return [ 'htdocs/core/actions_extrafields.inc.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/actions_lineupdown.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/actions_massactions.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/actions_sendmails.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/actions_massactions.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/core/ajax/ajaxdirpreview.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -404,107 +380,71 @@ return [ 'htdocs/core/ajax/loadinplace.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/ajax/objectonoff.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/ajax/onlineSign.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/ajax/price.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], 'htdocs/core/ajax/saveinplace.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/core/ajax/selectobject.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/ajax/selectsearchbox.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/core/ajax/ziptown.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_accountancy_last_manual_entries.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_accountancy_suspense_account.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_actions.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/boxes/box_actions_future.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/boxes/box_activity.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_birthdays.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_birthdays_members.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_boms.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_bookmarks.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_clients.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_commandes.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_comptes.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_contacts.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_contracts.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_customers_outstanding_bill_reached.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_dolibarr_state_board.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_external_rss.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/boxes/box_factures.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_factures_fourn.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_factures_fourn_imp.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_factures_imp.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_ficheinter.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_fournisseurs.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_funnel_of_prospection.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_goodcustomers.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_graph_invoices_permonth.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_invoices_peryear.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_invoices_supplier_permonth.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_nb_tickets_type.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/boxes/box_graph_new_vs_close_ticket.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/boxes/box_graph_orders_permonth.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_orders_supplier_permonth.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_product_distribution.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_propales_permonth.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_ticket_by_severity.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/boxes/box_last_knowledgerecord.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_last_modified_knowledgerecord.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_last_modified_ticket.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/boxes/box_last_ticket.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/boxes/box_lastlogin.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_members_by_tags.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/core/boxes/box_members_by_type.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/core/boxes/box_members_last_modified.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_members_last_subscriptions.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_members_subscriptions_by_year.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_mos.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_produits.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_produits_alerte_stock.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_project.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/boxes/box_project_opportunities.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/boxes/box_propales.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_prospect.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_scheduled_jobs.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_services_contracts.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_services_expired.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_shipments.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_supplier_orders.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_supplier_orders_awaiting_reception.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/boxes/box_task.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/boxes/box_validated_projects.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/boxes/modules_boxes.php' => ['PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/core/boxes/box_actions.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/boxes/box_actions_future.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/boxes/box_external_rss.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/boxes/box_funnel_of_prospection.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_invoices_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_invoices_peryear.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_invoices_supplier_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_nb_tickets_type.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/boxes/box_graph_new_vs_close_ticket.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/boxes/box_graph_orders_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_orders_supplier_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_product_distribution.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_propales_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_ticket_by_severity.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/boxes/box_last_modified_ticket.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/boxes/box_last_ticket.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/boxes/box_project.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/boxes/box_project_opportunities.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/boxes/box_services_contracts.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_task.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/boxes/box_validated_projects.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/boxes/modules_boxes.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/CSMSFile.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/canvas.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/ccountry.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/class/cgenericdic.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/commondocgenerator.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], - 'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType'], + 'htdocs/core/class/commondocgenerator.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], + 'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/commonincoterm.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], - 'htdocs/core/class/commoninvoice.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/core/class/commoninvoice.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/class/commonobject.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/core/class/commonobjectline.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/class/commonpeople.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/class/commonsocialnetworks.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/commonstickergenerator.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], + 'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/class/commonsocialnetworks.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/class/commonstickergenerator.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/conf.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchProperty'], + 'htdocs/core/class/cproductnature.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/ctypent.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/ctyperesource.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/cunits.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/class/cunits.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/class/defaultvalues.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/class/diasporahandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/discount.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/doleditor.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/dolgeoip.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/core/class/dolgeophp.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall'], 'htdocs/core/class/dolgraph.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], - 'htdocs/core/class/dolreceiptprinter.class.php' => ['PhanEmptyForeach', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod'], + 'htdocs/core/class/dolreceiptprinter.class.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/emailsenderprofile.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/class/events.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/class/extrafields.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNull', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], - 'htdocs/core/class/extralanguages.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/core/class/extrafields.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], + 'htdocs/core/class/extralanguages.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], + 'htdocs/core/class/fediverseparser.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/class/fileupload.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'], 'htdocs/core/class/fiscalyear.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/class/google.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/hookmanager.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/html.formaccounting.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/core/class/html.formaccounting.class.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/class/html.formadmin.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/class/html.formbarcode.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/class/html.formcategory.class.php' => ['PhanPluginUnknownArrayMethodParamType'], @@ -512,31 +452,33 @@ return [ 'htdocs/core/class/html.formfile.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/class/html.formldap.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/class/html.formmail.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/class/html.formmailing.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], 'htdocs/core/class/html.formmargin.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/html.formother.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], + 'htdocs/core/class/html.formother.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/html.formprojet.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/class/html.formsetup.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/class/html.formsetup.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/html.formsms.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccessButGotNull'], - 'htdocs/core/class/html.formticket.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/class/html.formticket.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/class/html.formwebsite.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/infobox.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/class/interfaces.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/class/ldap.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], + 'htdocs/core/class/ldap.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/class/link.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], + 'htdocs/core/class/mastodonhandler.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/class/notify.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/openid.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/core/class/reddithandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/rssparser.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeExpectedObjectPropAccess'], 'htdocs/core/class/smtps.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchDimFetch'], - 'htdocs/core/class/stats.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredMethod'], - 'htdocs/core/class/timespent.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/core/class/translate.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/class/socialnetworkmanager.class.php' => ['PhanPluginUnknownArrayMethodParamType'], + 'htdocs/core/class/stats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'], + 'htdocs/core/class/timespent.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/core/class/translate.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/class/utils.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/class/validate.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/core/class/vcard.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchDimFetch'], + 'htdocs/core/class/vcard.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchDimFetch'], 'htdocs/core/commonfieldsinexport.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/commonfieldsinimport.inc.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/core/customreports.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDimFetchNullable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/customreports.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUndeclaredVariableIsset', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDimFetchNullable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/db/Database.interface.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/db/mysqli.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray'], 'htdocs/core/db/pgsql.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], @@ -545,89 +487,104 @@ return [ 'htdocs/core/extrafieldsinimport.inc.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionParamType'], 'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/core/get_menudiv.php' => ['PhanRedefinedClassReference'], - 'htdocs/core/lib/accounting.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/core/lib/admin.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/lib/agenda.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/lib/accounting.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/admin.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', /* Bug : reference to id of module, not declared */ 'PhanUndeclaredProperty'], + 'htdocs/core/lib/agenda.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/lib/ajax.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/lib/bank.lib.php' => ['PhanPluginEmptyStatementIf', 'PhanUndeclaredProperty'], - 'htdocs/core/lib/company.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], - 'htdocs/core/lib/customreports.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchDimFetch'], - 'htdocs/core/lib/date.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/lib/asset.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/bank.lib.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], + 'htdocs/core/lib/categories.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/company.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], + 'htdocs/core/lib/contact.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/contract.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/cron.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/customreports.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchDimFetch'], + 'htdocs/core/lib/date.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/lib/doc.lib.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/fichinter.lib.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/lib/fourn.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], - 'htdocs/core/lib/ftp.lib.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/lib/functions2.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/lib/donation.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/ecm.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/emailing.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/eventorganization.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/expedition.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/expensereport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/fichinter.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/lib/fiscalyear.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/fourn.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/ftp.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/lib/functions.lib.php' => ['PhanPluginDuplicateArrayKey'], + 'htdocs/core/lib/functions2.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/lib/functions_ch.lib.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/core/lib/functionsnumtoword.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/core/lib/geturl.lib.php' => ['PhanPluginConstantVariableNull', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/lib/images.lib.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/lib/functionsnumtoword.lib.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/lib/geturl.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/lib/holiday.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/hrm.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/images.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/lib/import.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/invoice.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/invoice2.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/lib/ldap.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/lib/loan.lib.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/core/lib/memory.lib.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/core/lib/modulebuilder.lib.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/core/lib/multicurrency.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/lib/pdf.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/product.lib.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/project.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/lib/propal.lib.php' => ['PhanPluginUnknownObjectMethodCall'], + 'htdocs/core/lib/ldap.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/loan.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/mailmanspip.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/memory.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/multicurrency.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/oauth.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/openid_connect.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/order.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/payments.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/pdf.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/lib/prelevement.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/core/lib/product.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/core/lib/project.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/lib/propal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/core/lib/receiptprinter.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/reception.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/report.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/lib/security.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeInvalidLeftOperandOfNumericOp'], + 'htdocs/core/lib/resource.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/salaries.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/security.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], 'htdocs/core/lib/security2.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/sendings.lib.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/lib/sendings.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/lib/signature.lib.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/supplier_proposal.lib.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/core/lib/tax.lib.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/ticket.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], + 'htdocs/core/lib/socialnetwork.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/stock.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/supplier_proposal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/core/lib/takepos.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/tax.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/core/lib/ticket.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/treeview.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/lib/usergroups.lib.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/lib/website.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/lib/trip.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/usergroups.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/lib/vat.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/core/lib/website.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/lib/xcal.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/menus/standard/auguria.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType', 'PhanUndeclaredProperty'], - 'htdocs/core/menus/standard/auguria_menu.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanRedefineClass'], - 'htdocs/core/menus/standard/eldy.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/menus/standard/eldy_menu.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanRedefineClass', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/menus/standard/empty.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanRedefineClass'], - 'htdocs/core/modules/DolibarrModules.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/action/doc/pdf_standard_actions.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod'], + 'htdocs/core/modules/DolibarrModules.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/modules/action/doc/pdf_standard_actions.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/modules/action/modules_action.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod'], + 'htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/asset/modules_asset.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/bank/doc/pdf_ban.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/bank/modules_bank.php' => ['PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/barcode/doc/phpbarcode.modules.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/barcode/mod_barcode_product_standard.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/barcode/modules_barcode.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/bom/modules_bom.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/cheque/doc/pdf_blochet.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/cheque/doc/pdf_blochet.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanPluginUnknownObjectMethodCall'], + 'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/mod_commande_saphir.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/commande/modules_commande.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/contract/doc/pdf_strato.modules.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/contract/modules_contract.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/delivery/doc/pdf_storm.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/delivery/doc/pdf_typhon.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/commande/modules_commande.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/contract/doc/pdf_strato.modules.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/delivery/doc/pdf_storm.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/delivery/doc/pdf_typhon.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/delivery/modules_delivery.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/dons/html_cerfafr.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], 'htdocs/core/modules/dons/modules_don.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/expedition/doc/pdf_espadon.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/expedition/doc/pdf_merou.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/expedition/doc/pdf_rouget.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/expedition/modules_expedition.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/expedition/doc/pdf_espadon.modules.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/expedition/doc/pdf_merou.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/expedition/doc/pdf_rouget.modules.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/modules/expensereport/mod_expensereport_sand.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/expensereport/modules_expensereport.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/export/export_csviso.modules.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/modules/export/export_csvutf8.modules.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/modules/export/export_excel2007.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], @@ -635,201 +592,179 @@ return [ 'htdocs/core/modules/export/exportcsv.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/modules/export/modules_export.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchDimFetch'], 'htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/mod_facture_mercure.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/facture/modules_facture.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/facture/modules_facture.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/fichinter/mod_pacific.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/fichinter/modules_fichinter.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/core/modules/holiday/modules_holiday.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/hrm/modules_evaluation.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/import/modules_import.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchDimFetch'], - 'htdocs/core/modules/mailings/advthirdparties.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/core/modules/mailings/advthirdparties.modules.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/modules/mailings/contacts1.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/mailings/eventorganization.modules.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/mailings/modules_mailings.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/mailings/partnership.modules.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/mailings/thirdparties_services_expired.modules.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/mailings/xinputfile.modules.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/mailings/xinputuser.modules.php' => ['PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/core/modules/mailings/modules_mailings.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], + 'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/member/doc/doc_generic_member_odt.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeSuspiciousNonTraversableForeach'], 'htdocs/core/modules/member/doc/pdf_standard_member.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/modules/member/modules_cards.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/core/modules/member/modules_member.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/modFacture.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], - 'htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/movement/modules_movement.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/member/modules_cards.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/core/modules/member/modules_member.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/mrp/modules_mo.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/oauth/generic_oauthcallback.php' => ['PhanUndeclaredMethod'], - 'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/oauth/google_oauthcallback.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/oauth/microsoft2_oauthcallback.php' => ['PhanUndeclaredMethod'], - 'htdocs/core/modules/oauth/microsoft_oauthcallback.php' => ['PhanUndeclaredMethod'], + 'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/modules/oauth/stripelive_oauthcallback.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/modules/oauth/stripetest_oauthcallback.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/modules/payment/mod_payment_ant.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/printing/printgcp.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredMethod'], + 'htdocs/core/modules/printing/modules_printing.php' => ['PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/core/modules/printing/printgcp.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/modules/printsheet/modules_labels.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/core/modules/product/doc/pdf_standard.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/product/modules_product.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/core/modules/product/doc/pdf_standard.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/product_batch/mod_lot_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/product_batch/mod_lot_free.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/product_batch/mod_sn_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/product_batch/mod_sn_free.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/product_batch/modules_product_batch.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/project/doc/pdf_baleine.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/project/doc/pdf_beluga.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/project/doc/pdf_timespent.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/project/doc/pdf_baleine.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/project/doc/pdf_beluga.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/modules/project/doc/pdf_timespent.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/project/mod_project_universal.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/project/modules_project.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/project/task/modules_task.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/propale/mod_propale_saphir.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/propale/modules_propale.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/rapport/pdf_paiement.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/reception/modules_reception.php' => ['PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/core/modules/propale/modules_propale.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/rapport/pdf_paiement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/security/generate/modGeneratePassPerso.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/modules/societe/modules_societe.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredMethod'], - 'htdocs/core/modules/stock/modules_stock.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod'], + 'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanPossiblyUndeclaredVariable', /* Typing issues, ignored */ 'PhanUndeclaredProperty'], + 'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/stocktransfer/modules_stocktransfer.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/supplier_order/modules_commandefournisseur.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod'], + 'htdocs/core/modules/supplier_order/modules_commandefournisseur.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/supplier_payment/modules_supplier_payment.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/syslog/logHandler.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/takepos/mod_takepos_ref_universal.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeSuspiciousNonTraversableForeach'], 'htdocs/core/modules/ticket/mod_ticket_universal.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/ticket/modules_ticket.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeSuspiciousNonTraversableForeach'], - 'htdocs/core/modules/user/modules_user.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/core/modules/usergroup/modules_usergroup.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/workstation/modules_workstation.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/search_page.php' => ['PhanEmptyForeach', 'PhanPluginBothLiteralsBinaryOp'], 'htdocs/core/tpl/advtarget.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/bloc_comment.tpl.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/card_presend.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/card_presend.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/commonfields_add.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/tpl/commonfields_edit.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/commonfields_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/core/tpl/contacts.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/contacts.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/extrafields_edit.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/core/tpl/extrafields_list_print_fields.tpl.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/extrafields_list_search_title.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/core/tpl/extrafields_view.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredVariableAssignOp'], - 'htdocs/core/tpl/login.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/notes.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/list_print_total.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], + 'htdocs/core/tpl/login.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/notes.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/objectline_edit.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/objectline_title.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/onlinepaymentlinks.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/passwordforgotten.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/passwordreset.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/resource_add.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/resource_view.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/triggers/dolibarrtriggers.class.php' => ['PhanPluginUnknownArrayPropertyType'], + 'htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/triggers/interface_50_modNotification_Notification.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess'], - 'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanPluginEmptyStatementIf', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanPluginEmptyStatementIf', 'PhanUndeclaredProperty'], 'htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/cron/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/cron/class/cronjob.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/cron/class/cronjob.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/cron/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/datapolicy/class/datapolicy.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/datapolicy/class/datapolicycron.class.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/datapolicy/lib/datapolicy.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/dav/dav.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/debugbar/class/DataCollector/DolConfigCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/debugbar/class/DataCollector/DolLogsCollector.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanRedefinedClassReference'], 'htdocs/debugbar/class/DataCollector/DolMemoryCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/debugbar/class/DataCollector/DolPhpCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/debugbar/class/DataCollector/DolPhpCollector.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/debugbar/class/DataCollector/DolQueryCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolibarrCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/debugbar/class/TraceableDB.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/debugbar/class/TraceableDB.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/delivery/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/delivery/class/delivery.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/delivery/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/delivery/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/document.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/admin/donation.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/don/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/don/class/api_donations.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/don/class/donstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/don/class/paymentdonation.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/document.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/don/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/don/info.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/don/list.php' => ['PhanTypeMismatchProperty'], 'htdocs/don/note.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/don/paiement/list.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/don/payment/card.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanUndeclaredGlobalVariable'], + 'htdocs/don/payment/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/don/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/don/stats/index.php' => ['PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/don/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/ecm/ajax/ecmdatabase.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/ecm/class/ecmdirectory.class.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/ecm/class/ecmfiles.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/don/stats/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/don/tpl/linkedobjectblock.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/ecm/class/ecmdirectory.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/ecm/class/ecmfiles.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/ecm/class/htmlecm.form.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/ecm/dir_card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/ecm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ecm/index_auto.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ecm/index_medias.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanInvalidFQSENInClasslike', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanInvalidFQSENInClasslike', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/emailcollector/class/emailcollectoraction.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/emailcollector/class/emailcollectorfilter.class.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/emailcollector/lib/emailcollector.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/eventorganization/class/conferenceorbooth.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/eventorganization/conferenceorboothattendee_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorboothattendee_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/eventorganization/core/actions_massactions_mail.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/eventorganization/core/actions_massactions_mail.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/eventorganization/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/expedition/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/expedition/class/api_shipments.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], @@ -839,68 +774,61 @@ return [ 'htdocs/expedition/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expedition/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/expedition/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/expedition/list.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/expedition/list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/expedition/note.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expedition/shipment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/expedition/stats/index.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/expedition/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/expensereport/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/expedition/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], + 'htdocs/expensereport/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/expensereport/class/expensereport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeExpectedObjectPropAccessButGotNull'], 'htdocs/expensereport/class/expensereport_ik.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/expensereport/class/expensereport_rule.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/expensereport/class/expensereportstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/expensereport/list.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/expensereport/payment/card.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/expensereport/payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/payment/info.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/expensereport/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expensereport/tpl/expensereport_addfile.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/tpl/expensereport_linktofile.tpl.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/exports/class/export.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/exports/export.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fichinter/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/fichinter/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/fichinter/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], - 'htdocs/fichinter/class/fichinter.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], - 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/fichinter/class/fichinter.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], + 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/fichinterstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/filefunc.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/fourn/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/class/fournisseur.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], + 'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], 'htdocs/fourn/class/fournisseur.facture-rec.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/fourn/class/fournisseur.facture.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/fourn/class/fournisseur.product.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchProperty'], + 'htdocs/fourn/class/fournisseur.product.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], 'htdocs/fourn/class/paiementfourn.class.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/fourn/commande/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/fourn/commande/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/fourn/commande/contact.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fourn/commande/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/fourn/commande/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/fourn/commande/document.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fourn/commande/info.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/fourn/commande/info.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/commande/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/commande/note.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/fourn/contact.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fourn/facture/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/fourn/facture/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchProperty'], + 'htdocs/fourn/facture/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/fourn/facture/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], 'htdocs/fourn/facture/list-rec.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/facture/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], - 'htdocs/fourn/paiement/card.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], + 'htdocs/fourn/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/fourn/paiement/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/fourn/paiement/list.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], 'htdocs/fourn/product/list.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fourn/recap-fourn.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], 'htdocs/ftp/admin/ftpclient.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/ftp/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/holiday/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], @@ -909,54 +837,57 @@ return [ 'htdocs/holiday/define_holiday.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/holiday/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/hrm/admin/admin_hrm.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/hrm/class/evaluation.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/hrm/class/evaluation.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/hrm/class/evaluationdet.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/hrm/class/job.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/hrm/class/position.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/hrm/class/skill.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/hrm/class/job.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/hrm/class/position.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/hrm/class/skill.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/hrm/class/skilldet.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/hrm/class/skillrank.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/hrm/compare.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/hrm/core/tpl/objectline_view.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/hrm/compare.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/hrm/core/tpl/objectline_view.tpl.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/hrm/core/tpl/skilldet.fiche.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/hrm/evaluation_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/hrm/evaluation_card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/hrm/evaluation_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/hrm/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/hrm/job_agenda.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/hrm/job_agenda.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/hrm/job_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/hrm/job_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/hrm/position.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/hrm/position_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/hrm/lib/hrm.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/hrm/lib/hrm_job.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/hrm/lib/hrm_position.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/hrm/lib/hrm_skill.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/hrm/lib/hrm_skilldet.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/hrm/lib/hrm_skillrank.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/hrm/position_card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/hrm/position_list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/hrm/skill_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/hrm/skill_card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/hrm/skill_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/hrm/skill_tab.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/imports/class/import.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], + 'htdocs/imports/class/import.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/imports/import.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/imports/import.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/install/fileconf.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/install/inc.php' => ['PhanRedefineFunction'], + 'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanRedefineFunction'], 'htdocs/install/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/install/install.forced.php' => ['PhanPluginWhitespaceTrailing'], - 'htdocs/install/repair.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/install/repair.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/install/step2.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], + 'htdocs/install/step5.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/install/upgrade2.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/install/upgrade2.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/intracommreport/admin/intracommreport.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/intracommreport/class/intracommreport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/intracommreport/list.php' => ['PhanAccessPropertyStaticAsNonStatic', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/intracommreport/lib/intracommreport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/intracommreport/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/knowledgemanagement/class/knowledgerecord.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/knowledgemanagement/knowledgerecord_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/knowledgemanagement/class/knowledgerecord.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/knowledgemanagement/knowledgerecord_card.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/knowledgemanagement/knowledgerecord_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/loan/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/loan/class/loan.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/loan/class/loanschedule.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], @@ -964,19 +895,19 @@ return [ 'htdocs/loan/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/loan/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/loan/note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/loan/payment/card.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], 'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/loan/schedule.php' => ['PhanTypeInvalidLeftOperandOfNumericOp', 'PhanUndeclaredGlobalVariable'], - 'htdocs/main.inc.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanPossiblyUndeclaredVariable', 'PhanRedefineFunction', 'PhanRedefinedClassReference', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/loan/schedule.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/mailmanspip/class/mailmanspip.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/margin/customerMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/margin/lib/margins.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/margin/productMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/master.inc.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/modulebuilder/index.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/mrp/class/api_mos.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/mrp/class/mo.class.php' => ['PhanParamSignatureMismatch', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], - 'htdocs/mrp/mo_agenda.php' => ['PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/mrp/class/mo.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], + 'htdocs/mrp/lib/mrp.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/mrp/lib/mrp_mo.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/mrp/mo_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/mrp/mo_movements.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/mrp/mo_movements.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/mrp/mo_production.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/mrp/tpl/originproductline.tpl.php' => ['PhanUndeclaredProperty'], @@ -985,38 +916,37 @@ return [ 'htdocs/opcachepreload.php' => ['PhanEmptyForeach'], 'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], - 'htdocs/opensurvey/lib/opensurvey.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/opensurvey/list.php' => ['PhanEmptyForeach', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/opensurvey/lib/opensurvey.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/opensurvey/list.php' => ['PhanEmptyForeach', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/results.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/opensurvey/wizard/choix_autre.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], 'htdocs/opensurvey/wizard/choix_date.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/create_survey.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/partnership/class/api_partnerships.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/partnership/class/partnership.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/partnership/class/partnership.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/partnership/class/partnership_type.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/partnership/class/partnershiputils.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/partnership/core/modules/partnership/modules_partnership.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/partnership/partnership_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/partnership/lib/partnership.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/partnership/partnership_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/partnership/partnership_list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/paypal/lib/paypal.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], + 'htdocs/paypal/lib/paypal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/printing/admin/printing.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchDimFetch'], 'htdocs/printing/index.php' => ['PhanPluginUnknownObjectMethodCall'], + 'htdocs/printing/lib/printing.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/product/admin/dynamic_prices.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/product/admin/product.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/product/admin/product.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/admin/product_lot.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/product/admin/product_tools.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/ajax/product_lot.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/ajax/products.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/canvas/product/actions_card_product.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach'], 'htdocs/product/canvas/service/actions_card_service.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach'], - 'htdocs/product/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/class/api_products.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], 'htdocs/product/class/html.formproduct.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/class/product.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchReturn', 'PhanUndeclaredMethod'], + 'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/product/class/productbatch.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], - 'htdocs/product/class/productcustomerprice.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeInvalidLeftOperandOfNumericOp'], + 'htdocs/product/class/productcustomerprice.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/product/class/productfournisseurprice.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/product/class/propalmergepdfproduct.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/product/composition/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -1024,13 +954,14 @@ return [ 'htdocs/product/dynamic_price/class/price_global_variable.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], 'htdocs/product/dynamic_price/class/price_global_variable_updater.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], 'htdocs/product/dynamic_price/class/price_parser.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], + 'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/product/inventory/inventory.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/product/inventory/lib/inventory.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/product/price_suppliers.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/reassortlot.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], @@ -1048,14 +979,13 @@ return [ 'htdocs/product/stock/class/mouvementstock.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/class/productlot.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/product/stock/class/productstockentrepot.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/product/stock/fiche-valo.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], 'htdocs/product/stock/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/massstockmove.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/stock/movement_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/product.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/product/stock/productlot_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/massstockmove.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/product.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/productlot_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/replenish.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/stats/commande_fournisseur.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -1063,34 +993,32 @@ return [ 'htdocs/product/stock/stats/mo.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/product/stock/stats/reception.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/product/stock/stockatdate.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/stock/stocktransfer/class/stocktransfer.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], + 'htdocs/product/stock/stocktransfer/class/stocktransfer.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/product/stock/stocktransfer/class/stocktransferline.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/stocktransfer/stocktransfer_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/product/stock/stocktransfer/lib/stocktransfer.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/product/stock/stocktransfer/stocktransfer_card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/product/stock/stocktransfer/stocktransfer_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/tpl/stockcorrection.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/tpl/stocktransfer.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/valo.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], 'htdocs/projet/activity/index.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanUndeclaredGlobalVariable'], - 'htdocs/projet/activity/perday.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/activity/permonth.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/activity/perweek.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/projet/activity/perday.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/projet/activity/permonth.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/projet/activity/perweek.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/admin/project.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/ajax/projects.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/card.php' => ['PhanEmptyFQSENInClasslike', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/projet/class/api_projects.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/projet/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/projet/class/api_projects.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/class/api_tasks.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/projet/class/project.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginEmptyStatementIf', 'PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/projet/class/project.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/class/projectstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/projet/class/task.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/class/taskstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/projet/contact.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/document.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/projet/element.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/projet/element.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/projet/ganttchart.inc.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/projet/ganttview.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/graph_opportunities.inc.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanUndeclaredGlobalVariable'], + 'htdocs/projet/graph_opportunities.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], 'htdocs/projet/index.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/projet/list.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -1101,7 +1029,7 @@ return [ 'htdocs/projet/tasks/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/tasks/note.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/tasks/task.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/public/agenda/agendaexport.php' => ['PhanRedefineFunction'], 'htdocs/public/bookcal/index.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanRedefineFunction'], @@ -1118,21 +1046,21 @@ return [ 'htdocs/public/onlinesign/newonlinesign.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/public/opensurvey/studs.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/public/partnership/new.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanRedefineFunction'], - 'htdocs/public/payment/newpayment.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/public/payment/paymentko.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'], + 'htdocs/public/payment/newpayment.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/public/payment/paymentko.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/project/index.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/project/new.php' => ['PhanEmptyFQSENInClasslike', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction', 'PhanUndeclaredProperty'], + 'htdocs/public/project/new.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction', 'PhanUndeclaredProperty'], 'htdocs/public/project/suggestbooth.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/public/project/suggestconference.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/stripe/ipn.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/public/test/test_forms.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], 'htdocs/public/ticket/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/public/users/view.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/webportal/index.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/webportal/tpl/errors.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/public/webportal/tpl/footer.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], @@ -1150,68 +1078,61 @@ return [ 'htdocs/reception/class/receptionlinebatch.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/reception/class/receptionstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/reception/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/reception/list.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/reception/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/reception/note.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/reception/stats/index.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/reception/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/reception/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall'], 'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall'], 'htdocs/recruitment/class/api_recruitments.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanUndeclaredProperty'], - 'htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/recruitment/core/modules/recruitment/modules_recruitmentjobposition.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/recruitment/index.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/recruitment/lib/recruitment.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/recruitment/recruitmentcandidature_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/recruitment/recruitmentcandidature_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentcandidature_document.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/recruitment/recruitmentcandidature_list.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentcandidature_note.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/recruitment/recruitmentjobposition_agenda.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/recruitment/recruitmentjobposition_agenda.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], 'htdocs/recruitment/recruitmentjobposition_applications.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentjobposition_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentjobposition_document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentjobposition_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/resource/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/resource/class/dolresource.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/resource/class/dolresource.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/resource/class/html.formresource.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeExpectedObjectPropAccess'], 'htdocs/resource/element_resource.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/salaries/admin/salaries.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/salaries/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'], + 'htdocs/salaries/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/salaries/class/api_salaries.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/salaries/class/paymentsalary.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/salaries/class/paymentsalary.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/salaries/class/salariesstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/salaries/class/salary.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/salaries/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/salaries/info.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/salaries/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanUndeclaredGlobalVariable'], + 'htdocs/salaries/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/salaries/paiement_salary.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/salaries/payment_salary/card.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], - 'htdocs/salaries/stats/index.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], 'htdocs/salaries/virement_request.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/societe/admin/societe.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/societe/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/ajax/ajaxcompanies.php' => ['PhanUndeclaredProperty'], 'htdocs/societe/ajax/company.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/societe/canvas/actions_card_common.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach'], - 'htdocs/societe/canvas/company/actions_card_company.class.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/societe/canvas/individual/actions_card_individual.class.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/societe/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/societe/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/societe/checkvat/checkVatPopup.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/societe/class/api_contacts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], + 'htdocs/societe/class/client.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/societe/class/companybankaccount.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/societe/class/companypaymentmode.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/societe/class/societe.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/societe/class/societeaccount.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], - 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/societe/document.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], - 'htdocs/societe/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/societe/class/societeaccount.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/paymentmodes.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/societe/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/project.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -1222,58 +1143,55 @@ return [ 'htdocs/stripe/charge.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/stripe/class/stripe.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/stripe/lib/stripe.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/stripe/payout.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/stripe/transaction.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/supplier_proposal/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/supplier_proposal/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/support/inc.php' => ['PhanRedefineFunction'], + 'htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], + 'htdocs/support/inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanRedefineFunction'], 'htdocs/takepos/admin/orderprinters.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/takepos/admin/setup.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/admin/terminal.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/takepos/invoice.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/takepos/pay.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/takepos/index.php' => ['PhanPluginUndeclaredVariableIsset'], + 'htdocs/takepos/invoice.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/takepos/pay.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/public/menu.php' => ['PhanUndeclaredProperty'], - 'htdocs/takepos/receipt.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], - 'htdocs/takepos/split.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/takepos/split.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/theme/eldy/badges.inc.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], 'htdocs/theme/eldy/btn.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/eldy/dropdown.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/eldy/flags-sprite.inc.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/theme/eldy/global.inc.php' => ['PhanTypeInvalidLeftOperandOfNumericOp'], 'htdocs/theme/eldy/info-box.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/eldy/main_menu_fa_icons.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/eldy/progress.inc.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/theme/eldy/style.css.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanRedefinedClassReference', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/theme/eldy/style.css.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/theme/md/badges.inc.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], 'htdocs/theme/md/btn.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/md/dropdown.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/md/flags-sprite.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/md/info-box.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/md/progress.inc.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/theme/md/style.css.php' => ['PhanRedefinedClassReference', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/ticket/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/theme/md/style.css.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/ticket/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/ticket/class/actions_ticket.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/ticket/class/api_tickets.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/ticket/class/ticket.class.php' => ['PhanPluginRedundantReturnComment', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], + 'htdocs/ticket/class/ticket.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/ticket/class/ticketstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/ticket/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ticket/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/ticket/list.php' => ['PhanTypeComparisonFromArray'], 'htdocs/ticket/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/user/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/user/agenda_extsites.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/user/bank.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/user/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/user/class/api_users.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/user/class/user.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanRedefinedClassReference', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/user/class/user.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/user/class/usergroup.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/user/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/user/group/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -1281,57 +1199,64 @@ return [ 'htdocs/user/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/user/param_ihm.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/user/passwordforgotten.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/user/perms.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanRedefinedClassReference'], + 'htdocs/user/perms.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/variants/ajax/get_attribute_values.php' => ['PhanTypeComparisonFromArray'], - 'htdocs/variants/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/variants/class/ProductAttribute.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/variants/class/ProductCombination.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/variants/combinations.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], + 'htdocs/variants/lib/variants.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/variants/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/variants/tpl/productattributevalueline_edit.tpl.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/variants/tpl/productattributevalueline_view.tpl.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/variants/tpl/productattributevalueline_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/viewimage.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanRedefineFunction'], 'htdocs/webhook/ajax/webhook.php' => ['PhanPluginUnknownObjectMethodCall'], - 'htdocs/webhook/class/target.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanTypeMismatchProperty'], + 'htdocs/webhook/class/api_webhook.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/webhook/class/target.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty'], + 'htdocs/webhook/lib/webhook.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/webhook/lib/webhook_target.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/webhook/target_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/webhook/target_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/webportal/class/context.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/webportal/class/context.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/webportal/class/controller.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/webportal/class/html.formwebportal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchDimFetch'], + 'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/webportal/class/html.formwebportal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchDimFetch'], 'htdocs/webportal/class/webPortalTheme.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/webportal/class/webportalinvoice.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/webportal/class/webportalmember.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/webportal/class/webportalmember.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/webportal/class/webportalorder.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/webportal/class/webportalpartnership.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/webportal/class/webportalpropal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_actioncomm.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanUndeclaredProperty'], + 'htdocs/webportal/lib/webportal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/webservices/server_actioncomm.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_category.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_contact.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_invoice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_order.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_other.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_contact.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_invoice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_order.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_other.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_payment.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_productorservice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_project.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_supplier_invoice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_thirdparty.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_user.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_productorservice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_project.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_supplier_invoice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_thirdparty.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_user.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/website/class/website.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/website/class/websitepage.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/website/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/website/lib/websiteaccount.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/website/samples/wrapper.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/website/websiteaccount_card.php' => ['PhanUndeclaredProperty'], 'htdocs/workstation/class/api_workstations.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/workstation/class/workstation.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], 'htdocs/workstation/class/workstationresource.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/workstation/class/workstationusergroup.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/workstation/workstation_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/workstation/lib/workstation.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/workstation/lib/workstation_workstation.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/workstation/workstation_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/workstation/workstation_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/zapier/class/api_zapier.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/zapier/class/hook.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/zapier/lib/zapier.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], '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 f141bf80af3b2..d8b201d33c25c 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -31,7 +31,8 @@ // Not documented: 'restricthtmlallowclass', 'restricthtmlallowunvalid', - 'restricthtmlnolink' + 'restricthtmlnolink', + 'restricthtmlallowlinkscript' ) ).')*$/'; @@ -129,7 +130,7 @@ 'mymodule' => null, // modMyModule - Name used in module builder (avoid false positives) 'notification' => 'Notification', 'numberwords' => null, // Not provided by default, no module tests - 'oauth' => 'Oauth', + 'oauth' => 'OAuth', 'openstreetmap' => null, // External module? 'opensurvey' => 'OpenSurvey', 'order' => 'Commande', @@ -257,10 +258,12 @@ 'filtert' => 'int', 'forceall' => 'int<0,1>', 'form' => '\Form', + 'formcompany' => '\FormCompany', 'hookmanager' => '\HookManager', 'inputalsopricewithtax' => 'int<0,1>', 'langs' => '\Translate', 'leftmenu' => 'string', + 'linkedObjectBlock' => '\CommonObject[]', // See htdocs/core/class/html.form.class.php 'mainmenu' => 'string', 'menumanager' => '\MenuManager', 'mysoc' => '\Societe', @@ -268,6 +271,7 @@ 'obj' => '\CommonObject', // Deprecated 'object_rights' => 'int|stdClass', 'objectoffield' => '\CommonObject', + 'objsoc' => '\Societe', 'senderissupplier' => 'int<0,2>', 'user' => '\User', 'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 // Disable because Phan infers Website type @@ -317,13 +321,15 @@ //'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@', 'exclude_file_regex' => '@^(' // @phpstan-ignore-line .'dummy' // @phpstan-ignore-line + // mymodule seen in cti, but not in git. + .'|htdocs/custom/mymodule/.*' // @phpstan-ignore-line .'|htdocs/.*/canvas/.*/tpl/.*.tpl.php' // @phpstan-ignore-line - .'|htdocs/modulebuilder/template/.*' // @phpstan-ignore-line + //.'|htdocs/modulebuilder/template/.*' // @phpstan-ignore-line // Included as stub (better analysis) .'|htdocs/includes/nusoap/.*' // @phpstan-ignore-line // Included as stub (old version + incompatible typing hints) .'|htdocs/includes/restler/.*' // @phpstan-ignore-line - // Included as stub (did not seem properly analysed by phan without it) + // Included as stub (did not seem properly analyzed by phan without it) .'|htdocs/includes/stripe/.*' // @phpstan-ignore-line .'|htdocs/conf/conf.php' // @phpstan-ignore-line // .'|htdocs/[^h].*/.*' // For testing @phpstan-ignore-line @@ -346,9 +352,9 @@ '/^sanitizeVal$/' => [1, $sanitizeRegex,"UnknownSanitizeType"], '/^checkVal$/' => [1, $sanitizeRegex,"UnknownCheckValSanitizeType"], '/^\\\\ExtraFields::addExtraField$/' => [2, $extraFieldTypeRegex,"UnknownExtrafieldTypeBack"], - '/^dol_now$/' => [0, '{^(?:auto|gmt|tz(?:server|ref|user(?:rel)?))$}',"InvalidDolNowArgument"], // '', 0, 1 match bool and int values + '/^dol_now$/' => [0, '{^(?:auto|gmt|tz(?:server|ref|user(?:rel)?))$}',"InvalidDolNowArgument"], '/^dol_mktime$/' => [6, '{^(?:|0|1|auto|gmt|tz(?:server|ref|user(?:rel)?|,[+a-zA-Z-/]+))$}',"InvalidDolMktimeArgument"], // '', 0, 1 match bool and int values - '/^dol_print_date$/' => [2, '{^(?:|0|1|auto|gmt|tz(?:server|user(?:rel)?))$}',"InvalidDolMktimeArgument"], + '/^dol_print_date$/' => [2, '{^(?:|0|1|auto|gmt|tz(?:server|user(?:rel)?))$}',"InvalidDolMktimeArgument"], // '', 0, 1 match bool and int values '/^GETPOSTFLOAT$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidGetPostFloatRounding"], '/^price2num$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidPrice2NumRounding"], ], @@ -384,7 +390,7 @@ 'UnknownElementTypePlugin', 'WhitespacePlugin', //'RemoveDebugStatementPlugin', // Reports echo, print, ... - //'SimplifyExpressionPlugin', + 'SimplifyExpressionPlugin', //'StrictComparisonPlugin', // Expects === 'SuspiciousParamOrderPlugin', 'UnsafeCodePlugin', @@ -442,10 +448,10 @@ 'PhanPluginRedundantAssignment', // Not essential, useless 'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences - 'PhanPluginUnknownArrayMethodParamType', // Too many troubles to manage. Is enabled into config_extended only. - 'PhanPluginUnknownArrayMethodReturnType', // Too many troubles to manage. Is enabled into config_extended only. + 'PhanPluginUnknownArrayMethodParamType', // Too many troubles to manage. Is enabled in config_extended only. + 'PhanPluginUnknownArrayMethodReturnType', // Too many troubles to manage. Is enabled in config_extended only. 'PhanUndeclaredGlobalVariable', // Too many false positives on .tpl.php files. Is enabled into config_extended only. - 'PhanPluginUnknownObjectMethodCall', // False positive for some class. Is enabled into config_extended only. + // 'PhanPluginUnknownObjectMethodCall', // False positive for some class. Is enabled in config_extended only. ], // You can put relative paths to internal stubs in this config option. // Phan will continue using its detailed type annotations, diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 0920a7f7ecceb..94346c93296f5 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -94,6 +94,9 @@ 'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning 'PhanPluginRedundantAssignment', // Not essential, useless 'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences + + 'PhanPluginUnknownArrayMethodParamType', // this option costs more time to be supported than it solves time + 'PhanPluginUnknownArrayMethodReturnType', // this option costs more time to be supported than it solves time ]; return $config; diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst index d3416397d805c..3cc7b562e3069 100644 --- a/dev/translation/ignore_translation_keys.lst +++ b/dev/translation/ignore_translation_keys.lst @@ -525,7 +525,6 @@ MemberAllowchangeOfType MemberTypeCard MembersListOfTiers MenuAddedSuccesfuly -Message MigrationBankTransfertsToUpdate MigrationContractsEmptyCreationDatesUpdateSuccess Millisecond @@ -696,7 +695,6 @@ Production ProfId Profile Programs -Progression ProjectNbProject ProjectNbTask Property %s not found in the class. The class was probably not generated by modulebuilder. diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index cee3ee55a99b5..8836134a316cf 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -230,7 +230,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $langs->trans("ListAccounts"), $help_url); +llxHeader('', $langs->trans("ListAccounts"), $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_account'); if ($action == 'delete') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1); diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 1d15ae5d3a31a..52e4a77e4703a 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -340,7 +340,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $langs->trans("Pcg_version"), $help_url); +llxHeader('', $langs->trans("Pcg_version"), $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_accountmodel'); $titre = $langs->trans($tablib[$id]); $linkback = ''; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 59a412fa3a4b6..554109fb939f5 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -206,7 +206,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_card'); // Create mode @@ -305,15 +305,15 @@ // Account number print ''.$langs->trans("AccountNumber").''; - print ''; + print ''; // Label print ''.$langs->trans("Label").''; - print ''; + print ''; // Label short print ''.$langs->trans("LabelToShow").''; - print ''; + print ''; // Account parent print ''.$langs->trans("Accountparent").''; diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 0231856071a30..749082f7c3e25 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -117,7 +117,7 @@ $title= $langs->trans('AccountingCategory'); $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_categories'); $linkback = ''.$langs->trans("BackToList").''; $titlepicto = 'setup'; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 4442b88a6689f..5e1e5f94cb7b8 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -408,7 +408,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $langs->trans('DictionaryAccountancyCategory'), $help_url); +llxHeader('', $langs->trans('DictionaryAccountancyCategory'), $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_categories_list'); $titre = $langs->trans($tablib[$id]); $linkback = ''; diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php index ffadd01b5bd06..a11c83cea464e 100644 --- a/htdocs/accountancy/admin/closure.php +++ b/htdocs/accountancy/admin/closure.php @@ -106,7 +106,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_closure'); $linkback = ''; print load_fiche_titre($langs->trans('MenuClosureAccounts'), $linkback, 'title_accountancy'); diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index d22c384e276d9..5d856d5027c91 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -205,7 +205,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $langs->trans('MenuDefaultAccounts'), $help_url); +llxHeader('', $langs->trans('MenuDefaultAccounts'), $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_defaultaccounts'); $linkback = ''; print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_accountancy'); diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 7a499cad87bbc..4a53f8e7642cd 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -136,7 +136,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; $title = $langs->trans('ExportOptions'); -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_export'); $linkback = ''; // $linkback = '' . $langs->trans("BackToModuleList") . ''; diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 0a2901ceca7a7..9d6ffb239bde0 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -89,7 +89,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_fiscalyear'); $sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut as status, f.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f"; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 16792a057475f..b4f48bb27458c 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -46,7 +46,7 @@ if (!empty($backtopagejsfields)) { $tmpbacktopagejsfields = explode(':', $backtopagejsfields); - $dol_openinpopup = $tmpbacktopagejsfields[0]; + $dol_openinpopup = preg_replace('/[^a-z0-9_]/i', '', $tmpbacktopagejsfields[0]); } $error = 0; diff --git a/htdocs/accountancy/admin/fiscalyear_info.php b/htdocs/accountancy/admin/fiscalyear_info.php index c00453220fe55..deb1528fc07d7 100644 --- a/htdocs/accountancy/admin/fiscalyear_info.php +++ b/htdocs/accountancy/admin/fiscalyear_info.php @@ -47,7 +47,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_fiscalyear_info'); if ($id) { $object = new Fiscalyear($db); diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 27eccebb38963..4025db92cab39 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -259,7 +259,7 @@ $title = $langs->trans('ConfigAccountingExpert'); $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_index'); $linkback = ''; diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index ed021d0491745..008739defd766 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -351,7 +351,7 @@ $title = $langs->trans('AccountingJournals'); $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_journals_list'); $titre = $langs->trans("DictionarySetup"); $linkback = ''; diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index d20ec36af07e4..8c2909385897c 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -129,7 +129,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; $title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger'); -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_subaccount'); // Customer diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index fc21dd6945e63..92945c6c3a631 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -102,7 +102,7 @@ $search_date_end = strtotime($fiscalYear->date_end); } else { $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); - $year_start = dol_print_date(dol_now(), '%Y'); + $year_start = (int) dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) { $year_start--; // If current month is lower that starting fiscal month, we start last year } diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 4294363e75191..fa9c68fa598c9 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -172,7 +172,7 @@ $search_date_end = strtotime($fiscalYear->date_end); } else { $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); - $year_start = dol_print_date(dol_now(), '%Y'); + $year_start = (int) dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) { $year_start--; // If current month is lower that starting fiscal month, we start last year } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 4e2b285669a74..88b34e5cba184 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -177,7 +177,7 @@ $search_date_end = strtotime($fiscalYear->date_end); } else { $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); - $year_start = dol_print_date(dol_now(), '%Y'); + $year_start = (int) dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) { $year_start--; // If current month is lower that starting fiscal month, we start last year } @@ -1212,8 +1212,10 @@ } // Document ref - $modulepart = ''; + $modulepart = ''; // may be used by include*.tpl.php if (!empty($arrayfields['t.doc_ref']['checked'])) { + $objectstatic = null; + if ($line->doc_type === 'customer_invoice') { $langs->loadLangs(array('bills')); @@ -1270,11 +1272,11 @@ $labeltoshow = ''; $labeltoshowalt = ''; $classforlabel = ''; - if ($line->doc_type === 'customer_invoice' || $line->doc_type === 'supplier_invoice' || $line->doc_type === 'expense_report') { + if (($line->doc_type === 'customer_invoice' || $line->doc_type === 'supplier_invoice' || $line->doc_type === 'expense_report') && is_object($objectstatic)) { $labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); $labeltoshow .= $documentlink; $labeltoshowalt .= $objectstatic->ref; - } elseif ($line->doc_type === 'bank') { + } elseif ($line->doc_type === 'bank' && is_object($objectstatic)) { $labeltoshow .= $objectstatic->getNomUrl(1); $labeltoshowalt .= $objectstatic->ref; $bank_ref = strstr($line->doc_ref, '-'); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 7f9d5a12b5292..4c2fad27f0d81 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -153,7 +153,7 @@ $search_date_end = strtotime($fiscalYear->date_end); } else { $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); - $year_start = dol_print_date(dol_now(), '%Y'); + $year_start = (int) dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) { $year_start--; // If current month is lower that starting fiscal month, we start last year } @@ -1032,7 +1032,7 @@ $totalarray['val'] = array(); $totalarray['val']['totaldebit'] = 0; $totalarray['val']['totalcredit'] = 0; -$totalarray['val']['totalbalance']=0; +$totalarray['val']['totalbalance'] = 0; while ($i < min($num, $limit)) { $line = $object->lines[$i]; @@ -1283,7 +1283,7 @@ // Label operation if (!empty($arrayfields['t.label_operation']['checked'])) { - // Affiche un lien vers la facture client/fournisseur + // Show a link to the customer/supplier invoice $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); if (strlen(length_accounta($line->subledger_account)) == 0) { print ''.dol_escape_htmltag($line->label_operation).''; diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index 36f26b27f0d35..7cba6c8bfb7a3 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2017-2019 Frédéric France * Copyright (C) 2017 André Schild * Copyright (C) 2020 Guillaume Alexandre + * 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 @@ -179,7 +180,7 @@ public function computePieceNum(&$arrayrecord, $listfields, $record_key) } // at least one record value has changed, so we search for the next piece number from database or increment it - if ($atLeastOneLastRecordChanged === true) { + if ($atLeastOneLastRecordChanged) { $lastPieceNum = 0; if (empty($conf->cache['accounting']['nextPieceNum'])) { // get last piece number from database diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 25e9b0ca80d11..329b2986fe603 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -466,7 +466,7 @@ public function delete($user, $notrigger = 0) } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withlabel 0=No label, 1=Include label of account diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 3d55890919dbf..da85d8e363049 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -582,7 +582,7 @@ public function getAssetData(User $user, $type = 'view', $date_start = null, $da } $lines = array(); - $lines[0][$accountancy_code_value_asset_sold] = -($element_static->acquisition_value_ht - $last_cumulative_amount_ht); + $lines[0][$accountancy_code_value_asset_sold] = -((float) $element_static->acquisition_value_ht - $last_cumulative_amount_ht); $lines[0][$accountancy_code_depreciation_asset] = -$last_cumulative_amount_ht; $lines[0][$accountancy_code_asset] = $element_static->acquisition_value_ht; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 4bc9933e844d4..26ceb4868bafd 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -185,7 +185,7 @@ class BookKeeping extends CommonObject public $linesexport = array(); /** - * @var integer|string date of movement who are noticed like exported + * @var int|string date of movement who are noticed like exported */ public $date_export; @@ -3096,8 +3096,18 @@ class BookKeepingLine extends CommonObjectLine */ public $id; + /** + * @var ?int Date of source document + */ public $doc_date = null; + /** + * @var string Doc type + */ public $doc_type; + + /** + * @var string Doc ref + */ public $doc_ref; /** @@ -3110,13 +3120,44 @@ class BookKeepingLine extends CommonObjectLine */ public $fk_docdet; + /** + * @var string Thirdparty code + */ public $thirdparty_code; + + /** + * @var string|null Subledger account + */ public $subledger_account; + + /** + * @var string|null Subledger label + */ public $subledger_label; + + /** + * @var string doc_type + */ public $numero_compte; + + /** + * @var string label compte + */ public $label_compte; + + /** + * @var string label operation + */ public $label_operation; + + /** + * @var float FEC:Debit + */ public $debit; + + /** + * @var float FEC:Credit + */ public $credit; /** @@ -3144,7 +3185,15 @@ class BookKeepingLine extends CommonObjectLine * @var string Sens */ public $sens; + + /** + * @var ?string + */ public $lettering_code; + + /** + * @var string + */ public $date_lettering; /** @@ -3152,8 +3201,20 @@ class BookKeepingLine extends CommonObjectLine */ public $fk_user_author; + + /** + * @var string key for import + */ public $import_key; + + /** + * @var string + */ public $code_journal; + + /** + * @var string + */ public $journal_label; /** * @var int accounting transaction id @@ -3161,12 +3222,12 @@ class BookKeepingLine extends CommonObjectLine public $piece_num; /** - * @var integer|string $date_export; + * @var int|string $date_export; */ public $date_export; /** - * @var integer|string $date_lim_reglement; + * @var int|string $date_lim_reglement; */ public $date_lim_reglement; } diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 1dd8002ce9341..8aab1a2657554 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -163,7 +164,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Cl.C3.B4ture_annuelle'; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-closure-index'); $formconfirm = ''; @@ -255,7 +256,7 @@ 'name' => 'date_start', 'type' => 'date', 'label' => $langs->trans('DateStart'), - 'value' => dol_time_plus_duree($current_fiscal_period['date_end'], -1, 'm') + 'value' => dol_time_plus_duree((int) $current_fiscal_period['date_end'], -1, 'm') ); $form_question['date_end'] = array( 'name' => 'date_end', diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index c6519533a3347..66cc1ebd48ae9 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -423,7 +423,7 @@ // Fees description -- Can be null print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1)); - $trunclength = getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION', 32); + $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index ba963e78d6efa..a0a4b0ea48f6c 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -137,10 +137,10 @@ $sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,"; $sql .= " soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,"; if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { - $sql .= " spe.accountancy_code_customer as code_compta,"; + $sql .= " spe.accountancy_code_customer as code_compta_client,"; $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,"; } else { - $sql .= " soc.code_compta,"; + $sql .= " soc.code_compta as code_compta_client,"; $sql .= " soc.code_compta_fournisseur,"; } $sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, u.statut as userstatus,"; @@ -215,7 +215,7 @@ $tabmoreinfo = array(); ' -@phan-var-force array $tabcompany +@phan-var-force array $tabcompany @phan-var-force array $tabuser @phan-var-force array $tabpay @phan-var-force array $tabtp @@ -279,7 +279,7 @@ $compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier); } if ($lineisasale > 0) { - $compta_soc = (!empty($obj->code_compta) ? $obj->code_compta : $account_customer); + $compta_soc = (!empty($obj->code_compta_client) ? $obj->code_compta_client : $account_customer); } $tabcompany[$obj->rowid] = array( diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 46f986c08ac9a..37327508d78af 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -122,10 +122,10 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,"; if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { - $sql .= " spe.accountancy_code_customer as code_compta,"; + $sql .= " spe.accountancy_code_customer as code_compta_client,"; $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,"; } else { - $sql .= " s.code_compta as code_compta,"; + $sql .= " s.code_compta as code_compta_client,"; $sql .= " s.code_compta_fournisseur,"; } $sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,"; @@ -208,7 +208,7 @@ $obj = $db->fetch_object($result); // Controls - $compta_soc = (!empty($obj->code_compta)) ? $obj->code_compta : $cptcli; + $compta_soc = (!empty($obj->code_compta_client)) ? $obj->code_compta_client : $cptcli; $compta_prod = $obj->compte; if (empty($compta_prod)) { @@ -405,15 +405,16 @@ GROUP BY fk_facture "; $resql = $db->query($sql); - -$num = $db->num_rows($resql); -$i = 0; -while ($i < $num) { - $obj = $db->fetch_object($resql); - if ($obj->nb > 0) { - $errorforinvoice[$obj->fk_facture_fourn] = 'somelinesarenotbound'; +if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + if ($obj->nb > 0) { + $errorforinvoice[$obj->fk_facture_fourn] = 'somelinesarenotbound'; + } + $i++; } - $i++; } //var_dump($errorforinvoice);exit; diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index fdd46b9f0f40f..0a1ab7f661069 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -56,6 +56,8 @@ $action = GETPOST('action', 'aZ09'); $modulepart = GETPOST('modulepart', 'aZ09'); +$reg = array(); + /* * Actions @@ -63,6 +65,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +global $conf; + if ($action == 'set_default') { $ret = addDocumentModel($value, $type, $label, $scandir); $res = true; @@ -181,7 +185,7 @@ } } - $consttype = GETPOST('consttype', 'alpha'); + $consttype = GETPOSTINT('consttype'); $constnote = GETPOST('constnote'); $res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity); @@ -295,14 +299,14 @@ print ''."\n"; print ''.$modCodeMember->name.''."\n"; print ''.$modCodeMember->info($langs).''."\n"; - print ''.$modCodeMember->getExample($langs).''."\n"; + print ''.$modCodeMember->getExample().''."\n"; if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == "$file") { print ''."\n"; print img_picto($langs->trans("Activated"), 'switch_on'); print "\n"; } else { - $disabled = (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false); + $disabled = isModEnabled('multicompany') && ((is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity)); print ''; if (!$disabled) { print ''; @@ -315,7 +319,7 @@ } print ''; - $s = $modCodeMember->getToolTip($langs, null, -1); + $s = $modCodeMember->getToolTip($langs, null); print $form->textwithpicto('', $s, 1); print ''; @@ -389,6 +393,7 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force doc_generic_member_odt|pdf_standard_member $module'; $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 2ccb20f51bb2d..c4937a8a8a877 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -1,9 +1,10 @@ - * Copyright (C) 2006-2015 Laurent Destailleur - * Copyright (C) 2006-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2024 Alexandre Spangaro +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2006-2012 Regis Houssin + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 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 @@ -75,8 +76,8 @@ $res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", !$showtable, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show" - $res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", !$showvoteallowed, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show" + $res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", (string) !$showtable, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show" + $res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", (string) !$showvoteallowed, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show" $res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity); if ($forcetype < 0) { $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index d4b06aa2b1fd5..58a9c4d7b2a5c 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 Philippe Grand + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,14 +33,29 @@ abstract class ActionsAdherentCardCommon */ public $db; + /** + * @var string + */ public $dirmodule; + /** + * @var string + */ public $targetmodule; + /** + * @var string + */ public $canvas; + /** + * @var string + */ public $card; - - //! Template container + /** + * @var array Template container + */ public $tpl = array(); - //! Object container + /** + * @var Object container + */ public $object; /** @@ -57,7 +73,7 @@ abstract class ActionsAdherentCardCommon * Get object * * @param int $id Object id - * @return object Object loaded + * @return Adherent Object loaded */ public function getObject($id) { diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 451cd8cd81c1a..e9a5b94e0e9b4 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -471,7 +471,7 @@ $pass = GETPOST("password", 'password'); // For password, we use 'none' $photo = GETPOST("photo", 'alphanohtml'); $morphy = GETPOST("morphy", 'alphanohtml'); - $public = GETPOST("public", 'alphanohtml'); + $public = GETPOSTINT("public"); $userid = GETPOSTINT("userid"); $socid = GETPOSTINT("socid"); @@ -1419,7 +1419,7 @@ function initfieldrequired() { print ''; // Other attributes. Fields from hook formObjectOptions and Extrafields. - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; print ''; print dol_get_fiche_end(); @@ -2085,7 +2085,7 @@ function initfieldrequired() { print '
'; - $MAX = 10; + $MAXEVENT = 10; $morehtmlcenter = ''; $messagingUrl = DOL_URL_ROOT.'/adherents/messaging.php?rowid='.$object->id; @@ -2095,7 +2095,7 @@ function initfieldrequired() { // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAX, '', $morehtmlcenter); + $somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAXEVENT, '', $morehtmlcenter); print '
'; } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7eb943244d427..9acc5a1fe7868 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -96,7 +96,7 @@ class Adherent extends CommonObject /** * @var string - * @deprecated + * @deprecated Use $civility_code * @see $civility_code */ public $civility_id; @@ -106,11 +106,14 @@ class Adherent extends CommonObject */ public $civility_code; + /** + * @var int + */ public $civility; /** * @var string company name - * @deprecated + * @deprecated Use $company * @see $company */ public $societe; @@ -122,7 +125,7 @@ class Adherent extends CommonObject /** * @var int Thirdparty ID - * @deprecated + * @deprecated Use $socid * @see $socid */ public $fk_soc; @@ -133,7 +136,7 @@ class Adherent extends CommonObject public $socid; /** - * @var array array of socialnetworks + * @var array array of socialnetworks */ public $socialnetworks; @@ -202,6 +205,9 @@ class Adherent extends CommonObject */ public $datem; + /** + * @var string|int + */ public $datevalid; /** @@ -239,6 +245,9 @@ class Adherent extends CommonObject */ public $user_login; + /** + * @var string|int + */ public $datefin; @@ -299,13 +308,13 @@ class Adherent extends CommonObject public $partnerships = array(); /** - * @var Facture|null To store the created invoice into subscriptionComplementaryActions() + * @var ?Facture To store the created invoice into subscriptionComplementaryActions() */ public $invoice; /** - * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -795,7 +804,7 @@ public function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = $sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null"); $sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null"); $sql .= ", photo = ".($this->photo ? "'".$this->db->escape($this->photo)."'" : "null"); - $sql .= ", public = '".$this->db->escape($this->public)."'"; + $sql .= ", public = ".(int) $this->public; $sql .= ", statut = ".(int) $this->statut; $sql .= ", default_lang = ".(!empty($this->default_lang) ? "'".$this->db->escape($this->default_lang)."'" : "null"); $sql .= ", fk_adherent_type = ".(int) $this->typeid; @@ -2291,7 +2300,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small, -4=???) * @param int $maxlen length max label @@ -2679,6 +2688,7 @@ public function initAsSpecimen() $this->photo = ''; $this->public = 1; $this->statut = self::STATUS_DRAFT; + $this->status = self::STATUS_DRAFT; $this->datefin = $now; $this->datevalid = $now; @@ -3044,7 +3054,7 @@ public function sendReminderForExpiredSubscription($daysbeforeendlist = '10') } $tmp = dol_getdate($now); - $datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year'], 'tzserver'), $daysbeforeend, 'd'); + $datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year'], 'tzserver'), (int) $daysbeforeend, 'd'); $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent'; $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only; @@ -3251,11 +3261,11 @@ public function sendReminderForExpiredSubscription($daysbeforeendlist = '10') } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array{string,mixed} $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 605c9b248e66d..497d4e4d8dcb4 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2018-2019 Thibault Foucart * Copyright (C) 2021 Waël Almoman * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This 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,20 +68,23 @@ class AdherentType extends CommonObject */ public $morphy; + /** + * @var string + */ public $duration; /** - * type expiration + * @var int type expiration */ public $duration_value; /** - * Expiration unit + * @var string Expiration unit */ public $duration_unit; /** - * @var int Subscription required (0 or 1) + * @var int<0,1> Subscription required (0 or 1) */ public $subscription; @@ -118,7 +122,7 @@ class AdherentType extends CommonObject /** @var string Email sent after exclude */ public $mail_exclude = ''; - /** @var array Array of members */ + /** @var Adherent[] Array of members */ public $members = array(); /** @@ -501,7 +505,7 @@ public function fetch($rowid) $this->morphy = $obj->morphy; $this->status = $obj->status; $this->duration = $obj->duration; - $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1); + $this->duration_value = (int) substr($obj->duration, 0, dol_strlen($obj->duration) - 1); $this->duration_unit = substr($obj->duration, -1); $this->subscription = $obj->subscription; $this->amount = $obj->amount; @@ -533,7 +537,7 @@ public function fetch($rowid) * Return list of members' type * * @param int $status Filter on status of type - * @return array List of types of members + * @return array List of types of members */ public function liste_array($status = -1) { @@ -572,7 +576,7 @@ public function liste_array($status = -1) * Return the array of all amounts per membership type id * * @param int $status Filter on status of type - * @return array Array of membership type + * @return array Array of membership type */ public function amountByType($status = null) { @@ -608,11 +612,11 @@ public function amountByType($status = null) /** * Return array of Member objects for member type this->id (or all if this->id not defined) * - * @param string $excludefilter Filter to exclude. This value must not come from a user input. - * @param int $mode 0=Return array of member instance + * @param string $excludefilter Filter to exclude. This value must not come from a user input. + * @param int<0,2> $mode 0=Return array of member instance * 1=Return array of member instance without extra data * 2=Return array of members id only - * @return mixed Array of members or -1 on error + * @return Adherent[]|int<-1,-1> Array of members or -1 on error */ public function listMembersForMemberType($excludefilter = '', $mode = 0) { @@ -699,9 +703,9 @@ public function getTooltipContentArray($params) if (isset($this->duration)) { $datas['duration'] = '
'.$langs->trans("Duration").': '.$this->duration_value; if ($this->duration_value > 1) { - $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); } elseif ($this->duration_value > 0) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); } $datas['duration'] .= " " . (!empty($this->duration_unit) && isset($dur[$this->duration_unit]) ? $langs->trans($dur[$this->duration_unit]) : ''); } @@ -710,14 +714,14 @@ public function getTooltipContentArray($params) } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $maxlen length max label - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @return string String with URL + * @param int<0,2> $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $maxlen length max label + * @param int<0,1> $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL */ public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { @@ -772,8 +776,8 @@ public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $morecss /** * Return label of status (activity, closed) * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status */ public function getLibStatut($mode = 0) { @@ -784,9 +788,9 @@ public function getLibStatut($mode = 0) /** * Return the label of a given status * - * @param int $status Status id - * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Status label + * @param int $status Status id + * @param int<0,6> $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Status label */ public function LibStatut($status, $mode = 0) { @@ -814,11 +818,11 @@ public function LibStatut($status, $mode = 0) /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * - * @param array $info Info array loaded by _load_ldap_info - * @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) - * 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb) - * 2=Return key only (uid=qqq) - * @return string DN + * @param array $info Info array loaded by _load_ldap_info + * @param int<0,2> $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) + * 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb) + * 2=Return key only (uid=qqq) + * @return string DN */ public function _load_ldap_dn($info, $mode = 0) { @@ -970,11 +974,11 @@ public function getMailOnExclude() /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array{string,mixed} $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 78c531785a77e..c515188aa2014 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -40,12 +40,30 @@ class AdherentStats extends Stats */ public $table_element; + /** + * @var int + */ public $memberid; + /** + * @var int + */ public $socid; + /** + * @var int + */ public $userid; + /** + * @var string + */ public $from; + /** + * @var string + */ public $field; + /** + * @var string + */ public $where; diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 2012f7c839d6e..5f56609fd0d68 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -98,7 +98,7 @@ class Subscription extends CommonObject public $fk_bank; /** - * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -420,7 +420,7 @@ public function delete($user, $notrigger = 0) /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $notooltip 1=Disable tooltip @@ -536,10 +536,10 @@ public function info($id) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array $arraydata Array of data + * @param array{selected:?int,member:?Adherent,bank:?Account} $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) diff --git a/htdocs/adherents/messaging.php b/htdocs/adherents/messaging.php index 9222b072f5cfe..2ea8397391919 100644 --- a/htdocs/adherents/messaging.php +++ b/htdocs/adherents/messaging.php @@ -196,7 +196,7 @@ $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 - $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); + $titlelist = $langs->trans("ActionsOnMember").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); if (!empty($conf->dol_optimize_smallscreen)) { $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 1caa87e4a948c..1cf4c41a04daf 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -986,9 +986,9 @@ } // Now do a correction of the suggested date if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "m") { - $datefrom = dol_get_first_day(dol_print_date($datefrom, "%Y"), dol_print_date($datefrom, "%m")); + $datefrom = dol_get_first_day((int) dol_print_date($datefrom, "%Y"), (int) dol_print_date($datefrom, "%m")); } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "Y") { - $datefrom = dol_get_first_day(dol_print_date($datefrom, "%Y")); + $datefrom = dol_get_first_day((int) dol_print_date($datefrom, "%Y")); } } print $form->selectDate($datefrom, '', 0, 0, 0, "subscription", 1, 1); @@ -1000,9 +1000,9 @@ } if (!$dateto) { if (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH')) { - $dateto = dol_get_last_day(dol_print_date($datefrom, "%Y"), dol_print_date($datefrom, "%m")); + $dateto = dol_get_last_day((int) dol_print_date($datefrom, "%Y"), (int) dol_print_date($datefrom, "%m")); } elseif (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) { - $dateto = dol_get_last_day(dol_print_date($datefrom, "%Y")); + $dateto = dol_get_last_day((int) dol_print_date($datefrom, "%Y")); } else { $dateto = -1; // By default, no date is suggested } diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index e01630fefd36f..17e8b2f75c37e 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -409,7 +409,7 @@ /* include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element, $socid, 1); + $somethingshown = $formactions->showactions($object, $object->element, $socid, 1, '', $MAXEVENT); */ print ''; diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index 62a3a08aa49d8..21db449c9e9a4 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -29,7 +29,9 @@ global $user; $langs = $GLOBALS['langs']; +'@phan-var-force Translate $langs'; $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; +'@phan-var-force Subscription[] $linkedObjectBlock'; $langs->load("members"); $total = 0; diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php index e85d39c1d3602..e7bb1edb40d4a 100644 --- a/htdocs/adherents/type_ldap.php +++ b/htdocs/adherents/type_ldap.php @@ -36,15 +36,15 @@ $id = GETPOSTINT('rowid'); $action = GETPOST('action', 'aZ09'); +// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context +$hookmanager->initHooks(array('membertypeldapcard', 'globalcard')); + // Security check $result = restrictedArea($user, 'adherent', $id, 'adherent_type'); $object = new AdherentType($db); $object->fetch($id); -// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context -$hookmanager->initHooks(array('membertypeldapcard', 'globalcard')); - /* * Actions */ diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 12c91161e9281..99ae2a7d68ad4 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -53,6 +53,8 @@ // List of available colors $colorlist = array('BECEDD', 'DDBECE', 'BFDDBE', 'F598B4', 'F68654', 'CBF654', 'A4A4A5'); +$reg = array(); + /* * Actions diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 994537b515d02..4585a6be6fdab 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -256,6 +256,8 @@ require_once $dir.'/'.$file; $module = new $classname($db, new ActionComm($db)); + '@phan-var-force ModeleAction $module'; + print ''."\n"; print ""; print(empty($module->name) ? $name : $module->name); diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index bf50e94fb2fd0..f81d347f0046e 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -346,6 +346,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModeleBankAccountDoc $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -359,7 +361,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } @@ -374,7 +376,7 @@ print ''; } else { print ''."\n"; - print '
scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -468,7 +470,7 @@ print ''.$langs->trans("BankColorizeMovementName".$key).""; // Color print ''; - print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ? GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : getDolGlobalString($color)), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, '', 'right hideifnotset'); + print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ? GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : getDolGlobalString($color)), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, array(), 'right hideifnotset'); print ''; print ""; $i++; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index e16f64d15151e..94c655315bc1b 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -173,6 +173,8 @@ $classname = "mod".ucfirst($filebis); $module = new $classname($db); + '@phan-var-force ModeleBarCode $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -288,6 +290,9 @@ } $modBarCode = new $file(); + + '@phan-var-force ModeleNumRefBarCode $modBarCode'; + print ''; print ''.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."\n"; print $modBarCode->info($langs); diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index bd4aa16113657..67be5735c8087 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -212,6 +212,8 @@ $module = new $classname($db); + '@phan-var-force ModeleNumRefBoms $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 51d9aac95ebb3..c4d0665d987d4 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -860,7 +860,7 @@ print "\n"; } else { if (empty($mysoc->country_code)) { - print ''.$countrynotdefined.''; + print ''.$countrynotdefined.''; } else { print ''.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).''; } @@ -903,7 +903,7 @@ print "\n"; } else { if (empty($mysoc->country_code)) { - print ''.$countrynotdefined.''; + print ''.$countrynotdefined.''; } else { print ''.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).''; } @@ -929,7 +929,7 @@ print "\n"; } else { if (empty($mysoc->country_code)) { - print ''.$countrynotdefined.''; + print ''.$countrynotdefined.''; } else { print ''.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).''; } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index c42cd594fb869..da9a81fefdb48 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -247,6 +247,8 @@ /** @var ModelNumRefContracts $module */ $module = new $file($db); + '@phan-var-force ModelNumRefContracts $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -383,6 +385,8 @@ /** @var ModelePDFContract $module */ $module = new $classname($db); + '@phan-var-force ModelePDFContract $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -396,7 +400,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index c607f19922aa3..21bfe66310043 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -259,6 +259,8 @@ $module = new $file(); + '@phan-var-force ModeleNumRefDeliveryOrder $module'; + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -392,6 +394,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFDeliveryOrder $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -405,7 +409,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 4e79bde4b08fc..ef3df0538ad1d 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/socialnetwork.lib.php'; // constants for IDs of core dictionaries const DICT_FORME_JURIDIQUE = 1; @@ -1261,6 +1262,12 @@ llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-admin page-dict'); +if (GETPOSTINT('id') == DICT_SOCIALNETWORKS && $from == 'socialnetworksetup') { + $head = socialnetwork_prepare_head(); + print dol_get_fiche_head($head, 'dict', $langs->trans('MenuDict'), -1, 'user'); +} + + $linkback = ''; if ($id && empty($from)) { $title .= ' - '.$langs->trans($tablib[$id]); @@ -2620,7 +2627,9 @@ } print '
'; - +if (GETPOST('id') && GETPOST('id') == DICT_SOCIALNETWORKS) { + print dol_get_fiche_end(); +} // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index ac2e3c2ea46f2..a3648c44a6862 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -1,6 +1,7 @@ . + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modifyion 2.0 (the "License"); * it under the terms of the GNU General Public License as published bypliance with the License. @@ -39,18 +40,48 @@ class Dolistore */ public $end; - public $per_page; // pagination: display per page - public $categorie; // the current categorie + /** + * @var int Pagination: display per page + */ + public $per_page; + /** + * @var int The current categorie + */ + public $categorie; + /** + * @var ?SimpleXMLElement + */ public $categories; // an array of categories - public $search; // the search keywords + + /** + * @var string The search keywords + */ + public $search; // setups + /** + * @var string + */ public $url; // the url of this page + /** + * @var string + */ public $shop_url; // the url of the shop + /** + * @var int + */ public $lang; // the integer representing the lang in the store + /** + * @var bool + */ public $debug_api; // useful if no dialog - + /** + * @var PrestaShopWebservice + */ public $api; + /** + * @var ?SimpleXMLElement + */ public $products; /** @@ -99,6 +130,7 @@ public function getRemoteCategories() // Call dol_syslog("Call API with opt = ".var_export($opt, true)); $xml = $this->api->get($opt); + // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall $this->categories = $xml->categories->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors @@ -118,7 +150,7 @@ public function getRemoteCategories() * Load data from remote Dolistore market place. * This fills ->products * - * @param array $options Options. If 'categorie' is defined, we filter products on this category id + * @param array{start:int,end:int,per_page:int,categorie:int,search:string} $options Options. If 'categorie' is defined, we filter products on this category id * @return void */ public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0, 'search' => '')) @@ -154,6 +186,7 @@ public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'p $xml = $this->api->get($opt2); $products = array(); + // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall foreach ($xml->products->children() as $product) { $products[] = (int) $product['id']; } @@ -168,6 +201,7 @@ public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'p $xml = $this->api->get($opt2); $products = array(); + // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall foreach ($xml->category->associations->products->children() as $product) { $products[] = (int) $product->id; } @@ -182,6 +216,7 @@ public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'p // Call API to get the detail dol_syslog("Call API with opt = ".var_export($opt, true)); $xml = $this->api->get($opt); + // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall $this->products = $xml->products->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors @@ -222,14 +257,14 @@ public function get_categories($parent = 0) if ($cat->is_root_category == 1 && $parent == 0) { $html .= '
  • description->language[$this->lang - 1])).'">'.dol_escape_htmltag($cat->name->language[$this->lang - 1]).' '.dol_escape_htmltag($cat->nb_products_recursive).'

    '; - $html .= self::get_categories($cat->id); + $html .= self::get_categories((int) $cat->id); $html .= "
  • \n"; } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau $select = ($cat->id == $this->categorie) ? ' selected' : ''; $html .= '
  • description->language[$this->lang - 1])).'" '; $html .= '>'.dol_escape_htmltag($cat->name->language[$this->lang - 1]).' '.dol_escape_htmltag($cat->nb_products_recursive).''; - $html .= self::get_categories($cat->id); + $html .= self::get_categories((int) $cat->id); $html .= "
  • \n"; } } @@ -401,7 +436,7 @@ public function get_next_url() { // phpcs:enable $param_array = array(); - if (count($this->products) < $this->per_page) { + if ($this->products !== null && count($this->products) < $this->per_page) { $add = 0; } else { $add = $this->per_page; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 02bc1f00c8112..925a0eb4d75f9 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -439,15 +439,16 @@ $credentials = new Credentials( getDolGlobalString('OAUTH_'.$object->oauth_service.'_ID'), getDolGlobalString('OAUTH_'.$object->oauth_service.'_SECRET'), - getDolGlobalString('OAUTH_'.$object->oauth_service.'_URLAUTHORIZE') + getDolGlobalString('OAUTH_'.$object->oauth_service.'_URLCALLBACK') ); $serviceFactory = new \OAuth\ServiceFactory(); $oauthname = explode('-', $OAUTH_SERVICENAME); // ex service is Google-Emails we need only the first part Google $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); + '@phan-var-force OAuth\OAuth2\Service\AbstractService|OAuth\OAuth1\Service\AbstractService $apiService'; // createService is only ServiceInterface - // We have to save the token because Google give it only once + // We need to save the token because Google provides it only once $refreshtoken = $tokenobj->getRefreshToken(); //var_dump($tokenobj); @@ -457,6 +458,7 @@ throw new Exception("Failed to refresh access token: ".$e->getMessage()); } + // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall $tokenobj->setRefreshToken($refreshtoken); $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); } diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 71e457920742e..940c016b07fd8 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -203,6 +203,7 @@ require_once $dir.$file.'.php'; $module = new $file(); + '@phan-var-force ModelNumRefExpedition $module'; if ($module->isEnabled()) { // Show modules according to features level @@ -340,6 +341,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePdfExpedition $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -353,7 +356,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 6eee65a50a804..c8b57520e24f0 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -228,6 +228,8 @@ $module = new $file($db); + '@phan-var-force ModeleNumRefExpenseReport $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -237,7 +239,7 @@ } if ($module->isEnabled()) { - print ''.$module->nom."\n"; + print ''.$module->getName($langs)."\n"; print $module->info($langs); print ''; @@ -359,6 +361,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModeleExpenseReport $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -372,7 +376,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 4e4ef01d9f042..8440bee8e74d0 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -3,6 +3,7 @@ * Copyright (C) 2017 ATM Consulting * Copyright (C) 2017 Pierre-Henry Favre * Copyright (C) 2018-2019 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 @@ -355,7 +356,7 @@ echo ''; } -if (count($rules) == 0) { +if (!is_array($rules) || count($rules) == 0) { print ''.$langs->trans("None").''; } diff --git a/htdocs/admin/fediverse.php b/htdocs/admin/fediverse.php new file mode 100644 index 0000000000000..2a9c7fbbdbc8f --- /dev/null +++ b/htdocs/admin/fediverse.php @@ -0,0 +1,444 @@ + + * Copyright (C) 2003,2005 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2020 Tobias Sekan + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/faitdivers.php + * \ingroup faitdivers + * \brief Page to setupe module Socialnetworks + */ + +//load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/socialnetwork.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/modSocialNetworks.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/fediverseparser.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/boxes/box_fediverse.php'; + + + +//load translation files requires by the page +$langs->loadLangs(array('admin', 'users', 'dict')); + +$action = GETPOST('action', 'aZ09'); + +// Security check +if (!$user->admin) { + accessforbidden(); +} +if (!isModEnabled('socialnetworks')) { + accessforbidden('Module Social Networks is not enabled'); +} + + +/* + * Actions + */ + +if ($action == 'add') { + $error = 0; + + if (empty(GETPOST('socialnetwork_name')) || empty(GETPOST('socialnetwork_url'))) { + $error++; + } + + $socialNetworkName = GETPOST('socialnetwork_name', 'alpha'); + $socialNetworkUrl = GETPOST('socialnetwork_url', 'alpha'); + + // other params if exist + $paramNames = GETPOST('param_name', 'array'); + $paramValues = GETPOST('param_value', 'array'); + + $additionalParams = []; + if (!empty($paramNames) && is_array($paramNames)) { + foreach ($paramNames as $index => $paramName) { + if (!empty($paramName) && isset($paramValues[$index])) { + $additionalParams[$paramName] = $paramValues[$index]; + } + } + } + if (!$error) { + $db->begin(); + + $socialNetworkData = array( + 'title' => $socialNetworkName, + 'url' => $socialNetworkUrl + ); + + $socialNetworkData = array_merge($socialNetworkData, $additionalParams); + + $boxlabel = '(SocialNetwoksInformations)'; + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)"; + $sql .= " VALUES ('box_fediverse.php', '".$db->escape($socialNetworkName)."')"; + + if (!$db->query($sql)) { + dol_print_error($db); + $error++; + } else { + $jsonData = json_encode($socialNetworkData); + $result = dolibarr_set_const($db, "SOCIAL_NETWORKS_DATA_".$socialNetworkName, $jsonData, 'chaine', 0, '', $conf->entity); + } + } + if ($result) { + $db->commit(); + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } else { + $db->rollback(); + dol_print_error($db); + } +} + +if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes') { + $error = 0; + $key = GETPOST('key', 'alpha'); + $name = ''; + $sqlgetName = "SELECT note FROM ".MAIN_DB_PREFIX."boxes_def WHERE rowid=".((int) $key); + + $resqName = $db->query($sqlgetName); + if ($resqName) { + $objName = $db->fetch_object($resqName); + $name = $objName->note; + } + + $db->begin(); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; + $sql .= " WHERE entity = ".$conf->entity; + $sql .= " AND box_id = ".((int) $key); + $resql1 = $db->query($sql); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def"; + $sql .= " WHERE rowid = ".((int) $key); + $resql2 = $db->query($sql); + + if (!$resql1 || !$resql2) { + $db->rollback(); + dol_print_error($db, "sql=".$sql); + exit; + } else { + $result = dolibarr_del_const($db, "SOCIAL_NETWORKS_DATA_".$name, $conf->entity); + if ($result) { + $db->commit(); + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } else { + $db->rollback(); + dol_print_error($db); + } + } +} + +if ($action == 'updatesocialnetwork') { + $error = 0; + $id = GETPOST('key', 'alpha'); + $name = GETPOST('socialnetwork_name'); + $url = GETPOST('socialnetwork_url'); + $paramsKey = GETPOST('paramsKey', 'array'); + $paramsVal = GETPOST('paramsVal', 'array'); + + $result = dolibarr_get_const($db, "SOCIAL_NETWORKS_DATA_".$name, $conf); + $socialNetworkData = json_decode($result, true); + + foreach ($paramsKey as $index => $key) { + if (empty($key) || empty($paramsVal[$index])) { + $error++; + } + } + // delete others params + foreach ($socialNetworkData as $key => $value) { + if ($key != 'title' && $key != 'url') { + unset($socialNetworkData[$key]); + } + } + + // new keys and new values in array + $mergedParams = array(); + foreach ($paramsKey as $index => $key) { + if (isset($paramsVal[$index])) { + $mergedParams[$key] = $paramsVal[$index]; + } + } + + // Add new key, value if changed + foreach ($mergedParams as $newKey => $newValue) { + if (!isset($socialNetworkData[$newKey]) || $socialNetworkData[$newKey] !== $newValue) { + $socialNetworkData[$newKey] = $newValue; + } + } + if (!$error) { + $newData = json_encode($socialNetworkData); + $result = dolibarr_set_const($db, "SOCIAL_NETWORKS_DATA_".$name, $newData, 'chaine', 0, '', $conf->entity); + if ($result) { + $db->commit(); + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } else { + $db->rollback(); + dol_print_error($db); + } + } else { + setEventMessages($langs->trans("ErrorInputRequired"), null, 'errors'); + header("Location: ".$_SERVER["PHP_SELF"].'?action=editsocialnetwork&token='.newToken().'&key='.$id); + exit; + } +} + + + +/* + * View + */ + +$form = new Form($db); + +llxHeader('', $langs->trans("FediverseSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-dict'); + +$head = socialnetwork_prepare_head(); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print dol_get_fiche_head($head, 'divers', $langs->trans('MenuDict'), -1, 'user', 0, $linkback, '', 0, '', 0); + +$title = $langs->trans("ConfigImportSocialNetwork"); + +print_barre_liste($title, '', $_SERVER["PHP_SELF"], '', '', '', '', -1, '', 'tools', 0, '', '', -1, 0, 0, 0, ''); + + +print '
    '; +print ''; + +print '
    '; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + + +print '
    '.$langs->trans("NewSocialNetwork").''.$langs->trans("Example").'
    '.$langs->trans("Title").'Mastodon
    '.$langs->trans('SocialNetworkUrl').'https://mastodon.social/api/v1/accounts/id_user
    '; +print $form->textwithpicto($langs->trans("Others"), $langs->trans("AddMoreParams")); +print 'Token : ****
    Cookie : ****
    '; +print '
    '; +print '
    '; + +print '
    '; + +print $form->buttonsSaveCancel("Add", ''); +print ''; +print ''; +print '
    '; + +print '

    '; +print ''.$langs->trans('SocialNetworksNote').''; +print ' - '; +print ''.$langs->trans('JumpToBoxes').''; +print '

    '; + + +if ($action == 'deletesocialnetwork') { + $formconfirm = $form->formconfirm( + $_SERVER["PHP_SELF"].'?key='.urlencode(GETPOST('key', 'alpha')), + $langs->trans('Delete'), + $langs->trans('ConfirmDeleteSocialNetwork', GETPOST('key', 'alpha')), + 'confirm_delete', + '', + 0, + 1 + ); + print $formconfirm; +} +$sql = "SELECT rowid, file, note FROM ".MAIN_DB_PREFIX."boxes_def"; +$sql .= " WHERE file = 'box_fediverse.php'"; +$sql .= " ORDER BY note"; + +dol_syslog("select socialnetworks boxes", LOG_DEBUG); +$resql = $db->query($sql); +if ($resql) { + $boxlist = InfoBox::listBoxes($db, 'activated', -1, null); + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + + $jsonData = getDolGlobalString("SOCIAL_NETWORKS_DATA_".$obj->note); + + $socialNetworkData = json_decode($jsonData, true); + + $socialNetworkTitle = $socialNetworkData['title']; + $socialNetworkUrl = $socialNetworkData['url']; + $socialNetworkId = $obj->rowid; + + $fediverseparser = new SocialNetworkManager($socialNetworkTitle); + $path_fediverse = DOL_DATA_ROOT.'/fediverse/temp/'.$socialNetworkTitle; + + //check if other params exist + $authParams = []; + foreach ($socialNetworkData as $key => $value) { + if ($key !== 'title' && $key !== 'url') { + $authParams[$key] = $value; + } + } + + $result = $fediverseparser->fetchPosts($socialNetworkUrl, 5, 300, $path_fediverse, $authParams); + + print "
    "; + print '
    '."\n"; + print ''."\n"; + + print ''."\n"; + + print ''; + print ""; + print ''; + print ''."\n"; + + print ''; + print '"; + print ''; + print ''."\n"; + + print ''; + print ""; + print ''; + print ''."\n"; + + print ''; + print ""; + print ""; + print ''."\n"; + + // Active + $active = _isInBoxListFediverse((int) $socialNetworkId, $boxlist) ? 'yes' : 'no'; + + print ''; + print ''; + print ''; + print ''."\n"; + + if ($action == 'editsocialnetwork' && $socialNetworkId == GETPOST('key')) { + foreach ($socialNetworkData as $k => $val) { + if ($k != 'title' && $k != 'url') { + print ''; + print ''; + print ''."\n"; + } + } + + print ''; + print ''; + print ''; + print ''."\n"; + } + + print '
    ".$langs->trans("SocialNetworks")." ".($i+1)."'; + print ''.img_edit().''; + print ''.img_delete().''; + print ''; + print '
    '.$langs->trans("Title")."
    ".$langs->trans("URL")."
    ".$langs->trans("Status").""; + if ($result > 0 && empty($fediverseparser->error)) { + print ''.img_picto($langs->trans("Online"), 'tick', 'class="pictofixedwidth"').$langs->trans("Online").''; + } else { + print ''.$langs->trans("Offline"); + $langs->load("errors"); + if ($fediverseparser->error) { + print ' - '.$langs->trans($fediverseparser->error); + } + print ''; + } + print "
    '.$langs->trans('WidgetAvailable').''.yn($active); + print '   -   '; + print $langs->trans("JumpToBoxes"); + print ''; + print '
    '; + if ($k == 'password') { + print ''; + } else { + print ''; + } + print '
    '."\n"; + + print "
    \n"; + + $i++; + } +} else { + dol_print_error($db); +} + +print dol_get_fiche_end(); + +llxFooter(); +$db->close(); + +/** + * Check if the given fediverse feed if inside the list of boxes/widgets + * + * @param int $id The id of the socialnetwork + * @param array $boxlist A list with boxes/widgets (array of stdClass objects). + * @return bool True if the socialnetwork is inside the box/widget list, otherwise false + */ +function _isInBoxListFediverse(int $id, array $boxlist) +{ + foreach ($boxlist as $box) { + if ($box->boxcode === "lastfediverseinfos") { + return true; + } + } + return false; +} diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 033eceeaa89c2..39907889fafa4 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -295,6 +295,8 @@ $module = new $file(); + '@phan-var-force ModeleNumRefFicheinter $module'; + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -305,7 +307,7 @@ } - print ''.$module->nom."\n"; + print ''.$module->getName($langs)."\n"; print $module->info($langs); print ''; @@ -432,6 +434,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFFicheinter $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -445,7 +449,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/fichinter_xcal.php b/htdocs/admin/fichinter_xcal.php new file mode 100644 index 0000000000000..df02ac02a8653 --- /dev/null +++ b/htdocs/admin/fichinter_xcal.php @@ -0,0 +1,244 @@ + + * Copyright (C) 2012-2013 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2024 Charlene Benke + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/fichinter_xcal.php + * \ingroup agenda + * \brief Page to setup miscellaneous options of agenda module + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; + + +if (!$user->admin) { + accessforbidden(); +} + +// Load translation files required by the page +$langs->loadLangs(array("admin", "other", "agenda")); + +$def = array(); +$actionsave = GETPOST('save', 'alpha'); +$MAIN_FICHINTER_XCAL_EXPORTKEY = getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY'); +$MAIN_FICHINTER_EXPORT_PAST_DELAY = getDolGlobalString('MAIN_FICHINTER_EXPORT_PAST_DELAY', 100); +$MAIN_FICHINTER_EXPORT_CACHE = getDolGlobalInt('MAIN_FICHINTER_EXPORT_CACHE'); +$MAIN_FICHINTER_EXPORT_FIX_TZ = getDolGlobalString('MAIN_FICHINTER_EXPORT_FIX_TZ'); + +if (GETPOSTISSET('MAIN_FICHINTER_XCAL_EXPORTKEY')) { + $MAIN_FICHINTER_XCAL_EXPORTKEY = trim(GETPOST('MAIN_FICHINTER_XCAL_EXPORTKEY', 'alpha')); +} +if (GETPOSTISSET('MAIN_FICHINTER_EXPORT_PAST_DELAY')) { + $MAIN_FICHINTER_EXPORT_PAST_DELAY = intval(GETPOSTINT('MAIN_FICHINTER_EXPORT_PAST_DELAY')); +} +if (GETPOSTISSET('MAIN_FICHINTER_EXPORT_CACHE')) { + $MAIN_FICHINTER_EXPORT_CACHE = intval(GETPOSTINT('MAIN_FICHINTER_EXPORT_CACHE')); +} +if (GETPOSTISSET('MAIN_FICHINTER_EXPORT_FIX_TZ')) { + $MAIN_FICHINTER_EXPORT_FIX_TZ = trim(GETPOST('MAIN_FICHINTER_EXPORT_FIX_TZ', 'alpha')); +} + +// Sauvegardes parameters +if ($actionsave) { + $i = 0; + + $db->begin(); + + $i += dolibarr_set_const($db, 'MAIN_FICHINTER_XCAL_EXPORTKEY', $MAIN_FICHINTER_XCAL_EXPORTKEY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_FICHINTER_EXPORT_PAST_DELAY', $MAIN_FICHINTER_EXPORT_PAST_DELAY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_FICHINTER_EXPORT_CACHE', $MAIN_FICHINTER_EXPORT_CACHE, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_FICHINTER_EXPORT_FIX_TZ', $MAIN_FICHINTER_EXPORT_FIX_TZ, 'chaine', 0, '', $conf->entity); + + if ($i >= 4) { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + $db->rollback(); + setEventMessages($langs->trans("SaveFailed"), null, 'errors'); + } +} + + + +/** + * View + */ + +if (!getDolGlobalString("MAIN_FICHINTER_EXPORT_PAST_DELAY")) { + $conf->global->MAIN_FICHINTER_EXPORT_PAST_DELAY = 100; +} + +$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung'; +llxHeader('', $langs->trans("AgendaSetup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-agenda_xcal'); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup'); + + +print '
    '; +print ''; + +$head = fichinter_admin_prepare_head(); + +print dol_get_fiche_head($head, 'xcal', $langs->trans("Agenda"), -1, 'action'); + +print ''.$langs->trans("AgendaSetupOtherDesc")."
    \n"; +print "
    \n"; + +print '
    '; // You can use div-table-responsive-no-min if you don't need reserved height for your table +print ''; + +print ''; +print ""; +print ""; +//print ""; +print ""; +print ""; + +print ''; +print '"; +print ''; +print ""; +print ""; + +print ''; +print ""; +print '"; +print ""; +print ""; + +print ''; +print ""; +print ''; +print ""; +print ""; + +print '
    ".$langs->trans("Parameter")."".$langs->trans("Value")."".$langs->trans("Examples")." 
    '.$langs->trans("PasswordTogetVCalExport")."'; +if (!empty($conf->use_javascript_ajax)) { + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); +} +print ' 
    ".$langs->trans("PastDelayVCalExport")." '.$langs->trans("days")." 
    ".$langs->trans("UseACacheDelay")." 
    '; +print '
    '; + +print '
    '; + +print '
    '; // You can use div-table-responsive-no-min if you don't need reserved height for your table +print ''; + +print ''; +print '"; +print ""; +print ""; +print ''; +print '"; +print ""; +print ""; + +print '
    '.$langs->trans("Parameter")."".$langs->trans("Value")."
    '.$langs->trans("FixTZ").""; +print ''; +print '   '.$langs->trans("FillThisOnlyIfRequired"); +print "
    '; +print '
    '; + +print dol_get_fiche_end(); + +print $form->buttonsSaveCancel("Save", ''); + +print "
    \n"; + + +clearstatcache(); + +//if ($mesg) print "
    $mesg
    "; +print "
    "; + + +// Define $urlwithroot +$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current +$getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : ""); + +// Show message +$message = ''; + +$urlvcal = ''; +$urlvcal .= $urlwithroot.'/public/fichinter/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : 'KEYNOTDEFINED').''; +$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, ''.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').''); +$message .= ''; +$message .= ajax_autoselect('onlinepaymenturl1'); +$message .= '
    '; + +$urlical = ''; +$urlical .= $urlwithroot.'/public/fichinter/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : 'KEYNOTDEFINED').''; +$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, ''.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').''); +$message .= ''; +$message .= ajax_autoselect('onlinepaymenturl2'); +$message .= '
    '; + +$urlrss = ''; +$urlrss .= $urlwithroot.'/public/fichinter/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : 'KEYNOTDEFINED').''; +$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, ''.$langs->trans("WebCalUrlForVCalExport", 'rss', '').''); +$message .= ''; +$message .= ajax_autoselect('onlinepaymenturl3'); +$message .= '
    '; + +print $message; + +$message = $langs->trans("AgendaUrlOptions1", $user->login, $user->login).'
    '; +$message .= $langs->trans("AgendaUrlOptions3", $user->login, $user->login, $user->login).'
    '; +$message .= $langs->trans("AgendaUrlOptions4", $user->login, $user->login).'
    '; +$message .= $langs->trans("AgendaUrlOptionsProject", $user->login, $user->login).'
    '; +$message .= $langs->trans("AgendaUrlOptionsType", 'systemauto|system').'
    '; +$message .= $langs->trans("AgendaUrlOptionsCode", 'AC_COMPANY_CREATE,AC_PROPAL_VALIDATE,AC_CODE...').'
    '; +$message .= $langs->trans("AgendaUrlOptionsIncludeHolidays", '1', '1').'
    '; +//$defaultnotolderthan = getDolGlobalString('MAIN_FICHINTER_EXPORT_PAST_DELAY', 100); +//$message .= $langs->trans("AgendaUrlOptionsLimitDays", $defaultnotolderthan, $defaultnotolderthan, $defaultnotolderthan).'
    '; +$message .= $langs->trans("AgendaUrlOptionsLimit", '1000').'
    '; + +print info_admin($message); + +$constname = 'MAIN_FICHINTER_XCAL_EXPORTKEY'; + +// Add button to autosuggest a key +include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; +print dolJSToSetRandomPassword($constname); + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 3036a0691a106..9b2fa61193592 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -96,7 +96,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFHoliday $module'; if ($module->write_file($holiday, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf"); @@ -205,6 +205,8 @@ $module = new $file($db); + '@phan-var-force ModelNumRefHolidays $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -345,6 +347,9 @@ require_once $dir.'/'.$file; $module = new $classname($db); + + '@phan-var-force ModelePDFHoliday $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -358,7 +363,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 553bf4d994ccd..1a4b8fe0f4385 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -148,7 +148,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFEvaluation $module'; if ($module->write_file($tmpobject, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=hrm&file=evaluation/SPECIMEN.pdf"); @@ -262,6 +262,8 @@ $module = new $file($db); + '@phan-var-force ModeleNumRefEvaluation $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -405,6 +407,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFEvaluation $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -418,7 +422,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index c2a8d03b06c56..c35809945bafd 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -114,7 +114,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFFactures $module'; if ($module->write_file($facture, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf"); @@ -333,6 +333,8 @@ $module = new $classname($db); + '@phan-var-force ModeleNumRefFactures $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -528,6 +530,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFFactures $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -544,7 +548,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index ba18cbbd52294..cbd2d51dde1d2 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -123,7 +123,7 @@ require_once $file; $module = new $className($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFKnowledgeRecord $module'; if ($module->write_file($tmpobject, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); @@ -213,6 +213,7 @@ print ''; print ''; + // @phan-suppress-next-line PhanEmptyForeach foreach ($arrayofparameters as $constname => $val) { if ($val['enabled'] == 1) { $setupnotempty++; @@ -280,6 +281,7 @@ print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '; print ''; + // @phan-suppress-next-line PhanEmptyForeach foreach ($arrayofparameters as $constname => $val) { if ($val['enabled'] == 1) { $setupnotempty++; @@ -379,6 +381,8 @@ $module = new $file($db); + '@phan-var-force ModeleNumRefKnowledgeRecord $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -520,6 +524,8 @@ require_once $dir.'/'.$file; $module = new $className($db); + '@phan-var-force ModelePDFKnowledgeRecord $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -533,7 +539,7 @@ print(empty($module->name) ? $name : $module->name); print "'; print ''; - if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') { + if ($keyforsupportedoauth2array == 'OAUTH_GENERIC_NAME') { print ''; - print ''; + print ''; print ''; print ''; @@ -402,7 +429,7 @@ print ''; // Tenant - if ($keybeforeprovider == 'MICROSOFT') { + if ($keybeforeprovider == 'MICROSOFT' || $keybeforeprovider == 'MICROSOFT2') { print ''; print ''; print ''; - print ''; + print ''; print ''; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 00d754cc9eff8..43819c9e093e7 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2016 Laurent Destailleur * Copyright (C) 2014-2018 Frederic France * 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 @@ -30,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; use OAuth\Common\Storage\DoliStorage; +use OAuth\Common\Consumer\Credentials; $supportedoauth2array = getSupportedOauth2Array(); @@ -114,6 +116,82 @@ $action = ''; } +// Test a refresh of a token using the refresh token +if ($action == 'refreshtoken' && $user->admin) { + $keyforprovider = GETPOST('keyforprovider'); + $OAUTH_SERVICENAME = GETPOST('service'); + + // Show value of token + $tokenobj = null; + // Load OAUth libraries + require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; + // Dolibarr storage + $storage = new DoliStorage($db, $conf, $keyforprovider); + try { + // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' + print ''."\n"; + + dol_syslog("oauthlogintokens.php: Read token for service ".$OAUTH_SERVICENAME); + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + + $expire = ($tokenobj->getEndOfLife() !== -9002 && $tokenobj->getEndOfLife() !== -9001 && time() > ($tokenobj->getEndOfLife() - 30)); + // We have to save the refresh token in a memory variable because Google give it only once + $refreshtoken = $tokenobj->getRefreshToken(); + print ''; + + //print $tokenobj->getExtraParams()['id_token'].'
    '; + //print $tokenobj->getAccessToken().'
    '; + //print $tokenobj->getRefreshToken().'
    '; + + //var_dump($expire); + + // We do the refresh even if not expired, this is the goal of action. + $oauthname = explode('-', $OAUTH_SERVICENAME); + $keyforoauthservice = strtoupper($oauthname[0]).(empty($oauthname[1]) ? '' : '-'.$oauthname[1]); + $credentials = new Credentials( + getDolGlobalString('OAUTH_'.$keyforoauthservice.'_ID'), + getDolGlobalString('OAUTH_'.$keyforoauthservice.'_SECRET'), + getDolGlobalString('OAUTH_'.$keyforoauthservice.'_URLCALLBACK') + ); + + $serviceFactory = new \OAuth\ServiceFactory(); + $httpClient = new \OAuth\Common\Http\Client\CurlClient(); + // TODO Set options for proxy and timeout + // $params=array('CURLXXX'=>value, ...) + //$httpClient->setCurlParameters($params); + $serviceFactory->setHttpClient($httpClient); + + // ex service is Google-Emails we need only the first part Google + $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); + + if ($apiService instanceof OAuth\OAuth2\Service\AbstractService || $apiService instanceof OAuth\OAuth1\Service\AbstractService) { + // ServiceInterface does not provide refreshAccessToekn, AbstractService does + dol_syslog("oauthlogintokens.php: call refreshAccessToken to get the new access token"); + $tokenobj = $apiService->refreshAccessToken($tokenobj); // This call refresh and store the new token (but does not include the refresh token) + + dol_syslog("oauthlogintokens.php: call setRefreshToken"); + $tokenobj->setRefreshToken($refreshtoken); // Restore the refresh token + + dol_syslog("oauthlogintokens.php: call storeAccessToken to save the new access token + the old refresh token"); + $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); // This save the new token including the refresh token + + if ($expire) { + setEventMessages($langs->trans("OldTokenWasExpiredItHasBeenRefresh"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("OldTokenWasNotExpiredButItHasBeenRefresh"), null, 'mesgs'); + } + } else { + dol_print_error($db, 'apiService is not a correct OAUTH2 Abstract service'); + } + + dol_syslog("oauthlogintokens.php: Read token again for service ".$OAUTH_SERVICENAME); + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + } catch (Exception $e) { + // Return an error if token not found + print $e->getMessage(); + } +} + /* * View @@ -154,7 +232,7 @@ $provider.'_NAME', $provider.'_ID', $provider.'_SECRET', - $provider.'_URLAUTHORIZE', // For custom oauth links + $provider.'_URL', // For custom oauth links $provider.'_SCOPE' // For custom oauth links ); } @@ -188,6 +266,8 @@ } $state = $shortscope; // TODO USe a better state + $urltorefresh = $_SERVER["PHP_SELF"].'?action=refreshtoken&token='.newToken(); + // Define $urltorenew, $urltodelete, $urltocheckperms if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') { // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). @@ -217,6 +297,9 @@ if ($urltorenew) { $urltorenew .= '&keyforprovider='.urlencode($keyforprovider); } + if ($urltorefresh) { + $urltorefresh .= '&keyforprovider='.urlencode($keyforprovider).'&service='.urlencode($OAUTH_SERVICENAME); + } if ($urltodelete) { $urltodelete .= '&keyforprovider='.urlencode($keyforprovider); } @@ -334,17 +417,20 @@ if (is_object($tokenobj)) { //test on $storage->hasAccessToken($OAUTH_SERVICENAME) ? if ($urltodelete) { - print ''.$langs->trans('DeleteAccess').'
    '; + print ''.$langs->trans('DeleteAccess').''; } else { - print ''.$langs->trans('GoOnTokenProviderToDeleteToken').'
    '; + print ''.$langs->trans('GoOnTokenProviderToDeleteToken').''; } } // Request remote token if ($urltorenew) { - print ''.$langs->trans('GetAccess').''; - print $form->textwithpicto('', $langs->trans('RequestAccess')); - print '
    '; + print ''.$langs->trans('GetAccess').''; + } + // Request remote token + if ($urltorefresh && $refreshtoken) { + print ''.$langs->trans('RefreshToken').''; } + // Check remote access if ($urltocheckperms) { print '
    '.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': '.$urltocheckperms.''; @@ -353,56 +439,50 @@ print ''; print '
    '; - print ''; - print ''; - print ''; - print ''."\n"; - - if (is_object($tokenobj)) { - // Token refresh print ''; print ''; + print $langs->trans("TokenRawValue").''; print ''; - print ''; + print ''."\n"; - // Token expired print ''; print ''; + print $langs->trans("AccessToken").''; print ''; - print ''; + print ''."\n"; - // Token expired at + // Token refresh print ''; print ''; print ''; print ''; } @@ -432,6 +512,9 @@ $classname = 'printing_'.$driver; $langs->load($driver); $printer = new $classname($db); + + '@phan-var-force PrintingDriver $printer'; + //print '
    '.print_r($printer, true).'
    '; if (count($printer->getlistAvailablePrinters())) { if ($printer->listAvailablePrinters() == 0) { diff --git a/htdocs/admin/order.php b/htdocs/admin/order.php index 2b5b97dc90dfb..c6ad34ebbe594 100644 --- a/htdocs/admin/order.php +++ b/htdocs/admin/order.php @@ -297,6 +297,8 @@ $module = new $file($db); + '@phan-var-force ModeleNumRefCommandes $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -434,6 +436,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFCommandes $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -447,7 +451,7 @@ print(empty($module->name) ? $name : $module->name); print "'; @@ -409,6 +411,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFPropales $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -422,7 +426,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; + print '\n"; print ''; @@ -241,7 +243,7 @@ if ($conf->global->RECEPTION_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print 'scandir) ? '&scan_dir='.$module->scandir : '').(!empty($module->name) ? '&label='.urlencode($module->name) : '').'">'; + print 'name) ? '&label='.urlencode($module->name) : '').'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -350,6 +352,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePdfReception $module'; + $modulequalified = 1; if (isset($module->version) && $module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -363,7 +367,7 @@ print(empty($module->name) ? $name : $module->name); print "'; @@ -367,6 +369,8 @@ require_once $dir.'/'.$file; $module = new $classname($db, new FactureFournisseur($db)); + '@phan-var-force ModelePDFSuppliersInvoices $module'; + print "\n"; print "'; @@ -379,6 +381,8 @@ require_once $dir.'/'.$file; $module = new $classname($db, new CommandeFournisseur($db)); + '@phan-var-force ModeleNumRefSuppliersOrders $module'; + print "\n"; print "'."\n"; print ''; @@ -318,6 +321,7 @@ /* * Document templates generators */ + print '
    '; print load_fiche_titre($langs->trans("PaymentsPDFModules"), '', ''); @@ -348,17 +352,16 @@ $classname = substr($file, 0, dol_strlen($file) - 12); require_once $dir.'/'.$file; - $module = new $classname($db, new PaiementFourn($db)); + $module = new $classname($db); + '@phan-var-force ModelePDFSuppliersPayments $module'; - print "\n"; + print ''."\n"; print "\n"; print "'; @@ -413,7 +413,7 @@ print(empty($module->name) ? $name : $module->name); print "'; + $out .= ''; } $out .= '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    \n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 208cb94d83e6e..460232bae14c2 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -169,7 +169,7 @@ $conf->global->MAIN_MAIL_SENDMODE = 'mail'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 183c3b9341c40..77f5d942497ce 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -140,7 +140,7 @@ if (!getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')) { $conf->global->MAIN_MAIL_SENDMODE_EMAILING = 'default'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_EMAILING', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_EMAILING', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index adcb1ea1fc691..02e0ef24be112 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -138,7 +138,7 @@ if (!getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET')) { $conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET = 'default'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_PASSWORDRESET', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_PASSWORDRESET', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 2715f032ed834..29e97f935044d 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -138,7 +138,7 @@ if (!getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')) { $conf->global->MAIN_MAIL_SENDMODE_TICKET = 'default'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_TICKET', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_TICKET', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index beaed3ccd35d5..a8e2ee2da6796 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -3,6 +3,7 @@ * Copyright (C) 2007-2012 Laurent Destailleur * Copyright (C) 2009-2011 Regis Houssin * Copyright (C) 2016 Meziane Sof + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -137,7 +138,7 @@ $menu->enabled = (string) GETPOST('enabled', 'alphanohtml'); $menu->perms = (string) GETPOST('perms', 'alphanohtml'); $menu->target = (string) GETPOST('target', 'alphanohtml'); - $menu->user = (string) GETPOST('user', 'alphanohtml'); + $menu->user = GETPOSTINT('user'); $menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml'); if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) { $menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml'); @@ -198,7 +199,7 @@ $menu->enabled = (string) GETPOST('enabled', 'alphanohtml'); $menu->perms = (string) GETPOST('perms', 'alphanohtml'); $menu->target = (string) GETPOST('target', 'alphanohtml'); - $menu->user = (string) GETPOST('user', 'alphanohtml'); + $menu->user = GETPOSTINT('user'); $menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml'); if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) { $menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml'); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 94d4466fdbe1a..491efaf9fc4a1 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -888,7 +888,7 @@ if (!empty($objMod->disabled)) { $codeenabledisable .= $langs->trans("Disabled"); } elseif (!empty($objMod->always_enabled) || ((isModEnabled('multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) { - // @phan-suppress-next-line PhanUndeclaredMethodCall + // @phan-suppress-next-line PhanUndeclaredMethod if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { $codeenabledisable .= $langs->trans("Used"); } else { @@ -899,7 +899,7 @@ $disableSetup++; } } else { - // @phan-suppress-next-line PhanUndeclaredMethodCall + // @phan-suppress-next-line PhanUndeclaredMethod if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { $codeenabledisable .= 'warnings_unactivation[$mysoc->country_code]).'&value='.$modName.'&mode='.$mode.$param.'">'; $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on'); diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 0e8f19509d734..787c011fcb245 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -92,7 +92,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFMo $module'; if ($module->write_file($mo, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mrp&file=SPECIMEN.pdf"); @@ -211,6 +211,8 @@ $module = new $file($db); + '@phan-var-force ModeleNumRefMos $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -346,6 +348,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFMo $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -359,7 +363,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index d6b2b267c3ce3..bc1c95aa6882c 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -259,11 +259,12 @@ print '

    '; +// Emails templates for notification + print '
    '; print ''; print ''; -// Notification per contacts $title = $langs->trans("TemplatesForNotifications"); print load_fiche_titre($title, '', 'email'); @@ -310,7 +311,8 @@ $model = 'expensereport_send'; } elseif ($notifiedevent['elementtype'] == 'order_supplier') { $model = 'order_supplier_send'; - // } elseif ($notifiedevent['elementtype'] == 'invoice_supplier') $model = 'invoice_supplier_send'; + } elseif ($notifiedevent['elementtype'] == 'invoice_supplier') { + $model = 'invoice_supplier_send'; } elseif ($notifiedevent['elementtype'] == 'member') { $model = 'member'; } @@ -318,7 +320,7 @@ $constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label); } -$helptext = ''; +$helptext = $langs->trans("EmailTemplateHelp", $langs->transnoentitiesnoconv("Tools"), $langs->transnoentitiesnoconv("EMailTemplates")); form_constantes($constantes, 3, $helptext, 'EmailTemplate'); print $form->buttonsSaveCancel("Save", ''); diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 456ce4858ca8b..33f76eaa5c64a 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -90,6 +90,11 @@ $error++; } } + if (GETPOSTISSET($constvalue.'_URL')) { + if (!dolibarr_set_const($db, $newconstvalue.'_URL', GETPOST($constvalue.'_URL'), 'chaine', 0, '', $conf->entity)) { + $error++; + } + } if (GETPOSTISSET($constvalue.'_URLAUTHORIZE')) { if (!dolibarr_set_const($db, $newconstvalue.'_URLAUTHORIZE', GETPOST($constvalue.'_URLAUTHORIZE'), 'chaine', 0, '', $conf->entity)) { $error++; @@ -119,6 +124,7 @@ if ($constvalue !== $newconstvalue) { dolibarr_del_const($db, $constvalue.'_ID', $conf->entity); dolibarr_del_const($db, $constvalue.'_SECRET', $conf->entity); + dolibarr_del_const($db, $constvalue.'_URL', $conf->entity); dolibarr_del_const($db, $constvalue.'_URLAUTHORIZE', $conf->entity); dolibarr_del_const($db, $constvalue.'_SCOPE', $conf->entity); @@ -139,7 +145,7 @@ $error++; } - // Update const where the token was used, might not be exhaustive + // Update other const that was using the renamed key as token (might not be exhaustive) if (getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE') == $oldname) { if (!dolibarr_set_const($db, 'MAIN_MAIL_SMTPS_OAUTH_SERVICE', strtoupper($oldprovider).'-'.$newlabel, 'chaine', 0, '', $conf->entity)) { $error++; @@ -180,7 +186,7 @@ $callbacktodel .= '/core/modules/oauth/microsoft_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl); } elseif ($label == 'OAUTH_MICROSOFT2') { $callbacktodel .= '/core/modules/oauth/microsoft2_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl); - } elseif ($label == 'OAUTH_OTHER') { + } elseif ($label == 'OAUTH_GENERIC') { $callbacktodel .= '/core/modules/oauth/generic_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl); } header("Location: ".$callbacktodel); @@ -196,7 +202,12 @@ $globalkey = empty($provider) ? $label : $label.'-'.$provider; - if (!dolibarr_del_const($db, $globalkey.'_NAME', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_ID', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_SECRET', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_URLAUTHORIZE', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_SCOPE', $conf->entity)) { + if (!dolibarr_del_const($db, $globalkey.'_NAME', $conf->entity) + || !dolibarr_del_const($db, $globalkey.'_ID', $conf->entity) + || !dolibarr_del_const($db, $globalkey.'_SECRET', $conf->entity) + || !dolibarr_del_const($db, $globalkey.'_URL', $conf->entity) + || !dolibarr_del_const($db, $globalkey.'_URLAUTHORIZE', $conf->entity) + || !dolibarr_del_const($db, $globalkey.'_SCOPE', $conf->entity)) { setEventMessages($langs->trans("ErrorInEntryDeletion"), null, 'errors'); $error++; } else { @@ -253,7 +264,20 @@ continue; // show only supported } - print ''."\n"; + print ''."\n"; } print ''; print ajax_combobox('provider'); @@ -276,8 +300,8 @@ $provider.'_NAME', $provider.'_ID', $provider.'_SECRET', - $provider.'_URLAUTHORIZE', // For custom oauth links - $provider.'_SCOPE' // For custom oauth links + $provider.'_URL', // For custom oauth links + $provider.'_SCOPE' // For custom oauth links ); } } @@ -368,9 +392,12 @@ print '
    '.$langs->trans("URLOfServiceForAuthorization").''; + $tooltiphelp = $langs->trans("Example").'
    https://mastodon.example.com
    https://mastodon.social'; + print $form->textwithpicto($langs->trans("URLOfOAuthServiceEndpoints"), $tooltiphelp); + print '
    '; print '
    '; @@ -413,9 +440,11 @@ // TODO Move this into token generation ? if ($supported) { - if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') { + if ($keyforsupportedoauth2array == 'OAUTH_GENERIC_NAME') { print '
    '.$langs->trans("Scopes").''; + print $form->textwithpicto($langs->trans("Scopes"), $langs->trans("ScopesDesc")); + print ''; print ''; print '
    '; - //var_dump($key); - print $langs->trans("Token").''; - if (is_object($tokenobj)) { - $tokentoshow = $tokenobj->getAccessToken(); - print ''.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'
    '; - //print 'Refresh: '.$tokenobj->getRefreshToken().'
    '; - //print 'EndOfLife: '.$tokenobj->getEndOfLife().'
    '; - //var_dump($tokenobj->getExtraParams()); - /*print '
    Extra:
    ';*/ - } - print '
    '; //var_dump($key); - print $langs->trans("TOKEN_REFRESH"); - print ''; - print ''.showValueWithClipboardCPButton($refreshtoken, 1, dol_trunc($refreshtoken, 32)).''; + if (is_object($tokenobj)) { + print '
    '."\n"; + } print '
    '; //var_dump($key); - print $langs->trans("TOKEN_EXPIRED"); - print ''; - print yn($expire); + $tokentoshow = $tokenobj->getAccessToken(); + print ''.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).''; + //print 'Refresh: '.$tokenobj->getRefreshToken().'
    '; + //print 'EndOfLife: '.$tokenobj->getEndOfLife().'
    '; + //var_dump($tokenobj->getExtraParams()); + /*print '
    Extra:
    ';*/ + + print '   -   '; + print $langs->trans("ExpirationDate").': '; + print ''; + print $expiredat; + + print $expire ? ' ('.$langs->trans("TokenExpired").')' : ' ('.$langs->trans("TokenNotExpired").')'; + print '
    '; //var_dump($key); - print $langs->trans("TOKEN_EXPIRE_AT"); + print $langs->trans("TOKEN_REFRESH"); print ''; - print $expiredat; + print ''.showValueWithClipboardCPButton($refreshtoken, 1, dol_trunc($refreshtoken, 32)).''; print '
    \n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 0548636e5deda..0ee86f731cdc1 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -5,6 +5,7 @@ * Copyright (C) 2012-2107 Juanjo Menent * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2021-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 @@ -266,7 +267,7 @@ print ''.$form->textwithpicto($langs->trans("PDFDesc"), $s)."
    \n"; print "
    \n"; -$noCountryCode = (empty($mysoc->country_code) ? true : false); +$noCountryCode = empty($mysoc->country_code); print ''; print ''; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index f41c9e41d7664..b6a833c789756 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -91,6 +91,8 @@ include_once $dir.$file; $objMod = new $modName($db); + '@phan-var-force DolibarrModules $objMod'; + // Load all lang files of module if (isset($objMod->langfiles) && is_array($objMod->langfiles)) { foreach ($objMod->langfiles as $domain) { diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index a56d621267f97..f4103e2609e79 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -97,7 +97,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFPropales $module'; if ($module->write_file($propal, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf"); @@ -274,6 +274,8 @@ $module = new $file(); + '@phan-var-force ModeleNumRefPropales $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -283,7 +285,7 @@ } if ($module->isEnabled()) { - print '
    '.$module->nom."\n"; + print '
    '.$module->getName($langs)."\n"; print $module->info($langs); print '\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index f91d6322673bd..9b4c57e7a7dd1 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -120,7 +120,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePdfReception $module'; if ($module->write_file($exp, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=reception&file=SPECIMEN.pdf"); @@ -210,6 +210,8 @@ $module = new $file(); + '@phan-var-force ModelNumRefReception $module'; + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -219,7 +221,7 @@ continue; } - print '
    '.$module->nom."
    '.$module->getName($langs)."'; print $module->info($langs); print '\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index ed5e508cbd145..ddd9a5ad8a682 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -124,7 +124,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFStock $module'; if ($module->write_file($object, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=stock&file=SPECIMEN.pdf"); @@ -252,7 +252,7 @@ if ($disabled) { print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); } else { - print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); @@ -273,7 +273,7 @@ print ''; if (isModEnabled("shipping")) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); @@ -290,7 +290,7 @@ print ''; if (isModEnabled("shipping")) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')); @@ -326,7 +326,7 @@ if ($disabled) { print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); } else { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); @@ -348,7 +348,7 @@ if ($disabled) { print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); } else { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); @@ -367,7 +367,7 @@ print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); @@ -382,7 +382,7 @@ print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); @@ -396,7 +396,7 @@ print ''; if (isModEnabled("supplier_order")) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); @@ -604,7 +604,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index 13f894bc72870..85a75023bf5ab 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -106,7 +106,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFStockTransfer $module'; if ($module->write_file($tmpobject, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); @@ -237,13 +237,8 @@ $myTmpObjects[$moduledir] = array('includerefgeneration' => 1, 'includedocgeneration' => 1, 'class' => 'StockTransfer'); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { - /* - * Orders Numbering model - */ + // Orders Numbering model $setupnotempty++; print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); @@ -274,6 +269,8 @@ $module = new $file($db); + '@phan-var-force ModeleNumRefStockTransfer $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -349,9 +346,7 @@ } if ($myTmpObjectArray['includedocgeneration']) { - /* - * Document templates generators - */ + // Document templates generators $setupnotempty++; $type = strtolower($myTmpObjectKey); @@ -415,6 +410,8 @@ require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFStockTransfer $module'; + $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; @@ -428,7 +425,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index b47dc508cbd5d..9574ff99163cc 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -117,7 +117,7 @@ require_once $file; $module = new $classname($db, $facture); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFSuppliersInvoices $module'; if ($module->write_file($facture, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf"); @@ -236,6 +236,8 @@ $module = new $file(); + '@phan-var-force ModeleNumRefSuppliersInvoices $module'; + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -246,7 +248,7 @@ } - print '
    '.$module->nom."\n"; + print '
    '.$module->getName($langs)."\n"; print $module->info($langs); print '
    "; @@ -376,7 +380,7 @@ require_once $dir.'/'.$file; $module = new $classname($db, $specimenthirdparty); if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 0c490f9713149..238ee46d5dbbb 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -1,27 +1,27 @@ + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France -* Copyright (C) 2004-2011 Laurent Destailleur -* Copyright (C) 2005-2011 Regis Houssin -* Copyright (C) 2004 Sebastien Di Cintio -* Copyright (C) 2004 Benoit Mortier -* Copyright (C) 2010-2013 Juanjo Menent -* Copyright (C) 2011-2018 Philippe Grand -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /** * \file htdocs/admin/supplier_order.php @@ -107,7 +107,7 @@ require_once $file; $module = new $classname($db, $commande); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFSuppliersOrders $module'; if ($module->write_file($commande, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf"); @@ -252,6 +252,8 @@ $module = new $file(); + '@phan-var-force ModeleNumRefSuppliersOrders $module'; + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -262,7 +264,7 @@ } - print '
    '.$module->nom."\n"; + print '
    '.$module->getName($langs)."\n"; print $module->info($langs); print '
    "; @@ -388,7 +392,7 @@ require_once $dir.'/'.$file; $module = new $classname($db, $specimenthirdparty); if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 57587054dde8c..c777dc3167811 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -118,7 +118,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFSuppliersPayments $module'; if ($module->write_file($paiementFourn, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_payment&file=SPECIMEN.pdf"); @@ -145,6 +145,7 @@ } } + /* * View */ @@ -157,7 +158,7 @@ $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("SupplierPaymentSetup"), $linkback, 'title_setup'); +print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); print "
    "; @@ -221,6 +222,7 @@ $classname = "mod_supplier_payment_".$file; } // Check if there is a filter on country + $reg = array(); preg_match('/\-(.*)_(.*)$/', $classname, $reg); if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) { continue; @@ -233,6 +235,8 @@ $module = new $classname($db); + '@phan-var-force ModeleNumRefSupplierPayments $module'; + // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -264,11 +268,10 @@ print '
    '; - //print "> ".$conf->global->SUPPLIER_PAYMENT_ADDON." - ".$file; - if ($conf->global->SUPPLIER_PAYMENT_ADDON == $file || getDolGlobalString('SUPPLIER_PAYMENT_ADDON') . '.php' == $file) { + if (getDolGlobalString('SUPPLIER_PAYMENT_ADDON') == $file || getDolGlobalString('SUPPLIER_PAYMENT_ADDON') . '.php' == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print 'scandir) ? '&scandir='.$module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print '
    "; print(empty($module->name) ? $name : $module->name); print "\n"; - require_once $dir.'/'.$file; - $module = new $classname($db, new Societe($db)); if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 9320151feb0fc..9c2cb5d9915c7 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -96,7 +96,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFSupplierProposal $module'; if ($module->write_file($supplier_proposal, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_proposal&file=SPECIMEN.pdf"); @@ -274,7 +274,7 @@ } if ($module->isEnabled()) { - print '
    '.$module->nom."\n"; + print '
    '.$module->getName($langs)."\n"; print $module->info($langs); print '\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index d54fce807261e..899480c31395f 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -235,7 +235,7 @@ } if ($i == 0) { - $out .= '
    '.$langs->trans("None").'
    '.$langs->trans("None").'
    '; $out .= ''; @@ -292,7 +292,7 @@ $out .= "\n"; } } else { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; @@ -345,7 +345,7 @@ $out .= ''."\n"; $out .= "\n"; } else { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; @@ -384,7 +384,7 @@ $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; $out .= ''.dol_print_size($size).''."\n"; - $out .= ''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').''."\n"; + $out .= ''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').''."\n"; $out .= "\n"; } $out .= ''; @@ -396,7 +396,7 @@ $out .= ''."\n"; $out .= "\n"; } else { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index a576c5db400cb..87199978a27eb 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -125,6 +125,12 @@ print "PHP allow_url_include = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : img_picto('', 'tick').' '.yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
    \n"; //print "PHP safe_mode = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).'   '.$langs->trans("Deprecated")." (removed in PHP 5.4)
    \n"; +if (getDolGlobalString('MAIN_SECURITY_SHOW_MORE_INFO')) { + print "PHP auto_prepend_file = ".(ini_get('auto_prepend_file') ? ini_get('auto_prepend_file') : '')."
    \n"; + + print "PHP sendmail_path = ".(ini_get('sendmail_path') ? ini_get('sendmail_path') : '')."
    \n"; +} + print "PHP disable_functions = "; $arrayoffunctionsdisabled = explode(',', ini_get('disable_functions')); $arrayoffunctionstodisable = explode(',', 'dl,apache_note,apache_setenv,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,show_source,virtual'); @@ -579,11 +585,12 @@ } print '
    '; -print '
    '; // Modules for Payments $test = isModEnabled('stripe'); if ($test) { + print '
    '; + print ''.$langs->trans("Stripe").': '; if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe")); @@ -594,6 +601,8 @@ } else { $test = isModEnabled('paypal'); if ($test) { + print '
    '; + print ''.$langs->trans("Paypal").': '; if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal")); @@ -627,6 +636,10 @@ } } +print '
    '; + +print 'API_DISABLE_LOGIN_API = '.getDolGlobalString('API_DISABLE_LOGIN_API', '0').'   ('.$langs->trans("Recommended").': 1)
    '; + print ''; @@ -706,10 +719,19 @@ print 'MAIN_RESTRICTHTML_ONLY_VALID_HTML = '.(getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML') ? '1' : ''.$langs->trans("Undefined").''); print '   ('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)"; + +// Test compatibility of MAIN_RESTRICTHTML_ONLY_VALID_HTML +$savMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES'); +$savMAIN_RESTRICTHTML_ONLY_VALID_HTML = getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML'); +$savMAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY'); $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1; $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; $result=dol_htmlwithnojs(' src=>0xbeefed'); +$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = $savMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES; +$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = $savMAIN_RESTRICTHTML_ONLY_VALID_HTML; +$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = $savMAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY; + if ($result == 'InvalidHTMLStringCantBeCleaned') { print '   -   '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !'; } else { @@ -722,10 +744,18 @@ print 'MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = '.(getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY') ? '1' : ''.$langs->trans("Undefined").''); print '   ('.$langs->trans("Recommended").': 1)   -   Module "php-tidy" must be enabled (currently: '.((extension_loaded('tidy') && class_exists("tidy")) ? 'Enabled' : img_picto('', 'warning').' Not available').")"; if (extension_loaded('tidy') && class_exists("tidy")) { + // Test compatibility of MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY + $savMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES'); + $savMAIN_RESTRICTHTML_ONLY_VALID_HTML = getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML'); + $savMAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY'); $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; $result=dol_htmlwithnojs(' src=>0xbeefed'); + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = $savMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES; + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = $savMAIN_RESTRICTHTML_ONLY_VALID_HTML; + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = $savMAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY; + if ($result == 'InvalidHTMLStringCantBeCleaned') { print '   -   '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !'; } else { diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 44e8f5e9f3d90..f05618ba59252 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -1,10 +1,11 @@ - * Copyright (C) 2016 Christophe Battarel - * Copyright (C) 2022-2023 Udo Tamm - * Copyright (C) 2023 Alexandre Spangaro - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2013-2018 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2022-2023 Udo Tamm + * Copyright (C) 2023 Alexandre Spangaro + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Benjamin Falière * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +54,17 @@ $error = 0; $reg = array(); +// Initiate status list +$statuslist = array( + Ticket::STATUS_IN_PROGRESS => $langs->trans("InProgress"), + Ticket::STATUS_NOT_READ => $langs->trans("NotRead"), + Ticket::STATUS_READ => $langs->trans("Read"), + Ticket::STATUS_ASSIGNED => $langs->trans("Assigned"), + Ticket::STATUS_NEED_MORE_INFO => $langs->trans("NeedMoreInformationShort"), + Ticket::STATUS_WAITING => $langs->trans("Waiting"), + Ticket::STATUS_CLOSED => $langs->trans("SolvedClosed") +); + /* * Actions */ @@ -161,6 +173,13 @@ } } + $param_status = GETPOST('TICKET_SET_STATUS_ON_ANSWER'); + $res = dolibarr_set_const($db, 'TICKET_SET_STATUS_ON_ANSWER', $param_status, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_delay_first_response = GETPOSTINT('delay_first_response'); $res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { @@ -428,7 +447,7 @@ require_once $dir.'/'.$file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFTicket $module'; $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -443,7 +462,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } @@ -579,6 +598,46 @@ print ''; print ''; +// Automatically define status on answering a ticket +print ''.$langs->trans("TicketAutoChangeStatusOnAnswer").''; +print ''; +print $formcategory->selectarray("TICKET_SET_STATUS_ON_ANSWER", $statuslist, getDolGlobalString('TICKET_SET_STATUS_ON_ANSWER')); +print ''; +print ''; +print $formcategory->textwithpicto('', $langs->trans("TicketAutoChangeStatusOnAnswerHelp"), 1, 'help'); +print ''; +print ''; + +// Check "Notify thirdparty" on ticket creation +print ''.$langs->trans("TicketAutoCheckNotifyThirdParty").''; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $formcategory->selectarray("TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION", $arrval, getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')); +} +print ''; +print ''; +print $formcategory->textwithpicto('', $langs->trans("TicketAutoCheckNotifyThirdPartyHelp"), 1, 'help'); +print ''; +print ''; + +// Assign contact to a message +print ''.$langs->trans("TicketAssignContactToMessage").''; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_ASSIGN_CONTACT_TO_MESSAGE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $formcategory->selectarray("TICKET_ASSIGN_CONTACT_TO_MESSAGE", $arrval, getDolGlobalString('TICKET_ASSIGN_CONTACT_TO_MESSAGE')); +} +print ''; +print ''; +print $formcategory->textwithpicto('', $langs->trans("TicketAssignContactToMessageHelp"), 1, 'help'); +print ''; +print ''; + if (isModEnabled('product')) { $htmlname = "product_category_id"; print ''.$langs->trans("TicketChooseProductCategory").''; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index c08f303ae502d..8826b8d5e1f5f 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -249,7 +249,7 @@ require_once $dir.'/'.$file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFUser $module'; $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -264,7 +264,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index ce057b1bec1d7..7e810e69f8eb9 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -173,7 +173,7 @@ require_once $dir.'/'.$file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFUserGroup $module'; $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -188,7 +188,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index e40a5d1ddfb0a..1b84ee67e990c 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -108,7 +108,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFWorkstation $module'; if ($module->write_file($tmpobject, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); @@ -227,13 +227,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { - /* - * Orders Numbering model - */ + // Orders Numbering model $setupnotempty++; print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); @@ -262,7 +257,7 @@ require_once $dir.'/'.$file.'.php'; $module = new $file($db); - '@phan-var-force CommonNumRefGenerator $module'; + '@phan-var-force ModeleNumRefWorkstation $module'; // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -305,6 +300,7 @@ $nameofclass = ucfirst($myTmpObjectKey); $mytmpinstance = new $nameofclass($db); + '@phan-var-force Workstation $mytmpinstance'; $mytmpinstance->initAsSpecimen(); // Info @@ -340,9 +336,7 @@ } if ($myTmpObjectArray['includedocgeneration']) { - /* - * Document templates generators - */ + // Document templates generators $setupnotempty++; $type = strtolower($myTmpObjectKey); @@ -404,7 +398,7 @@ require_once $dir.'/'.$file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFWorkstation $module'; $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -419,7 +413,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 51b2f692cf1f0..e529a0b1b8d1a 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012-2018 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,7 +95,7 @@ * View */ -llxHeader(); +llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-api page-admin-index'); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup'); @@ -116,7 +117,7 @@ print ''; print ''.$langs->trans("ApiProductionMode").''; -$production_mode = (!getDolGlobalString('API_PRODUCTION_MODE') ? false : true); +$production_mode = getDolGlobalBool('API_PRODUCTION_MODE'); if ($production_mode) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); @@ -131,7 +132,7 @@ print ''; print ''.$langs->trans("API_DISABLE_COMPRESSION").''; -$disable_compression = (!getDolGlobalString('API_DISABLE_COMPRESSION') ? false : true); +$disable_compression = getDolGlobalBool('API_DISABLE_COMPRESSION'); if ($disable_compression) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index cd3f86d23fd2d..0882c22a97a0a 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -55,7 +55,7 @@ public function __construct($db, $cachedir = '', $refreshCache = false) Defaults::$cacheDirectory = $cachedir; $this->db = $db; - $production_mode = (!getDolGlobalString('API_PRODUCTION_MODE') ? false : true); + $production_mode = getDolGlobalBool('API_PRODUCTION_MODE'); $this->r = new Restler($production_mode, $refreshCache); $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -175,10 +175,14 @@ protected function _filterObjectProperties($object, $properties) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** - * Clean sensible object datas + * Clean sensitive object data + * @phpstan-template T of Object * * @param Object $object Object to clean * @return Object Object with cleaned properties + * + * @phpstan-param T $object + * @phpstan-return T */ protected function _cleanObjectDatas($object) { diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index fb074a8b32d42..1355261d0ef17 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -200,7 +200,7 @@ public function __isAllowed() } // User seems valid - $fuser->getrights(); + $fuser->loadRights(); // Set the property $user to the $user of API static::$user = $fuser; diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 77f337743fc30..daa4add41d54e 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -37,11 +37,11 @@ class Login */ public function __construct() { - global $conf, $db; + global $db; $this->db = $db; - //$conf->global->MAIN_MODULE_API_LOGIN_DISABLED = 1; - if (getDolGlobalString('MAIN_MODULE_API_LOGIN_DISABLED')) { + //$conf->global->API_DISABLE_LOGIN_API = 1; + if (getDolGlobalString('API_DISABLE_LOGIN_API')) { throw new RestException(403, "Error login APIs are disabled. You must get the token from backoffice to be able to use APIs"); } } @@ -144,7 +144,7 @@ public function index($login, $password, $entity = '', $reset = 0) // Renew the hash if (empty($tmpuser->api_key) || $reset) { - $tmpuser->getrights(); + $tmpuser->loadRights(); if (!$tmpuser->hasRight('user', 'self', 'creer')) { if (empty($tmpuser->api_key)) { throw new RestException(403, 'No API token set for this user and user need write permission on itself to reset its API token'); diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 4884c09fd8fae..67627aeb8c486 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2018-2022 Thibault FOUCART * Copyright (C) 2024 Jon Bendtsen + * Copyright (C) 2024 MDW * * * This program is free software; you can redistribute it and/or modify @@ -39,6 +40,9 @@ */ class Setup extends DolibarrApi { + /** + * @var ?Translate + */ private $translations = null; /** @@ -50,6 +54,76 @@ public function __construct() $this->db = $db; } + /** + * Get the list of Action Triggers. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number {@min 0} + * @param string $elementtype Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...) + * @param string $lang Code of the language the label of the type must be translated to + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'SO-%')" + * @return array List of extra fields + * @phan-return Object[] List of extra fields + * + * @url GET actiontriggers + * + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of action triggers + */ + public function getListOfActionTriggers($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $elementtype = '', $lang = '', $sqlfilters = '') + { + $list = array(); + + if ($elementtype == 'thirdparty') { + $elementtype = 'societe'; + } + if ($elementtype == 'contact') { + $elementtype = 'socpeople'; + } + + $sql = "SELECT t.rowid as id, t.elementtype, t.code, t.contexts, t.label, t.description, t.rang"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as t"; + if (!empty($elementtype)) { + $sql .= " WHERE t.elementtype = '".$this->db->escape($elementtype)."'"; + } + // Add sql filters + if ($sqlfilters) { + $errormessage = ''; + $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage); + if ($errormessage) { + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); + } + } + + $sql .= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $type = $this->db->fetch_object($result); + $this->translateLabel($type, $lang, 'Notify_', array('other')); + $list[] = $type; + } + } else { + throw new RestException(503, 'Error when retrieving list of action triggers : '.$this->db->lasterror()); + } + + return $list; + } + /** * Get the list of ordering methods. * @@ -1129,8 +1203,9 @@ public function getListOfExtrafields($sortfield = "t.pos", $sortorder = 'ASC', $ { $list = array(); - if (!DolibarrApiAccess::$user->admin) { - throw new RestException(403, 'Only an admin user can get list of extrafields'); + if (!DolibarrApiAccess::$user->admin + && (!getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_EXTRAFIELDS') || DolibarrApiAccess::$user->login != getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_EXTRAFIELDS'))) { + throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_GET_EXTRAFIELDS'); } if ($elementtype == 'thirdparty') { @@ -1263,7 +1338,7 @@ public function getExtrafields($attrname, $elementtype) $sql = "SELECT t.rowid as id, t.name, t.entity, t.elementtype, t.label, t.type, t.size, t.fieldcomputed, t.fielddefault,"; $sql .= " t.fieldunique, t.fieldrequired, t.perms, t.enabled, t.pos, t.alwayseditable, t.param, t.list, t.printable,"; - $sql .= " t.totalizable, t.langs, t.help, t.css, t.cssview, t.fk_user_author, t.fk_user_modif, t.datec, t.tms"; + $sql .= " t.totalizable, t.langs, t.help, t.css, t.cssview, t.csslist, t.fk_user_author, t.fk_user_modif, t.datec, t.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."extrafields as t"; $sql .= " WHERE t.entity IN (".getEntity('extrafields').")"; $sql .= " AND t.elementtype = '".$this->db->escape($elementtype)."'"; @@ -1374,7 +1449,7 @@ public function postExtrafields($attrname, $elementtype, $request_data = null) $pos = $request_data['pos']; $moreparams = array(); - if ( 0 > $extrafields->addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $default_value, $param, $alwayseditable, $perms, $list, $help, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams)) { + if (0 > $extrafields->addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $default_value, $param, $alwayseditable, $perms, $list, $help, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams)) { throw new RestException(500, 'Error creating extrafield', array_merge(array($extrafields->errno), $extrafields->errors)); } @@ -1460,7 +1535,7 @@ public function updateExtrafields($attrname, $elementtype, $request_data = null) $moreparams = array(); dol_syslog(get_class($this).'::updateExtraField', LOG_DEBUG); - if ( 0 > $extrafields->updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $default_value, $param, $alwayseditable, $perms, $list, $help, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams)) { + if (0 > $extrafields->updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $default_value, $param, $alwayseditable, $perms, $list, $help, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams)) { throw new RestException(500, 'Error updating extrafield', array_merge(array($extrafields->errno), $extrafields->errors)); } @@ -2105,7 +2180,7 @@ public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { - $type =$this->db->fetch_object($result); + $type = $this->db->fetch_object($result); $this->translateLabel($type, $lang, 'TicketTypeShort', array('ticket')); $list[] = $type; } @@ -2168,7 +2243,7 @@ public function getListOfIncoterms($sortfield = "code", $sortorder = 'ASC', $lim $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { - $type =$this->db->fetch_object($result); + $type = $this->db->fetch_object($result); $list[] = $type; } } else { @@ -2192,7 +2267,7 @@ public function getCompany() global $conf, $mysoc; if (!DolibarrApiAccess::$user->admin - && (!getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_COMPANY') || DolibarrApiAccess::$user->login != $conf->global->API_LOGINS_ALLOWED_FOR_GET_COMPANY)) { + && (!getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_COMPANY') || DolibarrApiAccess::$user->login != getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_COMPANY'))) { throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_GET_COMPANY'); } @@ -2344,7 +2419,7 @@ public function getCheckIntegrity($target) global $langs, $conf; if (!DolibarrApiAccess::$user->admin - && (!getDolGlobalString('API_LOGINS_ALLOWED_FOR_INTEGRITY_CHECK') || DolibarrApiAccess::$user->login != $conf->global->API_LOGINS_ALLOWED_FOR_INTEGRITY_CHECK)) { + && (!getDolGlobalString('API_LOGINS_ALLOWED_FOR_INTEGRITY_CHECK') || DolibarrApiAccess::$user->login != getDolGlobalString('API_LOGINS_ALLOWED_FOR_INTEGRITY_CHECK'))) { throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_INTEGRITY_CHECK'); } @@ -2364,7 +2439,7 @@ public function getCheckIntegrity($target) $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 @@ -2408,7 +2483,7 @@ public function getCheckIntegrity($target) if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { $xmlfile = $xmlarray['content']; //print "xmlfilestart".$xmlfile."endxmlfile"; - $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']; throw new RestException(500, $errormsg); @@ -2481,7 +2556,7 @@ public function getCheckIntegrity($target) $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); } } @@ -2644,7 +2719,7 @@ public function getCheckIntegrity($target) throw new RestException(404, 'No signature file known'); } - return array('resultcode'=>$resultcode, 'resultcomment'=>$resultcomment, 'expectedchecksum'=> $outexpectedchecksum, 'currentchecksum'=> $outcurrentchecksum, 'out'=>$out); + return array('resultcode' => $resultcode, 'resultcomment' => $resultcomment, 'expectedchecksum' => $outexpectedchecksum, 'currentchecksum' => $outcurrentchecksum, 'out' => $out); } @@ -2662,7 +2737,7 @@ public function getModules() global $conf; if (!DolibarrApiAccess::$user->admin - && (!getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_MODULES') || DolibarrApiAccess::$user->login != $conf->global->API_LOGINS_ALLOWED_FOR_GET_MODULES)) { + && (!getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_MODULES') || DolibarrApiAccess::$user->login != getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_MODULES'))) { throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_GET_MODULES'); } diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 4dfbc3c7dcb7b..9b78fe060ef83 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -267,8 +267,8 @@ static function () { continue; } - //$conf->global->MAIN_MODULE_API_LOGIN_DISABLED = 1; - if ($file_searched == 'api_login.class.php' && getDolGlobalString('MAIN_MODULE_API_LOGIN_DISABLED')) { + //$conf->global->API_DISABLE_LOGIN_API = 1; + if ($file_searched == 'api_login.class.php' && getDolGlobalString('API_DISABLE_LOGIN_API')) { continue; } diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index b9e96e1a3e960..0ba6dcdda7de3 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -120,7 +120,7 @@ require_once $file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFAsset $module'; if ($module->write_file($tmpobject, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); @@ -230,7 +230,7 @@ require_once $dir.'/'.$file.'.php'; $module = new $file($db); - '@phan-var-force CommonNumRefGenerator $module'; + '@phan-var-force ModeleNumRefAsset $module'; // Show modules according to feature level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -372,7 +372,7 @@ require_once $dir.'/'.$file; $module = new $classname($db); - '@phan-var-force CommonDocGenerator $module'; + '@phan-var-force ModelePDFAsset $module'; $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -387,7 +387,7 @@ print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 6d602cd652339..cbc7e0a7c880f 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -83,7 +83,7 @@ class Asset extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), @@ -116,33 +116,118 @@ class Asset extends CommonObject '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,), ); + + /** + * @var int + */ public $rowid; + /** + * @var string + */ public $ref; + /** + * @var string + */ public $label; + /** + * @var int + */ public $fk_asset_model; + /** + * @var string + */ public $reversal_amount_ht; + /** + * @var string + */ public $acquisition_value_ht; + /** + * @var string + */ public $recovered_vat; + /** + * @var string + */ public $reversal_date; + /** + * @var string + */ public $date_acquisition; + /** + * @var string + */ public $date_start; + /** + * @var float + */ public $qty; + /** + * @var int + */ public $acquisition_type; + /** + * @var int + */ public $asset_type; + /** + * @var int<0,1> + */ public $not_depreciated; + /** + * @var ?string + */ public $disposal_date; + /** + * @var null|string|int Is string, but asset/Card.php assigns int. + */ public $disposal_amount_ht; + /** + * @var ?int + */ public $fk_disposal_type; + /** + * @var int<0,1> + */ public $disposal_depreciated; + /** + * @var int<0,1> + */ public $disposal_subject_to_vat; + /** + * @var int + */ public $supplier_invoice_id; + /** + * @var string + */ public $note_public; + /** + * @var string + */ public $note_private; + /** + * @var int + */ public $fk_user_creat; + /** + * @var int + */ public $fk_user_modif; + /** + * @var string + */ public $last_main_doc; + /** + * @var string + */ public $import_key; + /** + * @var string + */ public $model_pdf; + /** + * @var int + */ public $status; /** @@ -155,9 +240,12 @@ class Asset extends CommonObject * @var AssetDepreciationOptions Used for computed fields of depreciation options class. */ public $asset_depreciation_options; + /** + * @var AssetAccountancyCodes + */ public $asset_accountancy_codes; /** - * @var array List of depreciation lines for each mode (sort by depreciation date). + * @var array> List of depreciation lines for each mode (sort by depreciation date). */ public $depreciation_lines = array(); @@ -204,9 +292,9 @@ public function __construct(DoliDB $db) /** * Create object into database * - * @param User $user User that creates - * @param int $notrigger false=launch triggers after, true=disable triggers - * @return int Return integer <0 if KO, Id of created object if OK + * @param User $user User that creates + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int<-1,max> Return integer <0 if KO, Id of created object if OK */ public function create(User $user, $notrigger = 0) { @@ -238,9 +326,9 @@ public function create(User $user, $notrigger = 0) /** * Clone an object into another one * - * @param User $user User that creates - * @param int $fromid Id of object to clone - * @return mixed New object created, <0 if KO + * @param User $user User that creates + * @param int $fromid Id of object to clone + * @return Object|int<-1,-1> New object created, <0 if KO */ public function createFromClone(User $user, $fromid) { @@ -338,9 +426,9 @@ public function createFromClone(User $user, $fromid) /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * @return int Return integer <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @return int<-1,max> Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = null) { @@ -388,7 +476,7 @@ public function fetchLines() * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -741,8 +829,8 @@ public function hasDepreciationLinesInBookkeeping() * @param string $mode Depreciation mode (economic, accelerated_depreciation, ...) * @param string $ref Ref line * @param int $depreciation_date Depreciation date - * @param double $depreciation_ht Depreciation amount HT - * @param double $cumulative_depreciation_ht Depreciation cumulative amount HT + * @param float $depreciation_ht Depreciation amount HT + * @param float $cumulative_depreciation_ht Depreciation cumulative amount HT * @param string $accountancy_code_debit Accountancy code Debit * @param string $accountancy_code_credit Accountancy code Credit * @return int Return integer <0 if KO, Id of created line if OK @@ -938,13 +1026,13 @@ public function calculationDepreciation() // Get depreciation period $depreciation_date_start = $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition; - $depreciation_date_end = dol_time_plus_duree($depreciation_date_start, $fields['duration'], $fields['duration_type'] == 1 ? 'm' : ($fields['duration_type'] == 2 ? 'd' : 'y')); + $depreciation_date_end = dol_time_plus_duree((int) $depreciation_date_start, $fields['duration'], $fields['duration_type'] == 1 ? 'm' : ($fields['duration_type'] == 2 ? 'd' : 'y')); $depreciation_amount = $fields['amount_base_depreciation_ht']; if ($fields['duration_type'] == 2) { // Daily $fiscal_period_start = $depreciation_date_start; $fiscal_period_end = $depreciation_date_start; } elseif ($fields['duration_type'] == 1) { // Monthly - $date_temp = dol_getdate($depreciation_date_start); + $date_temp = dol_getdate((int) $depreciation_date_start); $fiscal_period_start = dol_get_first_day($date_temp['year'], $date_temp['mon'], false); $fiscal_period_end = dol_get_last_day($date_temp['year'], $date_temp['mon'], false); } else { // Annually @@ -952,7 +1040,7 @@ public function calculationDepreciation() $fiscal_period_end = $init_fiscal_period_end; } $cumulative_depreciation_ht = $last_cumulative_depreciation_ht; - $depreciation_period_amount = $depreciation_amount - $this->reversal_amount_ht; + $depreciation_period_amount = $depreciation_amount - (float) $this->reversal_amount_ht; $start_date = $depreciation_date_start; $disposal_date = isset($this->disposal_date) && $this->disposal_date !== "" ? $this->disposal_date : ""; $finish_date = $disposal_date !== "" ? $disposal_date : $depreciation_date_end; @@ -1045,7 +1133,7 @@ public function calculationDepreciation() } if ($fiscal_period_start <= $depreciation_date_end && $depreciation_date_end <= $fiscal_period_end) { // last period - $depreciation_ht = (float) price2num($depreciation_amount - $cumulative_depreciation_ht, 'MT'); + $depreciation_ht = (float) price2num($depreciation_amount - (float) $cumulative_depreciation_ht, 'MT'); $cumulative_depreciation_ht = $depreciation_amount; } else { $cumulative_depreciation_ht += $depreciation_ht; @@ -1239,8 +1327,8 @@ public function reopen($user, $notrigger = 0) $this->disposal_date = null; $this->disposal_amount_ht = null; $this->fk_disposal_type = null; - $this->disposal_depreciated = null; - $this->disposal_subject_to_vat = null; + $this->disposal_depreciated = 0; + $this->disposal_subject_to_vat = 0; $result = $this->update($user, 1); if ($result > 0) { $this->deleteObjectLinked(null, 'facture'); @@ -1542,13 +1630,16 @@ public function getNextNumRef() $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } if (class_exists($classname)) { $obj = new $classname(); + + '@phan-var-force ModeleNumRefAsset $obj'; + $numref = $obj->getNextValue($this); if ($numref != '' && $numref != '-1') { diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index e11ecfb9321d8..eefaf8e3a2b8a 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -65,7 +65,7 @@ class AssetDepreciationOptions extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -78,15 +78,15 @@ class AssetDepreciationOptions extends CommonObject 'label' => 'AssetDepreciationOptionEconomic', 'table' => 'asset_depreciation_options_economic', 'fields' => array( - 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDepreciationTypeLinear', '1' => 'AssetDepreciationOptionDepreciationTypeDegressive', '2' => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => '1',), - 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1','enabled_field' => 'economic:depreciation_type:1'), - 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), - 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDurationTypeAnnual', '1' => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => '1',), - 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => '1', 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => '1', 'validate' => '1', 'computed' => '$object->asset_depreciation_options->getRate("economic")',), - 'accelerated_depreciation_option' => array('type' => 'boolean', 'label' => 'AssetDepreciationOptionAcceleratedDepreciation', 'enabled' => '1', 'position' => 60, 'column_break' => true, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => '1',), - 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => '1', 'validate' => '1',), - 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), - 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 110, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDepreciationTypeLinear', 1 => 'AssetDepreciationOptionDepreciationTypeDegressive', 2 => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => 1,), + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,'enabled_field' => 'economic:depreciation_type:1'), + 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDurationTypeAnnual', 1 => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => 1,), + 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => 1, 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'computed' => '$object->asset_depreciation_options->getRate("economic")',), + 'accelerated_depreciation_option' => array('type' => 'boolean', 'label' => 'AssetDepreciationOptionAcceleratedDepreciation', 'enabled' => 1, 'position' => 60, 'column_break' => true, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => 1,), + 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => 1, 'validate' => 1,), + 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 110, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), ), ), 'accelerated_depreciation' => array( @@ -94,19 +94,28 @@ class AssetDepreciationOptions extends CommonObject 'table' => 'asset_depreciation_options_fiscal', 'enabled_field' => 'economic:accelerated_depreciation_option:1', 'fields' => array( - 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDepreciationTypeLinear', '1' => 'AssetDepreciationOptionDepreciationTypeDegressive', '2' => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => '1',), - 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1','enabled_field' => 'accelerated_depreciation:depreciation_type:1'), - 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), - 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDurationTypeAnnual', '1' => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => '1',), - 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => '1', 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => '1', 'validate' => '1', 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',), - 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 80, 'column_break' => true, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => '1', 'validate' => '1',), - 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), - 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDepreciationTypeLinear', 1 => 'AssetDepreciationOptionDepreciationTypeDegressive', 2 => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => 1,), + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,'enabled_field' => 'accelerated_depreciation:depreciation_type:1'), + 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDurationTypeAnnual', 1 => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => 1,), + 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => 1, 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',), + 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 80, 'column_break' => true, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => 1, 'validate' => 1,), + 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), ), ), ); + /** + * @var int + */ public $fk_asset; + /** + * @var int + */ public $fk_asset_model; + /** + * @var int + */ public $fk_user_modif; /** @@ -114,10 +123,25 @@ class AssetDepreciationOptions extends CommonObject */ public $deprecation_options = array(); + /** + * @var int + */ public $depreciation_type; + /** + * @var float + */ public $degressive_coefficient; + /** + * @var int + */ public $duration; + /** + * @var int + */ public $duration_type; + /** + * @var int<0,1> + */ public $accelerated_depreciation_option; /** @@ -179,14 +203,14 @@ public function setInfosForMode($mode, $class_type = 0, $all_field = false) $this->{$field_key} = $this->deprecation_options[$mode][$field_key] ?? null; } - $this->fields['rowid'] = array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"); + $this->fields['rowid'] = array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"); if (empty($class_type)) { - $this->fields['fk_asset'] = array('type' => 'integer:Asset:asset/class/asset.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label' => 'Asset', 'enabled' => '1', 'position' => 0, 'notnull' => 0, 'visible' => 0, 'index' => 1, 'validate' => '1',); + $this->fields['fk_asset'] = array('type' => 'integer:Asset:asset/class/asset.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label' => 'Asset', 'enabled' => 1, 'position' => 0, 'notnull' => 0, 'visible' => 0, 'index' => 1, 'validate' => 1,); } else { - $this->fields['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' => 0, 'notnull' => 0, 'visible' => 0, 'index' => 1, 'validate' => '1',); + $this->fields['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' => 0, 'notnull' => 0, 'visible' => 0, 'index' => 1, 'validate' => 1,); } - $this->fields['tms'] = array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => 0,); - $this->fields['fk_user_modif'] = array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => 0,); + $this->fields['tms'] = array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => 0,); + $this->fields['fk_user_modif'] = array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => 0,); } return 1; @@ -195,8 +219,8 @@ public function setInfosForMode($mode, $class_type = 0, $all_field = false) /** * Fill deprecation_options property of object (using for data sent by forms) * - * @param int $class_type Type (0:asset, 1:asset model) - * @return int Return integer <0 if KO, >0 if OK + * @param int<0,1> $class_type Type (0:asset, 1:asset model) + * @return int<-1,-1>|int<1,1> Return integer <0 if KO, >0 if OK */ public function setDeprecationOptionsFromPost($class_type = 0) { @@ -383,7 +407,7 @@ public function fetchDeprecationOptions($asset_id = 0, $asset_model_id = 0) * get general depreciation info for a mode (used in depreciation card) * * @param string $mode Depreciation mode (economic, accelerated_depreciation, ...) - * @return array|int Return integer <0 if KO otherwise array with general depreciation info + * @return array{base_depreciation_ht:string,duration:string,duration_type:string,rate:string}|int<-1,-1> Return integer <0 if KO otherwise array with general depreciation info */ public function getGeneralDepreciationInfoForMode($mode) { diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index 5faaa71b710b1..38bb118665a0b 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -89,13 +89,13 @@ class AssetModel extends CommonObject */ /** - * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, '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,), + '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,), @@ -103,21 +103,63 @@ class AssetModel extends CommonObject '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,), + '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,), ); + /** + * @var int + */ public $rowid; + /** + * @var string + */ public $ref; + /** + * @var string + */ public $label; + /** + * @var string + */ public $asset_type; + /** + * @var string + */ public $note_public; + /** + * @var string + */ public $note_private; + /** + * @var int + */ public $fk_user_creat; + /** + * @var int + */ public $fk_user_modif; + /** + * @var string + */ public $last_main_doc; + /** + * @var string + */ public $import_key; + /** + * @var string + */ public $model_pdf; + /** + * @var int + */ public $status; + /** + * @var AssetDepreciationOptions + */ public $asset_depreciation_options; + /** + * @var AssetAccountancyCodes + */ public $asset_accountancy_codes; // /** @@ -464,7 +506,7 @@ public function validate($user, $notrigger = 0) if (!empty($this->fields['date_validation'])) { $sql .= ", date_validation = '" . $this->db->idate($now) . "'"; } - if (!empty($this->fields['fk_user_valid'])) { + if (!empty($this->fields['fk_user_valid'] ?? null)) { $sql .= ", fk_user_valid = " . ((int) $user->id); } $sql .= " WHERE rowid = " . ((int) $this->id); diff --git a/htdocs/asset/depreciation.php b/htdocs/asset/depreciation.php index 26909d2628979..13da0968e6153 100644 --- a/htdocs/asset/depreciation.php +++ b/htdocs/asset/depreciation.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 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 @@ -189,7 +190,7 @@ print price($line['cumulative_depreciation_ht']); print ''; print ''; - print price(price2num($depreciation_info['base_depreciation_ht'] - $line['cumulative_depreciation_ht'], 'MT')); + print price(price2num((float) $depreciation_info['base_depreciation_ht'] - $line['cumulative_depreciation_ht'], 'MT')); print ''; print "\n"; } diff --git a/htdocs/asset/tpl/linkedobjectblock.tpl.php b/htdocs/asset/tpl/linkedobjectblock.tpl.php index 0e8d62a692185..bb6034c6f70b6 100644 --- a/htdocs/asset/tpl/linkedobjectblock.tpl.php +++ b/htdocs/asset/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 @@ -29,7 +30,9 @@ global $noMoreLinkedObjectBlockAfter; $langs = $GLOBALS['langs']; +'@phan-var-force Translate $langs'; $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; +'@phan-var-force CommonObject[] $linkedObjectBlock'; // Load translation files required by the page $langs->load("assets"); @@ -56,7 +59,7 @@ echo ''.dol_print_date($objectlink->date_start, 'day').''; echo ''; if ($user->hasRight('asset', 'read')) { - $total = $total + $objectlink->acquisition_value_ht; + $total += $objectlink->acquisition_value_ht; echo price($objectlink->acquisition_value_ht); } echo ''; diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index 162144c819299..6ca7a795f990e 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -171,7 +171,7 @@ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = * View */ -llxHeader(); +llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-asterisk page-wrapper'); $sql = "SELECT s.nom as name FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid"; diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index de1f4f96e4dec..dd11e60e242f2 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -87,7 +87,7 @@ } $modBarCodeThirdparty = new $file(); - '@phan-var-force ModeleNumRefBarCode $module'; + '@phan-var-force ModeleNumRefBarCode $modBarCodeThirdparty'; break; } } @@ -192,7 +192,7 @@ } $modBarCodeProduct = new $file(); - '@phan-var-force ModeleNumRefBarCode $module'; + '@phan-var-force ModeleNumRefBarCode $modBarCodeProduct'; break; } } diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 16004ad8e9f91..a59a19155fdec 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -68,11 +68,11 @@ if (!$user->hasRight('barcode', 'read')) { accessforbidden(); } -restrictedArea($user, 'barcode'); - // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('printsheettools')); +restrictedArea($user, 'barcode'); + $parameters = array(); // Note that $action and $object may have been modified by some @@ -179,10 +179,12 @@ // Load barcode class for generating barcode image $classname = "mod".ucfirst($generator); + // $module can be modTcpdfbarcode or modPhpbarcode that both extends ModeleBarCode $module = new $classname($db); - '@phan-var-force ModeleBarCode $module'; - if ($generator != 'tcpdfbarcode') { - // May be phpbarcode + + // Build the file on disk for generator not able to return the document on the fly. + if ($generator != 'tcpdfbarcode') { // $generator can be 'phpbarcode' (with this generator, barcode is generated on disk first) or 'tcpdfbarcode' (no need to enter this section with this generator). + '@phan-var-force modPhpbarcode $module'; $template = 'standardlabel'; $is2d = false; if ($module->encodingIsSupported($encoding)) { @@ -200,6 +202,7 @@ setEventMessages("Error, encoding ".$encoding." is not supported by encoder ".$generator.'. You must choose another barcode type or install a barcode generation engine that support '.$encoding, null, 'errors'); } } else { + '@phan-var-force modTcpdfbarcode $module'; $template = 'tcpdflabel'; $encoding = $module->getTcpdfEncodingType($encoding); //convert to TCPDF compatible encoding types $is2d = $module->is2d; diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 86af171516de8..b0547f4adc38c 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -1,7 +1,7 @@ * Copyright (C) 2017-2018 Laurent Destailleur - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * Copyright (C) 2024 Alexandre Spangaro * @@ -75,7 +75,7 @@ $search_amount = GETPOST('search_amount', 'alpha'); if (($search_start == -1 || empty($search_start)) && !GETPOSTISSET('search_startmonth') && !GETPOSTISSET('begin')) { - $search_start = dol_time_plus_duree(dol_now(), '-1', 'w'); + $search_start = dol_time_plus_duree(dol_now(), -1, 'w'); $tmparray = dol_getdate($search_start); $search_startday = $tmparray['mday']; $search_startmonth = $tmparray['mon']; @@ -597,7 +597,7 @@ $texttoshow .= '

    '.$langs->trans("Fingerprint").' - Recalculated sha256(previoushash * data):
    '.$checkdetail[$block->id]['calculatedsignature']; $texttoshow .= '
    '.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].''; //$texttoshow .= '
    keyforsignature='.$checkdetail[$block->id]['keyforsignature']; - print $form->textwithpicto(dol_trunc($block->signature, '8'), $texttoshow, 1, 'help', '', 0, 2, 'fingerprint'.$block->id); + print $form->textwithpicto(dol_trunc($block->signature, 8), $texttoshow, 1, 'help', '', 0, 2, 'fingerprint'.$block->id); print ''; // Status diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index bc0e4a3bec464..6bb7aacb13135 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -65,6 +65,9 @@ class BlockedLog */ public $signature_line = ''; + /** + * @var float|string|null + */ public $amounts = null; /** @@ -98,22 +101,38 @@ class BlockedLog public $fk_user = 0; /** - * @var integer|string date_creation + * @var int|string date_creation */ public $date_creation; /** - * @var integer|string $date_modification; + * @var int|string $date_modification; */ public $date_modification; + /** + * @var int + */ public $date_object = 0; + /** + * @var string + */ public $ref_object = ''; + /** + * @var ?stdClass + */ public $object_data = null; + + /** + * @var string + */ public $object_version = ''; + /** + * @var string + */ public $user_fullname = ''; /** @@ -138,7 +157,7 @@ public function __construct(DoliDB $db) /** * Load list of tracked events into $this->trackedevents. * - * @return int Always 1 + * @return int<1,1> Always 1 */ public function loadTrackedEvents() { @@ -237,7 +256,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } if ($this->element === 'invoice_supplier') { @@ -247,7 +266,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->element === 'payment') { require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; @@ -256,7 +275,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->element === 'payment_supplier') { require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; @@ -265,7 +284,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->element === 'payment_donation') { require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php'; @@ -274,7 +293,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->element === 'payment_various') { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; @@ -283,7 +302,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->element === 'don' || $this->element === 'donation') { require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; @@ -292,7 +311,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->element === 'subscription') { require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; @@ -301,7 +320,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->element === 'cashcontrol') { require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php'; @@ -310,7 +329,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->element === 'stockmouvement') { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; @@ -319,7 +338,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->element === 'project') { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -328,7 +347,7 @@ public function getObjectLink() if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); } else { - $this->error++; + $this->error = (string) (((int) $this->error) + 1); } } elseif ($this->action == 'MODULE_SET') { return ''.$langs->trans("BlockedLogEnabled").''; @@ -344,7 +363,8 @@ public function getObjectLink() } /** - * try to retrieve user author + * Try to retrieve user author + * * @return string */ public function getUser() @@ -374,9 +394,9 @@ public function getUser() * * @param CommonObject $object object to store * @param string $action action - * @param string $amounts amounts + * @param float|int $amounts amounts * @param ?User $fuser User object (forced) - * @return int >0 if OK, <0 if KO + * @return int<-1,-1>|int<1,1> >0 if OK, <0 if KO */ public function setObjectData(&$object, $action, $amounts, $fuser = null) { @@ -394,21 +414,26 @@ public function setObjectData(&$object, $action, $amounts, $fuser = null) $this->amounts = $amounts; // date if ($object->element == 'payment' || $object->element == 'payment_supplier') { + '@phan-var-force Paiement|PaiementFourn $object'; $this->date_object = empty($object->datepaye) ? $object->date : $object->datepaye; } elseif ($object->element == 'payment_salary') { + '@phan-var-force PaymentSalary $object'; $this->date_object = $object->datev; } elseif ($object->element == 'payment_donation' || $object->element == 'payment_various') { + '@phan-var-force PaymentDonation $object'; $this->date_object = empty($object->datepaid) ? $object->datep : $object->datepaid; } elseif ($object->element == 'subscription') { + '@phan-var-force Subscription $object'; $this->date_object = $object->dateh; } elseif ($object->element == 'cashcontrol') { + '@phan-var-force CashControl $object'; $this->date_object = $object->date_creation; } elseif (property_exists($object, 'date')) { // Generic case - $this->date_object = $object->date; + $this->date_object = $object->date; // @phan-suppress-current-line PhanUndeclaredProperty } elseif (property_exists($object, 'datem')) { // Generic case (second chance, for example for stock movement) - $this->date_object = $object->datem; + $this->date_object = $object->datem; // @phan-suppress-current-line PhanUndeclaredProperty } // ref @@ -498,6 +523,7 @@ public function setObjectData(&$object, $action, $amounts, $fuser = null) // Field specific to object if ($this->element == 'facture') { + '@phan-var-force Facture $object'; foreach ($object as $key => $value) { if (in_array($key, $arrayoffieldstoexclude)) { continue; // Discard some properties @@ -536,6 +562,7 @@ public function setObjectData(&$object, $action, $amounts, $fuser = null) $this->object_data->ref = $object->newref; } } elseif ($this->element == 'invoice_supplier') { + '@phan-var-force FactureFournisseur $object'; foreach ($object as $key => $value) { if (in_array($key, $arrayoffieldstoexclude)) { continue; // Discard some properties @@ -554,6 +581,7 @@ public function setObjectData(&$object, $action, $amounts, $fuser = null) $this->object_data->ref = $object->newref; } } elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation' || $this->element == 'payment_various') { + '@phan-var-force Paiement|PaiementFourn|PaymentDonation|PaymentVarious $object'; $datepayment = $object->datepaye ? $object->datepaye : ($object->datepaid ? $object->datepaid : $object->datep); $paymenttypeid = $object->paiementid ? $object->paiementid : ($object->paymenttype ? $object->paymenttype : $object->type_payment); @@ -685,12 +713,14 @@ public function setObjectData(&$object, $action, $amounts, $fuser = null) $this->object_data->ref = $object->newref; } } elseif ($this->element == 'payment_salary') { + '@phan-var-force PaymentSalary $object'; $this->object_data->amounts = array($object->amount); if (!empty($object->newref)) { $this->object_data->ref = $object->newref; } } elseif ($this->element == 'subscription') { + '@phan-var-force Subscription $object'; foreach ($object as $key => $value) { if (in_array($key, $arrayoffieldstoexclude)) { continue; // Discard some properties @@ -709,6 +739,7 @@ public function setObjectData(&$object, $action, $amounts, $fuser = null) $this->object_data->ref = $object->newref; } } elseif ($this->element == 'stockmouvement') { + '@phan-var-force StockTransfer $object'; foreach ($object as $key => $value) { if (in_array($key, $arrayoffieldstoexclude)) { continue; // Discard some properties @@ -744,7 +775,7 @@ public function setObjectData(&$object, $action, $amounts, $fuser = null) * Get object from database * * @param int $id Id of object to load - * @return int >0 if OK, <0 if KO, 0 if not found + * @return int<-1,1> >0 if OK, <0 if KO, 0 if not found */ public function fetch($id) { @@ -806,9 +837,9 @@ public function fetch($id) /** * Encode data * - * @param string $data Data to serialize - * @param int $mode 0=serialize, 1=json_encode - * @return string Value serialized, an object (stdClass) + * @param ?stdClass $data Data to serialize + * @param int<0,1> $mode 0=serialize, 1=json_encode + * @return string Value serialized, an object (stdClass) */ public function dolEncodeBlockedData($data, $mode = 0) { @@ -828,7 +859,7 @@ public function dolEncodeBlockedData($data, $mode = 0) * * @param string $data Data to unserialize * @param int $mode 0=unserialize, 1=json_decode - * @return object Value unserialized, an object (stdClass) + * @return Object Value unserialized, an object (stdClass) */ public function dolDecodeBlockedData($data, $mode = 0) { @@ -862,8 +893,8 @@ public function setCertified() * Create blocked log in database. * * @param User $user Object user that create - * @param string $forcesignature Force signature (for example '0000000000' when we disabled the module) - * @return int Return integer <0 if KO, >0 if OK + * @param string $forcesignature Force signature (for example '0000000000' when we disabled the module) + * @return int<-3,-1>|int<1,1> Return integer <0 if KO, >0 if OK */ public function create($user, $forcesignature = '') { @@ -902,7 +933,7 @@ public function create($user, $forcesignature = '') $this->date_creation = dol_now(); - $this->object_version = ((float) DOL_VERSION); + $this->object_version = DOL_VERSION; $this->db->begin(); @@ -989,8 +1020,8 @@ public function create($user, $forcesignature = '') * Check if current signature still correct compared to the value in chain * * @param string $previoushash If previous signature hash is known, we can provide it to avoid to make a search of it in database. - * @param int $returnarray 1=Return array of details, 2=Return array of details including keyforsignature, 0=Boolean - * @return boolean|array True if OK, False if KO + * @param int<0,2> $returnarray 1=Return array of details, 2=Return array of details including keyforsignature, 0=Boolean + * @return boolean|array{checkresult:bool,calculatedsignature:string,previoushash:string,keyforsignature?:string} True if OK, False if KO */ public function checkSignature($previoushash = '', $returnarray = 0) { @@ -1044,9 +1075,9 @@ private function buildKeyForSignature() /** * Get previous signature/hash in chain * - * @param int $withlock 1=With a lock - * @param int $beforeid ID of a record - * @return string Hash of previous record (if beforeid is defined) or hash of last record (if beforeid is 0) + * @param int<0,1> $withlock 1=With a lock + * @param int $beforeid ID of a record + * @return string Hash of previous record (if beforeid is defined) or hash of last record (if beforeid is 0) */ public function getPreviousHash($withlock = 0, $beforeid = 0) { @@ -1084,18 +1115,18 @@ public function getPreviousHash($withlock = 0, $beforeid = 0) /** * Return array of log objects (with criteria) * - * @param string $element element to search - * @param int $fk_object id of object to search - * @param int $limit max number of element, 0 for all - * @param string $sortfield sort field - * @param string $sortorder sort order - * @param int $search_fk_user id of user(s) - * @param int $search_start start time limit - * @param int $search_end end time limit - * @param string $search_ref search ref - * @param string $search_amount search amount - * @param string $search_code search code - * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error + * @param string $element element to search + * @param int $fk_object id of object to search + * @param int<0,max> $limit max number of element, 0 for all + * @param string $sortfield sort field + * @param string $sortorder sort order + * @param int $search_fk_user id of user(s) + * @param int $search_start start time limit + * @param int $search_end end time limit + * @param string $search_ref search ref + * @param string $search_amount search amount + * @param string $search_code search code + * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') { @@ -1202,7 +1233,7 @@ public function getSignature() /** * Check if module was already used or not for at least one recording. * - * @param int $ignoresystem Ignore system events for the test + * @param int<0,1> $ignoresystem Ignore system events for the test * @return bool */ public function alreadyUsed($ignoresystem = 0) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index b7eaba7420955..0450717e0bd20 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -101,7 +101,7 @@ class BOM extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), @@ -155,7 +155,7 @@ class BOM extends CommonObject public $description; /** - * @var integer|string date_valid + * @var int|string date_valid */ public $date_valid; @@ -193,8 +193,17 @@ class BOM extends CommonObject * @var int product Id */ public $fk_product; + /** + * @var float + */ public $qty; + /** + * @var float + */ public $duration; + /** + * @var float + */ public $efficiency; // END MODULEBUILDER PROPERTIES @@ -301,7 +310,7 @@ public function create(User $user, $notrigger = 1) * * @param User $user User that creates * @param int $fromid Id of object to clone - * @return mixed New object created, <0 if KO + * @return BOM|int<-1,-1> New object created, <0 if KO */ public function createFromClone(User $user, $fromid) { @@ -330,7 +339,8 @@ public function createFromClone(User $user, $fromid) unset($object->import_key); // Clear fields - $object->ref = empty($this->fields['ref']['default']) ? $langs->trans("copy_of_").$object->ref : $this->fields['ref']['default']; + $default_ref = $this->fields['ref']['default'] ?? null; + $object->ref = empty($default_ref) ? $langs->trans("copy_of_").$object->ref : $default_ref; $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; $object->status = self::STATUS_DRAFT; // ... @@ -364,6 +374,7 @@ public function createFromClone(User $user, $fromid) if (!$error) { // copy external contacts if same company + // @phan-suppress-next-line PhanUndeclaredProperty if (property_exists($this, 'socid') && $this->socid == $object->socid) { if ($this->copy_linked_contact($object, 'external') < 0) { $error++; @@ -390,9 +401,9 @@ public function createFromClone(User $user, $fromid) /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * @return int Return integer <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @return int<-1,1> Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = null) { @@ -422,9 +433,9 @@ public function fetchLines() /** * Load object lines in memory from the database by type of product * - * @param int $typeproduct 0 type product, 1 type service + * @param int<0,1> $typeproduct 0 type product, 1 type service - * @return int Return integer <0 if KO, 0 if not found, >0 if OK + * @return int<-1,1> Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetchLinesbytypeproduct($typeproduct = 0) { @@ -438,6 +449,8 @@ public function fetchLinesbytypeproduct($typeproduct = 0) $objectline = new $objectlineclassname($this->db); + '@phan-var-force BOMLine $objectline'; + $sql = "SELECT ".$objectline->getFieldList('l'); $sql .= " FROM ".$this->db->prefix().$objectline->table_element." as l"; $sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = l.fk_product"; @@ -455,6 +468,7 @@ public function fetchLinesbytypeproduct($typeproduct = 0) $obj = $this->db->fetch_object($resql); if ($obj) { $newline = new $objectlineclassname($this->db); + '@phan-var-force BOMLine $newline'; $newline->setVarsFromFetchObj($obj); $this->lines[] = $newline; @@ -476,11 +490,11 @@ public function fetchLinesbytypeproduct($typeproduct = 0) * * @param string $sortorder Sort Order * @param string $sortfield Sort field - * @param int $limit Limit - * @param int $offset Offset + * @param int<0,max> $limit Limit + * @param int<0,max> $offset Offset * @param string $filter Filter USF * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK + * @return BOM[]|int<-1,-1> int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -537,9 +551,9 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = /** * Update object into database * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that modifies + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int<-1,-1>|int<1,1> Return integer <0 if KO, >0 if OK */ public function update(User $user, $notrigger = 1) { @@ -553,9 +567,9 @@ public function update(User $user, $notrigger = 1) /** * Delete object in database * - * @param User $user User that deletes - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that deletes + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int<-1,-1>|int<1,1> Return integer <0 if KO, >0 if OK */ public function delete(User $user, $notrigger = 1) { @@ -566,18 +580,18 @@ public function delete(User $user, $notrigger = 1) /** * Add an BOM line into database (linked to BOM) * - * @param int $fk_product Id of product - * @param float $qty Quantity - * @param int<0,1> $qty_frozen If the qty is Frozen - * @param int $disable_stock_change Disable stock change on using in MO - * @param float $efficiency Efficiency in MO - * @param int $position Position of BOM-Line in BOM-Lines - * @param int $fk_bom_child Id of BOM Child - * @param string $import_key Import Key - * @param int $fk_unit Unit - * @param array $array_options extrafields array - * @param int $fk_default_workstation Default workstation - * @return int Return integer <0 if KO, Id of created object if OK + * @param int $fk_product Id of product + * @param float $qty Quantity + * @param int<0,1> $qty_frozen If the qty is Frozen + * @param int $disable_stock_change Disable stock change on using in MO + * @param float $efficiency Efficiency in MO + * @param int<-1,max> $position Position of BOM-Line in BOM-Lines + * @param ?int $fk_bom_child Id of BOM Child + * @param ?string $import_key Import Key + * @param int $fk_unit Unit + * @param array $array_options extrafields array + * @param ?int $fk_default_workstation Default workstation + * @return int<-3,max> Return integer <0 if KO, Id of created object if OK */ public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = 0, $array_options = array(), $fk_default_workstation = null) { @@ -607,7 +621,7 @@ public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_chang $fk_bom_child = null; } if (empty($import_key)) { - $import_key = null; + $import_key = ''; } if (empty($position)) { $position = -1; @@ -675,17 +689,17 @@ public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_chang /** * Update an BOM line into database * - * @param int $rowid Id of line to update - * @param float $qty Quantity - * @param float $qty_frozen Frozen quantity - * @param int $disable_stock_change Disable stock change on using in MO - * @param float $efficiency Efficiency in MO - * @param int $position Position of BOM-Line in BOM-Lines - * @param string $import_key Import Key - * @param int $fk_unit Unit of line - * @param array $array_options extrafields array - * @param int $fk_default_workstation Default workstation - * @return int Return integer <0 if KO, Id of updated BOM-Line if OK + * @param int $rowid Id of line to update + * @param float $qty Quantity + * @param float $qty_frozen Frozen quantity + * @param int $disable_stock_change Disable stock change on using in MO + * @param float $efficiency Efficiency in MO + * @param int<-1,max> $position Position of BOM-Line in BOM-Lines + * @param ?string $import_key Import Key + * @param int $fk_unit Unit of line + * @param array $array_options extrafields array + * @param ?int $fk_default_workstation Default workstation + * @return int<-3,max> Return integer <0 if KO, Id of updated BOM-Line if OK */ public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null, $fk_unit = 0, $array_options = array(), $fk_default_workstation = null) { @@ -712,7 +726,7 @@ public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change $efficiency = 1.0; } if (empty($import_key)) { - $import_key = null; + $import_key = ''; } if (empty($position)) { $position = -1; @@ -794,10 +808,10 @@ public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change /** * Delete a line of object in database * - * @param User $user User that delete - * @param int $idline Id of line to delete - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int >0 if OK, <0 if KO + * @param User $user User that delete + * @param int $idline Id of line to delete + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int<-2,-1>|int<1,1> >0 if OK, <0 if KO */ public function deleteLine(User $user, $idline, $notrigger = 0) { @@ -866,12 +880,13 @@ public function getNextNumRef($prod) $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } $obj = new $classname(); + '@phan-var-force ModeleNumRefBoms $obj'; $numref = $obj->getNextValue($prod, $this); if ($numref != "") { @@ -890,9 +905,9 @@ public function getNextNumRef($prod) /** * Validate bom * - * @param User $user User making status change - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int Return integer <=0 if OK, 0=Nothing done, >0 if KO + * @param User $user User making status change + * @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int<-1,1> Return integer <=0 if OK, 0=Nothing done, >0 if KO */ public function validate($user, $notrigger = 0) { @@ -1009,9 +1024,9 @@ public function validate($user, $notrigger = 0) /** * Set draft status * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user Object user that modify + * @param int<0,1> $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int<-1,1> Return integer <0 if KO, 0=Nothing done, >0 if OK */ public function setDraft($user, $notrigger = 0) { @@ -1026,9 +1041,9 @@ public function setDraft($user, $notrigger = 0) /** * Set cancel status * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int Return integer <0 if KO, 0=Nothing done, >0 if OK + * @param User $user Object user that modify + * @param int<0,1> $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int<-1,1> Return integer <0 if KO, 0=Nothing done, >0 if OK */ public function cancel($user, $notrigger = 0) { @@ -1041,11 +1056,11 @@ public function cancel($user, $notrigger = 0) } /** - * Set cancel status + * Reopen if canceled * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int Return integer <0 if KO, 0=Nothing done, >0 if OK + * @param User $user Object user that modify + * @param int<0,1> $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int<-1,1> Return integer <0 if KO, 0=Nothing done, >0 if OK */ public function reopen($user, $notrigger = 0) { @@ -1061,7 +1076,7 @@ public function reopen($user, $notrigger = 0) * getTooltipContentArray * @param array $params params to construct tooltip data * @since v18 - * @return array + * @return array{picto:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string} */ public function getTooltipContentArray($params) { @@ -1098,11 +1113,11 @@ public function getTooltipContentArray($params) /** * Return a link to the object card (with optionally the picto) * - * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) - * @param string $option On what the link point to ('nolink', ...) - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int<0,2> $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int<0,1> $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) @@ -1196,8 +1211,8 @@ public function getLibStatut($mode = 0) /** * Return the status * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @param int $status Id status + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ public function LibStatut($status, $mode = 0) @@ -1256,7 +1271,7 @@ public function info($id) /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return BOMLine[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { @@ -1280,11 +1295,11 @@ public function getLinesArray() * * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs object lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref + * @param int<0,1> $hidedetails Hide details of lines + * @param int<0,1> $hidedesc Hide description + * @param int<0,1> $hideref Hide ref * @param null|array $moreparams Array to provide more information - * @return int 0 if KO, 1 if OK + * @return int<0,1> 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { @@ -1347,7 +1362,7 @@ public function is_photo_available($sdir) * Initialise object with example values * Id must be 0 if object instance is a specimen * - * @return int + * @return int<1,1> */ public function initAsSpecimen() { @@ -1502,9 +1517,9 @@ public function calculateCosts() /** * Function used to replace a product id with another one. * - * @param DoliDB $db Database handler - * @param int $origin_id Old product id - * @param int $dest_id New product id + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id * @return bool */ public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) @@ -1548,8 +1563,8 @@ public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) * Get/add Net needs Tree by product or bom * * @param array $TNetNeeds Array of ChildBom and infos linked to - * @param float $qty qty needed (used as a factor to produce 1 unit) - * @param int $level level of recursivity + * @param float $qty qty needed (used as a factor to produce 1 unit) + * @param int<0,1000> $level level of recursivity * @return void */ public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) @@ -1590,9 +1605,9 @@ public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) /** * Recursively retrieves all parent bom in the tree that leads to the $bom_id bom * - * @param array $TParentBom We put all found parent bom in $TParentBom - * @param int $bom_id ID of bom from which we want to get parent bom ids - * @param int $level Protection against infinite loop + * @param BOM[] $TParentBom We put all found parent bom in $TParentBom + * @param int $bom_id ID of bom from which we want to get parent bom ids + * @param int<0,1000> $level Protection against infinite loop * @return void */ public function getParentBomTreeRecursive(&$TParentBom, $bom_id = 0, $level = 1) @@ -1622,11 +1637,11 @@ public function getParentBomTreeRecursive(&$TParentBom, $bom_id = 0, $level = 1) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array $arraydata Array of data - * @return string HTML Code for Kanban thumb. + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array{prod:?Product,selected:int<-1,1>} $arraydata Array of data + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) { @@ -1644,12 +1659,13 @@ public function getKanbanView($option = '', $arraydata = null) if ($selected >= 0) { $return .= ''; } - if (property_exists($this, 'fields') && !empty($this->fields['bomtype']['arrayofkeyval'])) { + $arrayofkeyval = $this->fields['bomtype']['arrayofkeyval'] ?? null; + if (!empty($arrayofkeyval)) { $return .= '
    '.$langs->trans("Type").' : '; if ($this->bomtype == 0) { - $return .= ''.$this->fields['bomtype']['arrayofkeyval'][0].''; + $return .= ''.$arrayofkeyval[0].''; } else { - $return .= ''.$this->fields['bomtype']['arrayofkeyval'][1].''; + $return .= ''.$arrayofkeyval[1].''; } } if (!empty($arraydata['prod'])) { @@ -1720,7 +1736,7 @@ class BOMLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'LineID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), @@ -1754,7 +1770,7 @@ class BOMLine extends CommonObjectLine public $fk_product; /** - * @var int Id of parent bom + * @var ?int Id of parent bom */ public $fk_bom_child; @@ -1791,7 +1807,7 @@ class BOMLine extends CommonObjectLine public $fk_unit; /** - * @var int Service Workstation + * @var ?int Service Workstation */ public $fk_default_workstation; @@ -1807,17 +1823,17 @@ class BOMLine extends CommonObjectLine // END MODULEBUILDER PROPERTIES /** - * @var float Calculated cost for the BOM line + * @var int|float Calculated cost for the BOM line */ public $total_cost = 0; /** - * @var float Line unit cost based on product cost price or pmp + * @var int|float Line unit cost based on product cost price or pmp */ public $unit_cost = 0; /** - * @var array array of Bom in line + * @var BOM[] array of Bom in line */ public $childBom = array(); @@ -1902,7 +1918,7 @@ public function fetch($id, $ref = null) * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return BOMLine[]|int<-1,-1> int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -1989,11 +2005,11 @@ public function delete(User $user, $notrigger = 0) /** * Return a link to the object card (with optionally the picto) * - * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) - * @param string $option On what the link point to ('nolink', ...) - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int<0,2> $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int<0,1> $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) @@ -2077,9 +2093,9 @@ public function getLibStatut($mode = 0) /** * Return the status * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status + * @param int $status Id status + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status */ public function LibStatut($status, $mode = 0) { diff --git a/htdocs/bom/tpl/linkedobjectblock.tpl.php b/htdocs/bom/tpl/linkedobjectblock.tpl.php index 3ededc6bffa1b..aa429b2d65c8b 100644 --- a/htdocs/bom/tpl/linkedobjectblock.tpl.php +++ b/htdocs/bom/tpl/linkedobjectblock.tpl.php @@ -3,6 +3,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2013-2020 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 @@ -30,12 +31,15 @@ global $noMoreLinkedObjectBlockAfter; $langs = $GLOBALS['langs']; +'@phan-var-force Translate $langs'; $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; // Load translation files required by the page $langs->load("bom"); +'@phan-var-force array $linkedObjectBlock'; // Type before use $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1); +'@phan-var-force array $linkedObjectBlock'; // Type after dol_sort_array which looses typing $total = 0; $ilink = 0; @@ -65,7 +69,7 @@ echo ''.dol_print_date($objectlink->date_creation, 'day').''; echo ''; if ($user->hasRight('commande', 'lire')) { - $total = $total + $objectlink->total_ht; + $total += $objectlink->total_ht; echo price($objectlink->total_ht); } echo ''; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index faf4d8d385425..9e52fb9c187b4 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -246,7 +246,7 @@ } } else { print ''; - $coldisplay = $coldisplay + 3; + $coldisplay += 3; } if ($action == 'selectlines') { diff --git a/htdocs/bookcal/admin/availabilities_extrafields.php b/htdocs/bookcal/admin/availabilities_extrafields.php index 8241073f3fccc..10a9a4bcd37a2 100644 --- a/htdocs/bookcal/admin/availabilities_extrafields.php +++ b/htdocs/bookcal/admin/availabilities_extrafields.php @@ -67,7 +67,7 @@ $help_url = ''; $page_name = "BookCalSetup"; -llxHeader('', $langs->trans("BookCalSetup"), $help_url); +llxHeader('', $langs->trans("BookCalSetup"), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_availabilities_extrafields'); $linkback = '
    '.$langs->trans("BackToModuleList").''; diff --git a/htdocs/bookcal/admin/calendar_extrafields.php b/htdocs/bookcal/admin/calendar_extrafields.php index 79eabea10c9d9..582997fe3d0c6 100644 --- a/htdocs/bookcal/admin/calendar_extrafields.php +++ b/htdocs/bookcal/admin/calendar_extrafields.php @@ -68,7 +68,7 @@ $help_url = ''; $page_name = "BookCalSetup"; -llxHeader('', $langs->trans("BookCalSetup"), $help_url); +llxHeader('', $langs->trans("BookCalSetup"), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_calender_extrafields'); $linkback = ''.$langs->trans("BackToModuleList").''; diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index f67819497c386..421a72b13e310 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -163,7 +163,7 @@ $help_url = ''; $page_name = "BookCalSetup"; -llxHeader('', $langs->trans($page_name), $help_url); +llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_setup'); // Subheader $linkback = ''.$langs->trans("BackToModuleList").''; diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php index 082c2f936983d..4de8cdae28402 100644 --- a/htdocs/bookcal/availabilities_agenda.php +++ b/htdocs/bookcal/availabilities_agenda.php @@ -144,7 +144,7 @@ if ($object->id > 0) { $title = $langs->trans("Agenda"); $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; - llxHeader('', $title, $help_url); + llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-card_availabilities_agenda'); if (!empty($conf->notification->enabled)) { $langs->load("mails"); diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php index bcb42c44e1254..f13d1ffad9c38 100644 --- a/htdocs/bookcal/availabilities_card.php +++ b/htdocs/bookcal/availabilities_card.php @@ -1,6 +1,7 @@ - * Copyright (C) 2022 Alice Adminson +/* Copyright (C) 2017 Laurent Destailleur + * 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 @@ -223,7 +224,7 @@ $title = $langs->trans("Availabilities"); $help_url = ''; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-card_availabilities'); // Example : Adding jquery code // print ''; } diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index a10409161c3cb..10b6f28705e7a 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -383,7 +383,7 @@ public function select_account($selectid, $htmlname = 'account', $showempty = 0, } if ($usecache && !empty($this->options_cache[$usecache])) { - $options = $options + $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0 + $options += $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0 $selected = $selectid; } else { $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', 50); @@ -483,12 +483,12 @@ public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $sho $aux_account = array(); if ($usecache && !empty($this->options_cache[$usecache])) { - $aux_account = $aux_account + $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0 + $aux_account += $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0 } else { dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); // Auxiliary thirdparties account - $sql = "SELECT code_compta, code_compta_fournisseur, nom as name"; + $sql = "SELECT code_compta as code_compta_client, code_compta_fournisseur, nom as name"; $sql .= " FROM ".$this->db->prefix()."societe"; $sql .= " WHERE entity IN (".getEntity('societe').")"; $sql .= " AND (client IN (1,3) OR fournisseur = 1)"; @@ -496,8 +496,8 @@ public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $sho $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { - if (!empty($obj->code_compta)) { - $aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->name.')'; + if (!empty($obj->code_compta_client)) { + $aux_account[$obj->code_compta_client] = $obj->code_compta_client.' ('.$obj->name.')'; } if (!empty($obj->code_compta_fournisseur)) { $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->name.')'; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 337f211f182cb..d012ea3fac3c4 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -214,8 +214,16 @@ public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')); $url .= '&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')); $url .= ($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : ''); - $url .= ($assignedtouser > 0 ? '&assignedtouser='.$assignedtouser : ''); + $url .= ($assignedtouser > 0 ? '&assignedtouser='.((int) $assignedtouser) : ''); $url .= '&backtopage='.urlencode($urlbacktopage); + + if ($typeelement == 'invoice_supplier') { + $messagingUrl = DOL_URL_ROOT.'/fourn/facture/messaging.php?id='.$object->id; + $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + $messagingUrl = DOL_URL_ROOT.'/fourn/facture/agenda.php?id='.$object->id; + $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + } + $morehtmlright .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url); } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index b6a506e4e8082..5e9de42f3c457 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2017 Rui Strecht * Copyright (C) 2020 Open-Dsi * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -388,7 +389,7 @@ public function select_state($selected = 0, $country_codeid = 0, $htmlname = 'st public function select_state_ajax($parent_field_id = 'country_id', $selected = 0, $country_codeid = 0, $htmlname = 'state_id', $morecss = 'maxwidth200onsmartphone minwidth300') { $html = ''; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 41bf41958d9d1..08c2d00dc0f83 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1210,7 +1210,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl 'name' => array('type' => 'varchar(128)', 'label' => 'Name', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 10, 'searchall' => 1), 'poste' => array('type' => 'varchar(128)', 'label' => 'PostOrFunction', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 2, 'index' => 1, 'position' => 20), 'address' => array('type' => 'varchar(128)', 'label' => 'Address', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 3, 'index' => 1, 'position' => 30), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible' => 3, 'position' => 35), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => ((int) !getDolGlobalBool('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible' => 3, 'position' => 35), 'role' => array('type' => 'checkbox', 'label' => 'Role', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 4, 'index' => 1, 'position' => 40), 'birthday' => array('type' => 'date', 'label' => 'Birthday', 'enabled' => 1, 'visible' => -1, 'notnull' => 0, 'position' => 45), 'statut' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 50, 'arrayofkeyval' => array(0 => $contactstatic->LibStatut(0, 1), 1 => $contactstatic->LibStatut(1, 1))), @@ -1741,7 +1741,7 @@ function show_actions_todo($conf, $langs, $db, $filterobj, $objcon = null, $nopr * @param Translate $langs Object langs * @param DoliDB $db Object db * @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket... to list events linked to an object - * @param Contact $objcon Filter on object contact to filter events on a contact + * @param ?Contact $objcon Filter on object contact to filter events on a contact * @param int $noprint Return string but does not output it * @param string|string[] $actioncode Filter on actioncode * @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all). @@ -1803,12 +1803,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('agendadao')); - // Recherche histo sur actioncomm - if (is_object($objcon) && $objcon->id > 0) { - $sql = "SELECT DISTINCT a.id, a.label as label,"; - } else { - $sql = "SELECT a.id, a.label as label,"; - } + $sql = "SELECT a.id, a.label as label,"; $sql .= " a.datep as dp,"; $sql .= " a.datep2 as dp2,"; $sql .= " a.percent as percent, 'action' as type,"; @@ -1850,18 +1845,20 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr } $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; + // Link to the owner of action $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; + // Link to action types $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; - if (is_object($filterobj) && get_class($filterobj) !== 'User') { - $force_filter_contact = false; - } else { + // Set $force_filter_contact: + // - true for a filter on a user or a contact, so a link on table llx_actioncomm_resources or llx_actioncomm.fk_user_action + // - false for a link on table llx_element_resources + $force_filter_contact = false; + if (is_object($filterobj) && $filterobj->id > 0 && get_class($filterobj) == 'User') { $force_filter_contact = true; } if (is_object($objcon) && $objcon->id > 0) { $force_filter_contact = true; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm"; - $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id); } // Fields from hook @@ -1898,7 +1895,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr } $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; - if ($force_filter_contact === false) { + if (!$force_filter_contact) { if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) { $sql .= " AND a.fk_soc = ".((int) $filterobj->id); } elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { @@ -1957,7 +1954,16 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr return 'Bad value for $filterobj'; } } else { - $sql .= " AND u.rowid = ". ((int) $filterobj->id); + if (is_object($filterobj) && $filterobj->id > 0 && get_class($filterobj) == 'User') { + $sql .= " AND (u.rowid = ". ((int) $filterobj->id).' OR '; + $sql .= " EXISTS (SELECT r.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as r WHERE a.id = r.fk_actioncomm"; + $sql .= " AND r.element_type = '".$db->escape($filterobj->table_element)."' AND r.fk_element = ".((int) $filterobj->id).')'; + $sql .= ")"; + } + if (is_object($objcon) && $objcon->id > 0) { + $sql .= " AND EXISTS (SELECT r.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as r WHERE a.id = r.fk_actioncomm"; + $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id).')'; + } } if (!empty($tms_start) && !empty($tms_end)) { @@ -2467,6 +2473,7 @@ function show_subsidiaries($conf, $langs, $db, $object) $socstatic->code_client = $obj->code_client; $socstatic->code_fournisseur = $obj->code_fournisseur; $socstatic->code_compta = $obj->code_compta; + $socstatic->code_compta_client = $obj->code_compta; $socstatic->code_compta_fournisseur = $obj->code_compta_fournisseur; $socstatic->email = $obj->email; $socstatic->canvas = $obj->canvas; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index abe83bbd1a3b9..84dbc89d1207e 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -4,7 +4,7 @@ * Copyright (C) 2011-2015 Juanjo Menent * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Charlene Benke - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -274,7 +274,7 @@ function convertSecondToTime($iSecond, $format = 'all', $lengthOfDay = 86400, $l if ($sDay) { if ($sDay >= $lengthOfWeek) { $sWeek = (int) (($sDay - $sDay % $lengthOfWeek) / $lengthOfWeek); - $sDay = $sDay % $lengthOfWeek; + $sDay %= $lengthOfWeek; $weekTranslate = $langs->trans("DurationWeek"); if ($sWeek >= 2) { $weekTranslate = $langs->trans("DurationWeeks"); @@ -306,7 +306,7 @@ function convertSecondToTime($iSecond, $format = 'all', $lengthOfDay = 86400, $l $sTime = dol_print_date($iSecond, '%H', true); } elseif ($format == 'fullhour') { if (!empty($iSecond)) { - $iSecond = $iSecond / 3600; + $iSecond /= 3600; } else { $iSecond = 0; } @@ -466,7 +466,8 @@ function dol_stringtotime($string, $gm = 1) $gm = 'tzserver'; } - $date = dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), $gm); + $date = dol_mktime((int) substr($tmp, 8, 2), (int) substr($tmp, 10, 2), (int) substr($tmp, 12, 2), (int) substr($tmp, 4, 2), (int) substr($tmp, 6, 2), (int) substr($tmp, 0, 4), $gm); + return $date; } @@ -1060,7 +1061,7 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0, $numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday); $nbOpenDay = ($numdays - $numholidays); if ($inhour == 1 && $nbOpenDay <= 3) { - $nbOpenDay = ($nbOpenDay * 24); + $nbOpenDay *= 24; } return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); } elseif ($timestampStart == $timestampEnd) { @@ -1075,7 +1076,7 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0, $nbOpenDay = $lastday; if ($inhour == 1) { - $nbOpenDay = ($nbOpenDay * 24); + $nbOpenDay *= 24; } return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); } else { diff --git a/htdocs/core/lib/emaillayout.lib.php b/htdocs/core/lib/emaillayout.lib.php index d5afc4b1fee69..55d4d620a423f 100644 --- a/htdocs/core/lib/emaillayout.lib.php +++ b/htdocs/core/lib/emaillayout.lib.php @@ -41,6 +41,8 @@ function getHtmlOfLayout($name) '__USERSIGNATURE__' => !empty($user->signature) ? dol_htmlentities($user->signature) : '', '__GRAY_RECTANGLE__' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAIAAABM5OhcAAABGklEQVR4nO3SwQ3AIBDAsNLJb3SWIEJC9gR5ZM3MB6f9twN4k7FIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIuEsUgYi4SxSBiLhLFIGIvEBtxYAkgpLmAeAAAAAElFTkSuQmCC', '__LAST_NEWS__' => $langs->trans('LastNews'), + '__LIST_PRODUCTS___' => $langs->trans('ListProducts'), + ); $substitutionarray = array_merge($commonSubstitutionArray, $specificSubstitutionArray); diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 90fe590aff40e..7d2ad3a69a2e6 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -1,11 +1,11 @@ - * Copyright (C) 2007 Rodolphe Quiedeville - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2016 Gilles Poirier - * Copyright (C) 2018 charlene Benke - * Copyright (C) 2024 MDW - + * Copyright (C) 2007 Rodolphe Quiedeville + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2016 Gilles Poirier + * Copyright (C) 2018-2024 Charlene Benke + * 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 @@ -37,7 +37,7 @@ function fichinter_prepare_head($object) { global $db, $langs, $conf, $user; - $langs->load("fichinter"); + $langs->load("interventions"); $h = 0; $head = array(); @@ -175,6 +175,7 @@ function fichinter_admin_prepare_head() $extrafields->fetch_name_optionals_label('fichinter'); $extrafields->fetch_name_optionals_label('fichinterdet'); + $h = 0; $head = array(); @@ -183,6 +184,11 @@ function fichinter_admin_prepare_head() $head[$h][2] = 'ficheinter'; $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/fichinter_xcal.php"; + $head[$h][1] = $langs->trans("ExportCal"); + $head[$h][2] = 'xcal'; + $h++; + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 3534278382122..24d43764c8206 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1109,7 +1109,11 @@ function dol_move($srcfile, $destfile, $newmask = '0', $overwriteifexists = 1, $ $ecmfile->filename = $filename; $ecmfile->label = md5_file(dol_osencode($destfile)); // $destfile is a full path to file $ecmfile->fullpath_orig = basename($srcfile); - $ecmfile->gen_or_uploaded = 'uploaded'; + if (!empty($moreinfo) && !empty($moreinfo['gen_or_uploaded'])) { + $ecmfile->gen_or_uploaded = $moreinfo['gen_or_uploaded']; + } else { + $ecmfile->gen_or_uploaded = 'uploaded'; + } if (!empty($moreinfo) && !empty($moreinfo['description'])) { $ecmfile->description = $moreinfo['description']; // indexed content } else { @@ -1136,6 +1140,14 @@ function dol_move($srcfile, $destfile, $newmask = '0', $overwriteifexists = 1, $ $resultecm = $ecmfile->create($user); if ($resultecm < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); + } else { + if (!empty($moreinfo) && !empty($moreinfo['array_options']) && is_array($moreinfo['array_options'])) { + $ecmfile->array_options = $moreinfo['array_options']; + $resultecm = $ecmfile->insertExtraFields(); + if ($resultecm < 0) { + setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); + } + } } } elseif ($resultecm < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 44981c12b3eca..85d1323f6e73c 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -5,6 +5,7 @@ * Copyright (C) 2011-2013 Philippe Grand * Copyright (C) 2022-2023 Frédéric France * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,7 @@ */ function facturefourn_prepare_head(FactureFournisseur $object) { - global $db, $langs, $conf; + global $db, $langs, $conf, $user; $h = 0; $head = array(); @@ -123,6 +124,40 @@ function facturefourn_prepare_head(FactureFournisseur $object) $head[$h][2] = 'info'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/fourn/facture/agenda.php?id='.$object->id; + $head[$h][1] = $langs->trans("Events"); + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { + $nbEvent = 0; + // Enable caching of thirdparty count actioncomm + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_facture_'.$object->id; + $dataretrieved = dol_getcache($cachekey); + if (!is_null($dataretrieved)) { + $nbEvent = $dataretrieved; + } else { + $sql = "SELECT COUNT(id) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; + $sql .= " WHERE fk_element = ".((int) $object->id); + $sql .= " AND elementtype = 'invoice_supplier'"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $nbEvent = $obj->nb; + } else { + dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR); + } + dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result. + } + + $head[$h][1] .= '/'; + $head[$h][1] .= $langs->trans("Agenda"); + if ($nbEvent > 0) { + $head[$h][1] .= ''.$nbEvent.''; + } + } + $head[$h][2] = 'agenda'; + $h++; + complete_head_from_modules($conf, $langs, $object, $head, $h, 'supplier_invoice', 'add', 'external'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'supplier_invoice', 'remove'); @@ -178,12 +213,12 @@ function ordersupplier_prepare_head(CommandeFournisseur $object) $nbDispachedLines = count($dispachedLines); for ($line = 0 ; $line < $nbDispachedLines; $line++) { - $sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line]['qty']; + $sumQtyAllreadyDispatched += $dispachedLines[$line]['qty']; } for ($line = 0 ; $line < $nbLinesOrdered; $line++) { //If line is a product of conf to manage stocks for services if ($object->lines[$line]->product_type == 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { - $sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty; + $sumQtyOrdered += $object->lines[$line]->qty; } } $head[$h][1] .= ''.price2num($sumQtyAllreadyDispatched, 'MS').' / '.price2num($sumQtyOrdered, 'MS').''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ef6e0ddf11cb8..b9d58ed362059 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -205,7 +205,7 @@ function getMultidirVersion($object, $module = '', $forobject = 0) /** - * Return dolibarr global constant string value + * Return a Dolibarr global constant string value * * @param string $key Key to return value, return $default if not set * @param string|int|float $default Value to return if not defined @@ -222,9 +222,9 @@ function getDolGlobalString($key, $default = '') * Return a Dolibarr global constant int value. * The constants $conf->global->xxx are loaded by the script master.inc.php included at begin of any PHP page. * - * @param string $key key to return value, return 0 if not set - * @param int $default value to return - * @return int + * @param string $key Key to return value, return $default if not set + * @param int $default Value to return if not defined + * @return int Value returned * @see getDolUserInt() */ function getDolGlobalInt($key, $default = 0) @@ -233,6 +233,20 @@ function getDolGlobalInt($key, $default = 0) return (int) (isset($conf->global->$key) ? $conf->global->$key : $default); } +/** + * Return a Dolibarr global constant boolean value. + * The constants $conf->global->xxx are loaded by the script master.inc.php included at begin of any PHP page. + * + * @param string $key Key to return value, return $default if not set + * @param bool $default Value to return if not defined + * @return bool Value returned + */ +function getDolGlobalBool($key, $default = false) +{ + global $conf; + return (bool) ($conf->global->$key ?? $default); +} + /** * Return Dolibarr user constant string value * @@ -1258,6 +1272,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options case 'restricthtmlnolink': case 'restricthtml': // Recommended for most html textarea case 'restricthtmlallowclass': + case 'restricthtmlallowlinkscript': // Allow link and script tag for head section. case 'restricthtmlallowunvalid': $out = dol_htmlwithnojs($out, 1, $check); break; @@ -2206,9 +2221,8 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = } if (!empty($message)) { - // Test log level - // @phan-suppress-next-line PhanPluginDuplicateArrayKey - $logLevels = array(LOG_EMERG => 'EMERG', LOG_ALERT => 'ALERT', LOG_CRIT => 'CRITICAL', LOG_ERR => 'ERR', LOG_WARNING => 'WARN', LOG_NOTICE => 'NOTICE', LOG_INFO => 'INFO', LOG_DEBUG => 'DEBUG'); + // Test log level @phan-ignore-next-line PhanPluginDuplicateArrayKey + $logLevels = array(LOG_EMERG => 'EMERG', LOG_ALERT => 'ALERT', LOG_CRIT => 'CRITICAL', LOG_ERR => 'ERR', LOG_WARNING => 'WARN', LOG_NOTICE => 'NOTICE',LOG_INFO => 'INFO', LOG_DEBUG => 'DEBUG'); if (!array_key_exists($level, $logLevels)) { throw new Exception('Incorrect log level'); } @@ -2615,7 +2629,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab } if ($displaytab == 0) { - $out .= img_picto($title, $picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle paddingright').' '; + $out .= img_picto($title, $picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle paddingright marginrightonlyshort'); } $out .= $links[$i][1]; @@ -3417,7 +3431,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $smin = (!empty($reg[5]) ? $reg[5] : ''); $ssec = (!empty($reg[6]) ? $reg[6] : ''); - $time = dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true); + $time = dol_mktime((int) $shour, (int) $smin, (int) $ssec, (int) $smonth, (int) $sday, (int) $syear, true); if ($to_gmt) { $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC @@ -4530,8 +4544,8 @@ function dol_user_country() * Format address string * * @param string $address Address string, already formatted with dol_format_address() - * @param int $htmlid Html ID (for example 'gmap') - * @param int $element 'thirdparty'|'contact'|'member'|'user'|'other' + * @param string $htmlid Html ID (for example 'gmap') + * @param string $element 'thirdparty'|'contact'|'member'|'user'|'other' * @param int $id Id of object * @param int $noprint No output. Result is the function return * @param string $charfornl Char to use instead of nl2br. '' means we use a standad nl2br. @@ -4847,8 +4861,8 @@ function getPictoForType($key, $morecss = '') 'select' => 'list', 'sellist' => 'list', 'radio' => 'check-circle', - 'checkbox' => 'check-square', - 'chkbxlst' => 'check-square', + 'checkbox' => 'list', + 'chkbxlst' => 'list', 'link' => 'link', 'icon' => "question", 'point' => "country", @@ -4918,6 +4932,12 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco $pictowithouttext = str_replace('object_', '', $pictowithouttext); $pictowithouttext = str_replace('_nocolor', '', $pictowithouttext); + // Fix some values of $pictowithouttext + $pictoconvertkey = array('facture' => 'bill', 'shipping' => 'shipment', 'fichinter' => 'intervention', 'agenda' => 'calendar', 'invoice_supplier' => 'supplier_invoice', 'order_supplier' => 'supplier_order'); + if (in_array($pictowithouttext, array_keys($pictoconvertkey))) { + $pictowithouttext = $pictoconvertkey[$pictowithouttext]; + } + if (strpos($pictowithouttext, 'fontawesome_') === 0 || strpos($pictowithouttext, 'fa-') === 0) { // This is a font awesome image 'fontawesome_xxx' or 'fa-xxx' $pictowithouttext = str_replace('fontawesome_', '', $pictowithouttext); @@ -5113,7 +5133,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco 'grip_title', 'grip', 'listlight', 'note', 'on', 'off', 'playdisabled', 'printer', 'resize', 'sign-out', 'stats', 'switch_on', 'switch_on_red', 'switch_off', 'uparrow', '1uparrow', '1downarrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected' ); - if (!isset($arrayconvpictotomarginleftonly[$pictowithouttext])) { + if (!array_key_exists($pictowithouttext, $arrayconvpictotomarginleftonly)) { $marginleftonlyshort = 0; } @@ -6940,7 +6960,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round * @param Societe $thirdparty_buyer Object of buying third party * @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined) * @param int $vatnpr If vat rate is NPR or not - * @return int<0,0>|string 0 if not found, localtax rate if found + * @return int<0,0>|string 0 if not found, localtax rate if found (Can be '20', '-19:-15:-9') * @see get_default_tva() */ function get_localtax($vatrate, $local, $thirdparty_buyer = null, $thirdparty_seller = null, $vatnpr = 0) @@ -7020,7 +7040,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer = null, $thirdparty_se } } else { // i am the seller if (!isOnlyOneLocalTax($local)) { // TODO If seller is me, why not always returning this, even if there is only one locatax vat. - return $conf->global->MAIN_INFO_VALUE_LOCALTAX1; + return getDolGlobalString('MAIN_INFO_VALUE_LOCALTAX1'); } } } @@ -7034,7 +7054,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer = null, $thirdparty_se if (in_array($mysoc->country_code, array('ES'))) { return $thirdparty_buyer->localtax2_value; } else { - return $conf->global->MAIN_INFO_VALUE_LOCALTAX2; + return getDolGlobalString('MAIN_INFO_VALUE_LOCALTAX2'); } } } @@ -7204,7 +7224,7 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid * @param Societe $buyer Company object * @param Societe $seller Company object * @param int<0,1> $firstparamisid 1 if first param is ID into table instead of Rate+code (use this if you can) - * @return array{}|array{0:string,1:float,2:string,3:string}|array{0:string,1:float,2:string,3:float,4:string,5:string} array(localtax_type1(1-6 or 0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp) + * @return array{}|array{0:string,1:int|string,2:string,3:string}|array{0:string,1:int|string,2:string,3:int|string,4:string,5:string} array(localtax_type1('1-6' or '0' if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp) * @see getTaxesFromId() */ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid = 0) @@ -7952,12 +7972,13 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = * @param int $cleanalsojavascript Remove also occurrence of 'javascript:'. * @param int $allowiframe Allow iframe tags. * @param string[] $allowed_tags List of allowed tags to replace the default list - * @param int $allowlink Allow "link" tags. + * @param int $allowlink Allow "link" tags (for head html section) + * @param int $allowscript Allow "script" tags (for head html section) * @return string String cleaned * * @see dol_htmlwithnojs() dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags() */ -function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, $removeclassattribute = 1, $cleanalsojavascript = 0, $allowiframe = 0, $allowed_tags = array(), $allowlink = 0) +function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, $removeclassattribute = 1, $cleanalsojavascript = 0, $allowiframe = 0, $allowed_tags = array(), $allowlink = 0, $allowscript = 0) { if (empty($allowed_tags)) { $allowed_tags = array( @@ -7977,6 +7998,11 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, $allowed_tags[] = "link"; } } + if ($allowscript) { + if (!in_array('script', $allowed_tags)) { + $allowed_tags[] = "script"; + } + } $allowed_tags_string = implode("><", $allowed_tags); $allowed_tags_string = '<'.$allowed_tags_string.'>'; @@ -8233,7 +8259,7 @@ function dol_nl2br($stringtoencode, $nl2brmode = 0, $forxml = false) * * @param string $stringtoencode String to encode * @param int $nouseofiframesandbox 0=Default, 1=Allow use of option MAIN_SECURITY_USE_SANDBOX_FOR_HTMLWITHNOJS for html sanitizing (not yet working) - * @param string $check 'restricthtmlnolink' or 'restricthtml' or 'restricthtmlallowclass' or 'restricthtmlallowunvalid' + * @param string $check 'restricthtmlnolink' or 'restricthtml' or 'restricthtmlallowclass' or 'restricthtmlallowlinkscript' or 'restricthtmlallowunvalid' * @return string HTML sanitized */ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = 'restricthtml') @@ -8350,7 +8376,13 @@ static function ($m) { $out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'. // Keep only some html tags and remove also some 'javascript:' strings - $out = dol_string_onlythesehtmltags($out, 0, ($check == 'restricthtmlallowclass' ? 0 : 1), 1); + if ($check == 'restricthtmlallowlinkscript') { + $out = dol_string_onlythesehtmltags($out, 0, 1, 0, 0, array(), 1, 1); + } elseif ($check == 'restricthtmlallowclass') { + $out = dol_string_onlythesehtmltags($out, 0, 0, 1); + } else { + $out = dol_string_onlythesehtmltags($out, 0, 1, 1); + } // Keep only some html attributes and exclude non expected HTML attributes and clean content of some attributes (keep only alt=, title=...). if (getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES')) { @@ -8364,7 +8396,7 @@ static function ($m) { // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/Events $out = preg_replace('/on(mouse|drag|key|load|touch|pointer|select|transition)[a-z]*\s*=/i', '', $out); // onmousexxx can be set on img or any html tag like $out = preg_replace('/on(abort|after|animation|auxclick|before|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)[a-z]*\s*=/i', '', $out); - $out = preg_replace('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', '', $out); + $out = preg_replace('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus(in|out)?|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', '', $out); $out = preg_replace('/on(lostpointercapture|offline|online|pagehide|pageshow)[a-z]*\s*=/i', '', $out); $out = preg_replace('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)[a-z]*\s*=/i', '', $out); $out = preg_replace('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)[a-z]*\s*=/i', '', $out); @@ -8738,11 +8770,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray = array(); - if ((empty($exclude) || !in_array('user', $exclude)) && (empty($include) || in_array('user', $include))) { + if ((empty($exclude) || !in_array('user', $exclude)) && (empty($include) || in_array('user', $include)) && $user instanceof User) { // Add SIGNATURE into substitutionarray first, so, when we will make the substitution, // this will include signature content first and then replace var found into content of signature //var_dump($onlykey); - $emailsendersignature = $user->signature; // dy default, we use the signature of current user. We must complete substitution with signature in c_email_senderprofile of array after calling getCommonSubstitutionArray() + $emailsendersignature = $user->signature; // By default, we use the signature of current user. We must complete substitution with signature in c_email_senderprofile of array after calling getCommonSubstitutionArray() $usersignature = $user->signature; $substitutionarray = array_merge($substitutionarray, array( '__SENDEREMAIL_SIGNATURE__' => (string) ((!getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc('SignatureFromTheSelectedSenderProfile', 30) : $emailsendersignature) : ''), @@ -13383,7 +13415,7 @@ function forgeSQLFromUniversalSearchCriteria($filter, &$errorstr = '', $noand = // Test the filter syntax $t = preg_replace_callback('/'.$regexstring.'/i', 'dolForgeDummyCriteriaCallback', $filter); - $t = str_replace(array('and','or','AND','OR',' '), '', $t); // Remove the only strings allowed between each () criteria + $t = str_ireplace(array('and', 'or', ' '), '', $t); // Remove the only strings allowed between each () criteria // If the string result contains something else than '()', the syntax was wrong if (preg_match('/[^\(\)]/', $t)) { @@ -13572,7 +13604,7 @@ function dolForgeCriteriaCallback($matches) if (empty($matches[1])) { return ''; } - $tmp = explode(':', $matches[1]); + $tmp = explode(':', $matches[1], 3); if (count($tmp) < 3) { return ''; } @@ -13628,7 +13660,7 @@ function dolForgeCriteriaCallback($matches) } else { if (strtoupper($tmpescaped) == 'NULL') { $tmpescaped = 'NULL'; - } elseif (is_numeric((string) $tmpescaped)) { + } elseif (ctype_digit((string) $tmpescaped)) { // if only 0-9 chars, no . $tmpescaped = (int) $tmpescaped; } else { $tmpescaped = (float) $tmpescaped; @@ -13828,7 +13860,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id); } - if (is_object($filterobj) && get_class($filterobj) == 'Societe') { + if ((is_object($filterobj) && get_class($filterobj) == 'Societe') || (is_object($filterobj) && get_class($filterobj) == 'Contact')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; } elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er"; @@ -13847,6 +13879,10 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, $sql .= ", ".MAIN_DB_PREFIX."bom_bom as o"; } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { $sql .= ", ".MAIN_DB_PREFIX."contrat as o"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Facture') { + $sql .= ", ".MAIN_DB_PREFIX."facture as o"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'FactureFournisseur') { + $sql .= ", ".MAIN_DB_PREFIX."facture_fourn as o"; } $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; @@ -13885,6 +13921,16 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, if ($filterobj->id) { $sql .= " AND a.fk_element = ".((int) $filterobj->id); } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Contact' && $filterobj->id) { + $sql .= " AND a.fk_contact = sp.rowid"; + if ($filterobj->id) { + $sql .= " AND a.fk_contact = ".((int) $filterobj->id); + } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Facture') { + $sql .= "AND a.fk_element = o.rowid"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } } } else { $sql .= " AND u.rowid = ". ((int) $filterobj->id); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 48e8ec902e2e4..c4112bd672bd0 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1124,9 +1124,9 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if (!empty($yearoffsettype) && !is_numeric($yearoffsettype) && $yearoffsettype != '=') { // $yearoffsettype is - or + $currentyear = (int) date("Y", $date); - $fiscaldate = dol_mktime('0', '0', '0', $maskraz, '1', $currentyear); - $newyeardate = dol_mktime('0', '0', '0', '1', '1', $currentyear); - $nextnewyeardate = dol_mktime('0', '0', '0', '1', '1', $currentyear + 1); + $fiscaldate = dol_mktime(0, 0, 0, $maskraz, 1, $currentyear); + $newyeardate = dol_mktime(0, 0, 0, 1, 1, $currentyear); + $nextnewyeardate = dol_mktime(0, 0, 0, 1, 1, $currentyear + 1); //echo 'currentyear='.$currentyear.' date='.dol_print_date($date, 'day').' fiscaldate='.dol_print_date($fiscaldate, 'day').'
    '; // If after or equal of current fiscal date @@ -1718,13 +1718,13 @@ function weight_convert($weight, &$from_unit, $to_unit) $weight = is_numeric($weight) ? $weight : 0; while ($from_unit != $to_unit) { if ($from_unit > $to_unit) { - $weight = $weight * 10; - $from_unit = $from_unit - 1; + $weight *= 10; + $from_unit -= 1; $weight = weight_convert($weight, $from_unit, $to_unit); } if ($from_unit < $to_unit) { - $weight = $weight / 10; - $from_unit = $from_unit + 1; + $weight /= 10; + $from_unit += 1; $weight = weight_convert($weight, $from_unit, $to_unit); } } @@ -1895,7 +1895,7 @@ function version_webserver() * @param DoliDB $db Database handler * @param string $type Type of models (company, invoice, ...) * @param int $maxfilenamelength Max length of value to show - * @return array|int 0 if no module is activated, or array(key=>label). For modules that need directory scan, key is completed with ":filename". + * @return string[]|int<-1,0> 0 if no module is activated, or array(key=>label). For modules that need directory scan, key is completed with ":filename", -1 if error */ function getListOfModels($db, $type, $maxfilenamelength = 0) { @@ -2051,13 +2051,13 @@ function getSoapParams() global $conf; $params = array(); - $proxyuse = (!getDolGlobalString('MAIN_PROXY_USE') ? false : true); - $proxyhost = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_HOST); - $proxyport = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_PORT); - $proxyuser = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_USER); - $proxypass = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_PASS); - $timeout = (!getDolGlobalString('MAIN_USE_CONNECT_TIMEOUT') ? 10 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); // Connection timeout - $response_timeout = (!getDolGlobalString('MAIN_USE_RESPONSE_TIMEOUT') ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); // Response timeout + $proxyuse = getDolGlobalString('MAIN_PROXY_USE'); + $proxyhost = (!$proxyuse ? false : $conf->global->MAIN_PROXY_HOST); + $proxyport = (!$proxyuse ? false : $conf->global->MAIN_PROXY_PORT); + $proxyuser = (!$proxyuse ? false : $conf->global->MAIN_PROXY_USER); + $proxypass = (!$proxyuse ? false : $conf->global->MAIN_PROXY_PASS); + $timeout = getDolGlobalInt('MAIN_USE_CONNECT_TIMEOUT', 10); // Connection timeout + $response_timeout = getDolGlobalInt('MAIN_USE_RESPONSE_TIMEOUT', 30); // Response timeout //print extension_loaded('soap'); if ($proxyuse) { $params = array('connection_timeout' => $timeout, @@ -2246,7 +2246,7 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') /** - * Clean corrupted tree (orphelins linked to a not existing parent), record linked to themself and child-parent loop + * Clean corrupted database tree (orphelins linked to a not existing parent), record linked to themself, and also child-parent loop * * @param DoliDB $db Database handler * @param string $tabletocleantree Table to clean @@ -2309,6 +2309,7 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) $listofidtoclean[$cursor] = $id; break; } + // @phpstan-ignore-next-line PHPStan thinks this line is never reached $cursor = $listofparentid[$cursor]; } @@ -2317,8 +2318,8 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) } } - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; - $sql .= " SET ".$fieldfkparent." = 0"; + $sql = "UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tabletocleantree); + $sql .= " SET ".$db->sanitize($fieldfkparent)." = 0"; $sql .= " WHERE rowid IN (".$db->sanitize(implode(',', $listofidtoclean)).")"; // So we update only records detected wrong $resql = $db->query($sql); if ($resql) { @@ -2334,9 +2335,9 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) //else dol_print_error($db); // Check and clean orphelins - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; - $sql .= " SET ".$fieldfkparent." = 0"; - $sql .= " WHERE ".$fieldfkparent." NOT IN (".$db->sanitize(implode(',', $listofid), 1).")"; // So we update only records linked to a non existing parent + $sql = "UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tabletocleantree); + $sql .= " SET ".$db->sanitize($fieldfkparent)." = 0"; + $sql .= " WHERE ".$db->sanitize($fieldfkparent)." NOT IN (".$db->sanitize(implode(',', $listofid), 1).")"; // So we update only records linked to a non existing parent $resql = $db->query($sql); if ($resql) { $nb = $db->affected_rows($sql); diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 7e16ff46de1d8..307dc1772b87e 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -44,7 +44,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) } if ($centimes && strlen((string) $num) == 1) { - $num = $num * 10; + $num *= 10; } if (isModEnabled('numberwords')) { @@ -113,23 +113,23 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) $nboflevels = count($num_levels); for ($i = 0; $i < $nboflevels; $i++) { $levels--; - $hundreds = (int) ($num_levels[$i] / 100); + $hundreds = (int) ((int) $num_levels[$i] / 100); $hundreds = ($hundreds ? ' '.$list1[$hundreds].' '.$langs->transnoentities('hundred').($hundreds == 1 ? '' : 's').' ' : ''); - $tens = (int) ($num_levels[$i] % 100); + $tens = (int) ((int) $num_levels[$i] % 100); $singles = ''; if ($tens < 20) { $tens = ($tens ? ' '.$list1[$tens].' ' : ''); } else { $tens = (int) ($tens / 10); $tens = ' '.$list2[$tens].' '; - $singles = (int) ($num_levels[$i] % 10); + $singles = (int) ((int) $num_levels[$i] % 10); $singles = ' '.$list1[$singles].' '; } $words[] = $hundreds.$tens.$singles.(($levels && (int) ($num_levels[$i])) ? ' '.$list3[$levels].' ' : ''); } //end for loop $commas = count($words); if ($commas > 1) { - $commas = $commas - 1; + $commas -= 1; } $concatWords = implode(' ', $words); // Delete multi whitespaces @@ -202,21 +202,21 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $number = $numero; if ($number >= 1000000000) { $CdMMillon = (int) ($numero / 100000000000); - $numero = $numero - $CdMMillon * 100000000000; + $numero -= $CdMMillon * 100000000000; $DdMMillon = (int) ($numero / 10000000000); - $numero = $numero - $DdMMillon * 10000000000; + $numero -= $DdMMillon * 10000000000; $UdMMillon = (int) ($numero / 1000000000); - $numero = $numero - $UdMMillon * 1000000000; + $numero -= $UdMMillon * 1000000000; $entexto .= hundreds2text($CdMMillon, $DdMMillon, $UdMMillon); $entexto .= " MIL "; } if ($number >= 1000000) { $CdMILLON = (int) ($numero / 100000000); - $numero = $numero - $CdMILLON * 100000000; + $numero -= $CdMILLON * 100000000; $DdMILLON = (int) ($numero / 10000000); - $numero = $numero - $DdMILLON * 10000000; + $numero -= $DdMILLON * 10000000; $udMILLON = (int) ($numero / 1000000); - $numero = $numero - $udMILLON * 1000000; + $numero -= $udMILLON * 1000000; $entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON); if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON == 1) { $entexto .= " MILLÓN "; @@ -226,18 +226,18 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') } if ($number >= 1000) { $cdm = (int) ($numero / 100000); - $numero = $numero - $cdm * 100000; + $numero -= $cdm * 100000; $ddm = (int) ($numero / 10000); - $numero = $numero - $ddm * 10000; + $numero -= $ddm * 10000; $udm = (int) ($numero / 1000); - $numero = $numero - $udm * 1000; + $numero -= $udm * 1000; $entexto .= hundreds2text($cdm, $ddm, $udm); if ($cdm || $ddm || $udm) { $entexto .= " MIL "; } } $c = (int) ($numero / 100); - $numero = $numero - $c * 100; + $numero -= $c * 100; $d = (int) ($numero / 10); $u = (int) $numero - $d * 10; $entexto .= hundreds2text($c, $d, $u); diff --git a/htdocs/core/lib/intracommreport.lib.php b/htdocs/core/lib/intracommreport.lib.php deleted file mode 100644 index 6c4bea20adbbe..0000000000000 --- a/htdocs/core/lib/intracommreport.lib.php +++ /dev/null @@ -1,83 +0,0 @@ - - * Copyright (C) 2015 ATM Consulting - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/lib/intracommreport.lib.php - * \ingroup Intracomm report - * \brief Library of intracomm report functions - */ - -/** - * Prepare array with list of admin tabs - * - * @return array Array of tabs to show - */ -function intracommReportAdminPrepareHead() -{ - global $langs, $conf; - - $langs->load("intracommreport"); - - $h = 0; - $head = array(); - - $head[$h][0] = DOL_URL_ROOT.'/intracommreport/admin/intracommreport.php'; - $head[$h][1] = $langs->trans("Parameters"); - $head[$h][2] = 'general'; - $h++; - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, null, $head, $h, 'intracommreport_admin'); - - complete_head_from_modules($conf, $langs, null, $head, $h, 'intracommreport_admin', 'remove'); - return $head; -} - -/** - * Prepare array with list of tabs - * - * @param Object $object Object related to tabs - * - * @return array Array of tabs to show - */ -function intracommReportPrepareHead($object) -{ - global $langs, $conf; - - $langs->load("intracommreport"); - - $h = 0; - $head = array(); - - $head[$h][0] = DOL_URL_ROOT.'/intracommreport/card.php?rowid='.$object->id; - $head[$h][1] = $langs->trans("Card"); - $head[$h][2] = 'card'; - $h++; - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, null, $head, $h, 'intracommreport'); - - complete_head_from_modules($conf, $langs, null, $head, $h, 'intracommreport', 'remove'); - return $head; -} diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 8c0ccde4b6a6a..d9b7928ba4933 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -592,6 +592,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_compta = $obj->code_compta; + $companystatic->code_compta_client = $obj->code_compta; $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; $result .= ''; @@ -726,6 +727,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_compta = $obj->code_compta; + $companystatic->code_compta_client = $obj->code_compta; $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; $result .= ''; @@ -1096,6 +1098,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) $societestatic->code_client = $obj->code_client; $societestatic->code_fournisseur = $obj->code_fournisseur; $societestatic->code_compta = $obj->code_compta; + $societestatic->code_compta_client = $obj->code_compta; $societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur; print ''; @@ -1283,6 +1286,7 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) $societestatic->code_client = $obj->code_client; $societestatic->code_fournisseur = $obj->code_fournisseur; $societestatic->code_compta = $obj->code_compta; + $societestatic->code_compta_client = $obj->code_compta; $societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur; print ''; diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php index 5e8a982ddbea1..a3ea72226a19a 100644 --- a/htdocs/core/lib/ldap.lib.php +++ b/htdocs/core/lib/ldap.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2006-2021 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,12 +122,12 @@ function show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass) /** * Show a LDAP array into an HTML output array. * - * @param array $result Array to show. This array is already encoded into charset_output - * @param int $level Level - * @param int $count Count - * @param string $var Var - * @param int $hide Hide - * @param int $subcount Subcount + * @param array<'count'|int|string,int|string|array> $result Array to show. This array is already encoded into charset_output + * @param int $level Level + * @param int $count Count + * @param string $var Var + * @param int<0,1> $hide Hide + * @param int $subcount Subcount * @return int */ function show_ldap_content($result, $level, $count, $var, $hide = 0, $subcount = 0) diff --git a/htdocs/core/lib/loan.lib.php b/htdocs/core/lib/loan.lib.php index f1dd273c9b176..467b657591564 100644 --- a/htdocs/core/lib/loan.lib.php +++ b/htdocs/core/lib/loan.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2014-2016 Alexandre Spangaro * Copyright (C) 2015-2020 Frederic 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 @@ -118,18 +119,18 @@ function loanCalcMonthlyPayment($mens, $capital, $rate, $numactualloadterm, $nbt $int = 0; $cap_rest = $capital; } else { - $int = ($capital * ($rate / 12)); + $int = ((float) $capital * ((float) $rate / 12)); $int = round($int, 2, PHP_ROUND_HALF_UP); - $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP); + $cap_rest = round((float) $capital - ((float) $mens - $int), 2, PHP_ROUND_HALF_UP); } - $output[$numactualloadterm] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens); + $output[$numactualloadterm] = array('cap_rest' => $cap_rest, 'cap_rest_str' => price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet' => $int, 'interet_str' => price($int, 0, '', 1, -1, -1, $conf->currency), 'mens' => $mens); $numactualloadterm++; $capital = $cap_rest; while ($numactualloadterm <= $nbterm) { $mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $numactualloadterm + 1), 2, PHP_ROUND_HALF_UP); - $int = ($capital * ($rate / 12)); + $int = ($capital * ((float) $rate / 12)); $int = round($int, 2, PHP_ROUND_HALF_UP); $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP); diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index c2d7d7dd1f6a3..084549d2eb2c0 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2021 Frédéric France + * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -252,7 +252,7 @@ function dol_listshmop() /** * Save data into a memory area shared by all users, all sessions on server * - * @param int $memoryid Memory id of shared area ('main', 'agenda', ...) + * @param string $memoryid Memory id of shared area ('main', 'agenda', ...) * @param string $data Data to save. Must be a not null value. * @param int $expire ttl in seconds, 0 never expire * @return int Return integer <0 if KO, 0=Caching not available, Nb of bytes written if OK diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 98d3b66f34a01..2335ada1fb5a0 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -26,14 +26,14 @@ /** * Regenerate files .class.php * - * @param string $destdir Directory - * @param string $module Module name - * @param string $objectname Name of object - * @param string $newmask New mask - * @param string $readdir Directory source (use $destdir when not defined) + * @param string $destdir Directory + * @param string $module Module name + * @param string $objectname Name of object + * @param string $newmask New mask + * @param string $readdir Directory source (use $destdir when not defined) * @param array{}|array{name:string,key:string,type:string,label:string,picot?:string,enabled:int<0,1>,notnull:int<0,1>,position:int,visible:int,noteditable?:int<0,1>,alwayseditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int<0,1>,css?:string,cssview?:string,csslist?:string,help?:string,showoncombobox?:int<0,1>,disabled?:int<0,1>,autofocusoncreate?:int<0,1>,arrayofkeyval?:array,validate?:int<0,1>,comment?:string} $addfieldentry Array of 1 field entry to add - * @param string $delfieldentry Id of field to remove - * @return int<-7,-1>|CommonObject Return integer <=0 if KO, Object if OK + * @param string $delfieldentry Id of field to remove + * @return int<-7,-1>|CommonObject Return integer <=0 if KO, Object if OK * @see rebuildObjectSql() */ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = '', $addfieldentry = array(), $delfieldentry = '') @@ -79,7 +79,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = return -3; } - //$pathoffiletoedittmp=$destdir.'/class/'.strtolower($objectname).'.class.php.tmp'; + //$pathoffiletoedittmp = $destdir.'/class/'.strtolower($objectname).'.class.php.tmp'; //dol_delete_file($pathoffiletoedittmp, 0, 1, 1); try { @@ -116,67 +116,68 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = $i = 0; $texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n"; $texttoinsert .= "\t".'/**'."\n"; - $texttoinsert .= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n"; + $texttoinsert .= "\t".' * @inheritdoc'."\n"; + $texttoinsert .= "\t".' * Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n"; $texttoinsert .= "\t".' */'."\n"; - $texttoinsert .= "\t".'public $fields=array('."\n"; + $texttoinsert .= "\t".'public $fields = array('."\n"; if (count($object->fields)) { foreach ($object->fields as $key => $val) { $i++; $texttoinsert .= "\t\t".'"'.$key.'" => array('; - $texttoinsert .= '"type"=>"'.dol_escape_php($val['type']).'",'; - $texttoinsert .= ' "label"=>"'.dol_escape_php($val['label']).'",'; + $texttoinsert .= '"type" => "'.dol_escape_php($val['type']).'",'; + $texttoinsert .= ' "label" => "'.dol_escape_php($val['label']).'",'; if (!empty($val['picto'])) { - $texttoinsert .= ' "picto"=>"'.dol_escape_php($val['picto']).'",'; + $texttoinsert .= ' "picto" => "'.dol_escape_php($val['picto']).'",'; } - $texttoinsert .= ' "enabled"=>"'.($val['enabled'] !== '' ? dol_escape_php($val['enabled']) : 1).'",'; - $texttoinsert .= " 'position'=>".($val['position'] !== '' ? (int) $val['position'] : 50).","; - $texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : (int) $val['notnull']).","; - $texttoinsert .= ' "visible"=>"'.($val['visible'] !== '' ? dol_escape_js($val['visible']) : -1).'",'; + $texttoinsert .= ' "enabled" => "'.($val['enabled'] !== '' ? dol_escape_php($val['enabled']) : 1).'",'; + $texttoinsert .= " 'position' => ".($val['position'] !== '' ? (int) $val['position'] : 50).","; + $texttoinsert .= " 'notnull' => ".(empty($val['notnull']) ? 0 : (int) $val['notnull']).","; + $texttoinsert .= ' "visible" => "'.($val['visible'] !== '' ? dol_escape_js($val['visible']) : -1).'",'; if (!empty($val['noteditable'])) { - $texttoinsert .= ' "noteditable"=>"'.dol_escape_php($val['noteditable']).'",'; + $texttoinsert .= ' "noteditable" => "'.dol_escape_php($val['noteditable']).'",'; } if (!empty($val['alwayseditable'])) { - $texttoinsert .= ' "alwayseditable"=>"'.dol_escape_php($val['alwayseditable']).'",'; + $texttoinsert .= ' "alwayseditable" => "'.dol_escape_php($val['alwayseditable']).'",'; } if (array_key_exists('default', $val) && (!empty($val['default']) || $val['default'] === '0')) { - $texttoinsert .= ' "default"=>"'.dol_escape_php($val['default']).'",'; + $texttoinsert .= ' "default" => "'.dol_escape_php($val['default']).'",'; } if (!empty($val['index'])) { - $texttoinsert .= ' "index"=>"'.(int) $val['index'].'",'; + $texttoinsert .= ' "index" => "'.(int) $val['index'].'",'; } if (!empty($val['foreignkey'])) { - $texttoinsert .= ' "foreignkey"=>"'.(int) $val['foreignkey'].'",'; + $texttoinsert .= ' "foreignkey" => "'.(int) $val['foreignkey'].'",'; } if (!empty($val['searchall'])) { - $texttoinsert .= ' "searchall"=>"'.(int) $val['searchall'].'",'; + $texttoinsert .= ' "searchall" => "'.(int) $val['searchall'].'",'; } if (!empty($val['isameasure'])) { - $texttoinsert .= ' "isameasure"=>"'.(int) $val['isameasure'].'",'; + $texttoinsert .= ' "isameasure" => "'.(int) $val['isameasure'].'",'; } if (!empty($val['css'])) { - $texttoinsert .= ' "css"=>"'.dol_escape_php($val['css']).'",'; + $texttoinsert .= ' "css" => "'.dol_escape_php($val['css']).'",'; } if (!empty($val['cssview'])) { - $texttoinsert .= ' "cssview"=>"'.dol_escape_php($val['cssview']).'",'; + $texttoinsert .= ' "cssview" => "'.dol_escape_php($val['cssview']).'",'; } if (!empty($val['csslist'])) { - $texttoinsert .= ' "csslist"=>"'.dol_escape_php($val['csslist']).'",'; + $texttoinsert .= ' "csslist" => "'.dol_escape_php($val['csslist']).'",'; } if (!empty($val['help'])) { - $texttoinsert .= ' "help"=>"'.dol_escape_php($val['help']).'",'; + $texttoinsert .= ' "help" => "'.dol_escape_php($val['help']).'",'; } if (!empty($val['showoncombobox'])) { - $texttoinsert .= ' "showoncombobox"=>"'.(int) $val['showoncombobox'].'",'; + $texttoinsert .= ' "showoncombobox" => "'.(int) $val['showoncombobox'].'",'; } if (!empty($val['disabled'])) { - $texttoinsert .= ' "disabled"=>"'.(int) $val['disabled'].'",'; + $texttoinsert .= ' "disabled" => "'.(int) $val['disabled'].'",'; } if (!empty($val['autofocusoncreate'])) { - $texttoinsert .= ' "autofocusoncreate"=>"'.(int) $val['autofocusoncreate'].'",'; + $texttoinsert .= ' "autofocusoncreate" => "'.(int) $val['autofocusoncreate'].'",'; } if (!empty($val['arrayofkeyval'])) { - $texttoinsert .= ' "arrayofkeyval"=>array('; + $texttoinsert .= ' "arrayofkeyval" => array('; $i = 0; foreach ($val['arrayofkeyval'] as $key2 => $val2) { if ($i) { @@ -188,10 +189,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = $texttoinsert .= '),'; } if (!empty($val['validate'])) { - $texttoinsert .= ' "validate"=>"'.(int) $val['validate'].'",'; + $texttoinsert .= ' "validate" => "'.(int) $val['validate'].'",'; } if (!empty($val['comment'])) { - $texttoinsert .= ' "comment"=>"'.dol_escape_php($val['comment']).'"'; + $texttoinsert .= ' "comment" => "'.dol_escape_php($val['comment']).'"'; } $texttoinsert .= "),\n"; @@ -203,16 +204,16 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = //print ($texttoinsert);exit; if (count($object->fields)) { - //$typetotypephp=array('integer'=>'integer', 'duration'=>'integer', 'varchar'=>'string'); + //$typetotypephp = array('integer' => 'integer', 'duration' => 'integer', 'varchar' => 'string'); foreach ($object->fields as $key => $val) { $i++; - //$typephp=$typetotypephp[$val['type']]; + //$typephp = $typetotypephp[$val['type']]; $texttoinsert .= "\t".'public $'.$key.";"; //if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; //if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; //$texttoinsert.= ($val['notnull']?' NOT NULL':''); - //if ($i < count($object->fields)) $texttoinsert.=";"; + //if ($i < count($object->fields)) $texttoinsert. = ";"; $texttoinsert .= "\n"; } } @@ -245,14 +246,14 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = /** * Save data into a memory area shared by all users, all sessions on server * - * @param string $destdir Directory - * @param string $module Module name - * @param string $objectname Name of object - * @param string $newmask New mask - * @param string $readdir Directory source (use $destdir when not defined) - * @param Object $object If object was already loaded/known, it is pass to avoid another include and new. - * @param string $moduletype 'external' or 'internal' - * @return int Return integer <=0 if KO, >0 if OK + * @param string $destdir Directory + * @param string $module Module name + * @param string $objectname Name of object + * @param string $newmask New mask + * @param string $readdir Directory source (use $destdir when not defined) + * @param Object $object If object was already loaded/known, it is pass to avoid another include and new. + * @param string $moduletype 'external' or 'internal' + * @return int Return integer <=0 if KO, >0 if OK * @see rebuildObjectClass() */ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '', $object = null, $moduletype = 'external') @@ -430,8 +431,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' /** * Get list of existing objects from a directory * - * @param string $destdir Directory - * @return array|int Return integer <=0 if KO, array if OK + * @param string $destdir Directory + * @return string[]|int Return integer <=0 if KO, array if OK */ function dolGetListOfObjectClasses($destdir) { @@ -462,9 +463,9 @@ function dolGetListOfObjectClasses($destdir) /** * Function to check if comment BEGIN and END exists in modMyModule class * - * @param string $file Filename or path - * @param int $number 0 = For Menus, 1 = For permissions, 2 = For Dictionaries - * @return int 1 if OK , -1 if KO + * @param string $file Filename or path + * @param int<0,2> $number 0 = For Menus, 1 = For permissions, 2 = For Dictionaries + * @return int 1 if OK , -1 if KO */ function checkExistComment($file, $number) { @@ -507,8 +508,8 @@ function checkExistComment($file, $number) /** * Delete all permissions * - * @param string $file file with path - * @return void + * @param string $file file with path + * @return void */ function deletePerms($file) { @@ -538,10 +539,10 @@ function deletePerms($file) } /** - * Compare two value - * @param int|string $a value 1 - * @param int|string $b value 2 - * @return int less 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. + * Compare two values + * @param int|string $a value 1 + * @param int|string $b value 2 + * @return int<-1,1> <=0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. */ function compareFirstValue($a, $b) { @@ -549,25 +550,25 @@ function compareFirstValue($a, $b) } /** * Rewriting all permissions after any actions - * @param string $file filename or path - * @param array $permissions permissions existing in file - * @param int|null $key key for permission needed - * @param array{0:string,1:string}|null $right $right to update or add - * @param string|null $objectname name of object - * @param string|null $module name of module - * @param int<-2,2> $action 0 for delete, 1 for add, 2 for update, -1 when delete object completely, -2 for generate rights after add - * @return int<-1,1> 1 if OK,-1 if KO + * @param string $file filename or path + * @param array $permissions permissions existing in file + * @param ?int $key key for permission needed + * @param ?array{0:string,1:string} $right $right to update or add + * @param string $objectname name of object + * @param string $module name of module + * @param int<-2,2> $action 0 for delete, 1 for add, 2 for update, -1 when delete object completely, -2 for generate rights after add + * @return int<-1,1> 1 if OK,-1 if KO */ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $module, $action) { $error = 0; $rights = array(); - if ($action == 0) { + if ($action == 0 && $key !== null) { // delete right from permissions array array_splice($permissions, array_search($permissions[$key], $permissions), 1); } elseif ($action == 1) { array_push($permissions, $right); - } elseif ($action == 2 && !empty($right)) { + } elseif ($action == 2 && !empty($right) && $key !== null) { // update right from permissions array array_splice($permissions, array_search($permissions[$key], $permissions), 1, $right); } elseif ($action == -1 && !empty($objectname)) { @@ -624,7 +625,7 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $ foreach ($permissions as $perms) { $object = $perms[4]; if (!isset($perms_grouped[$object])) { - $perms_grouped[$object] = []; + $perms_grouped[$object] = array(); } $perms_grouped[$object][] = $perms; } @@ -656,11 +657,10 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $ //convert to string foreach ($permissions as $perms) { foreach ($perms as $per) { - $rights[] = implode(";\n\t\t", $per); - $rights[] = "\$r++;\n\t\t"; + $rights[] = implode(";\n\t\t", $per)."\$r++;\n"; } } - $rights_str = implode("", $rights); + $rights_str = implode("\t\t", $rights); // delete all permissions from file deletePerms($file); // rewrite all permissions again @@ -674,8 +674,8 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $ /** * Converts a formatted properties string into an associative array. * - * @param string $string The formatted properties string. - * @return array The resulting associative array. + * @param string $string The formatted properties string. + * @return array The resulting associative array. */ function parsePropertyString($string) { @@ -683,7 +683,7 @@ function parsePropertyString($string) // Uses a regular expression to capture keys and values preg_match_all('/\s*([^\s=>]+)\s*=>\s*([^,]+),?/', $string, $matches, PREG_SET_ORDER); - $propertyArray = []; + $propertyArray = array(); foreach ($matches as $match) { $key = trim($match[1]); @@ -718,10 +718,10 @@ function parsePropertyString($string) /** * Write all properties of the object in AsciiDoc format - * @param string $file path of the class - * @param string $objectname name of the objectClass - * @param string $destfile file where write table of properties - * @return int 1 if OK, -1 if KO + * @param string $file path of the class + * @param string $objectname name of the objectClass + * @param string $destfile file where write table of properties + * @return int 1 if OK, -1 if KO */ function writePropsInAsciiDoc($file, $objectname, $destfile) { @@ -729,7 +729,7 @@ function writePropsInAsciiDoc($file, $objectname, $destfile) // stock all properties in array $attributesUnique = array('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' ); - $start = "public \$fields=array("; + $start = "public \$fields = array("; $end = ");"; $i = 1; $keys = array(); @@ -817,9 +817,9 @@ function writePropsInAsciiDoc($file, $objectname, $destfile) /** * Delete property and permissions from documentation ascii file if we delete an object * - * @param string $file file or path - * @param string $objectname name of object wants to deleted - * @return void + * @param string $file file or path + * @param string $objectname name of object wants to deleted + * @return void */ function deletePropsAndPermsFromDoc($file, $objectname) { @@ -846,12 +846,12 @@ function deletePropsAndPermsFromDoc($file, $objectname) /** * Search a string and return all lines needed from file. Does not include line $start nor $end * - * @param string $file file for searching - * @param string $start start line if exist - * @param string $end end line if exist - * @param string $excludestart Ignore if start line is $excludestart - * @param int $includese Include start and end line - * @return string Return the lines between first line with $start and $end. "" if not found. + * @param string $file file for searching + * @param string $start start line if it exists + * @param string $end end line if it exists + * @param string $excludestart Ignore if start line is $excludestart + * @param int<0,1> $includese Include start and end line + * @return string Return the lines between first line with $start and $end. "" if not found. */ function getFromFile($file, $start, $end, $excludestart = '', $includese = 0) { @@ -889,9 +889,9 @@ function getFromFile($file, $start, $end, $excludestart = '', $includese = 0) /** * Write all permissions of each object in AsciiDoc format - * @param string $file path of the class - * @param string $destfile file where write table of permissions - * @return int<-1,1> 1 if OK, -1 if KO + * @param string $file path of the class + * @param string $destfile file where write table of permissions + * @return int<-1,1> 1 if OK, -1 if KO */ function writePermsInAsciiDoc($file, $destfile) { @@ -939,10 +939,10 @@ function writePermsInAsciiDoc($file, $destfile) array_pop($permsN); // Group permissions by Object and add it to string - $final_array = []; + $final_array = array(); $index = 0; while ($index < count($permsN)) { - $temp_array = [$permsN[$index], $permsN[$index + 1]]; + $temp_array = array($permsN[$index], $permsN[$index + 1]); $final_array[] = $temp_array; $index += 2; } @@ -974,11 +974,11 @@ function writePermsInAsciiDoc($file, $destfile) /** * Add Object in ModuleApi File * - * @param string $srcfile Source file to use as example - * @param string $file Path of modified file - * @param string[] $objects Array of objects in the module - * @param string $modulename Name of module - * @return int<-1,1> Return 1 if OK, -1 if KO + * @param string $srcfile Source file to use as example + * @param string $file Path of modified file + * @param string[] $objects Array of objects in the module + * @param string $modulename Name of module + * @return int<-1,1> Return 1 if OK, -1 if KO */ function addObjectsToApiFile($srcfile, $file, $objects, $modulename) { @@ -1007,7 +1007,7 @@ function addObjectsToApiFile($srcfile, $file, $objects, $modulename) } elseif (preg_match('/'.$props.'/', $lineContent)) { $lineContent = ''; foreach ($objects as $objectname) { - $lineContent .= "\tpublic \$".strtolower($objectname).";". PHP_EOL; + $lineContent .= "\t/*".PHP_EOL."\t * @var mixed TODO: set type".PHP_EOL."\t */".PHP_EOL."\tpublic \$".strtolower($objectname).";". PHP_EOL; } } elseif (preg_match('/'.$constructObj.'/', $lineContent)) { $lineContent = ''; @@ -1040,7 +1040,7 @@ function addObjectsToApiFile($srcfile, $file, $objects, $modulename) 'myobject' => strtolower($objectname), 'MyObject' => $objectname, 'MYOBJECT' => strtoupper($objectname), - '---Put here your own copyright and developer email---' => dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') + '---Replace with your own copyright and developer email---' => dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') ); $contentReplaced = make_substitutions($allContent, $arrayreplacement, null); //$contentReplaced = str_replace(["myobject","MyObject"], [strtolower($object),$object], $allContent); @@ -1060,10 +1060,10 @@ function addObjectsToApiFile($srcfile, $file, $objects, $modulename) /** * Remove Object variables and methods from API_Module File * - * @param string $file File api module - * @param string[] $objects Array of objects in the module - * @param string $objectname Name of object want to remove - * @return int<-1,1> 1 if OK, -1 if KO + * @param string $file File api module + * @param string[] $objects Array of objects in the module + * @param string $objectname Name of object want to remove + * @return int<-1,1> 1 if OK, -1 if KO */ function removeObjectFromApiFile($file, $objects, $objectname) { @@ -1108,12 +1108,12 @@ function removeObjectFromApiFile($file, $objects, $objectname) /** - * @param string $file path of filename - * @param array $menus all menus for module - * @param mixed|null $menuWantTo menu get for do actions - * @param int|null $key key for the concerned menu - * @param int<-1,2> $action for specify what action (0 = delete perm, 1 = add perm, 2 = update perm, -1 = when we delete object) - * @return int<-1,1> 1 if OK, -1 if KO + * @param string $file path of filename + * @param array $menus all menus for module + * @param null|string|array{commentgroup:string,fk_menu:string,type:string,titre:string,mainmenu:string,leftmenu:string,url:string,langs:string,position:int,enabled:int,perms:string,target:string,user:int} $menuWantTo menu get for do actions + * @param ?int $key key for the concerned menu + * @param int<-1,2> $action for specify what action (0 = delete perm, 1 = add perm, 2 = update perm, -1 = when we delete object) + * @return int<-1,1> 1 if OK, -1 if KO */ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) { @@ -1150,7 +1150,7 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) } else { $errors++; } - } elseif ($action == -1 && !empty($menuWantTo)) { + } elseif ($action == -1 && !empty($menuWantTo) && is_string($menuWantTo)) { // delete menus when delete Object foreach ($menus as $index => $menu) { if ((strpos(strtolower($menu['fk_menu']), strtolower($menuWantTo)) !== false) || (strpos(strtolower($menu['leftmenu']), strtolower($menuWantTo)) !== false)) { @@ -1184,20 +1184,20 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) //var_dump(dol_escape_php($menu['perms'], 1)); exit; $str_menu .= $start."\n"; - $str_menu .= "\t\t\$this->menu[\$r++]=array(\n"; - $str_menu .= "\t\t\t 'fk_menu' => '".dol_escape_php($menu['fk_menu'], 1)."',\n"; - $str_menu .= "\t\t\t 'type' => '".dol_escape_php($menu['type'], 1)."',\n"; - $str_menu .= "\t\t\t 'titre' => '".dol_escape_php($menu['titre'], 1)."',\n"; - $str_menu .= "\t\t\t 'mainmenu' => '".dol_escape_php($menu['mainmenu'], 1)."',\n"; - $str_menu .= "\t\t\t 'leftmenu' => '".dol_escape_php($menu['leftmenu'], 1)."',\n"; - $str_menu .= "\t\t\t 'url' => '".dol_escape_php($menu['url'], 1)."',\n"; - $str_menu .= "\t\t\t 'langs' => '".dol_escape_php($menu['langs'], 1)."',\n"; - $str_menu .= "\t\t\t 'position' => ".((int) $menu['position']).",\n"; - $str_menu .= "\t\t\t 'enabled' => '".dol_escape_php($menu['enabled'], 1)."',\n"; - $str_menu .= "\t\t\t 'perms' => '".dol_escape_php($menu['perms'], 1)."',\n"; - $str_menu .= "\t\t\t 'target' => '".dol_escape_php($menu['target'], 1)."',\n"; - $str_menu .= "\t\t\t 'user' => ".((int) $menu['user']).",\n"; - $str_menu .= "\t\t\t 'object' => '".dol_escape_php($menu['object'], 1)."',\n"; + $str_menu .= "\t\t\$this->menu[\$r++] = array(\n"; + $str_menu .= "\t\t\t'fk_menu' => '".dol_escape_php($menu['fk_menu'], 1)."',\n"; + $str_menu .= "\t\t\t'type' => '".dol_escape_php($menu['type'], 1)."',\n"; + $str_menu .= "\t\t\t'titre' => '".dol_escape_php($menu['titre'], 1)."',\n"; + $str_menu .= "\t\t\t'mainmenu' => '".dol_escape_php($menu['mainmenu'], 1)."',\n"; + $str_menu .= "\t\t\t'leftmenu' => '".dol_escape_php($menu['leftmenu'], 1)."',\n"; + $str_menu .= "\t\t\t'url' => '".dol_escape_php($menu['url'], 1)."',\n"; + $str_menu .= "\t\t\t'langs' => '".dol_escape_php($menu['langs'], 1)."',\n"; + $str_menu .= "\t\t\t'position' => ".((int) $menu['position']).",\n"; + $str_menu .= "\t\t\t'enabled' => '".dol_escape_php($menu['enabled'], 1)."',\n"; + $str_menu .= "\t\t\t'perms' => '".dol_escape_php($menu['perms'], 1)."',\n"; + $str_menu .= "\t\t\t'target' => '".dol_escape_php($menu['target'], 1)."',\n"; + $str_menu .= "\t\t\t'user' => ".((int) $menu['user']).",\n"; + $str_menu .= "\t\t\t'object' => '".dol_escape_php($menu['object'], 1)."',\n"; $str_menu .= "\t\t);\n"; if (is_null($next_val) || $val_actuel['leftmenu'] !== $next_val['leftmenu']) { @@ -1215,41 +1215,41 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) /** * Updates a dictionary in a module descriptor file. * - * @param string $module The name of the module. - * @param string $file The path to the module descriptor file. - * @param array> $dicts The dictionary data to be updated. - * @return int Returns the number of replacements made in the file. + * @param string $module The name of the module. + * @param string $file The path to the module descriptor file. + * @param array{langs:string,tabname:string[],tablib:string[],tabsql:string[],tabsqlsort:string[],tabfield:string[],tabfieldvalue:string[],tabfieldinsert:string[],tabrowid:string[],tabcond:array,tabhelp:array} $dicts The dictionary data to be updated. + * @return int Returns the number of replacements made in the file. */ function updateDictionaryInFile($module, $file, $dicts) { $isEmpty = false; - $dicData = "\t\t\$this->dictionaries=array(\n"; + $dicData = "\t\t\$this->dictionaries = array(\n"; $module = strtolower($module); foreach ($dicts as $key => $value) { if (empty($value)) { $isEmpty = true; - $dicData = "\t\t\$this->dictionaries=array();"; + $dicData = "\t\t\$this->dictionaries = array();"; break; } - $dicData .= "\t\t\t'$key'=>"; + $dicData .= "\t\t\t'$key' => "; if ($key === 'tabcond') { $conditions = array_map( /** - * @param bool|string|int $val - * @return string|int + * @param bool|string|int $val + * @return string|int */ - function ($val) use ($module) { + static function ($val) use ($module) { return is_bool($val) ? "isModEnabled('$module')" : $val; }, $value ); - $dicData .= "array(" . implode(",", $conditions) . ")"; + $dicData .= "array(" . implode(", ", $conditions) . ")"; } elseif ($key === 'tabhelp') { $helpItems = array(); foreach ($value as $helpValue) { - $helpItems[] = "array('code'=>\$langs->trans('".$helpValue['code']."'), 'field2' => 'field2tooltip')"; + $helpItems[] = "array('code' => \$langs->trans('".$helpValue['code']."'), 'field2' => 'field2tooltip')"; } $dicData .= "array(" . implode(",", $helpItems) . ")"; } else { @@ -1258,8 +1258,8 @@ function ($val) use ($module) { ",", array_map( /** - * @param string $val - * @return string + * @param string $val + * @return string */ static function ($val) { return "'$val'"; @@ -1282,16 +1282,16 @@ static function ($val) { } /** - * Creates a new dictionary table. + * Create a new dictionary table. * - * for creating a new dictionary table in Dolibarr. It generates the necessary SQL code to define the table structure, + * It generates the necessary SQL code to define the table structure, * including columns such as 'rowid', 'code', 'label', 'position', 'use_default', 'active', etc. The table name is constructed based on the provided $namedic parameter. * - * @param string $modulename The lowercase name of the module for which the dictionary table is being created. - * @param string $file The file path to the Dolibarr module builder file where the dictionaries are defined. - * @param string $namedic The name of the dictionary, which will also be used as the base for the table name. - * @param array> $dictionnaires An optional array containing pre-existing dictionary data, including 'tabname', 'tablib', 'tabsql', etc. - * @return int<-1,-1> Return int < 0 if error, return nothing on success + * @param string $modulename The lowercase name of the module for which the dictionary table is being created. + * @param string $file The file path to the Dolibarr module builder file where the dictionaries are defined. + * @param string $namedic The name of the dictionary, which will also be used as the base for the table name. + * @param ?array{langs:string,tabname:string[],tablib:string[],tabsql:string[],tabsqlsort:string[],tabfield:string[],tabfieldvalue:string[],tabfieldinsert:string[],tabrowid:string[],tabcond:array,tabhelp:array} $dictionnaires An optional array containing pre-existing dictionary data, including tabname, tablib, tabsql, etc. + * @return int<-1,-1> Return int < 0 if error, return nothing on success */ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = null) { @@ -1370,9 +1370,9 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul /** * Generate Urls and add them to documentation module * - * @param string $file_api filename or path of api - * @param string $file_doc filename or path of documentation - * @return int<-1,1> -1 if KO, 1 if OK, 0 if nothing change + * @param string $file_api filename or path of api + * @param string $file_doc filename or path of documentation + * @return int<-1,1> -1 if KO, 1 if OK, 0 if nothing change */ function writeApiUrlsInDoc($file_api, $file_doc) { @@ -1384,7 +1384,7 @@ function writeApiUrlsInDoc($file_api, $file_doc) $extractUrls = explode("\n", $string); // extract urls from file - $urlValues = []; + $urlValues = array(); foreach ($extractUrls as $key => $line) { $lineWithoutTabsSpaces = preg_replace('/^[\t\s]+/', '', $line); if (strpos($lineWithoutTabsSpaces, '* @url') === 0) { @@ -1395,7 +1395,7 @@ function writeApiUrlsInDoc($file_api, $file_doc) // get urls by object $str = $_SERVER['HTTP_HOST'].'/api/index.php/'; - $groupedUrls = []; + $groupedUrls = array(); foreach ($urlValues as $url) { if (preg_match('/(?:GET|POST|PUT|DELETE) (\w+)s/', $url, $matches)) { $objectName = $matches[1]; @@ -1427,9 +1427,9 @@ function writeApiUrlsInDoc($file_api, $file_doc) /** * count directories or files in modulebuilder folder - * @param string $path path of directory - * @param int $type type of file 1= file,2=directory - * @return int|bool + * @param string $path path of directory + * @param int<1,2> $type type of file 1= file,2=directory + * @return int|false False on failure (path is not a directory) */ function countItemsInDirectory($path, $type = 1) { diff --git a/htdocs/core/lib/oauth.lib.php b/htdocs/core/lib/oauth.lib.php index 0131a05d32c5b..2366b4c0d34a8 100644 --- a/htdocs/core/lib/oauth.lib.php +++ b/htdocs/core/lib/oauth.lib.php @@ -261,9 +261,9 @@ function getAllOauth2Array() 'OAUTH_YAMMER_SECRET', ), array( - 'OAUTH_OTHER_NAME', - 'OAUTH_OTHER_ID', - 'OAUTH_OTHER_SECRET', + 'OAUTH_GENERIC_NAME', + 'OAUTH_GENERIC_ID', + 'OAUTH_GENERIC_SECRET', ) ); @@ -340,17 +340,16 @@ function getSupportedOauth2Array() 'availablescopes' => 'openid,offline_access,profile,email,User.Read,https://outlook.office.com/.default', 'returnurl' => '/core/modules/oauth/microsoft_oauthcallback.php' ); - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $supportedoauth2array['OAUTH_OTHER_NAME'] = array( - 'callbackfile' => 'generic', - 'picto' => 'generic', - 'urlforapp' => 'OAUTH_OTHER_DESC', - 'name' => 'Other', - 'urlforcredentials' => '', - 'availablescopes' => 'Standard', - 'returnurl' => '/core/modules/oauth/generic_oauthcallback.php' - ); - } + // Add a generic Oauth token handler. Tested with Mastodon. + $supportedoauth2array['OAUTH_GENERIC_NAME'] = array( + 'callbackfile' => 'generic', + 'picto' => 'generic', + 'urlforapp' => 'OAUTH_GENERIC_DESC', + 'name' => 'Generic', + 'urlforcredentials' => '', + 'availablescopes' => 'Standard', + 'returnurl' => '/core/modules/oauth/generic_oauthcallback.php' + ); return $supportedoauth2array; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ba3988492e11c..8eeea4da03a0d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -819,6 +819,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) //rotate $pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', cos($watermark_angle), sin($watermark_angle), -sin($watermark_angle), cos($watermark_angle), $watermark_x * $k, ($h - $watermark_y) * $k, -$watermark_x * $k, -($h - $watermark_y) * $k)); //print watermark + $pdf->SetAlpha(0.5); $pdf->SetXY($watermark_x_pos, $watermark_y_pos); $pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text), "", 2, "C", 0); //antirotate @@ -1381,7 +1382,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ * Show linked objects for PDF generation * * @param TCPDF $pdf Object PDF - * @param object $object Object + * @param Object $object Object * @param Translate $outputlangs Object lang * @param int $posx X * @param int $posy Y @@ -1403,7 +1404,7 @@ function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $posy += 3; $pdf->SetXY($posx, $posy); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', (float) $default_font_size - 2); $pdf->MultiCell($w, $h, $reftoshow, '', $align); } } @@ -1461,7 +1462,7 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos if (getDolGlobalString('MARGIN_TOP_ZERO_UL')) { $pdf->setListIndentWidth(5); - $TMarginList = ['ul' => [['h'=>0.1, ],['h'=>0.1, ]], 'li' => [['h'=>0.1, ],],]; + $TMarginList = ['ul' => [['h' => 0.1, ],['h' => 0.1, ]], 'li' => [['h' => 0.1, ],],]; $pdf->setHtmlVSpace($TMarginList); } @@ -1550,6 +1551,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); } + $libelleproduitservice = ''; // Default value if (!getDolGlobalString('PDF_HIDE_PRODUCT_LABEL_IN_SUPPLIER_LINES')) { // Description short of product line $libelleproduitservice = $label; diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index da3ea50b9f97f..a6a4012ac4630 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -41,7 +41,7 @@ * @param float $qty Quantity * @param float $pu Unit price (HT or TTC depending on price_base_type. TODO Add also mode 'INCT' when pu is price HT+VAT+LT1+LT2) * @param float $remise_percent_ligne Discount for line - * @param float $txtva 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we alreaydy have all tax info into $localtaxes_array) + * @param float $txtva 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we already have all tax info into $localtaxes_array) * @param float $uselocaltax1_rate 0=do not use localtax1, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1. * @param float $uselocaltax2_rate 0=do not use localtax2, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1. * @param float $remise_percent_global 0 diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 920a815f429e7..dd5d927662b84 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Gauthier VERDOL * Copyright (C) 2024 MDW @@ -1157,7 +1157,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t * Output a task line into a pertime input mode * * @param string $inc Line number (start to 0, then increased by recursive call) - * @param string $parent Id of parent task to show (0 to show all) + * @param int $parent Id of parent task to show (0 to show all) * @param User|null $fuser Restrict list to user if defined * @param Task[] $lines Array of lines * @param int $level Level (start to 0, then increased/decrease by recursive call) @@ -1378,7 +1378,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec * Output a task line into a pertime input mode * * @param string $inc Line number (start to 0, then increased by recursive call) - * @param string $parent Id of parent task to show (0 to show all) + * @param int $parent Id of parent task to show (0 to show all) * @param User|null $fuser Restrict list to user if defined * @param Task[] $lines Array of lines * @param int $level Level (start to 0, then increased/decrease by recursive call) @@ -1777,7 +1777,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr * @param string $inc Line output identificator (start to 0, then increased by recursive call) * @param int $firstdaytoshow First day to show * @param User|null $fuser Restrict list to user if defined - * @param string $parent Id of parent task to show (0 to show all) + * @param int $parent Id of parent task to show (0 to show all) * @param Task[] $lines Array of lines (list of tasks but we will show only if we have a specific role on task) * @param int $level Level (start to 0, then increased/decrease by recursive call) * @param string $projectsrole Array of roles user has on project @@ -2177,7 +2177,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ * @param string $inc Line output identificator (start to 0, then increased by recursive call) * @param int $firstdaytoshow First day to show * @param User|null $fuser Restrict list to user if defined - * @param string $parent Id of parent task to show (0 to show all) + * @param int $parent Id of parent task to show (0 to show all) * @param Task[] $lines Array of lines (list of tasks but we will show only if we have a specific role on task) * @param int $level Level (start to 0, then increased/decrease by recursive call) * @param string $projectsrole Array of roles user has on project @@ -2385,7 +2385,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & // Fields to show current time $tableCell = ''; $modeinput = 'hours'; - $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); + $TFirstDay = getFirstDayOfEachWeek($TWeek, (int) date('Y', $firstdaytoshow)); $TFirstDay[reset($TWeek)] = 1; $firstdaytoshowarray = dol_getdate($firstdaytoshow); @@ -2591,8 +2591,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (empty($project_year_filter) || !is_numeric($project_year_filter)) { $project_year_filter = date("Y"); } - $sql .= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")"; - $sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")"; + $sql .= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day((int) $project_year_filter, 12, false)).")"; + $sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day((int) $project_year_filter, 1, false)).")"; } } @@ -2716,6 +2716,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks //$thirdpartystatic->name_alias = $objp->name_alias; //$thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_compta = $objp->code_compta; + $thirdpartystatic->code_compta_client = $objp->code_compta; $thirdpartystatic->client = $objp->client; //$thirdpartystatic->code_fournisseur = $objp->code_fournisseur; $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 17b06e5cdb9b5..05c1b0e7aba0f 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -836,10 +836,10 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', * This function is also called by restrictedArea() that check before if module is enabled and if permission of user for $action is ok. * * @param User $user User to check - * @param array $featuresarray Features/modules to check. Example: ('user','service','member','project','task',...) + * @param string[] $featuresarray Features/modules to check. Example: ('user','service','member','project','task',...) * @param int|string|Object $object Full object or object ID or list of object id. For example if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional). - * @param array|string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. + * @param string[]|string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional). Can use '' if NA. * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional). * @param string $parenttableforentity Parent table for entity. Example 'fk_website@website' @@ -1170,7 +1170,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl * * @param string $message Force error message * @param int $http_response_code HTTP response code - * @param int $stringalreadysanitized 1 if string is already sanitized with HTML entities + * @param int<0,1> $stringalreadysanitized 1 if string is already sanitized with HTML entities * @return void * @see accessforbidden() */ @@ -1265,7 +1265,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho * Return the max allowed for file upload. * Analyze among: upload_max_filesize, post_max_size, MAIN_UPLOAD_DOC * - * @return array Array with all max size for file upload + * @return array{max:string,maxmin:mixed,maxphptoshow:int|string,maxphptoshowparam:''|'post_max_size'|'upload_max_filesize'} Array with all max sizes for file upload */ function getMaxFileSizeArray() { @@ -1274,36 +1274,36 @@ function getMaxFileSizeArray() $maxphp = @ini_get('upload_max_filesize'); // In unknown if (preg_match('/k$/i', $maxphp)) { $maxphp = preg_replace('/k$/i', '', $maxphp); - $maxphp = $maxphp * 1; + $maxphp = (int) ((float) $maxphp * 1); } if (preg_match('/m$/i', $maxphp)) { $maxphp = preg_replace('/m$/i', '', $maxphp); - $maxphp = $maxphp * 1024; + $maxphp = (int) ((float) $maxphp * 1024); } if (preg_match('/g$/i', $maxphp)) { $maxphp = preg_replace('/g$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024; + $maxphp = (int) ((float) $maxphp * 1024 * 1024); } if (preg_match('/t$/i', $maxphp)) { $maxphp = preg_replace('/t$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024 * 1024; + $maxphp = (int) ((float) $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 = (int) ((float) $maxphp2) * 1; } if (preg_match('/m$/i', $maxphp2)) { $maxphp2 = preg_replace('/m$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024; + $maxphp2 = (int) ((float) $maxphp2 * 1024); } if (preg_match('/g$/i', $maxphp2)) { $maxphp2 = preg_replace('/g$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024; + $maxphp2 = (int) ((float) $maxphp2 * 1024 * 1024); } if (preg_match('/t$/i', $maxphp2)) { $maxphp2 = preg_replace('/t$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; + $maxphp2 = (int) ((float) $maxphp2 * 1024 * 1024 * 1024); } // Now $max and $maxphp and $maxphp2 are in Kb $maxmin = $max; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 38f18edbce776..fbc0baf93cd08 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -196,21 +196,21 @@ function dol_loginfunction($langs, $conf, $mysoc) if (getDolGlobalString('MAIN_SESSION_TIMEOUT')) { if (session_status() != PHP_SESSION_ACTIVE) { if (PHP_VERSION_ID < 70300) { - session_set_cookie_params(0, '/', null, ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start. + session_set_cookie_params(0, '/', null, !(empty($dolibarr_main_force_https) && isHTTPS() === false), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start. } else { // Only available for php >= 7.3 $sessioncookieparams = array( 'lifetime' => 0, 'path' => '/', //'domain' => '.mywebsite.com', // the dot at the beginning allows compatibility with subdomains - 'secure' => ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), + 'secure' => !(empty($dolibarr_main_force_https) && isHTTPS() === false), 'httponly' => true, 'samesite' => 'Lax' // None || Lax || Strict ); session_set_cookie_params($sessioncookieparams); } - setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', (empty($dolibarr_main_force_https) ? false : true), true); + setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', !empty($dolibarr_main_force_https), true); } } diff --git a/htdocs/core/lib/socialnetwork.lib.php b/htdocs/core/lib/socialnetwork.lib.php new file mode 100644 index 0000000000000..368b356f962ef --- /dev/null +++ b/htdocs/core/lib/socialnetwork.lib.php @@ -0,0 +1,47 @@ + + * Copyright (C) 2019 Alexandre Spangaro + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2023 Frédéric France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see https://www.gnu.org/ + */ + +/** + * Function for return different onglet of socialnetworks admin page + * @return array Tabs for the admin section + */ +function socialnetwork_prepare_head() +{ + global $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/admin/dict.php?id=38&from=socialnetworksetup'; + $head[$h][1] = $langs->trans("Dictionary").' - '.$langs->trans("SocialNetworks"); + $head[$h][2] = 'dict'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/fediverse.php'; + $head[$h][1] = $langs->trans("Fediverse"); + $head[$h][2] = 'divers'; + $h++; + + complete_head_from_modules($conf, $langs, null, $head, $h, 'socialnetwork', 'add', 'external'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'socialnetwork', 'remove'); + return $head; +} diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index b867d6c7a03c5..40cb53438d40b 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -331,9 +331,9 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = 0) // at end we replace the '!~!~!~' only if we are in final parent page. $content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep); // Replace occurrence like _service_XXX.php with dolibarr URL - $content = preg_replace('/([\'"])_service_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_service_\2\1', $content, -1, $nbrep); + $content = preg_replace('/([\'"])_service_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_service_\2\1', $content, -1, $nbrep); // Replace occurrence like _library_XXX.php with dolibarr URL - $content = preg_replace('/([\'"])_library_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_library_\2\1', $content, -1, $nbrep); + $content = preg_replace('/([\'"])_library_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_library_\2\1', $content, -1, $nbrep); // Replace relative link without .php like /xxx#aaa or /xxx with dolibarr URL: ...href="....php" $content = preg_replace('/(href=")\/?([a-zA-Z0-9\-_#]+)(\"|\?)/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep); @@ -570,7 +570,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri } } else { // When page called from virtual host server $newurl = '/'.$containerref.'.php'; - $newurl = $newurl.(empty($_SERVER["QUERY_STRING"]) ? '' : '?'.$_SERVER["QUERY_STRING"]); + $newurl .= (empty($_SERVER["QUERY_STRING"]) ? '' : '?'.$_SERVER["QUERY_STRING"]); } if ($newurl) { @@ -1188,15 +1188,15 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so $arrayresult['message'] = $weblangs->trans("ErrorSearchCriteriaTooSmall"); } else { */ - $tmparrayoftype = explode(',', $type); - /*foreach ($tmparrayoftype as $tmptype) { - if (!in_array($tmptype, array('', 'page', 'blogpost'))) { - $error++; - $arrayresult['code'] = 'KO'; - $arrayresult['message'] = 'Bad value for parameter type'; - break; - } - }*/ + $tmparrayoftype = explode(',', $type); + /*foreach ($tmparrayoftype as $tmptype) { + if (!in_array($tmptype, array('', 'page', 'blogpost'))) { + $error++; + $arrayresult['code'] = 'KO'; + $arrayresult['message'] = 'Bad value for parameter type'; + break; + } + }*/ //} $searchdone = 0; diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index f2f39b2eddf4b..2efffff73af25 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -72,7 +72,7 @@ function check_authentication($authentication, &$error, &$errorcode, &$errorlabe // Validation of login if (!$error) { - $fuser->getrights(); // Load permission of user + $fuser->loadRights(); // Load permission of user // Authentication mode if (empty($dolibarr_main_authentication)) { diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index ed042b0a21891..322fb3fea9181 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -77,7 +77,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) $ldapdn = $dolibarr_main_auth_ldap_dn; $ldapadminlogin = $dolibarr_main_auth_ldap_admin_login; $ldapadminpass = $dolibarr_main_auth_ldap_admin_pass; - $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false") ? false : true); + $ldapdebug = !(empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false"); if ($ldapdebug) { print "DEBUG: Logging LDAP steps
    \n"; diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index a3fda66b87ab3..3f0aad13e4399 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -29,13 +29,13 @@ /** * Core function to output top menu auguria * - * @param DoliDB $db Database handler - * @param string $atarget Target (Example: '' or '_top') - * @param int $type_user 0=Menu for backoffice, 1=Menu for front office + * @param DoliDB $db Database handler + * @param string $atarget Target (Example: '' or '_top') + * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @param Menu $menu Object Menu to return back list of menu entries - * @param int $noout 1=Disable output (Initialise &$menu only). - * @param string $mode 'top', 'topnb', 'left', 'jmobile' + * @param Menu $menu Object Menu to return back list of menu entries + * @param int<0,1> $noout 1=Disable output (Initialise &$menu only). + * @param string $mode 'top', 'topnb', 'left', 'jmobile' * @return int 0 */ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 0, $mode = '') @@ -220,14 +220,14 @@ function print_start_menu_entry_auguria($idsel, $classname, $showmode) /** * Output menu entry * - * @param string $text Text - * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed - * @param string $url Url - * @param string $id Id - * @param string $idsel Id sel - * @param string $classname Class name - * @param string $atarget Target - * @param array $menuval All the $menuval array + * @param string $text Text + * @param int<0,2> $showmode 0 = hide, 1 = allowed or 2 = not allowed + * @param string $url Url + * @param string $id Id + * @param string $idsel Id sel + * @param string $classname Class name + * @param string $atarget Target + * @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}|array{} $menuval The full $menuval array * @return void */ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array()) @@ -314,11 +314,11 @@ function print_end_menu_array_auguria() * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries - * @param int $noout Disable output (Initialise &$menu only). + * @param int<0,1> $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. - * @param array $moredata An array with more data to output - * @param int $type_user 0=Menu for backoffice, 1=Menu for front office + * @param ?array $moredata An array with more data to output + * @param int<0,1> $type_user 0=Menu for backoffice, 1=Menu for front office * @return int Nb of menu entries */ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) @@ -500,10 +500,10 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t $reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks if (is_numeric($reshook)) { - if ($reshook == 0 && !empty($hookmanager->results)) { - $menu_array[] = $hookmanager->results; // add + if ($reshook == 0 && !empty($hookmanager->resArray)) { + $menu_array[] = $hookmanager->resArray; // add } elseif ($reshook == 1) { - $menu_array = $hookmanager->results; // replace + $menu_array = $hookmanager->resArray; // replace } // @todo Sort menu items by 'position' value @@ -578,7 +578,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad $url = dol_buildpath($url, 1).($param ? '?'.$param : ''); $shorturlwithoutparam = $shorturl; - $shorturl = $shorturl.($param ? '?'.$param : ''); + $shorturl .= ($param ? '?'.$param : ''); } @@ -689,9 +689,9 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t * Function to test if an entry is enabled or not * * @param string $type_user 0=We need backoffice menu, 1=We need frontoffice menu - * @param array $menuentry Array for menu entry - * @param array $listofmodulesforexternal Array with list of modules allowed to external users - * @return int 0=Hide, 1=Show, 2=Show gray + * @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string} $menuentry Array for menu entry + * @param string[] $listofmodulesforexternal Array with list of modules allowed to external users + * @return int<0,2> 0=Hide, 1=Show, 2=Show gray */ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexternal) { @@ -703,7 +703,7 @@ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexterna return 0; // Entry disabled by condition } if ($type_user && $menuentry['module']) { - $tmploops = explode('|', $menuentry['module']); + $tmploops = explode('|', (string) $menuentry['module']); $found = 0; foreach ($tmploops as $tmploop) { if (in_array($tmploop, $listofmodulesforexternal)) { diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index fcb5e02c77519..5416dfad1f0f0 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -27,6 +27,8 @@ /** * Class to manage menu Auguria + * + * @phan-suppress PhanRedefineClass */ class MenuManager { @@ -36,12 +38,12 @@ class MenuManager public $db; /** - * @var int Put 0 for internal users, 1 for external users + * @var int<0,1> 0 for internal users, 1 for external users */ public $type_user; /** - * @var string To store default target to use onto links + * @var string Default target to use for links */ public $atarget = ""; @@ -55,9 +57,18 @@ class MenuManager */ public $menu; + /** + * @var array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> + */ public $menu_array; + /** + * @var array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> + */ public $menu_array_after; + /** + * @var array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> + */ public $tabMenu; @@ -65,7 +76,7 @@ class MenuManager * Constructor * * @param DoliDB $db Database handler - * @param int $type_user Type of user + * @param int<0,1> $type_user Type of user */ public function __construct($db, $type_user) { @@ -100,7 +111,7 @@ public function loadMenu($forcemainmenu = '', $forceleftmenu = '') $_SESSION["mainmenu"] = $mainmenu; $_SESSION["leftmenuopened"] = ""; } else { - // On va le chercher en session si non defini par le lien + // Look for the menu in the session if not set by the link $mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : ''; } if (!empty($forcemainmenu)) { @@ -119,7 +130,7 @@ public function loadMenu($forcemainmenu = '', $forceleftmenu = '') $_SESSION["leftmenuopened"] = $leftmenu; } } else { - // On va le chercher en session si non defini par le lien + // Look for the menu in the session if not set by the link $leftmenu = isset($_SESSION["leftmenu"]) ? $_SESSION["leftmenu"] : ''; } if (!empty($forceleftmenu)) { @@ -141,9 +152,9 @@ public function loadMenu($forcemainmenu = '', $forceleftmenu = '') * Show menu. * Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called. * - * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) - * @param array $moredata An array with more data to output - * @return int 0 or nb of top menu entries if $mode = 'topnb' + * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) + * @param ?array $moredata An array with more data to output + * @return int<0,max> 0 or nb of top menu entries if $mode = 'topnb' */ public function showmenu($mode, $moredata = null) { diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 46ccae9ed9e9b..2987a34f58916 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -726,11 +726,11 @@ function print_end_menu_array() * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) * @param array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries - * @param int $noout Disable output (Initialise &$menu only). + * @param int<0,1> $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. - * @param array $moredata An array with more data to output - * @param int $type_user 0=Menu for backoffice, 1=Menu for front office + * @param ?array $moredata An array with more data to output + * @param int<0,1> $type_user 0=Menu for backoffice, 1=Menu for front office * @return int Nb of menu entries */ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) @@ -744,7 +744,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"] ?? ''); $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"] ?? '')); - if (is_null($mainmenu)) { + if (empty($mainmenu)) { $mainmenu = 'home'; } @@ -997,7 +997,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad $url = dol_buildpath($url, 1).($param ? '?'.$param : ''); $shorturlwithoutparam = $shorturl; - $shorturl = $shorturl.($param ? '?'.$param : ''); + $shorturl .= ($param ? '?'.$param : ''); } @@ -1535,7 +1535,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen if (isModEnabled('supplier_invoice')) { if (getDolGlobalString('SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE')) { $langs->load("supplier"); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&search_billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&search_billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->hasRight('commande', 'lire')); } } @@ -1777,6 +1777,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($nature) { $langs->load('accountancy'); $journallabel = ''; + $journallabelwithoutspan = ''; if ($objp->label) { $journallabelwithoutspan = $langs->trans($objp->label); $journallabel = '('.$langs->trans($objp->label).')'; // Label of bank account in llx_accounting_journal diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 40cb9f0d427fb..220be3817f78d 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -26,6 +26,8 @@ /** * Class to manage menu Eldy + * + * @phan-suppress PhanRedefineClass */ class MenuManager { @@ -54,9 +56,18 @@ class MenuManager */ public $menu; + /** + * @var array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> + */ public $menu_array; + /** + * @var array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> + */ public $menu_array_after; + /** + * @var array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> + */ public $tabMenu; @@ -64,7 +75,7 @@ class MenuManager * Constructor * * @param DoliDB $db Database handler - * @param int $type_user Type of user + * @param int<0,1> $type_user Type of user */ public function __construct($db, $type_user) { @@ -99,7 +110,7 @@ public function loadMenu($forcemainmenu = '', $forceleftmenu = '') $_SESSION["mainmenu"] = $mainmenu; $_SESSION["leftmenuopened"] = ""; } else { - // On va le chercher en session si non defini par le lien + // Look for the menu in the session if not set by the link $mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : ''; } if (!empty($forcemainmenu)) { @@ -118,7 +129,7 @@ public function loadMenu($forcemainmenu = '', $forceleftmenu = '') $_SESSION["leftmenuopened"] = $leftmenu; } } else { - // On va le chercher en session si non defini par le lien + // Look for the menu in the session if not set by the link $leftmenu = isset($_SESSION["leftmenu"]) ? $_SESSION["leftmenu"] : ''; } if (!empty($forceleftmenu)) { @@ -137,9 +148,9 @@ public function loadMenu($forcemainmenu = '', $forceleftmenu = '') * Show menu. * Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called. * - * @param string $mode 'top', 'topnb', 'left', 'leftdropdown', 'jmobile' (used to get full xml ul/li menu) - * @param array $moredata An array with more data to output - * @return int 0 or nb of top menu entries if $mode = 'topnb' + * @param string $mode 'top', 'topnb', 'left', 'leftdropdown', 'jmobile' (used to get full xml ul/li menu) + * @param ?array $moredata An array with more data to output + * @return int 0 or nb of top menu entries if $mode = 'topnb' */ public function showmenu($mode, $moredata = null) { @@ -274,7 +285,7 @@ public function showmenu($mode, $moredata = null) */ $lastlevel2 = array(); - foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu','prefix'] $showmenu = true; if (getDolGlobalString('MAIN_MENU_HIDE_UNAUTHORIZED') && empty($val2['enabled'])) { $showmenu = false; diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 1a5fea91f01bc..f00a785d93c12 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -23,6 +23,8 @@ /** * Class to manage empty menu + * + * @phan-suppress PhanRedefineClass */ class MenuManager { @@ -31,26 +33,47 @@ class MenuManager */ public $db; - public $type_user = 0; // Put 0 for internal users, 1 for external users - public $atarget = ""; // To store default target to use onto links + /** + * @var int<0,1> 0 for internal users, 1 for external users + */ + public $type_user = 0; + /** + * @var string Default target to use in links + */ + public $atarget = ""; + /** + * @var string + */ public $name = "empty"; /** * @var Menu */ public $menu; + /** + * @var array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> + */ public $menu_array_after; + /** + * @var array,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> + */ public $tabMenu; + /** + * @var Menu + */ public $topmenu; + /** + * @var Menu + */ public $leftmenu; /** * Constructor * * @param DoliDB $db Database handler - * @param int $type_user Type of user + * @param int<0,1> $type_user Type of user */ public function __construct($db, $type_user) { @@ -76,9 +99,9 @@ public function loadMenu($forcemainmenu = '', $forceleftmenu = '') /** * Show menu * - * @param string $mode 'top', 'left', 'jmobile' - * @param array $moredata An array with more data to output - * @return int|string 0 or nb of top menu entries if $mode = 'topnb', string inc ase of bad parameter + * @param string $mode 'top', 'left', 'jmobile' + * @param ?array $moredata An array with more data to output + * @return int<0,max>|string 0 or nb of top menu entries if $mode = 'topnb', string inc ase of bad parameter */ public function showmenu($mode, $moredata = null) { @@ -508,7 +531,7 @@ function print_start_menu_entry_empty($idsel, $classname, $showmode) * @param string $idsel Id sel * @param string $classname Class name * @param string $atarget Target - * @param array $menuval All the $menuval array + * @param array{}|array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string} $menuval All the $menuval array * @return void */ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array()) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 88232c594f0c6..9b4c003ad5855 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -192,10 +192,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it public $errors; /** - * @var string Module version + * @var string Module version ('x.y.z' or a reserved keyword) * @see http://semver.org * - * The following keywords can also be used: + * The following keywords that can also be used are: * 'development' * 'experimental' * 'dolibarr': only for core modules that share its version @@ -898,7 +898,7 @@ public function getVersion($translated = 1) */ public function getModulePosition() { - if (in_array($this->version, array('dolibarr', 'experimental', 'development'))) { // core module + if (in_array($this->version, array('dolibarr', 'dolibarr_deprecated', 'experimental', 'development'))) { // core module return $this->module_position; } else { // external module if ($this->module_position >= 100000) { @@ -912,8 +912,7 @@ public function getModulePosition() /** * Tells if module is core or external. - * 'dolibarr' and 'dolibarr_deprecated' is core - * 'experimental' and 'development' is core + * Version = 'dolibarr', 'dolibarr_deprecated', 'experimental' and 'development' means core modules * * @return string 'core', 'external' or 'unknown' */ @@ -1507,124 +1506,104 @@ public function delete_boxes() */ public function insert_cronjobs() { - // phpcs:enable - include_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; + // phpcs:enable + include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; + include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php'; - global $conf; + global $conf, $user; $err = 0; if (is_array($this->cronjobs)) { - dol_syslog(get_class($this)."::insert_cronjobs", LOG_DEBUG); + dol_syslog(get_class($this) . "::insert_cronjobs", LOG_DEBUG); foreach ($this->cronjobs as $key => $value) { - $entity = isset($this->cronjobs[$key]['entity']) ? $this->cronjobs[$key]['entity'] : $conf->entity; - $label = isset($this->cronjobs[$key]['label']) ? $this->cronjobs[$key]['label'] : ''; - $jobtype = isset($this->cronjobs[$key]['jobtype']) ? $this->cronjobs[$key]['jobtype'] : ''; - $class = isset($this->cronjobs[$key]['class']) ? $this->cronjobs[$key]['class'] : ''; - $objectname = isset($this->cronjobs[$key]['objectname']) ? $this->cronjobs[$key]['objectname'] : ''; - $method = isset($this->cronjobs[$key]['method']) ? $this->cronjobs[$key]['method'] : ''; - $command = isset($this->cronjobs[$key]['command']) ? $this->cronjobs[$key]['command'] : ''; - $parameters = isset($this->cronjobs[$key]['parameters']) ? $this->cronjobs[$key]['parameters'] : ''; - $comment = isset($this->cronjobs[$key]['comment']) ? $this->cronjobs[$key]['comment'] : ''; - $frequency = isset($this->cronjobs[$key]['frequency']) ? $this->cronjobs[$key]['frequency'] : ''; - $unitfrequency = isset($this->cronjobs[$key]['unitfrequency']) ? $this->cronjobs[$key]['unitfrequency'] : ''; - $priority = isset($this->cronjobs[$key]['priority']) ? $this->cronjobs[$key]['priority'] : ''; - $datestart = isset($this->cronjobs[$key]['datestart']) ? $this->cronjobs[$key]['datestart'] : ''; - $dateend = isset($this->cronjobs[$key]['dateend']) ? $this->cronjobs[$key]['dateend'] : ''; - $status = isset($this->cronjobs[$key]['status']) ? $this->cronjobs[$key]['status'] : ''; - $test = isset($this->cronjobs[$key]['test']) ? $this->cronjobs[$key]['test'] : ''; // Line must be enabled or not (so visible or not) + $now = dol_now(); + + $entity = isset($value['entity']) ? $value['entity'] : $conf->entity; + $label = isset($value['label']) ? $value['label'] : ''; + $jobtype = isset($value['jobtype']) ? $value['jobtype'] : ''; + $classesname = isset($value['class']) ? $value['class'] : ''; + $objectname = isset($value['objectname']) ? $value['objectname'] : ''; + $methodename = isset($value['method']) ? $value['method'] : ''; + $command = isset($value['command']) ? $value['command'] : ''; + $params = isset($value['parameters']) ? $value['parameters'] : ''; + $md5params = isset($value['md5params']) ? $value['md5params'] : ''; + $comment = isset($value['comment']) ? $value['comment'] : ''; + $frequency = isset($value['frequency']) ? $value['frequency'] : ''; + $unitfrequency = isset($value['unitfrequency']) ? $value['unitfrequency'] : ''; + $priority = isset($value['priority']) ? $value['priority'] : ''; + $datestart = isset($value['datestart']) ? $value['datestart'] : ''; + $dateend = isset($value['dateend']) ? $value['dateend'] : ''; + $datenextrun = isset($value['datenextrun']) ? $value['datenextrun'] : $now; + $status = isset($value['status']) ? $value['status'] : ''; + $maxrun = isset($value['maxrun']) ? $value['maxrun'] : 0; + $libname = isset($value['libname']) ? $value['libname'] : ''; + $test = isset($value['test']) ? $value['test'] : ''; // Line must be enabled or not (so visible or not) // Search if cron entry already present - $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob"; - //$sql .= " WHERE module_name = '".$this->db->escape(empty($this->rights_class) ?strtolower($this->name) : $this->rights_class)."'"; + $sql = "SELECT count(*) as nb FROM " . MAIN_DB_PREFIX . "cronjob"; + //$sql .= " WHERE module_name = '" . $this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class) . "'"; $sql .= " WHERE label = '".$this->db->escape($label)."'"; - /*if ($class) { - $sql .= " AND classesname = '".$this->db->escape($class)."'"; + if ($classesname) { + $sql .= " AND classesname = '" . $this->db->escape($classesname) . "'"; } if ($objectname) { - $sql .= " AND objectname = '".$this->db->escape($objectname)."'"; + $sql .= " AND objectname = '" . $this->db->escape($objectname) . "'"; } - if ($method) { - $sql .= " AND methodename = '".$this->db->escape($method)."'"; + if ($methodename) { + $sql .= " AND methodename = '" . $this->db->escape($methodename) . "'"; } if ($command) { - $sql .= " AND command = '".$this->db->escape($command)."'"; + $sql .= " AND command = '" . $this->db->escape($command) . "'"; } - if ($parameters) { - $sql .= " AND params = '".$this->db->escape($parameters)."'"; - }*/ - $sql .= " AND entity = ".((int) $entity); // Must be exact entity - - $now = dol_now(); + if ($params) { + $sql .= " AND params = '" . $this->db->escape($params) . "'"; + } + $sql .= " AND entity = " . ((int) $entity); // Must be exact entity $result = $this->db->query($sql); - if ($result) { - $obj = $this->db->fetch_object($result); - if ($obj->nb == 0) { - $this->db->begin(); - - if (!$err) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, datestart, dateend, label, jobtype, classesname, objectname, methodename, command, params, note,"; - if (is_int($frequency)) { - $sql .= ' frequency,'; - } - if (is_int($unitfrequency)) { - $sql .= ' unitfrequency,'; - } - if (is_int($priority)) { - $sql .= ' priority,'; - } - if (is_int($status)) { - $sql .= ' status,'; - } - $sql .= " entity, test)"; - $sql .= " VALUES ("; - $sql .= "'".$this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class)."', "; - $sql .= "'".$this->db->idate($now)."', "; - $sql .= ($datestart ? "'".$this->db->idate($datestart)."'" : "'".$this->db->idate($now)."'").", "; - $sql .= ($dateend ? "'".$this->db->idate($dateend)."'" : "NULL").", "; - $sql .= "'".$this->db->escape($label)."', "; - $sql .= "'".$this->db->escape($jobtype)."', "; - $sql .= ($class ? "'".$this->db->escape($class)."'" : "null").","; - $sql .= ($objectname ? "'".$this->db->escape($objectname)."'" : "null").","; - $sql .= ($method ? "'".$this->db->escape($method)."'" : "null").","; - $sql .= ($command ? "'".$this->db->escape($command)."'" : "null").","; - $sql .= ($parameters ? "'".$this->db->escape($parameters)."'" : "null").","; - $sql .= ($comment ? "'".$this->db->escape($comment)."'" : "null").","; - if (is_int($frequency)) { - $sql .= "'".$this->db->escape($frequency)."', "; - } - if (is_int($unitfrequency)) { - $sql .= "'".$this->db->escape($unitfrequency)."', "; - } - if (is_int($priority)) { - $sql .= "'".$this->db->escape($priority)."', "; - } - if (is_int($status)) { - $sql .= ((int) $status).", "; - } - $sql .= $entity.","; - $sql .= "'".$this->db->escape($test)."'"; - $sql .= ")"; - - $resql = $this->db->query($sql); - if (!$resql) { - $err++; - } - } - - if (!$err) { - $this->db->commit(); - } else { - $this->error = $this->db->lasterror(); - $this->db->rollback(); - } - } - // else box already registered into database - } else { + if (!$result) { $this->error = $this->db->lasterror(); $err++; + break; + // else box already registered into database + } + + $obj = $this->db->fetch_object($result); + if ($obj->nb > 0) { + continue; + } + + $cronjob = new Cronjob($this->db); + + $cronjob->entity = $entity; + $cronjob->label = $label; + $cronjob->jobtype = $jobtype; + $cronjob->classesname = $classesname; + $cronjob->objectname = $objectname; + $cronjob->methodename = $methodename; + $cronjob->command = $command; + $cronjob->params = $params; + $cronjob->md5params = $md5params; + $cronjob->comment = $comment; + $cronjob->frequency = $frequency; + $cronjob->unitfrequency = $unitfrequency; + $cronjob->priority = $priority; + $cronjob->datestart = $datestart; + $cronjob->dateend = $dateend; + $cronjob->datenextrun = $datenextrun; + $cronjob->maxrun = $maxrun; + $cronjob->status = $status; + $cronjob->test = $test; + $cronjob->libname = $libname; + $cronjob->module_name = empty($this->rights_class) ? strtolower($this->name) : $this->rights_class; + + $retCreate = $cronjob->create($user); + + if ($retCreate < 0) { + $this->error = implode("\n", array_merge([$cronjob->error], $cronjob->errors)); + return -1; } } } @@ -1632,8 +1611,7 @@ public function insert_cronjobs() return $err; } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Removes boxes * @@ -2019,7 +1997,7 @@ public function insert_permissions($reinitadminperms = 0, $force_entity = null, if (!empty($reinitadminperms) && !empty($user->admin)) { // Reload permission for current user if defined // We reload permissions $user->clearrights(); - $user->getrights(); + $user->loadRights(); } } $this->db->free($resql); diff --git a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php index 1d2c32ca617f6..8bc4377426319 100644 --- a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php +++ b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php @@ -119,13 +119,13 @@ public function __construct($db, $month, $year) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Write the object to document file to disk + * Write the object to document file to disk * - * @param int $socid Thirdparty id - * @param Translate $outputlangs Lang object for output language - * @return int 1=OK, 0=KO + * @param ?CommonObject $object Order/... + * @param Translate $outputlangs Lang object for output language + * @return int<0,1> 1=OK, 0=KO */ - public function write_file($socid, $outputlangs) + public function write_file($object, $outputlangs) { // phpcs:enable global $user, $conf, $langs, $hookmanager; @@ -194,7 +194,7 @@ public function write_file($socid, $outputlangs) $nbpage = $this->_pages($pdf, $outputlangs); // Write content if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php index a04f323bcb306..a37790cbd9e81 100644 --- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php +++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2021 Philippe Grand * 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 @@ -41,7 +42,7 @@ class doc_generic_asset_odt extends ModelePDFAsset { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -52,7 +53,7 @@ class doc_generic_asset_odt extends ModelePDFAsset */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; // Load translation files required by the page $langs->loadLangs(array("main", "companies")); @@ -187,15 +188,15 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param Asset $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param Asset $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -316,7 +317,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -372,7 +373,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -408,7 +409,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -440,7 +441,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -462,14 +463,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index ba8d529df2264..86aed0d699610 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -71,7 +71,7 @@ class pdf_standard_asset extends ModelePDFAsset /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -81,7 +81,7 @@ class pdf_standard_asset extends ModelePDFAsset public $situationinvoice; /** - * @var array Array of document table columns + * @var array Array of document table columns */ public $cols; @@ -141,13 +141,13 @@ public function __construct($db) /** * Function to build pdf onto disk * - * @param Asset $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param Asset $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -415,7 +415,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $posyafter + 6; } else { $height_note = 0; @@ -672,7 +672,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -1109,7 +1109,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = $rank + 10; + $rank += 10; $this->cols['vat'] = array( 'rank' => $rank, 'status' => false, @@ -1124,7 +1124,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['vat']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -1135,7 +1135,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['qty'] = array( 'rank' => $rank, 'width' => 16, // in mm @@ -1146,7 +1146,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['progress'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -1161,7 +1161,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['progress']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['unit'] = array( 'rank' => $rank, 'width' => 11, // in mm @@ -1175,7 +1175,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['unit']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['discount'] = array( 'rank' => $rank, 'width' => 13, // in mm @@ -1189,7 +1189,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['discount']['status'] = true; } - $rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm diff --git a/htdocs/core/modules/asset/mod_asset_advanced.php b/htdocs/core/modules/asset/mod_asset_advanced.php index 5495d8b886f4d..129e5c55ea6f7 100644 --- a/htdocs/core/modules/asset/mod_asset_advanced.php +++ b/htdocs/core/modules/asset/mod_asset_advanced.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,7 @@ class mod_asset_advanced extends ModeleNumRefAsset { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -116,7 +117,7 @@ public function getExample() * Return next free value * * @param Asset $object Object we need next value for - * @return string|int Next value if OK, 0 if KO + * @return string|int<-1,0> Next value if OK, <=0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/asset/mod_asset_standard.php b/htdocs/core/modules/asset/mod_asset_standard.php index d09748f158c2b..90ea78e702769 100644 --- a/htdocs/core/modules/asset/mod_asset_standard.php +++ b/htdocs/core/modules/asset/mod_asset_standard.php @@ -35,7 +35,7 @@ class mod_asset_standard extends ModeleNumRefAsset { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -117,11 +117,12 @@ public function canBeActivated($object) return true; } + /** * Return next free value * - * @param Asset $object Object we need next value for - * @return string|-1 Next value if OK, -1 if KO + * @param Asset $object Object we need next value for + * @return string|int<-1,0> Next value if OK, <=0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/asset/modules_asset.php b/htdocs/core/modules/asset/modules_asset.php index 87ac7c723dd95..324ad6a32b1ea 100644 --- a/htdocs/core/modules/asset/modules_asset.php +++ b/htdocs/core/modules/asset/modules_asset.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2012 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 @@ -42,9 +43,9 @@ abstract class ModelePDFAsset extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -57,6 +58,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param Asset $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } @@ -66,5 +82,11 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefAsset extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Asset $object Object we need next value for + * @return string|int<-1,0> Next value if OK, <=0 if KO + */ + abstract public function getNextValue($object); } diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index daacb9aba6868..e39607bf5fa58 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -38,7 +38,7 @@ class pdf_ban extends ModeleBankAccountDoc { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'development'; @@ -208,7 +208,7 @@ public function write_file($object, $outputlangs) $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -237,7 +237,7 @@ public function write_file($object, $outputlangs) */ $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index d094af7457319..cd1a9de66e875 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -39,7 +39,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -116,14 +116,14 @@ public function __construct($db) /** * Function to create pdf of company bank account sepa mandate * - * @param Account $object CompanyBankAccount bank account to generate document for - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details (not used for this template) - * @param int $hidedesc Do not show desc (not used for this template) - * @param int $hideref Do not show ref (not used for this template) - * @param null|array $moreparams More parameters - * @return int 1 if OK, <=0 if KO + * @param Account $object CompanyBankAccount bank account to generate document for + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @param ?array $moreparams More parameters + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { @@ -239,7 +239,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -437,7 +437,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede */ $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/bank/modules_bank.php b/htdocs/core/modules/bank/modules_bank.php index 5367ae52e8cb3..66c4c97ad7fad 100644 --- a/htdocs/core/modules/bank/modules_bank.php +++ b/htdocs/core/modules/bank/modules_bank.php @@ -36,9 +36,9 @@ abstract class ModeleBankAccountDoc extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -52,13 +52,14 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Write the document to disk * * @param Account $object Object Account to generate * @param Translate $outputlangs Lang output object - * @return int 1 if OK, <=0 if KO + * @return int<-1,1> 1 if OK, <=0 if KO */ abstract public function write_file($object, $outputlangs); // phpcs:enable diff --git a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php index 3ef61f9e1e36d..b066f2a460c39 100644 --- a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2005 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 @@ -34,9 +35,9 @@ class modPhpbarcode extends ModeleBarCode { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z''development'|'experimental'|'dolibarr' */ - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + public $version = 'dolibarr'; /** * @var string Error code (or message) diff --git a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php index c114ab8d6945a..e93e8dfee231d 100644 --- a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php @@ -34,9 +34,9 @@ class modTcpdfbarcode extends ModeleBarCode { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z''development'|'experimental'|'dolibarr' */ - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + public $version = 'dolibarr'; /** * @var string Error code (or message) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 92bb510c10783..944e244fd17fd 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -39,7 +39,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -109,12 +109,16 @@ public function info($langs) /** * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs - * @param ?Product $objproduct Object product - * @return string Return string example + * @param ?Translate $langs Object langs + * @param ?CommonObject $objproduct Object + * @return string Return string example */ - public function getExample($langs, $objproduct = null) + public function getExample($langs = null, $objproduct = null) { + if (!$langs instanceof Translate) { + $langs = $GLOBALS['langs']; + '@phan-var-force Translate $langs'; + } $examplebarcode = $this->getNextValue($objproduct, ''); if (!$examplebarcode) { $examplebarcode = $langs->trans('NotConfigured'); @@ -224,18 +228,22 @@ public function getNextValue($objproduct = null, $type = '') * * @param DoliDB $db Database handler * @param string $code Code to check/correct - * @param Product $product Object product - * @param int $thirdparty_type 0 = customer/prospect , 1 = supplier + * @param Product|Societe $product Object product + * @param int<0,1> $thirdparty_type 0 = customer/prospect , 1 = supplier * @param string $type type of barcode (EAN, ISBN, ...) - * @return int 0 if OK + * @return int<-7,0> 0 if OK * -1 ErrorBadCustomerCodeSyntax * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired + * -7 ErrorBadClass */ public function verif($db, &$code, $product, $thirdparty_type, $type) { - global $conf; + if (!$product instanceof Product) { + dol_syslog(get_class($this)."::verif called with ".get_class($product)." Expected Product", LOG_ERR); + return -7; + } //var_dump($code.' '.$product->ref.' '.$thirdparty_type);exit; diff --git a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php index bcaeeea69a574..9cb371267b639 100644 --- a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php @@ -38,25 +38,48 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode { public $name = 'Standard'; // Model Name - public $code_modifiable; // Editable code + /** + * @var int<0,1> Editable code + */ + public $code_modifiable; - public $code_modifiable_invalide; // Modified code if it is invalid + /** + * @var int<0,1> Modified code if it is invalid + */ + public $code_modifiable_invalide; - public $code_modifiable_null; // Modified code if it is null + /** + * @var int<0,1> Modified code if it is null + */ + public $code_modifiable_null; - public $code_null; // Optional code + /** + * @var int<0,1> Optional code + */ + public $code_null; /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' - public $searchcode; // Search string + /** + * @var string Search string + */ + public $searchcode; - public $numbitcounter; // Number of digits the counter + /** + * Number of digits for the counter (not bits, but digits) + * + * @var int<0,max> + */ + public $numbitcounter; - public $prefixIsRequired; // The prefix field of third party must be filled when using {pre} + /** + * @var int<0,1> If the prefix field of third party must be filled when using {pre} + */ + public $prefixIsRequired; /** @@ -122,12 +145,16 @@ public function info($langs) /** * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs - * @param ?Societe $objthirdparty Object third-party - * @return string Return string example + * @param ?Translate $langs Object langs + * @param ?CommonObject $objthirdparty Object third-party / Societe + * @return string Return string example */ - public function getExample($langs, $objthirdparty = null) + public function getExample($langs = null, $objthirdparty = null) { + if (!$langs instanceof Translate) { + $langs = $GLOBALS['langs']; + '@phan-var-force Translate $langs'; + } $examplebarcode = $this->getNextValue($objthirdparty, ''); if (!$examplebarcode) { $examplebarcode = $langs->trans('NotConfigured'); @@ -231,17 +258,22 @@ public function getNextValue($objthirdparty = null, $type = '') * * @param DoliDB $db Database handler * @param string $code Code to check/correct - * @param Societe $thirdparty Object third-party - * @param int $thirdparty_type 0 = customer/prospect , 1 = supplier + * @param Societe|Product $thirdparty Object third party + * @param int<0,1> $thirdparty_type 0 = customer/prospect , 1 = supplier * @param string $type type of barcode (EAN, ISBN, ...) - * @return int 0 if OK + * @return int<-7,0> 0 if OK * -1 ErrorBadCustomerCodeSyntax * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired + * -7 ErrorBadClass */ public function verif($db, &$code, $thirdparty, $thirdparty_type, $type) { + if (!$thirdparty instanceof Societe) { + dol_syslog(get_class($this)."::verif called with ".get_class($thirdparty)." Expected Societe", LOG_ERR); + return -7; + } require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $result = 0; diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index c531c97aeed0d..9512e3e20365f 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -29,6 +29,8 @@ /** * Parent class for barcode document generators (image) + * + * @property 'development'|'experimental'|'dolibarr' $version Dolibarr version of loaded document */ abstract class ModeleBarCode { @@ -48,6 +50,16 @@ public function isEnabled() return true; } + + /** + * Return description + * + * @param Translate $langs Lang object to use for output + * @return string Descriptive text + */ + abstract public function info($langs); + + /** * Save an image file on disk (with no output) * @@ -67,6 +79,8 @@ public function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $noo /** * Parent class for barcode numbering models + * + * @property string $nom Name for the GeneratorModel */ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator { @@ -87,11 +101,22 @@ public function getNextValue($objcommon = null, $type = '') return $langs->trans("Function_getNextValue_InModuleNotWorking"); } + + /** + * Return an example of result returned by getNextValue + * + * @param ?Translate $langs Object langs + * @param ?CommonObject $object Object product + * @return string Return string example + */ + abstract public function getExample($langs = null, $object = null); + + /** * Return description of module parameters * * @param Translate $langs Output language - * @param Societe $soc Third party object + * @param ?Societe $soc Third party object * @param int $type -1=Nothing, 0=Product, 1=Service * @return string HTML translated description */ @@ -156,4 +181,22 @@ public function getToolTip($langs, $soc, $type) return $s; } + + + /** + * Check validity of code according to its rules + * + * @param DoliDB $db Database handler + * @param string $code Code to check/correct + * @param Product|Societe $object Object product or ThirdParty + * @param int<0,1> $thirdparty_type 0 = customer/prospect , 1 = supplier + * @param string $type type of barcode (EAN, ISBN, ...) + * @return int<-7,0> 0 if OK + * -1 ErrorBadCustomerCodeSyntax + * -2 ErrorCustomerCodeRequired + * -3 ErrorCustomerCodeAlreadyUsed + * -4 ErrorPrefixRequired + * -7 ErrorBadClass + */ + abstract public function verif($db, &$code, $object, $thirdparty_type, $type); } diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 89347b5b0c1b5..3f22a2b274cbd 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2019 Philippe Grand * 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 @@ -41,7 +42,7 @@ class doc_generic_bom_odt extends ModelePDFBom { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -193,12 +194,12 @@ public function info($langs) * @param BOM $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -317,7 +318,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -373,7 +374,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -418,7 +419,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -450,7 +451,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -472,14 +473,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index 5e63218488b2a..65b3edf3b681e 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This 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,7 +37,7 @@ class mod_bom_advanced extends ModeleNumRefBoms { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php index 696561644614c..5b3d8006cfa00 100644 --- a/htdocs/core/modules/bom/mod_bom_standard.php +++ b/htdocs/core/modules/bom/mod_bom_standard.php @@ -33,7 +33,7 @@ class mod_bom_standard extends ModeleNumRefBoms { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -116,7 +116,7 @@ public function canBeActivated($object) * * @param Product $objprod Object product * @param Bom $object Object we need next value for - * @return string|-1 Next value if OK, -1 if KO + * @return string|int<-1,-1> Next value if OK, -1 if KO */ public function getNextValue($objprod, $object) { diff --git a/htdocs/core/modules/bom/modules_bom.php b/htdocs/core/modules/bom/modules_bom.php index 5e639f025548b..ed78515888a58 100644 --- a/htdocs/core/modules/bom/modules_bom.php +++ b/htdocs/core/modules/bom/modules_bom.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2012 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 @@ -43,9 +44,9 @@ abstract class ModelePDFBom extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -58,6 +59,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param BOM $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } @@ -68,4 +84,13 @@ public static function liste_modeles($db, $maxfilenamelength = 0) abstract class ModeleNumRefBoms extends CommonNumRefGenerator { // No overload code + + /** + * Return next free value + * + * @param Product $objprod Object product + * @param Bom $object Object we need next value for + * @return string|int<-1,-1> Next value if OK, -1 if KO + */ + abstract public function getNextValue($objprod, $object); } diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 684f52faa22ff..9fb45623b372b 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2009-2015 Laurent Destailleur * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,23 +56,9 @@ class BordereauChequeBlochet extends ModeleChequeReceipts */ public $line_per_page; - /** - * @var Account bank account - */ - public $account; - - public $amount; - public $date; - public $nbcheque; - public $ref; public $ref_ext; - /** - * @var array lines - */ - public $lines; - /** * Constructor * @@ -215,7 +202,7 @@ public function write_file($object, $_dir, $number, $outputlangs) // Pied de page $this->_pagefoot($pdf, '', $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -420,7 +407,7 @@ public function Body(&$pdf, $pagenb, $pages, $outputlangs) $pdf->SetXY(180, $this->tab_top + 10 + $yp); $pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0); - $yp = $yp + ($this->line_height * $nb_lines); + $yp += ($this->line_height * $nb_lines); } } diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 3f7607947509a..6c9660efe0a2f 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -33,7 +33,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -111,9 +111,9 @@ public function canBeActivated($object) /** * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param RemiseCheque $object Object we need next value for - * @return string|-1 Next value if OK, -1 if KO + * @param Societe $objsoc Object third party + * @param RemiseCheque $object Object we need next value for + * @return string|int<-1,0> Next value if OK, -1 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index 0910f6e77b6c7..edff2ae13e834 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -1,6 +1,7 @@ * 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 @@ -33,7 +34,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -116,9 +117,9 @@ public function getExample() /** * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param RemiseCheque $object Object we need next value for - * @return string|int Next value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param RemiseCheque $object Object we need next value for + * @return string|int<-1,0> Next value if OK, -1 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index 30d36660b97d5..94ccd9dcd8526 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,6 +38,14 @@ abstract class ModeleNumRefChequeReceipts extends CommonNumRefGenerator { // No overload code + /** + * Return next free value + * + * @param Societe $objsoc Object thirdparty + * @param RemiseCheque $object Object we need next value for + * @return string|int<-1,0> Next value if OK, 0 if KO + */ + abstract public function getNextValue($objsoc, $object); } /** @@ -44,6 +53,31 @@ abstract class ModeleNumRefChequeReceipts extends CommonNumRefGenerator */ abstract class ModeleChequeReceipts extends CommonDocGenerator { + /** + * @var Account bank account + */ + public $account; + + /** + * @var string|float + */ + public $amount; + /** + * @var string + */ + public $date; + /** + * @var int + */ + public $nbcheque; + /** + * @var string + */ + public $ref; + /** + * @var stdClass[] lines + */ + public $lines; /** * @var string Error code (or message) */ @@ -53,9 +87,9 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -66,7 +100,7 @@ public static function liste_modeles($db, $maxfilenamelength = 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $list = getListOfModels($db, $type, $maxfilenamelength); // TODO Remove this to use getListOfModels only - $list = array('blochet'=>'blochet'); + $list = array('blochet' => 'blochet'); return $list; } diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 0dd24592bb414..36d42c7742bce 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2021 Philippe Grand * 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 @@ -42,7 +43,7 @@ class doc_generic_order_odt extends ModelePDFCommandes { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -195,17 +196,17 @@ public function info($langs) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build pdf onto disk * * @param Commande $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -327,7 +328,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -387,7 +388,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -421,7 +422,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -452,7 +453,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -474,14 +475,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index f6f2350448235..78b4b884bd150 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -75,7 +75,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -166,13 +166,13 @@ public function __construct(DoliDB $db) /** * Function to build pdf onto disk * - * @param Commande $object Object to generate + * @param Commande $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -629,7 +629,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -920,7 +920,7 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs $this->atleastoneratenotnull = 0; if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { - $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])); if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { // Nothing to do } else { diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 2a9e07c137ccd..e4fadaef0ace5 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -75,12 +75,12 @@ class pdf_eratosthene extends ModelePDFCommandes /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; /** - * @var array Array of document table columns + * @var array Array of document table columns */ public $cols; @@ -153,10 +153,10 @@ public function __construct(DoliDB $db) * @param Commande $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -517,7 +517,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $posyafter + 6; } else { $height_note = 0; @@ -846,7 +846,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -1127,7 +1127,7 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan $this->atleastoneratenotnull = 0; if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { - $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])); if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { // Nothing to do } else { @@ -1783,7 +1783,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['position'] = array( 'rank' => $rank, 'width' => 10, - 'status' => getDolGlobalInt('PDF_ERATOSHTENE_ADD_POSITION') ? true : (getDolGlobalInt('PDF_ADD_POSITION') ? true : false), + 'status' => getDolGlobalInt('PDF_ERATOSHTENE_ADD_POSITION') ? true : ((bool) getDolGlobalInt('PDF_ADD_POSITION')), 'title' => array( 'textkey' => '#', // use lang key is useful in somme case with module 'align' => 'C', @@ -1816,7 +1816,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ); // Image of product - $rank = $rank + 10; + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => (!getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')), // in mm @@ -1835,7 +1835,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['photo']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['vat'] = array( 'rank' => $rank, 'status' => false, @@ -1850,7 +1850,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['vat']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -1872,7 +1872,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['subprice']['width'] += (2 * ($tmpwidth - 10)); } - $rank = $rank + 10; + $rank += 10; $this->cols['qty'] = array( 'rank' => $rank, 'width' => 16, // in mm @@ -1883,7 +1883,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['unit'] = array( 'rank' => $rank, 'width' => 11, // in mm @@ -1897,7 +1897,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['unit']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['discount'] = array( 'rank' => $rank, 'width' => 13, // in mm @@ -1911,22 +1911,22 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['discount']['status'] = true; } - $rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_ORDER_HIDE_PRICE_EXCL_TAX') ? true : false, + 'status' => !getDolGlobalString('PDF_ORDER_HIDE_PRICE_EXCL_TAX'), 'title' => array( 'textkey' => 'TotalHTShort' ), 'border-left' => true, // add left line separator ); - $rank = $rank + 1010; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1010; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalincltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_ORDER_SHOW_PRICE_INCL_TAX') ? false : true, + 'status' => getDolGlobalBool('PDF_ORDER_SHOW_PRICE_INCL_TAX'), 'title' => array( 'textkey' => 'TotalTTCShort' ), diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index e5e2e52534244..348f083902264 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -33,7 +33,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -128,7 +128,7 @@ public function canBeActivated($object) * * @param Societe $objsoc Object thirdparty * @param Commande $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @return string|int<-1,0> Value if OK, -1 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index ca1b476eb2458..a3280fa145539 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This 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,7 +37,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -124,7 +125,7 @@ public function getExample() * * @param Societe $objsoc Object thirdparty * @param Commande $object Object we need next value for - * @return string|int Next value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, -1 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index 4d438407a7627..7f0f1456189ba 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2012 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 @@ -62,9 +63,9 @@ abstract class ModelePDFCommandes extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -77,6 +78,22 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Commande $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } @@ -86,5 +103,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefCommandes extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Societe $objsoc Object thirdparty + * @param Commande $object Object we need next value for + * @return string|int<-1,0> Value if OK, -1 if KO + */ + abstract public function getNextValue($objsoc, $object); } diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 0112484d973b9..f5326c0cc545e 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2018 Ferran Marcet * 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 @@ -39,7 +40,7 @@ class doc_generic_contract_odt extends ModelePDFContract { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -192,17 +193,17 @@ public function info($langs) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build a document on disk using the generic odt module * - * @param Contrat $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param Contrat $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -338,7 +339,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $substitutionarray; // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -381,7 +382,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -418,7 +419,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -449,7 +450,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -471,14 +472,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index ab762c06e7cd5..194f8846b4862 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -73,7 +73,7 @@ class pdf_strato extends ModelePDFContract /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -128,15 +128,15 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build pdf onto disk + * Function to build pdf on disk * - * @param Contrat $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param Contrat $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -459,7 +459,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index aa5c911481067..7af0d9e16bb4b 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -1,6 +1,7 @@ * 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 @@ -30,7 +31,6 @@ */ class mod_contract_magre extends ModelNumRefContracts { - // variables inherited from ModelNumRefContracts class public $name = 'Magre'; public $version = 'dolibarr'; @@ -113,7 +113,7 @@ public function getExample() * * @param Societe $objsoc third party object * @param Contrat $contract contract object - * @return string|int Next value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $contract) { diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php index ca517b5a8a493..3ebb48d59e8a5 100644 --- a/htdocs/core/modules/contract/mod_contract_olive.php +++ b/htdocs/core/modules/contract/mod_contract_olive.php @@ -77,9 +77,9 @@ public function getExample() /** * Return an example of result returned by getNextValue * - * @param Societe $objsoc Object thirdparty - * @param Contrat $contract Object contract - * @return string Return next value + * @param Societe $objsoc Object thirdparty + * @param Contrat $contract Object contract + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $contract) { diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index e0ffb17003cae..10f93b547e1c1 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -114,7 +114,7 @@ public function canBeActivated($object) * * @param Societe $objsoc third party object * @param Contrat $contract contract object - * @return string|-1 Value if OK, -1 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $contract) { diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index 818e9519198dd..0a5f96ada52ea 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -7,6 +7,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013 Philippe Grand * 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 @@ -42,9 +43,9 @@ abstract class ModelePDFContract extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string|int<-1,0> List of templates, 0 if no module, -1 if error */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -57,13 +58,36 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk + * + * @param Contrat $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps } /** * Parent class for all contract numbering modules */ -class ModelNumRefContracts extends CommonNumRefGenerator +abstract class ModelNumRefContracts extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe $objsoc third party object + * @param Contrat $contract contract object + * @return string|int<-1,0> Next value if OK, -1 or 0 if KO + */ + abstract public function getNextValue($objsoc, $contract); } diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 626f7907165c0..3df593da5d77f 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -68,7 +68,7 @@ class pdf_storm extends ModelePDFDeliveryOrder /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -119,10 +119,10 @@ public function __construct($db) * @param Delivery $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -337,7 +337,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -558,7 +558,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -932,7 +932,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = $rank + 10; + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm @@ -952,7 +952,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } - $rank = $rank + 10; + $rank += 10; $this->cols['Comments'] = array( 'rank' => $rank, 'width' => 50, // in mm @@ -963,7 +963,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - // $rank = $rank + 10; + // $rank += 10; // $this->cols['weight'] = array( // 'rank' => $rank, // 'width' => 30, // in mm @@ -974,7 +974,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide // 'border-left' => true, // add left line separator // ); - $rank = $rank + 10; + $rank += 10; $this->cols['qty_shipped'] = array( 'rank' => $rank, 'width' => 20, // in mm @@ -985,7 +985,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['qty_remaining'] = array( 'rank' => $rank, 'width' => 20, // in mm diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index f26095e885f6b..ef5ecdabcc9ec 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -67,7 +67,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -140,10 +140,10 @@ public function __construct($db) * @param Delivery $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -314,7 +314,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -490,7 +490,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } // Check product remaining to be delivered @@ -551,7 +551,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->_pagefoot($pdf,$object,$outputlangs); - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod }*/ $pdf->Close(); diff --git a/htdocs/core/modules/delivery/mod_delivery_jade.php b/htdocs/core/modules/delivery/mod_delivery_jade.php index 8cc8ec7f234a0..37e6112b81cc0 100644 --- a/htdocs/core/modules/delivery/mod_delivery_jade.php +++ b/htdocs/core/modules/delivery/mod_delivery_jade.php @@ -38,7 +38,7 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -129,7 +129,7 @@ public function canBeActivated($object) * * @param Societe $objsoc Object thirdparty * @param Delivery $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @return string|int<-1,0> Value if OK, 0 or -1 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index e5daaffe518fc..60cbc9420ab6d 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * 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 @@ -34,7 +35,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -126,11 +127,11 @@ public function getExample() /** - * Return next value + * Return next free value * - * @param Societe $objsoc Object third party - * @param Delivery $object Object delivery - * @return string|int Value if OK, 0 if KO + * @param Societe $objsoc Object thirdparty + * @param Delivery $object Object we need next value for + * @return string|int<-1,0> Value if OK, 0 or -1 if KO */ public function getNextValue($objsoc, $object) { @@ -157,7 +158,7 @@ public function getNextValue($objsoc, $object) * * @param Societe $objsoc Object third party * @param Delivery $objforref Object for number to search - * @return string|int Next free value, 0 if KO + * @return string|int<-1,0> Next free value, 0 if KO * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref) diff --git a/htdocs/core/modules/delivery/modules_delivery.php b/htdocs/core/modules/delivery/modules_delivery.php index 5f727d5f4ce12..c1f919924f63e 100644 --- a/htdocs/core/modules/delivery/modules_delivery.php +++ b/htdocs/core/modules/delivery/modules_delivery.php @@ -5,6 +5,7 @@ * Copyright (C) 2006-2011 Regis Houssin * Copyright (C) 2011-2012 Philippe Grand * 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 @@ -41,9 +42,9 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -56,6 +57,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Delivery $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } @@ -64,5 +80,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefDeliveryOrder extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Societe $objsoc Object thirdparty + * @param Delivery $object Object we need next value for + * @return string|int<-1,0> Value if OK, 0 or -1 if KO + */ + abstract public function getNextValue($objsoc, $object); } diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 3c8fd22c3d4ff..bf2364426e80e 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -403,16 +403,16 @@ private function amountToLetters($montant, $devise1 = '', $devise2 = '') } if (($cent[2] == 0 || $cent[2] == '') && ($dix[2] == 0 || $dix[2] == '') && ($unite[2] == 1)) { - $somme = $somme.' mille '; + $somme .= ' mille '; } elseif (($cent[2] != 0 && $cent[2] != '') || ($dix[2] != 0 && $dix[2] != '') || ($unite[2] != 0 && $unite[2] != '')) { - $somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2].' milles '; + $somme .= $trio[2].' '.$secon[2].' '.$prim[2].' milles '; } else { - $somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2]; + $somme .= $trio[2].' '.$secon[2].' '.$prim[2]; } - $somme = $somme.$trio[1].' '.$secon[1].' '.$prim[1]; + $somme .= $trio[1].' '.$secon[1].' '.$prim[1]; - $somme = $somme.' '.$dev1.' '; + $somme .= ' '.$dev1.' '; if (($cent_c == '0' || $cent_c == '') && ($dix_c == '0' || $dix_c == '')) { return $somme.' et zéro '.$dev2; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index f2a1d1ee530a6..a423a41f07c0b 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2021 Philippe Grand * 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 @@ -42,7 +43,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -193,17 +194,17 @@ public function info($langs) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build pdf onto disk * * @param Expedition $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -325,7 +326,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -450,7 +451,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -487,7 +488,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -518,7 +519,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -540,14 +541,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index d0c891e7dc4d0..4a14a1778bccd 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -65,7 +65,7 @@ class pdf_espadon extends ModelePdfExpedition /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -113,15 +113,15 @@ public function __construct(DoliDB $db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build pdf onto disk + * Function to build pdf onto disk * * @param Expedition $object Object shipping to generate (or id if old method) - * @param Translate $outputlangs Lang output object + * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -264,7 +264,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(128, 128, 128); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -496,7 +496,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $posyafter + 6; } else { $height_note = 0; @@ -770,7 +770,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -1075,10 +1075,10 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) { $text .= ' ('.$linkedobject->ref_client.')'; } - $Yoff = $Yoff + 8; + $Yoff += 8; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); - $Yoff = $Yoff + 3; + $Yoff += 3; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R'); } @@ -1288,7 +1288,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = $rank + 10; + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm @@ -1307,7 +1307,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['photo']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['weight'] = array( 'rank' => $rank, 'width' => 30, // in mm @@ -1319,7 +1319,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ); - $rank = $rank + 10; + $rank += 10; $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -1330,7 +1330,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm @@ -1341,7 +1341,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['qty_asked'] = array( 'rank' => $rank, 'width' => 30, // in mm @@ -1355,7 +1355,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = $rank + 10; + $rank += 10; $this->cols['unit_order'] = array( 'rank' => $rank, 'width' => 15, // in mm @@ -1369,7 +1369,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = $rank + 10; + $rank += 10; $this->cols['qty_shipped'] = array( 'rank' => $rank, 'width' => 30, // in mm diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 6a842cee2e6eb..bfc9ee0a2cb40 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -70,7 +70,7 @@ class pdf_merou extends ModelePdfExpedition /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -111,17 +111,17 @@ public function __construct(DoliDB $db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build pdf onto disk + * Function to build pdf onto disk * * @param Expedition $object Object expedition to generate (or id if old method) - * @param Translate $outputlangs Lang output object + * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file(&$object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $conf, $langs, $mysoc, $hookmanager; @@ -219,7 +219,7 @@ public function write_file(&$object, $outputlangs, $srctemplatepath = '', $hided $pdf->SetDrawColor(128, 128, 128); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -258,7 +258,7 @@ public function write_file(&$object, $outputlangs, $srctemplatepath = '', $hided $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -366,7 +366,7 @@ public function write_file(&$object, $outputlangs, $srctemplatepath = '', $hided // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -539,7 +539,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetTextColor(0, 0, 0); $pdf->MultiCell(0, 3, $outputlangs->transnoentities("SendingSheet"), '', 'L'); // Sending sheet //Num Expedition - $Yoff = $Yoff + 7; + $Yoff += 7; $Xoff = 142; //$pdf->Rect($Xoff, $Yoff, 85, 8); $pdf->SetXY($Xoff, $Yoff); @@ -586,7 +586,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) } // Date delivery - $Yoff = $Yoff + 7; + $Yoff += 7; $pdf->SetXY($blSocX - 80, $blSocY + 17); $pdf->SetFont('', 'B', $default_font_size - 3); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index c41e1e83f0fc6..703e74ea93b05 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -65,7 +65,7 @@ class pdf_rouget extends ModelePdfExpedition /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -146,15 +146,15 @@ public function __construct(DoliDB $db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build pdf onto disk + * Function to build pdf onto disk * * @param Expedition $object Object shipping to generate (or id if old method) - * @param Translate $outputlangs Lang output object + * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -297,7 +297,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(128, 128, 128); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -324,7 +324,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetTextColor(0, 0, 0); $tab_top = 90; // position of top tab - $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift: 10); + $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; @@ -400,7 +400,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -661,7 +661,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -1008,10 +1008,10 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) { $text .= ' ('.$linkedobject->ref_client.')'; } - $Yoff = $Yoff + 8; + $Yoff += 8; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); - $Yoff = $Yoff + 3; + $Yoff += 3; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R'); } diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index 192d1a0c0c5a9..c87f4982c5cb2 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -1,6 +1,7 @@ * 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 @@ -32,7 +33,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -122,7 +123,7 @@ public function getExample() * * @param Societe $objsoc Third party object * @param Expedition $shipment Shipment object - * @return string|int Value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, 0 or -1 if KO */ public function getNextValue($objsoc, $shipment) { diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index a96b405e69492..55f109e47d5ee 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -32,7 +32,7 @@ class mod_expedition_safor extends ModelNumRefExpedition { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -121,7 +121,7 @@ public function canBeActivated($object) * * @param Societe $objsoc Third party object * @param Expedition $shipment Shipment object - * @return string|-1 Value if OK, -1 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $shipment) { diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index 249a2bc46e337..6e606571fda75 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -7,6 +7,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2011-2019 Philippe Grand * 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 @@ -41,11 +42,11 @@ abstract class ModelePdfExpedition extends CommonDocGenerator { // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation models + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -58,6 +59,22 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Expedition $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } @@ -66,5 +83,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModelNumRefExpedition extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe $objsoc Third party object + * @param Expedition $shipment Shipment object + * @return string|int<-1,0> Value if OK, 0 or -1 if KO + */ + abstract public function getNextValue($objsoc, $shipment); } diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php index 14383a66e855d..2e69df6d35533 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php @@ -72,7 +72,7 @@ class pdf_standard_expensereport extends ModeleExpenseReport /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -180,10 +180,10 @@ public function __construct($db) * @param ExpenseReport $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -317,7 +317,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -500,7 +500,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Page footer $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index 575d3ab499cef..60600810b1fdd 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -32,7 +32,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -118,10 +118,10 @@ public function canBeActivated($object) } /** - * Return next free value + * Return next free value * - * @param Object $object Object we need next value for - * @return string|int Next value if OK, 0 if KO + * @param ExpenseReport $object Object we need next value for + * @return string|int<-1,0> Next value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php index dcdb17f776303..0c5962c871e1f 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.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 @@ -33,7 +34,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -123,7 +124,7 @@ public function getExample() * Return next free value * * @param ExpenseReport $object Object we need next value for - * @return string|int Next value if OK, 0 if KO + * @return string|int<-1,0> Next value if OK, -1 or 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php index b7222eb725cae..64d5a4c4a27fa 100644 --- a/htdocs/core/modules/expensereport/modules_expensereport.php +++ b/htdocs/core/modules/expensereport/modules_expensereport.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 @@ -26,11 +27,11 @@ abstract class ModeleExpenseReport extends CommonDocGenerator { // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active models generation + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -43,6 +44,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param ExpenseReport $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } /** @@ -68,5 +84,11 @@ function expensereport_pdf_create(DoliDB $db, ExpenseReport $object, $message, $ */ abstract class ModeleNumRefExpenseReport extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param ExpenseReport $object Object we need next value for + * @return string|int<-1,0> Next value if OK, -1 or 0 if KO + */ + abstract public function getNextValue($object); } diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 3f166308cc760..b6a4960a4aa43 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2012 Marcos García * Copyright (C) 2024 William Mead * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,7 +51,7 @@ class ExportExcel2007 extends ModeleExports /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php index f247b006f89b4..580a7ffa46faa 100644 --- a/htdocs/core/modules/export/export_tsv.modules.php +++ b/htdocs/core/modules/export/export_tsv.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 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 @@ -44,7 +45,7 @@ class ExportTsv extends ModeleExports /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/export/exportcsv.class.php b/htdocs/core/modules/export/exportcsv.class.php index c52779bc74eba..a921204798109 100644 --- a/htdocs/core/modules/export/exportcsv.class.php +++ b/htdocs/core/modules/export/exportcsv.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 @@ -45,7 +46,7 @@ class ExportCsv extends ModeleExports /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index e03194f9f415d..1b6e57d1a5206 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke * 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 @@ -41,7 +42,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -75,8 +76,8 @@ public function __construct($db) $this->option_logo = 1; // Display logo $this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION - $this->option_modereg = 0; // Display payment mode - $this->option_condreg = 0; // Display payment terms + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms $this->option_multilang = 1; // Available in several languages $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes @@ -194,15 +195,15 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param Facture $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param Facture $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, <=0=KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -367,7 +368,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -444,7 +445,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -480,7 +481,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -511,7 +512,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -532,14 +533,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails return -1; } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index aaeee1470c3d7..80c1043d2b2c5 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -73,7 +73,7 @@ class pdf_crabe extends ModelePDFFactures /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -184,13 +184,13 @@ public function __construct($db) /** * Function to build pdf onto disk * - * @param Facture $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param Facture $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, <=0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -873,7 +873,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs, 0, $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs)); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') { @@ -1260,7 +1260,7 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs, $outputlan $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', ''); + $paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); @@ -1397,7 +1397,7 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs $this->atleastoneratenotnull = 0; if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { - $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])); if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { // Nothing to do } else { diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 4d7dc5e970573..9074fde6c5c39 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -12,6 +12,7 @@ * Copyright (C) 2022 Anthony Berton * Copyright (C) 2022-2024 Alexandre Spangaro * Copyright (C) 2022-2024 Eric Seigne + * 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 @@ -74,7 +75,7 @@ class pdf_octopus extends ModelePDFFactures /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'disabled'; // Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2. @@ -116,7 +117,7 @@ class pdf_octopus extends ModelePDFFactures /** - * @var array Array of columns + * @var array Array of document table columns */ public $cols; @@ -256,13 +257,13 @@ public function __construct($db) /** * Function to build pdf onto disk * - * @param Facture $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param Facture $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, <=0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -416,7 +417,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede if ($nbprevsituation > 0) { $this->heightforinfotot += 4 * ($nbprevsituation + 3); } - $this->heightforfreetext= (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page + $this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page $this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) if (class_exists('TCPDF')) { @@ -578,7 +579,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->_tableFirstPage($pdf, $tab_top, $this->page_hauteur - 100 - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); - $bottomlasttab=$this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -746,7 +747,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $this->tab_top = $posyafter + 6; } else { $height_note = 0; @@ -952,9 +953,9 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $parameters = array( 'object' => $object, 'i' => $i, - 'pdf' =>& $pdf, - 'curY' =>& $posy, - 'nexY' =>& $nexY, + 'pdf' => & $pdf, + 'curY' => & $posy, + 'nexY' => & $nexY, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); @@ -1121,11 +1122,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $this->resumeLastPage($pdf, $object, 0, $tab_top, $outputlangs, $outputlangsbis); - $bottomlasttab=$this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; $this->_pagefoot($pdf, $object, $outputlangs, 1); $pdf->Close(); @@ -1161,7 +1162,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede /** * Show payments table * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output @@ -1305,7 +1306,7 @@ public function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs) /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object @@ -1461,7 +1462,7 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlan $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', ''); + $paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); @@ -1536,7 +1537,7 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlan /** * Show total to pay * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Amount already paid (in the currency of invoice) * @param int $posy Position depart @@ -1562,7 +1563,7 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan $default_font_size--; } - $tab2_top = $posy-4; + $tab2_top = $posy - 4; $tab2_hl = 4; $pdf->SetFont('', '', $default_font_size - 1); @@ -1608,7 +1609,7 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan $this->atleastoneratenotnull = 0; if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { - $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])); if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { // Nothing to do } else { @@ -1691,15 +1692,15 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan // VAT $tvas = array(); $nblines = count($object->lines); - for ($i=0; $i < $nblines; $i++) { + for ($i = 0; $i < $nblines; $i++) { $tvaligne = $object->lines[$i]->total_tva; - $vatrate=(string) $object->lines[$i]->tva_tx; + $vatrate = (string) $object->lines[$i]->tva_tx; if (($object->lines[$i]->info_bits & 0x01) == 0x01) { - $vatrate.='*'; + $vatrate .= '*'; } if (! isset($tvas[$vatrate])) { - $tvas[$vatrate]=0; + $tvas[$vatrate] = 0; } $tvas[$vatrate] += $tvaligne; } @@ -1923,9 +1924,9 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -1937,7 +1938,7 @@ public static function liste_modeles($db, $maxfilenamelength = 0) /** * Show table for lines * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param int $tab_top Top position of table * @param int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -1953,8 +1954,8 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ global $conf; // Force to disable hidetop and hidebottom - $hidebottom=0; - $hidetop=0; + $hidebottom = 0; + $hidetop = 0; $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1977,16 +1978,16 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ // MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } - $tab_top+=4; + $tab_top += 4; } $pdf->SetDrawColor(128, 128, 128); $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param // situation invoice $pdf->SetFont('', '', $default_font_size - 2); @@ -2019,14 +2020,14 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ if (empty($hidetop)) { $pdf->SetXY($xstartpos + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]); - $textWidth = $colDef['width'] - $colDef['title']['padding'][3] -$colDef['title']['padding'][1]; + $textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1]; $pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']); } } $pdf->SetFont('', '', $default_font_size - 1); if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param } } @@ -2034,7 +2035,7 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ /** * Show top header of page. This include the logo, ref and address blocks * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object to show * @param int $showaddress 0=no, 1=yes (usually set to 1 for first page, and 0 for next pages) * @param Translate $outputlangs Object lang for output @@ -2142,7 +2143,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $pdf->MultiCell($w, 3, $title, '', 'R'); if (!empty($subtitle)) { $pdf->SetFont('', 'B', $default_font_size); - $pdf->SetXY($posx, $posy+5); + $pdf->SetXY($posx, $posy + 5); $pdf->MultiCell($w, 6, $subtitle, '', 'R'); $posy += 2; } @@ -2424,7 +2425,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output /** * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text @@ -2499,7 +2500,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ); // Image of product - $rank = $rank + 10; + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalString('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm @@ -2519,7 +2520,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } - $rank = $rank + 10; + $rank += 10; $this->cols['vat'] = array( 'rank' => $rank, 'status' => false, @@ -2534,7 +2535,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['vat']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['unit'] = array( 'rank' => $rank, 'width' => 11, // in mm @@ -2548,7 +2549,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['unit']['status'] = false; } - $rank = $rank + 10; + $rank += 10; $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 17, // in mm @@ -2570,7 +2571,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['subprice']['width'] += (2 * ($tmpwidth - 10)); } - $rank = $rank + 10; + $rank += 10; $this->cols['qty'] = array( 'rank' => $rank, 'width' => 10, // in mm @@ -2584,7 +2585,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['qty']['status'] = true; //sum column - $rank = $rank + 10; + $rank += 10; $this->cols['btpsomme'] = array( 'rank' => $rank, 'width' => 18, // in mm @@ -2611,7 +2612,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } // Column 'Previous progression' - $rank = $rank + 10; + $rank += 10; $this->cols['prev_progress'] = array( 'rank' => $rank, 'width' => 10, // in mm @@ -2624,7 +2625,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'textkey' => 'S'.$derniere_situation->situation_counter . ' - ' . dol_print_date($derniere_situation->date, "%d/%m/%Y"), 'align' => 'C', 'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left - 'width' => 10+15 //current width + amount cell width + 'width' => 10 + 15 //current width + amount cell width ), ); if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) { @@ -2632,7 +2633,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } // Column 'Previous progression' - $rank = $rank + 10; + $rank += 10; $this->cols['prev_progress_amount'] = array( 'rank' => $rank, 'width' => 15, // in mm @@ -2647,7 +2648,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } // Column 'Current percent progress' - $rank = $rank + 10; + $rank += 10; $this->cols['progress'] = array( 'rank' => $rank, 'width' => 10, // in mm @@ -2660,12 +2661,12 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'textkey' => 'S'.$object->situation_counter . ' - ' . dol_print_date($object->date, "%d/%m/%Y"), 'align' => 'C', 'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left - 'width' => 10+15 + 'width' => 10 + 15 ), ); // Column 'Current progress' - $rank = $rank + 10; + $rank += 10; $this->cols['progress_amount'] = array( 'rank' => $rank, 'width' => 15, // in mm @@ -2681,7 +2682,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide // FIN BTP SITUATION - $rank = $rank + 10; + $rank += 10; $this->cols['discount'] = array( 'rank' => $rank, 'width' => 10, // in mm @@ -2694,7 +2695,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide if ($this->atleastonediscount) { $this->cols['discount']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 18, // in mm @@ -2727,7 +2728,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide /** * Show table for lines * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param int $tab_top Top position of table * @param int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -2751,9 +2752,9 @@ public function _tableFirstPage(&$pdf, $tab_top, $tab_height, $nexY, $outputlang // Force to disable hidetop and hidebottom - $hidebottom=0; + $hidebottom = 0; if ($hidetop) { - $hidetop=-1; + $hidetop = -1; } $currency = !empty($currency) ? $currency : $conf->currency; @@ -2765,15 +2766,15 @@ public function _tableFirstPage(&$pdf, $tab_top, $tab_height, $nexY, $outputlang if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-8); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 8); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); - $width = $this->page_largeur-$this->marge_gauche-$this->marge_droite-83; + $width = $this->page_largeur - $this->marge_gauche - $this->marge_droite - 83; //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->posx_cumul_anterieur-1, $tab_top, $width, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); - $pdf->Rect($this->marge_gauche, $tab_top + 92.5, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->Rect($this->posx_cumul_anterieur - 1, $tab_top, $width, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->Rect($this->marge_gauche, $tab_top + 92.5, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } @@ -2782,47 +2783,47 @@ public function _tableFirstPage(&$pdf, $tab_top, $tab_height, $nexY, $outputlang // Output Rect // KEEPTHIS => Affiche les bords extérieurs - $this->printRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param + $this->printRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param - $pdf->line($this->posx_cumul_anterieur-1, $tab_top, $this->posx_cumul_anterieur-1, $tab_top + $tab_height); + $pdf->line($this->posx_cumul_anterieur - 1, $tab_top, $this->posx_cumul_anterieur - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posx_cumul_anterieur-1, $tab_top+0.5); + $pdf->SetXY($this->posx_cumul_anterieur - 1, $tab_top + 0.5); $pdf->MultiCell(35, 2, $outputlangs->transnoentities("SituationInvoiceOldCumulation"), '', 'C'); } // PRINT COLUMNS TITLES - $pdf->line($this->posx_new_cumul-1, $tab_top, $this->posx_new_cumul-1, $tab_top + $tab_height); + $pdf->line($this->posx_new_cumul - 1, $tab_top, $this->posx_new_cumul - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posx_new_cumul-1, $tab_top+0.5); + $pdf->SetXY($this->posx_new_cumul - 1, $tab_top + 0.5); $pdf->MultiCell(35, 2, $outputlangs->transnoentities("SituationInvoiceNewCumulation"), '', 'C'); } - $pdf->line($this->posx_current-1, $tab_top, $this->posx_current-1, $tab_top + $tab_height); + $pdf->line($this->posx_current - 1, $tab_top, $this->posx_current - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posx_current-1, $tab_top+0.5); + $pdf->SetXY($this->posx_current - 1, $tab_top + 0.5); $pdf->MultiCell(36, 2, $outputlangs->transnoentities("CurrentSituationTotal", $object->situation_counter), '', 'C'); } // ADD HORIZONTAL LINES - $pdf->line($this->posx_cumul_anterieur-1, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); + $pdf->line($this->posx_cumul_anterieur - 1, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); - $pdf->line($this->posx_cumul_anterieur-1, $tab_top+24, $this->page_largeur-$this->marge_droite, $tab_top+24); + $pdf->line($this->posx_cumul_anterieur - 1, $tab_top + 24, $this->page_largeur - $this->marge_droite, $tab_top + 24); - $pdf->line($this->marge_gauche, $tab_top+55, $this->page_largeur-$this->marge_droite, $tab_top+55); + $pdf->line($this->marge_gauche, $tab_top + 55, $this->page_largeur - $this->marge_droite, $tab_top + 55); $pdf->line($this->marge_gauche, $tab_top + 65, $this->page_largeur - $this->marge_droite, $tab_top + 65); if ($displayWarranty) { - $pdf->line($this->marge_gauche, $tab_top+85, $this->page_largeur-$this->marge_droite, $tab_top+85); + $pdf->line($this->marge_gauche, $tab_top + 85, $this->page_largeur - $this->marge_droite, $tab_top + 85); } // ADD TEXT INTO CELL /********************** Titles ******************************/ - $pdf->SetXY($this->marge_gauche+2, $tab_top+8); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + 8); $pdf->MultiCell(60, 2, $outputlangs->transnoentities("SituationInvoiceMainTask"), '', 'L'); - $pdf->SetXY($this->marge_gauche+2, $tab_top+12); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + 12); $pdf->MultiCell(60, 2, $outputlangs->transnoentities("SituationInvoiceAdditionalTask"), '', 'L'); $form->load_cache_vatrates("'".$object->thirdparty->country_code."'"); @@ -2836,7 +2837,7 @@ public function _tableFirstPage(&$pdf, $tab_top, $tab_height, $nexY, $outputlang } $i += 8; - $pdf->SetXY($this->marge_gauche+10, $tab_top+24 + $i); + $pdf->SetXY($this->marge_gauche + 10, $tab_top + 24 + $i); $pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalHT").' '.$TVatInfo['label'], '', 'L'); if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) { @@ -2847,25 +2848,25 @@ public function _tableFirstPage(&$pdf, $tab_top, $tab_height, $nexY, $outputlang } } - $pdf->SetXY($this->marge_gauche+2, $tab_top+33+$i); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + 33 + $i); $pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalTTC"), '', 'L'); $pdf->SetFont('', 'B', $default_font_size - 1); - $pdf->SetXY($this->marge_gauche+2, $tab_top+58); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + 58); $pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalSituationInvoice"), '', 'L'); $pdf->SetFont('', '', $default_font_size - 2); if ($displayWarranty) { $pdf->SetXY($this->marge_gauche + 2, $tab_top + 74); $pdf->MultiCell(80, 2, $outputlangs->trans("TotalSituationInvoiceWithRetainedWarranty", $object->retained_warranty), '', 'L'); - $nextY = $tab_top+93; + $nextY = $tab_top + 93; } else { - $nextY = $tab_top+74; + $nextY = $tab_top + 74; } $pdf->SetFont('', 'B', $default_font_size - 1); - $pdf->SetXY($this->marge_gauche+2, $nextY); + $pdf->SetXY($this->marge_gauche + 2, $nextY); $pdf->MultiCell(80, 2, $outputlangs->transnoentities("SituationTotalRayToRest"), '', 'L'); $pdf->SetFont('', '', $default_font_size - 2); /***********************************************************/ @@ -2877,17 +2878,17 @@ public function _tableFirstPage(&$pdf, $tab_top, $tab_height, $nexY, $outputlang 'current' ); - $x = $this->marge_gauche+85; + $x = $this->marge_gauche + 85; // unset($this->TDataSituation['derniere_situation']); // print json_encode($object->lines);exit; // print json_encode($this->TDataSituation);exit; foreach ($TToDisplay as $col) { // Travaux principaux - $pdf->SetXY($x, $tab_top+8); + $pdf->SetXY($x, $tab_top + 8); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['HT'], 0, '', 1, -1, 2), '', 'R'); // Travaux supplémentaires - $pdf->SetXY($x, $tab_top+12); + $pdf->SetXY($x, $tab_top + 12); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['travaux_sup'], 0, '', 1, -1, 2), '', 'R'); $i = -8; @@ -2899,7 +2900,7 @@ public function _tableFirstPage(&$pdf, $tab_top, $tab_height, $nexY, $outputlang $i += 8; // Total HT - $pdf->SetXY($x, $tab_top+24+$i); + $pdf->SetXY($x, $tab_top + 24 + $i); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['HT'], 0, '', 1, -1, 2), '', 'R'); // Total TVA @@ -2912,23 +2913,23 @@ public function _tableFirstPage(&$pdf, $tab_top, $tab_height, $nexY, $outputlang } // Total TTC - $pdf->SetXY($x, $tab_top+33+$i); + $pdf->SetXY($x, $tab_top + 33 + $i); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['TTC'], 0, '', 1, -1, 2), '', 'R'); // Total situation $pdf->SetFont('', 'B', $default_font_size - 1); - $pdf->SetXY($x, $tab_top+58); + $pdf->SetXY($x, $tab_top + 58); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['TTC'], 0, '', 1, -1, 2), '', 'R'); $pdf->SetFont('', '', $default_font_size - 2); if ($displayWarranty) { // Retained warranty - $pdf->SetXY($x, $tab_top+74); + $pdf->SetXY($x, $tab_top + 74); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['retenue_garantie'], 0, '', 1, -1, 2), '', 'R'); - $nextY = $tab_top+93; + $nextY = $tab_top + 93; } else { - $nextY = $tab_top+74; + $nextY = $tab_top + 74; } // Amount payable incl. VAT @@ -2937,7 +2938,7 @@ public function _tableFirstPage(&$pdf, $tab_top, $tab_height, $nexY, $outputlang $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['total_a_payer'], 0, '', 1, -1, 2), '', 'R'); $pdf->SetFont('', '', $default_font_size - 2); - $x+=36; + $x += 36; } /************************************************************/ } @@ -3024,7 +3025,7 @@ public function getDataSituation(&$object) $isFirstSituation = false; if (!empty($l->fk_prev_id)) { $prevSituationPercent = $l->get_prev_progress($previousInvoice->id, true); - } elseif (! array_key_exists($i+1, $TPreviousInvoices)) { + } elseif (! array_key_exists($i + 1, $TPreviousInvoices)) { $isFirstSituation = true; } @@ -3033,7 +3034,7 @@ public function getDataSituation(&$object) $ltvatx = (float) sprintf("%01.3f", $l->tva_tx); //1ere ligne - $amounttva = $calc_ht * ($ltvatx/100); + $amounttva = $calc_ht * ($ltvatx / 100); if (! isset($TDataSituation['cumul_anterieur'][$ltvatx])) { $TDataSituation['cumul_anterieur'][$ltvatx]['HT'] = $calc_ht; $TDataSituation['cumul_anterieur'][$ltvatx]['TVA'] = $amounttva; @@ -3201,7 +3202,7 @@ public function getInfosLineLastSituation(&$object, &$current_line) /** * Rect pdf * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param float $x Abscissa of first point * @param float $y Ordinate of first point * @param float $l ?? @@ -3212,14 +3213,14 @@ public function getInfosLineLastSituation(&$object, &$current_line) */ public function printRectBtp(&$pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) { - if (empty($hidetop) || $hidetop==-1) { - $pdf->line($x, $y, $x+$l, $y); + if (empty($hidetop) || $hidetop == -1) { + $pdf->line($x, $y, $x + $l, $y); } - $pdf->line($x+$l, $y, $x+$l, $y+$h); + $pdf->line($x + $l, $y, $x + $l, $y + $h); if (empty($hidebottom)) { - $pdf->line($x+$l, $y+$h, $x, $y+$h); + $pdf->line($x + $l, $y + $h, $x, $y + $h); } - $pdf->line($x, $y+$h, $x, $y); + $pdf->line($x, $y + $h, $x, $y); } @@ -3235,7 +3236,7 @@ public function btpGetInvoiceAmounts($id, $forceReadFromDB = false) { global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; - $object=new Facture($db); + $object = new Facture($db); $object->fetch($id); /* from dolibarr core @@ -3305,7 +3306,7 @@ public function btpGetInvoiceAmounts($id, $forceReadFromDB = false) /** * Show last page with a resume of all invoices * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Amount already paid (in the currency of invoice) * @param int $posy Position depart @@ -3383,33 +3384,33 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, if (count($propals)) { $propal = array_pop($propals); - $total_ht = ($conf->multicurrency->enabled && $propal->mylticurrency_tx != 1) ? $propal->multicurrency_total_ht : $propal->total_ht; + $total_ht = ($conf->multicurrency->enabled && $propal->multicurrency_tx != 1) ? $propal->multicurrency_total_ht : $propal->total_ht; $remain_to_pay = $total_ht; $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', '', $default_font_size - 1); $label = $outputlangs->transnoentities("SituationInvoiceTotalProposal"); - $pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy+1); + $pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy + 1); - $amount = price($sign * ($total_ht + (! empty($propal->remise)?$propal->remise:0))); - $pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx+$width, $posy+1); + $amount = price($sign * ($total_ht + (! empty($propal->remise) ? $propal->remise : 0))); + $pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1); $pdf->SetFont('', '', $default_font_size - 1); // Output Rect $pdf->SetDrawColor(128, 128, 128); - $this->printRect($pdf, $posx, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 6); // Rect prend une longueur en 3eme param et 4eme param + $this->printRect($pdf, $posx, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 6); // Rect prend une longueur en 3eme param et 4eme param $posy += 4; } elseif (count($orders)) { $order = array_pop($orders); - $total_ht = ($conf->multicurrency->enabled && $order->mylticurrency_tx != 1 ? $order->multicurrency_total_ht : $order->total_ht); + $total_ht = ($conf->multicurrency->enabled && $order->multicurrency_tx != 1 ? $order->multicurrency_total_ht : $order->total_ht); $remain_to_pay = $total_ht; } - $useborder=0; + $useborder = 0; $index = 0; $height = 4; @@ -3425,7 +3426,7 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $pdf->SetXY($posx, $posy); - $depositsamount=$object->getSumDepositsUsed(); + $depositsamount = $object->getSumDepositsUsed(); $deja_regle = $object->getSommePaiement(); $tot_deja_regle = ($depositsamount + $deja_regle); @@ -3452,13 +3453,13 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $ref = $outputlangs->transnoentities("InvoiceSituation").$outputlangs->convToOutputCharset(" n°".$invoice->situation_counter); if ($invoice->situation_final) { - $ref.= ' - DGD'; + $ref .= ' - DGD'; $force_to_zero = true; } - $ref.= ' - '. $invoice->ref; - $ref.= ' ('.dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs).')'; - $pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $ref, 0, 'L', 0); + $ref .= ' - '. $invoice->ref; + $ref .= ' ('.dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs).')'; + $pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $ref, 0, 'L', 0); $pdf->SetFont('', '', $default_font_size - 1); @@ -3473,21 +3474,22 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $pdf->SetXY($posx, $posy); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ($conf->multicurrency->enabled && $invoice->mylticurrency_tx != 1 ? $invoice->multicurrency_total_ht : $invoice->total_ht); - $pdf->SetXY($posx+$width, $posy); - $pdf->MultiCell($width2, $height, price($sign * ($total_ht + (!empty($invoice->remise)?$invoice->remise:0)), 0, $outputlangs), 0, 'R', 1); + $total_ht = ($conf->multicurrency->enabled && $invoice->multicurrency_tx != 1 ? $invoice->multicurrency_total_ht : $invoice->total_ht); + + $pdf->SetXY($posx + $width, $posy); + $pdf->MultiCell($width2, $height, price($sign * ($total_ht + (!empty($invoice->remise) ? $invoice->remise : 0)), 0, $outputlangs), 0, 'R', 1); $tvas = array(); $nblines = count($invoice->lines); - for ($i=0; $i < $nblines; $i++) { + for ($i = 0; $i < $nblines; $i++) { $tvaligne = $invoice->lines[$i]->total_tva; $vatrate = (string) $invoice->lines[$i]->tva_tx; if (($invoice->lines[$i]->info_bits & 0x01) == 0x01) { - $vatrate.='*'; + $vatrate .= '*'; } if (! isset($tvas[$vatrate])) { - $tvas[$vatrate]=0; + $tvas[$vatrate] = 0; } $tvas[$vatrate] += $tvaligne; } @@ -3505,10 +3507,10 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; - $totalvat.= vatrate($tvakey, 1).$tvacompl; + $totalvat .= vatrate($tvakey, 1).$tvacompl; $pdf->MultiCell($width, $height, $totalvat, 0, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } @@ -3525,7 +3527,7 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); $retainedWarrantyRate = (float) ($object->retained_warranty ? price2num($object->retained_warranty) : price2num(getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', 0))); @@ -3541,10 +3543,10 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $pdf->SetFillColor(241, 241, 241); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("RetainedWarrantyShort", $retainedWarrantyRate), $useborder, 'L', 1); - $total_ht_rg = (float) price2num(price($total_ht * $retainedWarrantyRate/100), 'MT'); - $total_ttc_rg = (float) price2num(price($total_ttc * $retainedWarrantyRate/100), 'MT'); + $total_ht_rg = (float) price2num(price($total_ht * $retainedWarrantyRate / 100), 'MT'); + $total_ttc_rg = (float) price2num(price($total_ttc * $retainedWarrantyRate / 100), 'MT'); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price(-$sign * $total_ht_rg, 0, $outputlangs), $useborder, 'R', 1); $total_ht_with_rg = $total_ht - $total_ht_rg; @@ -3558,7 +3560,7 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $pdf->SetFillColor(224, 224, 224); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalSituationInvoiceWithRetainedWarranty"), $useborder, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($sign * $total_ttc_with_rg, 0, $outputlangs), $useborder, 'R', 1); } @@ -3573,7 +3575,9 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $deja_regle = $invoice->getSommePaiement(); $resteapayer = price2num($invoice->total_ttc - $deja_regle - $total_ttc_rg - $creditnoteamount - $depositsamount, 'MT'); - if ($invoice->paye) $resteapayer = 0; + if ($invoice->paye) { + $resteapayer = 0; + } $y = 0; @@ -3583,7 +3587,7 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $pdf->SetXY($posx, $posy + $height * $index); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("Paid"), 0, 'L', 0); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', 0); // Credit note @@ -3591,7 +3595,7 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $index++; $pdf->SetXY($posx, $posy + $height * $index); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0); } @@ -3602,10 +3606,10 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $pdf->SetXY($posx, $posy + $height * $index); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($invoice->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1); - $resteapayer=0; + $resteapayer = 0; } $index++; @@ -3613,7 +3617,7 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $pdf->SetFillColor(224, 224, 224); $pdf->SetXY($posx, $posy + $height * $index); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); $pdf->SetFont('', '', $default_font_size - 1); @@ -3622,8 +3626,10 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $index++; if ($deja_regle > 0) { - $title=$outputlangs->transnoentities("PaymentsAlreadyDone"); - if ($invoice->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone"); + $title = $outputlangs->transnoentities("PaymentsAlreadyDone"); + if ($invoice->type == 2) { + $title = $outputlangs->transnoentities("PaymentsBackAlreadyDone"); + } $pdf->SetFont('', '', $default_font_size - 3); $pdf->SetXY($posx, $posy + $height * $index); @@ -3633,21 +3639,21 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $index++; - $width4 = ($this->page_largeur - $this->marge_droite - $posx)/4; + $width4 = ($this->page_largeur - $this->marge_droite - $posx) / 4; $pdf->SetFont('', '', $default_font_size - 4); $pdf->SetXY($posx, $posy + $height * $index); - $pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Payment"), 0, 'L', 0); - $pdf->SetXY($posx+$width4, $posy + $height * $index); - $pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Amount"), 0, 'L', 0); - $pdf->SetXY($posx+$width4*2, $posy + $height * $index); - $pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Type"), 0, 'L', 0); - $pdf->SetXY($posx+$width4*3, $posy + $height * $index); - $pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Num"), 0, 'L', 0); + $pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Payment"), 0, 'L', 0); + $pdf->SetXY($posx + $width4, $posy + $height * $index); + $pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Amount"), 0, 'L', 0); + $pdf->SetXY($posx + $width4 * 2, $posy + $height * $index); + $pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Type"), 0, 'L', 0); + $pdf->SetXY($posx + $width4 * 3, $posy + $height * $index); + $pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Num"), 0, 'L', 0); //$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); - $y=$height-1; + $y = $height - 1; $pdf->SetFont('', '', $default_font_size - 4); /** @var Facture $invoice */ @@ -3656,15 +3662,15 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, if (count($payments)) { foreach ($payments as $payment) { $pdf->SetXY($posx, $posy + $height * $index + $y); - $pdf->MultiCell($width4, $height-1, dol_print_date($this->db->jdate($payment['date']), 'day', false, $outputlangs, true), 0, 'L', 0); - $pdf->SetXY($posx+$width4, $posy + $height * $index + $y); - $pdf->MultiCell($width4, $height-1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0); - $pdf->SetXY($posx+$width4*2, $posy + $height * $index + $y); + $pdf->MultiCell($width4, $height - 1, dol_print_date($this->db->jdate($payment['date']), 'day', false, $outputlangs, true), 0, 'L', 0); + $pdf->SetXY($posx + $width4, $posy + $height * $index + $y); + $pdf->MultiCell($width4, $height - 1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0); + $pdf->SetXY($posx + $width4 * 2, $posy + $height * $index + $y); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $payment['type']); - $pdf->MultiCell($width4, $height-1, $oper, 0, 'L', 0); - $pdf->SetXY($posx+$width4*3, $posy + $height * $index + $y); - $pdf->MultiCell($width4, $height-1, $payment['num'], 0, 'L', 0); + $pdf->MultiCell($width4, $height - 1, $oper, 0, 'L', 0); + $pdf->SetXY($posx + $width4 * 3, $posy + $height * $index + $y); + $pdf->MultiCell($width4, $height - 1, $payment['num'], 0, 'L', 0); //$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3); $y += ($height - 1); @@ -3674,20 +3680,22 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, // Output Rect $pdf->SetDrawColor(128, 128, 128); - $this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height * $index + $y); + $this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height * $index + $y); $posy += $height * $index + $y; - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) { // There is a pagebreak $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; $pdf->AddPage('', '', true); if (!empty($this->tplidx)) { $pdf->useTemplate($this->tplidx); } - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + $pdf->setPage($pageposafter + 1); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $posy = $this->tab_top_newpage + 1; @@ -3726,12 +3734,12 @@ public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $pdf->SetFont('', '', $default_font_size - 1); $pdf->SetXY($this->marge_gauche, $posy + 1); $label = $outputlangs->transnoentities("SituationTotalRayToRest"); - $pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $label, 0, 'L', 0); + $pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0); $amount = price($remain_to_pay); - $pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx+$width, $posy+1); + $pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1); $pdf->SetDrawColor(128, 128, 128); - $this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 7); + $this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 7); } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 71edf73db9bf0..0cffc22136cbf 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -73,7 +73,7 @@ class pdf_sponge extends ModelePDFFactures /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -109,7 +109,7 @@ class pdf_sponge extends ModelePDFFactures /** - * @var array Array of columns + * @var array Array of document table columns */ public $cols; @@ -186,13 +186,13 @@ public function __construct($db) /** * Function to build pdf onto disk * - * @param Facture $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param Facture $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, <=0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -675,7 +675,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $this->tab_top = $posyafter + 6; } else { $height_note = 0; @@ -1035,7 +1035,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs, 0, $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs)); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') { @@ -1360,7 +1360,7 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlan $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', ''); + $paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); @@ -1684,7 +1684,7 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan $this->atleastoneratenotnull = 0; if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { - $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])); if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { // Nothing to do } else { @@ -2013,9 +2013,9 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -2582,7 +2582,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ); // Image of product - $rank = $rank + 10; + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm @@ -2602,7 +2602,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } - $rank = $rank + 10; + $rank += 10; $this->cols['vat'] = array( 'rank' => $rank, 'status' => false, @@ -2617,7 +2617,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['vat']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -2639,7 +2639,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['subprice']['width'] += (2 * ($tmpwidth - 10)); } - $rank = $rank + 10; + $rank += 10; $this->cols['qty'] = array( 'rank' => $rank, 'width' => 16, // in mm @@ -2650,7 +2650,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['progress'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -2665,7 +2665,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['progress']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['unit'] = array( 'rank' => $rank, 'width' => 11, // in mm @@ -2679,7 +2679,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['unit']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['discount'] = array( 'rank' => $rank, 'width' => 13, // in mm @@ -2693,22 +2693,22 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['discount']['status'] = true; } - $rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_PROPAL_HIDE_PRICE_EXCL_TAX') ? true : false, + 'status' => !getDolGlobalString('PDF_PROPAL_HIDE_PRICE_EXCL_TAX'), 'title' => array( 'textkey' => 'TotalHTShort' ), 'border-left' => true, // add left line separator ); - $rank = $rank + 1010; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1010; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalincltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_PROPAL_SHOW_PRICE_INCL_TAX') ? false : true, + 'status' => getDolGlobalBool('PDF_PROPAL_SHOW_PRICE_INCL_TAX'), 'title' => array( 'textkey' => 'TotalTTCShort' ), diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 65f5e84f0a47b..3bf4271aa06c4 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -34,7 +34,7 @@ class mod_facture_mars extends ModeleNumRefFactures { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -161,8 +161,8 @@ public function canBeActivated($object) * * @param Societe $objsoc Object third party * @param Facture $invoice Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string|int Value if OK, 0 if KO + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,1> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $invoice, $mode = 'next') { diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index a3607cac7a0d3..9ff41aa2258f6 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2022 Anthony Berton * 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 @@ -37,7 +38,7 @@ class mod_facture_mercure extends ModeleNumRefFactures { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -135,12 +136,12 @@ public function getExample() } /** - * Return next value + * Return next value not used or last value used * - * @param Societe $objsoc Object third party - * @param Facture $invoice Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string|int Value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param Facture $invoice Object invoice + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,1> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $invoice, $mode = 'next') { diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 66cbfc46b563d..25ac8001b86bd 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -34,7 +34,7 @@ class mod_facture_terre extends ModeleNumRefFactures { /** * Dolibarr version of the loaded document 'development', 'experimental', 'dolibarr' - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -200,10 +200,10 @@ public function canBeActivated($object) * ALTER TABLE llx_facture ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'FA' THEN CAST(SUBSTRING(ref FROM 10) AS SIGNED) ELSE 0 END) PERSISTENT; * ALTER TABLE llx_facture ADD INDEX calculated_numrefonly_idx (calculated_numrefonly); * - * @param Societe $objsoc Object third party + * @param Societe $objsoc Object third party * @param Facture $invoice Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string|int<-1,0> Next ref value or last ref if $mode is 'last', -1 or 0 if KO + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,1> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $invoice, $mode = 'next') { diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index 7c7392e30ebd3..2bf9f1fc5160b 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 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 @@ -62,9 +63,9 @@ abstract class ModelePDFFactures extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -78,6 +79,23 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Facture $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, <=0=KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable + + /** * Get the SwissQR object, including validation * @@ -250,5 +268,13 @@ public function addBottomQRInvoice(TCPDF $pdf, Facture $object, Translate $langs */ abstract class ModeleNumRefFactures extends CommonNumRefGenerator { - // No overload code + /** + * Return next value not used or last value used + * + * @param Societe $objsoc Object third party + * @param Facture $invoice Object invoice + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,1> Value if OK, <=0 if KO + */ + abstract public function getNextValue($objsoc, $invoice, $mode = 'next'); } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 6d51ddbe1ede1..6912fccb4ad4c 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -68,7 +68,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -123,10 +123,10 @@ public function __construct($db) * @param Fichinter $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -255,7 +255,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -409,7 +409,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 285a465cc1e8c..0ac08eb7e063f 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,7 @@ class mod_arctic extends ModeleNumRefFicheinter { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -46,7 +47,7 @@ class mod_arctic extends ModeleNumRefFicheinter /** * @var string Nom du modele - * @deprecated + * @deprecated Use $name, getName() * @see $name */ public $nom = 'arctic'; @@ -124,7 +125,7 @@ public function getExample() * * @param Societe|string $objsoc Object thirdparty * @param Fichinter|string $object Object we need next value for - * @return string|int Value if OK, 0 if KO + * @return string|int<-1,0> Next value if OK, <=0 if KO */ public function getNextValue($objsoc = '', $object = '') { diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index f721029b13290..15ee3e339b330 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -34,7 +34,7 @@ class mod_pacific extends ModeleNumRefFicheinter { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -47,7 +47,7 @@ class mod_pacific extends ModeleNumRefFicheinter /** * @var string Nom du modele - * @deprecated + * @deprecated Use $name, getName() * @see $name */ public $nom = 'pacific'; @@ -124,7 +124,7 @@ public function canBeActivated($object) * * @param Societe|string $objsoc Object thirdparty * @param Fichinter|string $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|int<-1,0> Next value if OK, <=0 if KO */ public function getNextValue($objsoc = '', $object = '') { diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index dc50dcb180432..727e1441ab2b7 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -38,11 +38,11 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator { // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation modules + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -55,6 +55,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Fichinter $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } @@ -63,7 +78,14 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefFicheinter extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Societe|string $objsoc Object thirdparty + * @param Fichinter|string $object Object we need next value for + * @return string|int<-1,0> Next value if OK, <=0 if KO + */ + abstract public function getNextValue($objsoc = '', $object = ''); } @@ -135,6 +157,8 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $obj = new $classname($db); + '@phan-var-force ModelePDFFicheinter $obj'; + // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output = $outputlangs->charset_output; diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php index 3f3225b39902f..03029517427a2 100644 --- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -2,6 +2,7 @@ /* Copyright (C) 2011-2019 Juanjo Menent * Copyright (C) 2018 Charlene Benke * 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 @@ -111,7 +112,7 @@ public function getExample() * * @param Societe $objsoc third party object * @param Holiday $holiday holiday object - * @return string|int Value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $holiday) { diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php index c084f48e46df1..9f10ed28eef72 100644 --- a/htdocs/core/modules/holiday/mod_holiday_madonna.php +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -113,9 +113,9 @@ public function canBeActivated($object) /** * Return next value * - * @param Societe $objsoc third party object - * @param Holiday $holiday Holiday object - * @return string|-1 Value if OK, -1 if KO + * @param Societe $objsoc third party object + * @param Holiday $holiday holiday object + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $holiday) { diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php index ef57eff7aa4b5..3b5dae7cf95f9 100644 --- a/htdocs/core/modules/holiday/modules_holiday.php +++ b/htdocs/core/modules/holiday/modules_holiday.php @@ -8,6 +8,7 @@ * Copyright (C) 2013 Philippe Grand * Copyright (C) 2014 Marcos García * Copyright (C) 2018 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 @@ -41,11 +42,11 @@ abstract class ModelePDFHoliday extends CommonDocGenerator { // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation modules + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -58,13 +59,35 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Holiday $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } /** * Parent class for all holidays numbering modules */ -class ModelNumRefHolidays extends CommonNumRefGenerator +abstract class ModelNumRefHolidays extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe $objsoc third party object + * @param Holiday $holiday holiday object + * @return string|int<-1,0> Value if OK, <=0 if KO + */ + abstract public function getNextValue($objsoc, $holiday); } diff --git a/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php b/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php index f581c42901ac8..f0f27172fb3a0 100644 --- a/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php +++ b/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php @@ -67,7 +67,7 @@ class pdf_standard_evaluation extends ModelePDFEvaluation /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -133,13 +133,13 @@ public function __construct($db) /** * Function to build pdf onto disk * - * @param Evaluation $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param Evaluation $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -263,7 +263,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1 - 4, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1 + 6); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -418,7 +418,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Page footer $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/hrm/mod_evaluation_advanced.php b/htdocs/core/modules/hrm/mod_evaluation_advanced.php index 79bc43b248048..9482b9989625c 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_advanced.php +++ b/htdocs/core/modules/hrm/mod_evaluation_advanced.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +27,7 @@ * \brief File containing class for advanced numbering model of Evaluation */ - require_once DOL_DOCUMENT_ROOT . '/core/modules/hrm/modules_evaluation.php'; +require_once DOL_DOCUMENT_ROOT . '/core/modules/hrm/modules_evaluation.php'; /** @@ -36,7 +37,7 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -125,7 +126,7 @@ public function getExample() * Return next free value * * @param Evaluation $object Object we need next value for - * @return string|int Value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/hrm/mod_evaluation_standard.php b/htdocs/core/modules/hrm/mod_evaluation_standard.php index 98fd02255c7ed..56555a4b8f79c 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_standard.php +++ b/htdocs/core/modules/hrm/mod_evaluation_standard.php @@ -34,7 +34,7 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -119,8 +119,8 @@ public function canBeActivated($object) /** * Return next free value * - * @param Evaluation $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @param Evaluation $object Object we need next value for + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/hrm/modules_evaluation.php b/htdocs/core/modules/hrm/modules_evaluation.php index 1e10efcd5993e..c2127651aade9 100644 --- a/htdocs/core/modules/hrm/modules_evaluation.php +++ b/htdocs/core/modules/hrm/modules_evaluation.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2012 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 @@ -42,9 +43,9 @@ abstract class ModelePDFEvaluation extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -57,6 +58,22 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Evaluation $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<0,1> 1=OK, 0=KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } @@ -66,5 +83,11 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefEvaluation extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Evaluation $object Object we need next value for + * @return string|int<-1,0> Value if OK, <=0 if KO + */ + abstract public function getNextValue($object); } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index a6631f0f4709f..ecfb9612891c6 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012-2016 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +47,7 @@ class ImportCsv extends ModeleImports /** * Dolibarr version of driver - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -587,7 +588,7 @@ public function import_insert($arrayrecord, $array_match_file_to_database, $obji } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') { if (strtolower($newval) == 'auto') { $this->thirdpartyobject->get_codecompta('customer'); - $newval = $this->thirdpartyobject->code_compta; + $newval = $this->thirdpartyobject->code_compta_client; //print 'code_compta='.$newval; } if (empty($newval)) { diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index dd02070d6123c..049537a491138 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -52,7 +52,7 @@ class ImportXlsx extends ModeleImports /** * Dolibarr version of driver - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -645,7 +645,7 @@ public function import_insert($arrayrecord, $array_match_file_to_database, $obji } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') { if (strtolower($newval) == 'auto') { $this->thirdpartyobject->get_codecompta('customer'); - $newval = $this->thirdpartyobject->code_compta; + $newval = $this->thirdpartyobject->code_compta_client; //print 'code_compta='.$newval; } if (empty($newval)) { diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 5e5a45163a1fe..243b83ad7ad97 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -71,7 +71,7 @@ class ModeleImports /** * Dolibarr version of driver - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index fe348963e1481..ab337600a1a5c 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This file is an example to follow to add your own email selector inside * the Dolibarr email tool. @@ -150,7 +151,7 @@ public function add_to_target_spec($mailing_id, $socid, $type_of_target, $contac if (!array_key_exists($obj->email, $cibles)) { $cibles[$obj->email] = array( 'email' => $obj->email, - 'fk_contact' =>$obj->id, + 'fk_contact' => $obj->id, 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'other' => '', @@ -184,7 +185,7 @@ public function add_to_target_spec($mailing_id, $socid, $type_of_target, $contac * array of SQL request that returns two field: * One called "label", One called "nb". * - * @return array Array with SQL requests + * @return string[] Array with SQL requests */ public function getSqlArrayForStats() { diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index bbe821716f03e..10acc659212ff 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -317,10 +318,10 @@ public function formFilter() /** - * Renvoie url lien vers fiche de la source du destinataire du mailing + * Provide the URL to the car of the source information of the recipient for the mailing * * @param int $id ID - * @return string Url lien + * @return string URL link */ public function url($id) { diff --git a/htdocs/core/modules/mailings/eventorganization.modules.php b/htdocs/core/modules/mailings/eventorganization.modules.php index d6261ae0d02b5..12a0562ae5dce 100644 --- a/htdocs/core/modules/mailings/eventorganization.modules.php +++ b/htdocs/core/modules/mailings/eventorganization.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2018-2018 Andre Schild * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This file is an example to follow to add your own email selector inside * the Dolibarr email tool. @@ -137,7 +138,7 @@ public function add_to_target($mailing_id) * array of SQL request that returns two field: * One called "label", One called "nb". * - * @return array Array with SQL requests + * @return string[] Array with SQL requests */ public function getSqlArrayForStats() { diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 6007b7adb9528..207f05e2d4c40 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2005-2009 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 @@ -212,10 +213,10 @@ public function formFilter() /** - * Renvoie url lien vers fiche de la source du destinataire du mailing + * Provide the URL to the car of the source information of the recipient for the mailing * - * @param int $id ID - * @return string Url lien + * @param int $id ID + * @return string URL link */ public function url($id) { diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 7a8d2d86f44f3..a61ded50bcc25 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2004 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2004 Eric Seigne + * 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 @@ -390,6 +391,7 @@ public static function getEmailingSelectorsList($forcedir = null) $objMod = new $modName($db); if (is_object($objMod)) { + '@phan-var-force ModeleBoxes $objMod'; // Define disabledbyname and disabledbymodule $disabledbyname = 0; $disabledbymodule = 0; // TODO Set to 2 if module is not enabled @@ -400,7 +402,7 @@ public static function getEmailingSelectorsList($forcedir = null) $disabledbyname = 1; } - // We set info of modules + // We set info of modules @phan-suppress-next-line PhanUndeclaredProperty $widget[$j]['picto'] = (empty($objMod->picto) ? (empty($objMod->boximg) ? img_object('', 'generic') : $objMod->boximg) : img_object('', $objMod->picto)); $widget[$j]['file'] = $files[$key]; $widget[$j]['fullpath'] = $fullpath[$key]; @@ -426,4 +428,21 @@ public static function getEmailingSelectorsList($forcedir = null) return $widget; } + + + /** + * On the main mailing area, there is a box with statistics. + * If you want to add a line in this report you must provide an + * array of SQL request that returns two field: + * One called "label", One called "nb". + * + * @return string[] Array with SQL requests + */ + public function getSqlArrayForStats() + { + // Needs to be implemented in child class + $msg = get_class($this)."::".__FUNCTION__." not implemented"; + dol_syslog($msg, LOG_ERR); + return array(); + } } diff --git a/htdocs/core/modules/mailings/partnership.modules.php b/htdocs/core/modules/mailings/partnership.modules.php index e3d64ff808399..a2874475f236d 100644 --- a/htdocs/core/modules/mailings/partnership.modules.php +++ b/htdocs/core/modules/mailings/partnership.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2018-2018 Andre Schild * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This file is an example to follow to add your own email selector inside * the Dolibarr email tool. @@ -159,7 +160,7 @@ public function add_to_target($mailing_id) * array of SQL request that returns two field: * One called "label", One called "nb". * - * @return array Array with SQL requests + * @return string[] Array with SQL requests */ public function getSqlArrayForStats() { diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 5cf555762d763..4d982621e946b 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.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 @@ -137,10 +138,10 @@ public function formFilter() /** - * Renvoie url lien vers fiche de la source du destinataire du mailing + * Provide the URL to the car of the source information of the recipient for the mailing * * @param int $id ID - * @return string Url lien + * @return string URL link */ public function url($id) { diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 0d1c0b6931ea2..7eda228bb24b8 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2018-2018 Andre Schild * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This file is an example to follow to add your own email selector inside * the Dolibarr email tool. @@ -226,7 +227,7 @@ public function add_to_target($mailing_id) * array of SQL request that returns two field: * One called "label", One called "nb". * - * @return array Array with SQL requests + * @return string[] Array with SQL requests */ public function getSqlArrayForStats() { diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 285b4ae3a261d..35a728566dd65 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This file is an example to follow to add your own email selector inside * the Dolibarr email tool. @@ -167,7 +168,7 @@ public function add_to_target($mailing_id) * array of SQL request that returns two field: * One called "label", One called "nb". * - * @return array Array with SQL requests + * @return string[] Array with SQL requests */ public function getSqlArrayForStats() { diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 55c5ce0bc54c7..5fad7010d053d 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.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 @@ -60,7 +61,7 @@ public function __construct($db) * array of SQL request that returns two field: * One called "label", One called "nb". * - * @return array Array with SQL requests + * @return string[] Array with SQL requests */ public function getSqlArrayForStats() { @@ -87,10 +88,10 @@ public function getNbOfRecipients($sql = '') /** - * Renvoie url lien vers fiche de la source du destinataire du mailing + * Provide the URL to the car of the source information of the recipient for the mailing * * @param int $id ID - * @return string Url lien + * @return string URL link */ public function url($id) { diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 1f1a7cb5aa8f2..3f844ec0d406d 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.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 @@ -60,7 +61,7 @@ public function __construct($db) * array of SQL request that returns two field: * One called "label", One called "nb". * - * @return array Array with SQL requests + * @return string[] Array with SQL requests */ public function getSqlArrayForStats() { @@ -87,10 +88,10 @@ public function getNbOfRecipients($sql = '') /** - * Renvoie url lien vers fiche de la source du destinataire du mailing + * Provide the URL to the car of the source information of the recipient for the mailing * * @param int $id ID - * @return string Url lien + * @return string URL link */ public function url($id) { diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index fec763d30d044..4c0f279e92f6f 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -39,7 +39,7 @@ class doc_generic_member_odt extends ModelePDFMember { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -51,7 +51,7 @@ class doc_generic_member_odt extends ModelePDFMember */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; // Load translation files required by the page $langs->loadLangs(array("main", "companies")); @@ -190,11 +190,11 @@ public function info($langs) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $mode Tell if doc module is called for 'member', ... - * @param int $nooutput 1=Generate only file on disk and do not return it on response + * @param int<0,1> $nooutput 1=Generate only file on disk and do not return it on response * @param string $filename Name of output file (without extension) - * @return int 1 if OK, <=0 if KO + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = 0, $filename = 'tmp_cards') + public function write_file($object, $outputlangs, $srctemplatepath = '', $mode = 'member', $nooutput = 0, $filename = 'tmp_cards') { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -339,10 +339,10 @@ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'mem complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook $parameters = array( - 'file'=>$file, - 'object'=>$object, - 'outputlangs'=>$outputlangs, - 'substitutionarray'=>&$tmparray + 'file' => $file, + 'object' => $object, + 'outputlangs' => $outputlangs, + 'substitutionarray' => &$tmparray ); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -374,7 +374,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'mem } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -402,7 +402,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'mem $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/member/doc/pdf_standard_member.class.php b/htdocs/core/modules/member/doc/pdf_standard_member.class.php index 7e9f438443fe9..7664273c5429d 100644 --- a/htdocs/core/modules/member/doc/pdf_standard_member.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard_member.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2015 Francis Appels * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +37,7 @@ class pdf_standard_member extends CommonStickerGenerator { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -48,7 +49,7 @@ class pdf_standard_member extends CommonStickerGenerator */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs; // Translations $langs->loadLangs(array("main", "admin")); diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php index 853601860a8a7..f7300eba1b281 100644 --- a/htdocs/core/modules/member/modules_cards.php +++ b/htdocs/core/modules/member/modules_cards.php @@ -143,6 +143,8 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o $obj = new $classname($db); + '@phan-var-force ModelePDFMember $obj'; + // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output = $outputlangs->charset_output; diff --git a/htdocs/core/modules/member/modules_member.class.php b/htdocs/core/modules/member/modules_member.class.php index ca21a6d782040..7ed8c7c5ed896 100644 --- a/htdocs/core/modules/member/modules_member.class.php +++ b/htdocs/core/modules/member/modules_member.class.php @@ -39,11 +39,11 @@ abstract class ModelePDFMember extends CommonDocGenerator { // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation modules + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -55,6 +55,22 @@ public static function liste_modeles($db, $maxfilenamelength = 0) $list = getListOfModels($db, $type, $maxfilenamelength); return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document + * + * @param Adherent $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param string $mode Tell if doc module is called for 'member', ... + * @param int<0,1> $nooutput 1=Generate only file on disk and do not return it on response + * @param string $filename Name of output file (without extension) + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $mode = 'member', $nooutput = 0, $filename = 'tmp_cards'); + // phpcs:enable } diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 9ea2ff996331f..cb91305a48368 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -102,6 +102,7 @@ public function __construct($db) } else { dol_print_error($this->db, $this->db->lasterror()); } + //$this->const[] = array("MAIN_AGENDA_XCAL_EXPORTKEY", "chaine", "123456", "Securekey for the public link"); // New pages on tabs // ----------------- @@ -586,4 +587,28 @@ public function __construct($db) $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; } + + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + global $conf; + + // Permissions + $this->remove($options); + + $sql = array( + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type='member' AND entity = ".((int) $conf->entity), + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".((int) $conf->entity).")" + ); + + return $this->_init($sql, $options); + } } diff --git a/htdocs/core/modules/modAi.class.php b/htdocs/core/modules/modAi.class.php index 4aa1f0cce755d..2bf7230a12d7e 100644 --- a/htdocs/core/modules/modAi.class.php +++ b/htdocs/core/modules/modAi.class.php @@ -379,9 +379,6 @@ public function init($options = '') $myTmpObjects['Availabilities'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); // foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - // if ($myTmpObjectKey == 'Availabilities') { - // continue; - // } // if ($myTmpObjectArray['includerefgeneration']) { // $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_availabilitiess.odt'; // $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index 1e358738b271a..c08828442c9c3 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -1,9 +1,10 @@ - * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2019 Maxime Kohlhaas - * Copyright (C) 2021 Ferran Marcet +/* Copyright (C) 2004-2018 Laurent Destailleur + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2019 Maxime Kohlhaas + * Copyright (C) 2021 Ferran Marcet * Copyright (C) 2024 MDW + * Copyright (C) 2024 Rafael San José * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -455,6 +456,8 @@ public function init($options = '') { global $conf, $langs; + $result = $this->_load_tables('/install/mysql/', 'bom'); + // Create extrafields //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index 92df539aad2d4..4fe4cd081b4c2 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -121,7 +121,7 @@ public function __construct($db) array('DATAPOLICY_ADHERENT', 'chaine', '', $langs->trans('NUMBER_MONTH_BEFORE_DELETION'), 0), ); - $country = explode(":", !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY') ? '' : $conf->global->MAIN_INFO_SOCIETE_COUNTRY); + //$country = explode(":", getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')); // Some keys to add into the overwriting translation tables /* $this->overwrite_translation = array( @@ -176,7 +176,7 @@ public function __construct($db) // Cronjobs (List of cron jobs entries to add when module is enabled) // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week $this->cronjobs = array( - 0 => array('label' => 'DATAPOLICYJob', 'jobtype' => 'method', 'class' => 'datapolicy/class/datapolicycron.class.php', 'objectname' => 'DataPolicyCron', 'method' => 'cleanDataForDataPolicy', 'parameters' => '', 'comment' => 'Clean data', 'frequency' => 1, 'unitfrequency' => 86400, 'status' => 1, 'test' => '$conf->datapolicy->enabled'), + 0 => array('label' => 'DATAPOLICYJob', 'jobtype' => 'method', 'class' => 'datapolicy/class/datapolicycron.class.php', 'objectname' => 'DataPolicyCron', 'method' => 'cleanDataForDataPolicy', 'parameters' => '', 'comment' => 'Clean data', 'frequency' => 1, 'unitfrequency' => 86400, 'status' => 1, 'test' => 'isModEnabled("datapolicy")'), ); // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 4f59e7bdbe5bf..e4be0d8b18f00 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -445,9 +445,6 @@ public function init($options = '') $myTmpObjects['ConferenceOrBooth'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'ConferenceOrBooth') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/eventorganization/template_conferenceorbooths.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/eventorganization'; diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 36633e11f5dca..0448e1a8f11d3 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -357,8 +357,6 @@ public function init($options = '') } } - $sql = array(); - $sql = array( "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'shipping' AND entity = ".((int) $conf->entity), "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."', 'shipping', ".((int) $conf->entity).")", diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 16c8e98367360..dd10071abf66e 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2021 Alexandre Spangaro * Copyright (C) 2022 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 @@ -65,7 +66,7 @@ public function __construct($db) $this->dirs = array("/facture/temp"); // Dependencies - $this->depends = array('always'=>"modSociete"); + $this->depends = array('always' => "modSociete"); $this->requiredby = array("modComptabilite", "modAccounting"); $this->conflictwith = array(); $this->langfiles = array("bills", "companies", "compta", "products"); @@ -103,10 +104,10 @@ public function __construct($db) // Boxes //$this->boxes = array(0=>array(1=>'box_factures_imp.php'),1=>array(1=>'box_factures.php')); $this->boxes = array( - 0=>array('file'=>'box_factures_imp.php', 'enabledbydefaulton'=>'Home'), - 1=>array('file'=>'box_factures.php', 'enabledbydefaulton'=>'Home'), - 2=>array('file'=>'box_graph_invoices_permonth.php', 'enabledbydefaulton'=>'Home'), - 3=>array('file'=>'box_customers_outstanding_bill_reached.php', 'enabledbydefaulton'=>'Home') + 0 => array('file' => 'box_factures_imp.php', 'enabledbydefaulton' => 'Home'), + 1 => array('file' => 'box_factures.php', 'enabledbydefaulton' => 'Home'), + 2 => array('file' => 'box_graph_invoices_permonth.php', 'enabledbydefaulton' => 'Home'), + 3 => array('file' => 'box_customers_outstanding_bill_reached.php', 'enabledbydefaulton' => 'Home') ); // Cronjobs @@ -114,34 +115,34 @@ public function __construct($db) $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0 => array( - 'label'=>'RecurringInvoicesJob', - 'jobtype'=>'method', - 'class'=>'compta/facture/class/facture-rec.class.php', - 'objectname'=>'FactureRec', - 'method'=>'createRecurringInvoices', - 'parameters'=>'', - 'comment'=>'Generate recurring invoices', - 'frequency'=>1, - 'unitfrequency'=>3600 * 24, - 'priority'=>51, - 'status'=>1, - 'test'=>'$conf->facture->enabled', - 'datestart'=>$datestart + 'label' => 'RecurringInvoicesJob', + 'jobtype' => 'method', + 'class' => 'compta/facture/class/facture-rec.class.php', + 'objectname' => 'FactureRec', + 'method' => 'createRecurringInvoices', + 'parameters' => '', + 'comment' => 'Generate recurring invoices', + 'frequency' => 1, + 'unitfrequency' => 3600 * 24, + 'priority' => 51, + 'status' => 1, + 'test' => '$conf->facture->enabled', + 'datestart' => $datestart ), 1 => array( - 'label'=>'SendEmailsRemindersOnInvoiceDueDate', - 'jobtype'=>'method', - 'class'=>'compta/facture/class/facture.class.php', - 'objectname'=>'Facture', - 'method'=>'sendEmailsRemindersOnInvoiceDueDate', - 'parameters'=>"10,all,EmailTemplateCode,duedate", - 'comment'=>'Send an email when we reach the invoice due date (or invoice date) - n days. First param is n, the number of days before due date (or invoice date) to send the remind (or after if value is negative), second parameter is "all" or a payment mode code, third parameter is the code of the email template to use (an email template with the EmailTemplateCode must exists. The version of the email template in the language of the thirdparty will be used in priority. Language of the thirdparty will be also used to update the PDF of the sent invoice). The fourth parameter is the string "duedate" (default) or "invoicedate" to define which date of the invoice to use.', - 'frequency'=>1, - 'unitfrequency'=>3600 * 24, - 'priority'=>50, - 'status'=>0, - 'test'=>'$conf->facture->enabled', - 'datestart'=>$datestart + 'label' => 'SendEmailsRemindersOnInvoiceDueDate', + 'jobtype' => 'method', + 'class' => 'compta/facture/class/facture.class.php', + 'objectname' => 'Facture', + 'method' => 'sendEmailsRemindersOnInvoiceDueDate', + 'parameters' => "10,all,EmailTemplateCode,duedate", + 'comment' => 'Send an email when we reach the invoice due date (or invoice date) - n days. First param is n, the number of days before due date (or invoice date) to send the remind (or after if value is negative), second parameter is "all" or a payment mode code, third parameter is the code of the email template to use (an email template with the EmailTemplateCode must exists. The version of the email template in the language of the thirdparty will be used in priority. Language of the thirdparty will be also used to update the PDF of the sent invoice). The fourth parameter is the string "duedate" (default) or "invoicedate" to define which date of the invoice to use.', + 'frequency' => 1, + 'unitfrequency' => 3600 * 24, + 'priority' => 50, + 'status' => 0, + 'test' => '$conf->facture->enabled', + 'datestart' => $datestart ), ); @@ -506,21 +507,21 @@ public function __construct($db) $this->export_permission[$r] = array(array("facture", "facture", "export", "other")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom' => 'ParentCompany', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State', - 's.phone'=>'Phone', - 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', - 's.code_compta'=>'CustomerAccountancyCode', - 's.code_compta_fournisseur'=>'SupplierAccountancyCode', - 's.tva_intra'=>'VATIntra', - 't.libelle'=>"ThirdPartyType", // 'ce.code'=>"Staff", "cfj.libelle"=>"JuridicalStatus", - 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.fk_facture_source'=>'SourceInvoiceId', - 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", - 'f.fk_cond_reglement'=>'IdPaymentTerm', 'f.fk_mode_reglement'=>'IdPaymentMode', - 'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", - 'f.localtax1'=>"TotalLT1", 'f.localtax2'=>"TotalLT2", - 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', - 'none.rest'=>'Rest', - 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic" + 's.rowid' => "IdCompany", 's.nom' => 'CompanyName', 'ps.nom' => 'ParentCompany', 's.code_client' => 'CustomerCode', 's.address' => 'Address', 's.zip' => 'Zip', 's.town' => 'Town', 'c.code' => 'CountryCode', 'cd.nom' => 'State', + 's.phone' => 'Phone', + 's.siren' => 'ProfId1', 's.siret' => 'ProfId2', 's.ape' => 'ProfId3', 's.idprof4' => 'ProfId4', + 's.code_compta' => 'CustomerAccountancyCode', + 's.code_compta_fournisseur' => 'SupplierAccountancyCode', + 's.tva_intra' => 'VATIntra', + 't.libelle' => "ThirdPartyType", // 'ce.code'=>"Staff", "cfj.libelle"=>"JuridicalStatus", + 'f.rowid' => "InvoiceId", 'f.ref' => "InvoiceRef", 'f.ref_client' => 'RefCustomer', 'f.fk_facture_source' => 'SourceInvoiceId', + 'f.type' => "Type", 'f.datec' => "InvoiceDateCreation", 'f.datef' => "DateInvoice", 'f.date_lim_reglement' => "DateDue", + 'f.fk_cond_reglement' => 'IdPaymentTerm', 'f.fk_mode_reglement' => 'IdPaymentMode', + 'f.total_ht' => "TotalHT", 'f.total_ttc' => "TotalTTC", 'f.total_tva' => "TotalVAT", + 'f.localtax1' => "TotalLT1", 'f.localtax2' => "TotalLT2", + 'f.paye' => "InvoicePaidCompletely", 'f.fk_statut' => 'InvoiceStatus', 'f.close_code' => 'EarlyClosingReason', 'f.close_note' => 'EarlyClosingComment', + 'none.rest' => 'Rest', + 'f.note_private' => "NotePrivate", 'f.note_public' => "NotePublic" ); if (!$uselocaltax1) { unset($this->export_fields_array[$r]['f.localtax1']); @@ -542,10 +543,10 @@ public function __construct($db) $this->export_fields_array[$r]['f.module_source'] = 'Module'; $this->export_fields_array[$r]['f.pos_source'] = 'POSTerminal'; } - $this->export_fields_array[$r] = $this->export_fields_array[$r] + array( - 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', - 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', - 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel' + $this->export_fields_array[$r] += array( + 'f.fk_user_author' => 'CreatedById', 'uc.login' => 'CreatedByLogin', + 'f.fk_user_valid' => 'ValidatedById', 'uv.login' => 'ValidatedByLogin', + 'pj.ref' => 'ProjectRef', 'pj.title' => 'ProjectLabel' ); // Add multicompany field if (getDolGlobalString('MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED')) { @@ -554,16 +555,16 @@ public function __construct($db) $this->export_fields_array[$r]['f.entity'] = 'Entity'; } } - $this->export_fields_array[$r] = $this->export_fields_array[$r] + array( - 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", - 'fd.subprice'=>"LineUnitPrice", 'fd.qty'=>"LineQty", - 'fd.tva_tx'=>"LineVATRate", - 'fd.total_ht'=>"LineTotalHT", 'fd.total_tva'=>"LineTotalVAT", 'fd.total_ttc'=>"LineTotalTTC", - 'fd.localtax1_tx'=>"LineLT1Rate", 'fd.localtax1_type'=>"LineLT1Type", 'fd.total_localtax1'=>"LineTotalLT1", - 'fd.localtax2_tx'=>"LineLT2Rate", 'fd.localtax2_type'=>"LineLT2Type", 'fd.total_localtax2'=>"LineTotalLT2", - 'fd.buy_price_ht'=>'BuyingPrice', 'fd.date_start'=>"DateStart", 'fd.date_end'=>"DateEnd", 'fd.special_code'=>'SpecialCode', - 'fd.product_type'=>"TypeOfLineServiceOrProduct", 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', - $alias_product_perentity . '.accountancy_code_sell'=>'ProductAccountancySellCode', + $this->export_fields_array[$r] += array( + 'fd.rowid' => 'LineId', 'fd.description' => "LineDescription", + 'fd.subprice' => "LineUnitPrice", 'fd.qty' => "LineQty", + 'fd.tva_tx' => "LineVATRate", + 'fd.total_ht' => "LineTotalHT", 'fd.total_tva' => "LineTotalVAT", 'fd.total_ttc' => "LineTotalTTC", + 'fd.localtax1_tx' => "LineLT1Rate", 'fd.localtax1_type' => "LineLT1Type", 'fd.total_localtax1' => "LineTotalLT1", + 'fd.localtax2_tx' => "LineLT2Rate", 'fd.localtax2_type' => "LineLT2Type", 'fd.total_localtax2' => "LineTotalLT2", + 'fd.buy_price_ht' => 'BuyingPrice', 'fd.date_start' => "DateStart", 'fd.date_end' => "DateEnd", 'fd.special_code' => 'SpecialCode', + 'fd.product_type' => "TypeOfLineServiceOrProduct", 'fd.fk_product' => 'ProductId', 'p.ref' => 'ProductRef', 'p.label' => 'ProductLabel', + $alias_product_perentity . '.accountancy_code_sell' => 'ProductAccountancySellCode', 'aa.account_number' => 'AccountingAffectation' ); if (!$uselocaltax1) { @@ -578,44 +579,44 @@ public function __construct($db) } $this->export_TypeFields_array[$r] = array( - 's.rowid'=>'Numeric', 's.nom'=>'Text', 'ps.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', - 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', - 't.libelle'=>"Text", // 'ce.code'=>"List:c_effectif:libelle:code", "cfj.libelle"=>"Text", - 'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.fk_facture_source'=>'Numeric', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", - 'f.fk_cond_reglement'=>'Numeric', 'f.fk_mode_reglement'=>'Numeric', - 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text', - 'none.rest'=>"NumericCompute", - 'f.note_private'=>"Text", 'f.note_public'=>"Text", + 's.rowid' => 'Numeric', 's.nom' => 'Text', 'ps.nom' => 'Text', 's.code_client' => 'Text', 's.address' => 'Text', 's.zip' => 'Text', 's.town' => 'Text', 'c.code' => 'Text', 'cd.nom' => 'Text', 's.phone' => 'Text', 's.siren' => 'Text', + 's.siret' => 'Text', 's.ape' => 'Text', 's.idprof4' => 'Text', 's.code_compta' => 'Text', 's.code_compta_fournisseur' => 'Text', 's.tva_intra' => 'Text', + 't.libelle' => "Text", // 'ce.code'=>"List:c_effectif:libelle:code", "cfj.libelle"=>"Text", + 'f.rowid' => 'Numeric', 'f.ref' => "Text", 'f.ref_client' => 'Text', 'f.fk_facture_source' => 'Numeric', 'f.type' => "Numeric", 'f.datec' => "Date", 'f.datef' => "Date", 'f.date_lim_reglement' => "Date", + 'f.fk_cond_reglement' => 'Numeric', 'f.fk_mode_reglement' => 'Numeric', + 'f.total_ht' => "Numeric", 'f.total_ttc' => "Numeric", 'f.total_tva' => "Numeric", 'f.localtax1' => 'Numeric', 'f.localtax2' => 'Numeric', 'f.paye' => "Boolean", 'f.fk_statut' => 'Numeric', 'f.close_code' => 'Text', 'f.close_note' => 'Text', + 'none.rest' => "NumericCompute", + 'f.note_private' => "Text", 'f.note_public' => "Text", 'f.module_source' => 'Text', 'f.pos_source' => 'Text', - 'f.entity'=>'List:entity:label:rowid', - 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text', - 'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric", - 'fd.qty'=>"Numeric", 'fd.buy_price_ht'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date", - 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.total_localtax1'=>"Numeric", 'fd.total_localtax2'=>"Numeric", - 'fd.localtax1_tx'=>'Numeric', 'fd.localtax2_tx'=>'Numeric', 'fd.localtax1_type'=>'Numeric', 'fd.localtax2_type'=>'Numeric', - 'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text', - $alias_product_perentity . '.accountancy_code_sell'=>'Text', + 'f.entity' => 'List:entity:label:rowid', + 'f.fk_user_author' => 'Numeric', 'uc.login' => 'Text', 'f.fk_user_valid' => 'Numeric', 'uv.login' => 'Text', + 'pj.ref' => 'Text', 'pj.title' => 'Text', 'fd.rowid' => 'Numeric', 'fd.description' => "Text", 'fd.subprice' => "Numeric", 'fd.tva_tx' => "Numeric", + 'fd.qty' => "Numeric", 'fd.buy_price_ht' => "Numeric", 'fd.date_start' => "Date", 'fd.date_end' => "Date", + 'fd.total_ht' => "Numeric", 'fd.total_tva' => "Numeric", 'fd.total_ttc' => "Numeric", 'fd.total_localtax1' => "Numeric", 'fd.total_localtax2' => "Numeric", + 'fd.localtax1_tx' => 'Numeric', 'fd.localtax2_tx' => 'Numeric', 'fd.localtax1_type' => 'Numeric', 'fd.localtax2_type' => 'Numeric', + 'fd.special_code' => 'Numeric', 'fd.product_type' => "Numeric", 'fd.fk_product' => 'List:product:label', 'p.ref' => 'Text', 'p.label' => 'Text', + $alias_product_perentity . '.accountancy_code_sell' => 'Text', 'aa.account_number' => 'Text', 'f.multicurrency_code' => 'Text', 'f.multicurrency_tx' => 'Number', 'f.multicurrency_total_ht' => 'Number', 'f.multicurrency_total_tva' => 'Number', 'f.multicurrency_total_ttc' => 'Number' ); $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company', - 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company', - 't.libelle'=>'company', // 'ce.code'=>'company', 'cfj.libelle'=>'company' - 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.description'=>"invoice_line", - 'fd.subprice'=>"invoice_line", 'fd.buy_price_ht'=>'invoice_line', - 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.total_localtax1'=>"invoice_line", 'fd.total_localtax2'=>"invoice_line", - 'fd.tva_tx'=>"invoice_line", 'fd.localtax1_tx'=>"invoice_line", 'fd.localtax2_tx'=>"invoice_line", 'fd.localtax1_type'=>"invoice_line", 'fd.localtax2_type'=>"invoice_line", - 'fd.qty'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>'invoice_line', - 'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity . '.accountancy_code_sell'=>'product', - 'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user', + 's.rowid' => "company", 's.nom' => 'company', 'ps.nom' => 'company', 's.code_client' => 'company', 's.address' => 'company', 's.zip' => 'company', 's.town' => 'company', 'c.code' => 'company', 'cd.nom' => 'company', 's.phone' => 'company', + 's.siren' => 'company', 's.siret' => 'company', 's.ape' => 'company', 's.idprof4' => 'company', 's.code_compta' => 'company', 's.code_compta_fournisseur' => 'company', 's.tva_intra' => 'company', + 't.libelle' => 'company', // 'ce.code'=>'company', 'cfj.libelle'=>'company' + 'pj.ref' => 'project', 'pj.title' => 'project', 'fd.rowid' => 'invoice_line', 'fd.description' => "invoice_line", + 'fd.subprice' => "invoice_line", 'fd.buy_price_ht' => 'invoice_line', + 'fd.total_ht' => "invoice_line", 'fd.total_tva' => "invoice_line", 'fd.total_ttc' => "invoice_line", 'fd.total_localtax1' => "invoice_line", 'fd.total_localtax2' => "invoice_line", + 'fd.tva_tx' => "invoice_line", 'fd.localtax1_tx' => "invoice_line", 'fd.localtax2_tx' => "invoice_line", 'fd.localtax1_type' => "invoice_line", 'fd.localtax2_type' => "invoice_line", + 'fd.qty' => "invoice_line", 'fd.date_start' => "invoice_line", 'fd.date_end' => "invoice_line", 'fd.special_code' => 'invoice_line', + 'fd.product_type' => 'invoice_line', 'fd.fk_product' => 'product', 'p.ref' => 'product', 'p.label' => 'product', $alias_product_perentity . '.accountancy_code_sell' => 'product', + 'f.fk_user_author' => 'user', 'uc.login' => 'user', 'f.fk_user_valid' => 'user', 'uv.login' => 'user', 'aa.account_number' => "invoice_line", ); - $this->export_help_array[$r] = array('fd.buy_price_ht'=>'CostPriceUsage'); - $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); - $this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_help_array[$r] = array('fd.buy_price_ht' => 'CostPriceUsage'); + $this->export_special_array[$r] = array('none.rest' => 'getRemainToPay'); + $this->export_dependencies_array[$r] = array('invoice_line' => 'fd.rowid', 'product' => 'fd.rowid', 'none.rest' => array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; @@ -668,19 +669,19 @@ public function __construct($db) $this->export_icon[$r] = 'invoice'; $this->export_permission[$r] = array(array("facture", "facture", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State', - 's.phone'=>'Phone', - 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', - 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', - 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.fk_facture_source'=>'SourceInvoiceId', - 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", - 'f.fk_cond_reglement'=>'IdPaymentTerm', 'f.fk_mode_reglement'=>'IdPaymentMode', - 'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.localtax1'=>'LT1', 'f.localtax2'=>'LT2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', - 'none.rest'=>'Rest', - 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', - 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'p.rowid'=>'PaymentId', 'p.ref'=>'PaymentRef', - 'p.amount'=>'AmountPayment', 'pf.amount'=>'AmountPaymentDistributedOnInvoice', 'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber', - 'pt.code'=>'CodePaymentMode', 'pt.libelle'=>'LabelPaymentMode', 'p.note'=>'PaymentNote', 'p.fk_bank'=>'IdTransaction', 'ba.ref'=>'AccountRef' + 's.rowid' => "IdCompany", 's.nom' => 'CompanyName', 's.code_client' => 'CustomerCode', 's.address' => 'Address', 's.zip' => 'Zip', 's.town' => 'Town', 'c.code' => 'CountryCode', 'cd.nom' => 'State', + 's.phone' => 'Phone', + 's.siren' => 'ProfId1', 's.siret' => 'ProfId2', 's.ape' => 'ProfId3', 's.idprof4' => 'ProfId4', 's.code_compta' => 'CustomerAccountancyCode', + 's.code_compta_fournisseur' => 'SupplierAccountancyCode', 's.tva_intra' => 'VATIntra', + 'f.rowid' => "InvoiceId", 'f.ref' => "InvoiceRef", 'f.ref_client' => 'RefCustomer', 'f.fk_facture_source' => 'SourceInvoiceId', + 'f.type' => "Type", 'f.datec' => "InvoiceDateCreation", 'f.datef' => "DateInvoice", 'f.date_lim_reglement' => "DateDue", + 'f.fk_cond_reglement' => 'IdPaymentTerm', 'f.fk_mode_reglement' => 'IdPaymentMode', + 'f.total_ht' => "TotalHT", 'f.total_ttc' => "TotalTTC", 'f.total_tva' => "TotalVAT", 'f.localtax1' => 'LT1', 'f.localtax2' => 'LT2', 'f.paye' => "InvoicePaidCompletely", 'f.fk_statut' => 'InvoiceStatus', 'f.close_code' => 'EarlyClosingReason', 'f.close_note' => 'EarlyClosingComment', + 'none.rest' => 'Rest', + 'f.note_private' => "NotePrivate", 'f.note_public' => "NotePublic", 'f.fk_user_author' => 'CreatedById', 'uc.login' => 'CreatedByLogin', + 'f.fk_user_valid' => 'ValidatedById', 'uv.login' => 'ValidatedByLogin', 'pj.ref' => 'ProjectRef', 'pj.title' => 'ProjectLabel', 'p.rowid' => 'PaymentId', 'p.ref' => 'PaymentRef', + 'p.amount' => 'AmountPayment', 'pf.amount' => 'AmountPaymentDistributedOnInvoice', 'p.datep' => 'DatePayment', 'p.num_paiement' => 'PaymentNumber', + 'pt.code' => 'CodePaymentMode', 'pt.libelle' => 'LabelPaymentMode', 'p.note' => 'PaymentNote', 'p.fk_bank' => 'IdTransaction', 'ba.ref' => 'AccountRef' ); if (!$uselocaltax1) { unset($this->export_fields_array[$r]['f.localtax1']); @@ -689,7 +690,7 @@ public function __construct($db) unset($this->export_fields_array[$r]['f.localtax2']); } - $this->export_help_array[$r] = array('f.paye'=>'InvoicePaidCompletelyHelp'); + $this->export_help_array[$r] = array('f.paye' => 'InvoicePaidCompletelyHelp'); if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; $this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; @@ -703,29 +704,29 @@ public function __construct($db) $this->export_fields_array[$r]['f.pos_source'] = 'POSTerminal'; } $this->export_TypeFields_array[$r] = array( - 's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', - 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', - 'f.rowid'=>"Numeric", 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.fk_facture_source'=>'Numeric', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", - 'f.fk_cond_reglement'=>'Numeric', 'f.fk_mode_reglement'=>'Numeric', - 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.close_code'=>'Text', 'f.close_note'=>'Text', - 'none.rest'=>'NumericCompute', - 'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text', - 'pj.ref'=>'Text', 'pj.title'=>'Text', 'p.amount'=>'Numeric', 'pf.amount'=>'Numeric', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.title'=>'Text', 'p.datep'=>'Date', 'p.num_paiement'=>'Numeric', - 'p.fk_bank'=>'Numeric', 'p.note'=>'Text', 'pt.code'=>'Text', 'pt.libelle'=>'text', 'ba.ref'=>'Text' + 's.rowid' => 'Numeric', 's.nom' => 'Text', 's.code_client' => 'Text', 's.address' => 'Text', 's.zip' => 'Text', 's.town' => 'Text', 'c.code' => 'Text', 'cd.nom' => 'Text', 's.phone' => 'Text', 's.siren' => 'Text', + 's.siret' => 'Text', 's.ape' => 'Text', 's.idprof4' => 'Text', 's.code_compta' => 'Text', 's.code_compta_fournisseur' => 'Text', 's.tva_intra' => 'Text', + 'f.rowid' => "Numeric", 'f.ref' => "Text", 'f.ref_client' => 'Text', 'f.fk_facture_source' => 'Numeric', 'f.type' => "Numeric", 'f.datec' => "Date", 'f.datef' => "Date", 'f.date_lim_reglement' => "Date", + 'f.fk_cond_reglement' => 'Numeric', 'f.fk_mode_reglement' => 'Numeric', + 'f.total_ht' => "Numeric", 'f.total_ttc' => "Numeric", 'f.total_tva' => "Numeric", 'f.localtax1' => 'Numeric', 'f.localtax2' => 'Numeric', 'f.paye' => "Boolean", 'f.fk_statut' => 'Status', 'f.close_code' => 'Text', 'f.close_note' => 'Text', + 'none.rest' => 'NumericCompute', + 'f.note_private' => "Text", 'f.note_public' => "Text", 'f.fk_user_author' => 'Numeric', 'uc.login' => 'Text', 'f.fk_user_valid' => 'Numeric', 'uv.login' => 'Text', + 'pj.ref' => 'Text', 'pj.title' => 'Text', 'p.amount' => 'Numeric', 'pf.amount' => 'Numeric', 'p.rowid' => 'Numeric', 'p.ref' => 'Text', 'p.title' => 'Text', 'p.datep' => 'Date', 'p.num_paiement' => 'Numeric', + 'p.fk_bank' => 'Numeric', 'p.note' => 'Text', 'pt.code' => 'Text', 'pt.libelle' => 'text', 'ba.ref' => 'Text' ); if (!empty($conf->cashdesk->enabled) || !empty($conf->takepos->enabled) || getDolGlobalString('INVOICE_SHOW_POS')) { $this->export_fields_array[$r]['f.module_source'] = 'POSModule'; $this->export_fields_array[$r]['f.pos_source'] = 'POSTerminal'; } $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company', - 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', - 's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'p.rowid'=>'payment', 'p.ref'=>'payment', 'p.amount'=>'payment', 'pf.amount'=>'payment', 'p.datep'=>'payment', - 'p.num_paiement'=>'payment', 'pt.code'=>'payment', 'pt.libelle'=>'payment', 'p.note'=>'payment', 'f.fk_user_author'=>'user', 'uc.login'=>'user', - 'f.fk_user_valid'=>'user', 'uv.login'=>'user', 'p.fk_bank'=>'account', 'ba.ref'=>'account' + 's.rowid' => "company", 's.nom' => 'company', 's.code_client' => 'company', 's.address' => 'company', 's.zip' => 'company', 's.town' => 'company', 'c.code' => 'company', 'cd.nom' => 'company', 's.phone' => 'company', + 's.siren' => 'company', 's.siret' => 'company', 's.ape' => 'company', 's.idprof4' => 'company', 's.code_compta' => 'company', 's.code_compta_fournisseur' => 'company', + 's.tva_intra' => 'company', 'pj.ref' => 'project', 'pj.title' => 'project', 'p.rowid' => 'payment', 'p.ref' => 'payment', 'p.amount' => 'payment', 'pf.amount' => 'payment', 'p.datep' => 'payment', + 'p.num_paiement' => 'payment', 'pt.code' => 'payment', 'pt.libelle' => 'payment', 'p.note' => 'payment', 'f.fk_user_author' => 'user', 'uc.login' => 'user', + 'f.fk_user_valid' => 'user', 'uv.login' => 'user', 'p.fk_bank' => 'account', 'ba.ref' => 'account' ); - $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); - $this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them, or just to have field we need + $this->export_special_array[$r] = array('none.rest' => 'getRemainToPay'); + $this->export_dependencies_array[$r] = array('payment' => 'p.rowid', 'none.rest' => array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them, or just to have field we need $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index 80dd7b5fe9a93..92a1da8e8d0af 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -447,9 +447,6 @@ public function init($options = '') $myTmpObjects['KnowledgeRecord'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'KnowledgeRecord') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/knowledgemanagement/template_knowledgerecords.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/knowledgemanagement'; diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index e99045d05fc00..099cce8a574e3 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -463,9 +463,6 @@ public function init($options = '') $myTmpObjects['Partnership'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'Partnership') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_partnerships.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index a34ea519d2ab0..20137d7c90598 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -315,7 +315,7 @@ public function __construct($db) // End add extra fields $this->import_fieldshidden_array[$r] = array('t.fk_user_creat'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'projet'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_convertvalue_array[$r] = array( - 't.ref'=>array('rule'=>'getrefifauto', 'class'=>(!getDolGlobalString('PROJECT_ADDON') ? 'mod_project_simple' : $conf->global->PROJECT_ADDON), 'path'=>"/core/modules/project/".(!getDolGlobalString('PROJECT_ADDON') ? 'mod_project_simple' : $conf->global->PROJECT_ADDON).'.php'), + 't.ref' => array('rule' => 'getrefifauto', 'class' => getDolGlobalString('PROJECT_ADDON', 'mod_project_simple'), 'path' => "/core/modules/project/".getDolGlobalString('PROJECT_ADDON', 'mod_project_simple').'.php'), 't.fk_soc' => array( 'rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', diff --git a/htdocs/core/modules/modRecruitment.class.php b/htdocs/core/modules/modRecruitment.class.php index 89e26d587e29f..5bc9fe4516bd6 100644 --- a/htdocs/core/modules/modRecruitment.class.php +++ b/htdocs/core/modules/modRecruitment.class.php @@ -417,9 +417,6 @@ public function init($options = '') $myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration' => 1, 'includedocgeneration' => 1); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } if ($myTmpObjectArray['includedocgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_recruitmentjobposition.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; diff --git a/htdocs/core/modules/modSocialNetworks.class.php b/htdocs/core/modules/modSocialNetworks.class.php index a62b249f410a7..df025b3b82c06 100644 --- a/htdocs/core/modules/modSocialNetworks.class.php +++ b/htdocs/core/modules/modSocialNetworks.class.php @@ -37,8 +37,6 @@ class modSocialNetworks extends DolibarrModules */ public function __construct($db) { - global $langs, $conf; - $this->db = $db; $this->numero = 3400; @@ -61,7 +59,7 @@ public function __construct($db) $this->dirs = array(); // Config pages - $this->config_page_url = array(DOL_URL_ROOT.'/admin/dict.php?id=38'); + $this->config_page_url = array(DOL_URL_ROOT.'/admin/dict.php?id=38&from=socialnetworksetup'); // Dependencies $this->hidden = getDolGlobalInt('MODULE_SOCIALNETWORKS_DISABLED'); // A condition to hide module diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 003fd8acf1b03..ffdcfa41b9d9b 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -305,9 +305,9 @@ public function __construct($db) 'e.rowid' => 'IdWarehouse', 'e.ref' => 'LocationSummary', 'e.description' => 'DescWareHouse', 'e.lieu' => 'LieuWareHouse', 'e.address' => 'Address', 'e.zip' => 'Zip', 'e.town' => 'Town', 'p.rowid' => "ProductId", 'p.ref' => "Ref", 'p.fk_product_type' => "Type", 'p.label' => "Label", 'p.description' => "Description", 'p.note' => "Note", 'p.price' => "Price", 'p.tva_tx' => 'VAT', 'p.tosell' => "OnSell", 'p.tobuy' => 'OnBuy', 'p.duration' => "Duration", - 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification', 'p.pmp' => 'PMPValue', 'p.cost_price' => 'CostPrice', + 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification', 'p.pmp' => 'PMPValue', 'p.cost_price' => 'CostPrice', 'lcpn.label'=>'Nature', 'pb.rowid' => 'Id', 'pb.batch' => 'Batch', 'pb.qty' => 'Qty', - 'pl.eatby' => 'EatByDate', 'pl.sellby' => 'SellByDate' + 'pl.eatby' => 'EatByDate', 'pl.sellby' => 'SellByDate', 'none.dateLastMovement' => 'LastMovement' ); if (isModEnabled('barcode')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode' => 'BarCode')); @@ -316,9 +316,9 @@ public function __construct($db) 'e.rowid' => 'List:entrepot:ref::stock', 'e.ref' => 'Text', 'e.lieu' => 'Text', 'e.description' => 'Text', 'e.address' => 'Text', 'e.zip' => 'Text', 'e.town' => 'Text', 'p.rowid' => "Numeric", 'p.ref' => "Text", 'p.fk_product_type' => "Text", 'p.label' => "Text", 'p.description' => "Text", 'p.note' => "Text", 'p.price' => "Numeric", 'p.tva_tx' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", 'p.duration' => "Duree", - 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification', 'p.pmp' => 'PMPValue', 'p.cost_price' => 'CostPrice', + 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification', 'p.pmp' => 'PMPValue', 'p.cost_price' => 'CostPrice', 'lcpn.label'=>'Text', 'pb.batch' => 'Text', 'pb.qty' => 'Numeric', - 'pl.eatby' => 'Date', 'pl.sellby' => 'Date' + 'pl.eatby' => 'Date', 'pl.sellby' => 'Date', 'none.dateLastMovement' => 'Date' ); if (isModEnabled('barcode')) { $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode' => 'Text')); @@ -326,10 +326,13 @@ public function __construct($db) $this->export_entities_array[$r] = array( 'p.rowid' => "product", 'p.ref' => "product", 'p.fk_product_type' => "product", 'p.label' => "product", 'p.description' => "product", 'p.note' => "product", 'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", - 'p.datec' => 'product', 'p.tms' => 'product', 'p.pmp' => 'product', 'p.cost_price' => 'product', - 'pb.rowid' => 'batch', 'pb.batch' => 'batch', 'pb.qty' => 'batch', + 'p.datec' => 'product', 'p.tms' => 'product', 'p.pmp' => 'product', 'p.cost_price' => 'product', 'lcpn.label'=>'product', + 'pb.rowid' => 'batch', 'pb.batch' => 'batch', 'pb.qty' => 'batch', 'none.dateLastMovement' => 'movement', 'pl.eatby' => 'batch', 'pl.sellby' => 'batch' ); // We define here only fields that use another icon that the one defined into export_icon + $this->export_special_array[$r] = array( + 'none.dateLastMovement'=>array('rule'=>'compute', 'classfile'=>'/product/stock/class/mouvementstock.class.php', 'class'=>'MouvementStock', 'method'=>'getDateLastMovementProductBatch', 'method_params'=>['e_rowid', 'p_rowid', 'pb_batch']), + ); if (isModEnabled('barcode')) { $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product')); } @@ -345,7 +348,8 @@ public function __construct($db) $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_stock as ps ON ps.rowid = pb.fk_product_stock'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = ps.fk_product'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl ON pl.fk_product = p.rowid AND pl.batch = pb.batch'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot_extrafields as extra ON extra.fk_object = pl.rowid,'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot_extrafields as extra ON extra.fk_object = pl.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_product_nature as lcpn on lcpn.code = p.finished,'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'entrepot as e'; $this->export_sql_end[$r] .= ' WHERE ps.fk_entrepot = e.rowid'; $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; @@ -409,7 +413,7 @@ public function __construct($db) 'id.batch' => 'Lotserial', 'e.rowid' => 'IdWarehouse', 'e.ref' => 'LocationSummary', 'e.description' => 'DescWareHouse', 'e.lieu' => 'LieuWareHouse', 'e.address' => 'Address', 'e.zip' => 'Zip', 'e.town' => 'Town', 'p.rowid' => "ProductId", 'p.ref' => "Ref", 'p.fk_product_type' => "Type", 'p.label' => "Label", 'p.description' => "Description", 'p.note' => "Note", - 'p.price' => "Price", 'p.tva_tx' => 'VAT', 'p.tosell' => "OnSell", 'p.tobuy' => 'OnBuy', 'p.duration' => "Duration", 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification' + 'p.barcode' => "Barcode", 'p.price' => "Price", 'p.tva_tx' => 'VAT', 'p.tosell' => "OnSell", 'p.tobuy' => 'OnBuy', 'p.duration' => "Duration", 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification' ); if (isModEnabled('barcode')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode' => 'BarCode')); @@ -418,7 +422,7 @@ public function __construct($db) 'id.rowid' => 'Numeric', 'e.rowid' => 'List:entrepot:ref::stock', 'e.ref' => 'Text', 'e.description' => 'Text', 'e.lieu' => 'Text', 'e.address' => 'Text', 'e.zip' => 'Text', 'e.town' => 'Text', 'p.rowid' => "Numeric", 'p.ref' => "Text", 'p.fk_product_type' => "Text", 'p.label' => "Text", 'p.description' => "Text", 'p.note' => "Text", - 'p.price' => "Numeric", 'p.tva_tx' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", 'p.duration' => "Duree", 'p.datec' => 'Date', 'p.tms' => 'Date', + 'p.barcode' => "Text", 'p.price' => "Numeric", 'p.tva_tx' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", 'p.duration' => "Duree", 'p.datec' => 'Date', 'p.tms' => 'Date', 'i.rowid' => 'Numeric', 'i.ref' => 'Text', 'i.date_inventory' => 'Date', 'i.status' => 'Numeric', 'i.title' => 'Text', 'id.qty_view' => 'Numeric', 'id.qty_stock' => 'Numeric', 'id.batch' => 'Text', 'id.qty_regulated' => 'Numeric', 'id.fk_warehouse' => 'Numeric', @@ -429,7 +433,7 @@ public function __construct($db) $this->export_entities_array[$r] = array( 'e.rowid' => 'warehouse', 'e.ref' => 'warehouse', 'e.description' => 'warehouse', 'e.lieu' => 'warehouse', 'e.address' => 'warehouse', 'e.zip' => 'warehouse', 'e.town' => 'warehouse', 'p.rowid' => "product", 'p.ref' => "product", 'p.fk_product_type' => "product", 'p.label' => "product", 'p.description' => "product", 'p.note' => "product", - 'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", 'p.datec' => 'product', 'p.tms' => 'product' + 'p.barcode' => "product", 'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", 'p.datec' => 'product', 'p.tms' => 'product' ); // We define here only fields that use another icon that the one defined into export_icon if (isModEnabled('productbatch')) { $this->export_fields_array[$r]['id.batch'] = 'Batch'; diff --git a/htdocs/core/modules/modWorkstation.class.php b/htdocs/core/modules/modWorkstation.class.php index cc656a9c03db9..2f5a184640883 100644 --- a/htdocs/core/modules/modWorkstation.class.php +++ b/htdocs/core/modules/modWorkstation.class.php @@ -394,9 +394,6 @@ public function init($options = '') $myTmpObjects['Workstation'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'Workstation') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/workstation/template_workstations.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/workstation'; diff --git a/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php b/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php index 3324865d54cbf..21045e9ec2106 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php @@ -125,15 +125,15 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build pdf onto disk * * @param MouvementStock $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -711,7 +711,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -743,7 +743,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/movement/modules_movement.php b/htdocs/core/modules/movement/modules_movement.php index 1f95210055f22..063f8f628fbfe 100644 --- a/htdocs/core/modules/movement/modules_movement.php +++ b/htdocs/core/modules/movement/modules_movement.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 @@ -47,18 +48,18 @@ abstract class ModelePDFMovement extends CommonDocGenerator /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation modules + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -71,4 +72,20 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build document + * + * @param MouvementStock $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index f19deec6f4c67..dc48a7f5fa143 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2021 Philippe Grand * 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 @@ -41,7 +42,7 @@ class doc_generic_mo_odt extends ModelePDFMo { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -183,17 +184,17 @@ public function info($langs) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build pdf onto disk * - * @param MO $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param Mo $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -310,7 +311,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -369,7 +370,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -406,7 +407,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -438,7 +439,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -460,14 +461,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index faa364523c0ba..0e7b04d97c37a 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -5,8 +5,9 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Josep Lluís Amador * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,7 +71,7 @@ class pdf_vinci extends ModelePDFMo /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -125,15 +126,15 @@ public function __construct($db) /** * Function to build pdf onto disk * - * @param Mo $object Id of object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param Mo $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs = null, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $mysoc; @@ -389,7 +390,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $posyafter + 6; } else { $height_note = 0; @@ -581,7 +582,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -1334,9 +1335,15 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'status' => true, 'width' => 35, // in mm 'title' => array( - 'textkey' => 'Ref' + 'textkey' => 'Ref', + 'align' => 'L', + 'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left ), 'border-left' => true, // add left line separator + 'content' => array( + 'align' => 'L', + 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), ); $rank = 1; // do not use negative rank @@ -1358,7 +1365,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = $rank + 10; + $rank += 10; $this->cols['dim'] = array( 'rank' => $rank, 'status' => true, @@ -1369,7 +1376,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['qty'] = array( 'rank' => $rank, 'width' => 16, // in mm @@ -1380,7 +1387,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['qtytot'] = array( 'rank' => $rank, 'width' => 25, // in mm diff --git a/htdocs/core/modules/mrp/mod_mo_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php index eb147ff2f2abd..3c8e8bae56428 100644 --- a/htdocs/core/modules/mrp/mod_mo_advanced.php +++ b/htdocs/core/modules/mrp/mod_mo_advanced.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019-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 @@ -37,7 +38,7 @@ class mod_mo_advanced extends ModeleNumRefMos { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -126,7 +127,7 @@ public function getExample() * * @param Product $objprod Object product * @param Mo $object Object we need next value for - * @return string|int Value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objprod, $object) { diff --git a/htdocs/core/modules/mrp/mod_mo_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php index b835a07614ffb..599ceef2c0db3 100644 --- a/htdocs/core/modules/mrp/mod_mo_standard.php +++ b/htdocs/core/modules/mrp/mod_mo_standard.php @@ -33,7 +33,7 @@ class mod_mo_standard extends ModeleNumRefMos { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -116,7 +116,7 @@ public function canBeActivated($object) * * @param Product $objprod Object product * @param Mo $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objprod, $object) { diff --git a/htdocs/core/modules/mrp/modules_mo.php b/htdocs/core/modules/mrp/modules_mo.php index 9d542be1208f7..1e9955a27b182 100644 --- a/htdocs/core/modules/mrp/modules_mo.php +++ b/htdocs/core/modules/mrp/modules_mo.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2012 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 @@ -43,9 +44,9 @@ abstract class ModelePDFMo extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -58,6 +59,20 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Mo $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } @@ -66,5 +81,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefMos extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Product $objprod Object product + * @param Mo $object Object we need next value for + * @return string|int<-1,0> Value if OK, <=0 if KO + */ + abstract public function getNextValue($objprod, $object); } diff --git a/htdocs/core/modules/oauth/generic_oauthcallback.php b/htdocs/core/modules/oauth/generic_oauthcallback.php index b2c75f381b4f9..787b730e0a5e0 100644 --- a/htdocs/core/modules/oauth/generic_oauthcallback.php +++ b/htdocs/core/modules/oauth/generic_oauthcallback.php @@ -1,6 +1,7 @@ * 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 @@ -22,6 +23,17 @@ * \brief Page to get oauth callback */ +// Force keyforprovider +$forlogin = 0; +if (!empty($_GET['state']) && preg_match('/^forlogin-/', $_GET['state'])) { + $forlogin = 1; + $_GET['keyforprovider'] = 'Login'; +} + +if (!defined('NOLOGIN') && $forlogin) { + define("NOLOGIN", 1); // This means this output page does not require to be logged. +} + // Load Dolibarr environment require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; @@ -29,18 +41,21 @@ use OAuth\Common\Consumer\Credentials; // Define $urlwithroot +global $dolibarr_main_url_root; $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current +$langs->load("oauth"); $action = GETPOST('action', 'aZ09'); $backtourl = GETPOST('backtourl', 'alpha'); $keyforprovider = GETPOST('keyforprovider', 'aZ09'); -if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) { +if (!GETPOSTISSET('keyforprovider') && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) { + // If we are coming from the Oauth page $keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"]; } -$genericstring = 'OTHER'; +$genericstring = 'GENERIC'; /** @@ -64,9 +79,6 @@ //$httpClient->setCurlParameters($params); $serviceFactory->setHttpClient($httpClient); -// Dolibarr storage -$storage = new DoliStorage($db, $conf, $keyforprovider); - // Setup the credentials for the requests $keyforparamid = 'OAUTH_'.$genericstring.($keyforprovider ? '-'.$keyforprovider : '').'_ID'; $keyforparamsecret = 'OAUTH_'.$genericstring.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET'; @@ -77,17 +89,35 @@ ); $state = GETPOST('state'); +$statewithscopeonly = ''; +$statewithanticsrfonly = ''; $requestedpermissionsarray = array(); if ($state) { - $requestedpermissionsarray = explode(',', $state); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back + // 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back + $statewithscopeonly = preg_replace('/\-.*$/', '', preg_replace('/^forlogin-/', '', $state)); + $requestedpermissionsarray = explode(',', $statewithscopeonly); // Example: 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print'. + $statewithanticsrfonly = preg_replace('/^.*\-/', '', $state); } -if ($action != 'delete' && empty($requestedpermissionsarray)) { - print 'Error, parameter state is not defined'; - exit; + +// Add a test to check that the state parameter is provided into URL when we make the first call to ask the redirect or when we receive the callback +// but not when callback was ok and we recall the page +if ($action != 'delete' && !GETPOSTINT('afteroauthloginreturn') && (empty($statewithscopeonly) || empty($requestedpermissionsarray))) { + dol_syslog("state or statewithscopeonly and/or requestedpermissionsarray are empty"); + setEventMessages($langs->trans('ScopeUndefined'), null, 'errors'); + if (empty($backtourl)) { + $backtourl = DOL_URL_ROOT.'/'; + } + header('Location: '.$backtourl); + exit(); } + //var_dump($requestedpermissionsarray);exit; + +// Dolibarr storage +$storage = new DoliStorage($db, $conf, $keyforprovider); + // Instantiate the Api service using the credentials, http client and storage mechanism for the token // ucfirst(strtolower($genericstring)) must be the name of a class into OAuth/OAuth2/Services/Xxxx $apiService = $serviceFactory->createService(ucfirst(strtolower($genericstring)), $credentials, $storage, $requestedpermissionsarray); @@ -99,21 +129,26 @@ var_dump($requestedpermissionsarray); */ -if (empty($apiService)) { - print 'Error, failed to create serviceFactory'; +if (empty($apiService) || !$apiService instanceof OAuth\OAuth2\Service\Generic) { + print 'Error, failed to create Generic serviceFactory'; + exit; +} +if (!$apiService->getBaseApiUri()) { + print 'Error, setup of OAuth entry is not complete (missing base url)'; exit; } // access type needed to have oauth provider refreshing token -//$apiService->setAccessType('offline'); - -$langs->load("oauth"); +// also note that a refresh token is sent only after a prompt +if (method_exists($apiService, 'setAccessType')) { + $apiService->setAccessType('offline'); // Most generic OAUTH provider does not provide AccessType online/offline. They are mostly offline. // @phan-suppress-current-line PhanUndeclaredMethod +} if (!getDolGlobalString($keyforparamid)) { - accessforbidden('Setup of service is not complete. Customer ID is missing'); + accessforbidden('Setup of service '.$keyforparamid.' is not complete. Customer ID is missing'); } if (!getDolGlobalString($keyforparamsecret)) { - accessforbidden('Setup of service is not complete. Secret key is missing'); + accessforbidden('Setup of service '.$keyforparamid.' is not complete. Secret key is missing'); } @@ -134,52 +169,224 @@ exit(); } -if (GETPOST('code') || GETPOST('error')) { // We are coming from oauth provider page - // We should have - //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) - - dol_syslog("We are coming from the oauth provider page code=".dol_trunc(GETPOST('code'), 5)." error=".GETPOST('error')); - - // This was a callback request from service, get the token - try { - //var_dump($state); - //var_dump($apiService); // OAuth\OAuth2\Service\Xxx - - if (GETPOST('error')) { - setEventMessages(GETPOST('error').' '.GETPOST('error_description'), null, 'errors'); - } else { - //$token = $apiService->requestAccessToken(GETPOST('code'), $state); - $token = $apiService->requestAccessToken(GETPOST('code')); - - setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token - } - - $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; - unset($_SESSION["backtourlsavedbeforeoauthjump"]); +if (!GETPOST('code') && !GETPOST('error')) { + dol_syslog("Page is called without the 'code' parameter defined"); - header('Location: '.$backtourl); - exit(); - } catch (Exception $e) { - print $e->getMessage(); - } -} else { - // If we enter this page without 'code' parameter, we arrive here. This is the case when we want to get the redirect + // If we enter this page without 'code' parameter, it means we click on the link from login page ($forlogin is set) or from setup page and we want to get the redirect // to the OAuth provider login page. $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; $_SESSION['oauthstateanticsrf'] = $state; + // Save more data into session + // No need to save more data in sessions. We have several info into $_SESSION['datafromloginform'], saved when form is posted with a click + // on "Login with Generic" with param actionlogin=login and beforeoauthloginredirect=generic, by the functions_genericoauth.php. + + // Set approval_prompt. Note: A refresh token will be provided only if prompt is done. + if ($forlogin) { + $approval_prompt = getDolGlobalString('OAUTH_'.$genericstring.'_FORCE_PROMPT_ON_LOGIN', 'auto'); // Can be 'force' + if (method_exists($apiService, 'setApprouvalPrompt')) { + $apiService->setApprouvalPrompt($approval_prompt); // @phan-suppress-current-line PhanUndeclaredMethod + } + } else { + if (method_exists($apiService, 'setApprouvalPrompt')) { + $apiService->setApprouvalPrompt('force'); // @phan-suppress-current-line PhanUndeclaredMethod + } + } + // This may create record into oauth_state before the header redirect. - // Creation of record with state in this tables depend on the Provider used (see its constructor). + // Creation of record with state, create record or just update column state of table llx_oauth_token (and create/update entry in llx_oauth_state) depending on the Provider used (see its constructor). if ($state) { - $url = $apiService->getAuthorizationUri(array('state' => $state)); + $url = $apiService->getAuthorizationUri(array('client_id' => getDolGlobalString($keyforparamid), 'response_type' => 'code', 'state' => $state)); } else { - $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated + $url = $apiService->getAuthorizationUri(array('client_id' => getDolGlobalString($keyforparamid), 'response_type' => 'code')); // Parameter state will be randomly generated } + // The redirect_uri is included into this $url + + // Add scopes + $url .= '&scope='.str_replace(',', '+', $statewithscopeonly); + + // Add more param + $url .= '&nonce='.bin2hex(random_bytes(64 / 8)); + + if ($forlogin) { + // TODO Add param hd. What is it for ? + //$url .= 'hd=xxx'; + + if (GETPOST('username')) { + $url .= '&login_hint='.urlencode(GETPOST('username')); + } - // we go on oauth provider authorization page + // Check that the redirect_uri that will be used is same than url of current domain + + // Define $urlwithroot + global $dolibarr_main_url_root; + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + include DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + $currentrooturl = getRootURLFromURL(DOL_MAIN_URL_ROOT); + $externalrooturl = getRootURLFromURL($urlwithroot); + + if ($currentrooturl != $externalrooturl) { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorTheUrlOfYourDolInstanceDoesNotMatchURLIntoOAuthSetup", $currentrooturl, $externalrooturl), null, 'errors'); + $url = DOL_URL_ROOT; + } + } + + //var_dump($url);exit; + + // we go on oauth provider authorization page, we will then go back on this page but into the other branch of the if (!GETPOST('code')) header('Location: '.$url); exit(); +} else { + // We are coming from the return of an OAuth2 provider page. + dol_syslog("We are coming from the oauth provider page keyforprovider=".$keyforprovider." code=".dol_trunc(GETPOST('code'), 5)); + + // We must validate that the $state is the same than the one into $_SESSION['oauthstateanticsrf'], return error if not. + if (isset($_SESSION['oauthstateanticsrf']) && $state != $_SESSION['oauthstateanticsrf']) { + //var_dump($_SESSION['oauthstateanticsrf']);exit; + print 'Value for state='.dol_escape_htmltag($state).' differs from value in $_SESSION["oauthstateanticsrf"]. Code is refused.'; + unset($_SESSION['oauthstateanticsrf']); + } else { + // This was a callback request from service, get the token + try { + //var_dump($apiService); // OAuth\OAuth2\Service\Generic + //dol_syslog("_GET=".var_export($_GET, true)); + + $errorincheck = 0; + + $db->begin(); + + // This requests the token from the received OAuth code (call of the endpoint) + // Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php and into database table llx_oauth_token + $token = $apiService->requestAccessToken(GETPOST('code'), $state); + + '@phan-var-force OAuth\Common\Token\AbstractToken $token'; + + // The refresh token is inside the object token if the prompt was forced only. + //$refreshtoken = $token->getRefreshToken(); + //var_dump($refreshtoken); + + // Note: The extraparams has the 'id_token' than contains a lot of information about the user. + $extraparams = $token->getExtraParams(); + + $username = ''; + $useremail = ''; + + // Extract the middle part, base64 decode, then json_decode it + /* + $jwt = explode('.', $extraparams['id_token']); + + if (!empty($jwt[1])) { + $userinfo = json_decode(base64_decode($jwt[1]), true); + + dol_syslog("userinfo=".var_export($userinfo, true)); + + $useremail = $userinfo['email']; + + // We should make the steps of validation of id_token + + // Verify that the state is the one expected + // TODO + + // Verify that the ID token is properly signed by the issuer. + // TODO + + // Verify that the value of the iss claim in the ID token is equal to https://accounts.google.com or accounts.google.com. + if ($userinfo['iss'] != 'accounts.google.com' && $userinfo['iss'] != 'https://accounts.google.com') { + setEventMessages($langs->trans('Bad value for returned userinfo[iss]'), null, 'errors'); + $errorincheck++; + } + + // Verify that the value of the aud claim in the ID token is equal to your app's client ID. + if ($userinfo['aud'] != getDolGlobalString($keyforparamid)) { + setEventMessages($langs->trans('Bad value for returned userinfo[aud]'), null, 'errors'); + $errorincheck++; + } + + // Verify that the expiry time (exp claim) of the ID token has not passed. + if ($userinfo['exp'] <= dol_now()) { + setEventMessages($langs->trans('Bad value for returned userinfo[exp]. Token expired.'), null, 'errors'); + $errorincheck++; + } + + // If you specified a hd parameter value in the request, verify that the ID token has a hd claim that matches an accepted G Suite hosted domain. + // $userinfo['hd'] is the domain name of Gmail account. + // TODO + } + */ + + if (!$errorincheck) { + // If call back to url for a OAUTH2 login + if ($forlogin) { + dol_syslog("we received the login/email to log to, it is ".$useremail); + + $tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']); + $entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1); + + // Delete the old token + $storage->clearToken($genericstring); // Delete the token called ("Generic-".$storage->keyforprovider) + + $tmpuser = new User($db); + $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. + + if ($res > 0) { + $username = $tmpuser->login; + + $_SESSION['genericoauth_receivedlogin'] = dol_hash($conf->file->instance_unique_id.$username, '0'); + dol_syslog('We set $_SESSION[\'genericoauth_receivedlogin\']='.$_SESSION['genericoauth_receivedlogin']); + } else { + $errormessage = "Failed to login using '.$genericstring.'. User with the Email '".$useremail."' was not found"; + if ($entitytosearchuser > 0) { + $errormessage .= ' ('.$langs->trans("Entity").' '.$entitytosearchuser.')'; + } + $_SESSION["dol_loginmesg"] = $errormessage; + $errorincheck++; + + dol_syslog($errormessage); + } + } + } else { + // If call back to url for a OAUTH2 login + if ($forlogin) { + $_SESSION["dol_loginmesg"] = "Failed to login using '.$genericstring.'. OAuth callback URL retrieves a token with non valid data"; + $errorincheck++; + } + } + + if (!$errorincheck) { + $db->commit(); + } else { + $db->rollback(); + } + + $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; + unset($_SESSION["backtourlsavedbeforeoauthjump"]); + + if (empty($backtourl)) { + $backtourl = DOL_URL_ROOT.'/'; + } + + // If call back to this url was for a OAUTH2 login + if ($forlogin) { + // _SESSION['genericoauth_receivedlogin'] has been set to the key to validate the next test by function_genericoauth(), so we can make the redirect + $backtourl .= '?actionlogin=login&afteroauthloginreturn=1&mainmenu=home'.($username ? '&username='.urlencode($username) : '').'&token='.newToken(); + if (!empty($tmparray['entity'])) { + $backtourl .= '&entity='.$tmparray['entity']; + } + } + + dol_syslog("Redirect now on backtourl=".$backtourl); + + header('Location: '.$backtourl); + exit(); + } catch (Exception $e) { + print $e->getMessage(); + } + } } diff --git a/htdocs/core/modules/oauth/github_oauthcallback.php b/htdocs/core/modules/oauth/github_oauthcallback.php index 23f9be9272411..6f5a895b6c378 100644 --- a/htdocs/core/modules/oauth/github_oauthcallback.php +++ b/htdocs/core/modules/oauth/github_oauthcallback.php @@ -1,6 +1,7 @@ * 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 @@ -87,6 +88,7 @@ // Instantiate the Api service using the credentials, http client and storage mechanism for the token $apiService = $serviceFactory->createService('GitHub', $credentials, $storage, $requestedpermissionsarray); +'@phan-var-force OAuth\OAuth2\Service\AbstractService|OAuth\OAuth1\Service\AbstractService $apiService'; // createService is only ServiceInterface // access type needed to have oauth provider refreshing token //$apiService->setAccessType('offline'); diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 1949caeadd9cd..0a6ce5def56cc 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -1,6 +1,7 @@ * 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 @@ -124,6 +125,7 @@ // $requestedpermissionsarray contains list of scopes. // Conversion into URL is done by Reflection on constant with name SCOPE_scope_in_uppercase $apiService = $serviceFactory->createService('Google', $credentials, $storage, $requestedpermissionsarray); +'@phan-var-force OAuth\OAuth2\Service\Google $apiService'; // createService is only ServiceInterface // access type needed to have oauth provider refreshing token // also note that a refresh token is sent only after a prompt @@ -151,10 +153,11 @@ exit(); } + if (!GETPOST('code')) { dol_syslog("Page is called without the 'code' parameter defined"); - // If we enter this page without 'code' parameter, it means we click on the link from login page and we want to get the redirect + // If we enter this page without 'code' parameter, it means we click on the link from login page ($forlogin is set) or from setup page and we want to get the redirect // to the OAuth provider login page. $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; @@ -164,14 +167,16 @@ // No need to save more data in sessions. We have several info into $_SESSION['datafromloginform'], saved when form is posted with a click // on "Login with Google" with param actionlogin=login and beforeoauthloginredirect=google, by the functions_googleoauth.php. + // Set approval_prompt. Note: A refresh token will be provided only if prompt is done. if ($forlogin) { - // Set approval_prompt $approval_prompt = getDolGlobalString('OAUTH_GOOGLE_FORCE_PROMPT_ON_LOGIN', 'auto'); // Can be 'force' $apiService->setApprouvalPrompt($approval_prompt); + } else { + $apiService->setApprouvalPrompt('force'); } // This may create record into oauth_state before the header redirect. - // Creation of record with state in this tables depend on the Provider used (see its constructor). + // Creation of record with state, create record or just update column state of table llx_oauth_token (and create/update entry in llx_oauth_state) depending on the Provider used (see its constructor). if ($state) { $url = $apiService->getAuthorizationUri(array('state' => $state)); } else { @@ -180,7 +185,7 @@ // The redirect_uri is included into this $url // Add more param - $url .= '&nonce='.bin2hex(random_bytes(64/8)); + $url .= '&nonce='.bin2hex(random_bytes(64 / 8)); if ($forlogin) { // TODO Add param hd. What is it for ? @@ -209,7 +214,9 @@ } } - // we go on oauth provider authorization page + //var_dump($url);exit; + + // we go on oauth provider authorization page, we will then go back on this page but into the other branch of the if (!GETPOST('code')) header('Location: '.$url); exit(); } else { @@ -233,9 +240,13 @@ $db->begin(); // This requests the token from the received OAuth code (call of the https://oauth2.googleapis.com/token endpoint) - // Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php, so into table llx_oauth_token + // Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php and into database table llx_oauth_token $token = $apiService->requestAccessToken(GETPOST('code'), $state); + // The refresh token is inside the object token if the prompt was forced only. + //$refreshtoken = $token->getRefreshToken(); + //var_dump($refreshtoken); + // Note: The extraparams has the 'id_token' than contains a lot of information about the user. $extraparams = $token->getExtraParams(); $jwt = explode('.', $extraparams['id_token']); @@ -305,8 +316,8 @@ $tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']); $entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1); - // Delete the token - $storage->clearToken('Google'); + // Delete the old token + $storage->clearToken('Google'); // Delete the token called ("Google-".$storage->keyforprovider) $tmpuser = new User($db); $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. diff --git a/htdocs/core/modules/oauth/microsoft2_oauthcallback.php b/htdocs/core/modules/oauth/microsoft2_oauthcallback.php index 6ee6ca64430ca..38405c680ecb4 100644 --- a/htdocs/core/modules/oauth/microsoft2_oauthcallback.php +++ b/htdocs/core/modules/oauth/microsoft2_oauthcallback.php @@ -1,6 +1,7 @@ * 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 @@ -95,6 +96,7 @@ // Conversion into URL is done by Reflection on constant with name SCOPE_scope_in_uppercase try { $apiService = $serviceFactory->createService(ucfirst(strtolower($genericstring)), $credentials, $storage, $requestedpermissionsarray); + '@phan-var-force OAuth\OAuth2\Service\AbstractService|OAuth\OAuth1\Service\AbstractService $apiService'; // createService is only ServiceInterface } catch (Exception $e) { print $e->getMessage(); exit; diff --git a/htdocs/core/modules/oauth/microsoft_oauthcallback.php b/htdocs/core/modules/oauth/microsoft_oauthcallback.php index c8cd593bf078c..d315b7903bb87 100644 --- a/htdocs/core/modules/oauth/microsoft_oauthcallback.php +++ b/htdocs/core/modules/oauth/microsoft_oauthcallback.php @@ -1,6 +1,7 @@ * 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 @@ -95,6 +96,7 @@ // Conversion into URL is done by Reflection on constant with name SCOPE_scope_in_uppercase try { $apiService = $serviceFactory->createService(ucfirst(strtolower($genericstring)), $credentials, $storage, $requestedpermissionsarray); + '@phan-var-force OAuth\OAuth2\Service\AbstractService|OAuth\OAuth1\Service\AbstractService $apiService'; // createService is only ServiceInterface } catch (Exception $e) { print $e->getMessage(); exit; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 68a544ec8f120..5541cdc417da8 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +33,7 @@ class mod_payment_ant extends ModeleNumRefPayments { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -121,7 +122,7 @@ public function getExample() * * @param Societe $objsoc Object thirdparty * @param Object $object Object we need next value for - * @return string|int Value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index 5991cc2be9319..d49230d3f3e05 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -32,7 +32,7 @@ class mod_payment_cicada extends ModeleNumRefPayments { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -120,9 +120,9 @@ public function canBeActivated($object) /** * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/payment/modules_payment.php b/htdocs/core/modules/payment/modules_payment.php index d0913c71e2399..d67f0e7671f71 100644 --- a/htdocs/core/modules/payment/modules_payment.php +++ b/htdocs/core/modules/payment/modules_payment.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 @@ -23,5 +24,12 @@ */ abstract class ModeleNumRefPayments extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for + * @return string|int<-1,0> Value if OK, <=0 if KO + */ + abstract public function getNextValue($objsoc, $object); } diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php index d082604c707ca..ea5bcf0239720 100644 --- a/htdocs/core/modules/printing/modules_printing.php +++ b/htdocs/core/modules/printing/modules_printing.php @@ -42,6 +42,12 @@ class PrintingDriver */ public $error = ''; + /** + * @var string[] Error codes (or messages) + */ + public $errors = array(); + + /** * @var string Name */ @@ -115,4 +121,46 @@ public function getDesc() return $this->desc; } } + + /** + * Return list of available printers + * + * @return int 0 if OK, >0 if KO + */ + public function listAvailablePrinters() + { + $msg = get_class($this)."::".__FUNCTION__." not implemented"; + dol_syslog($msg, LOG_ERR); + $this->errors[] = $msg; + return 1; + } + + /** + * Return list of available printers + * + * @return array list of printers + */ + public function getlistAvailablePrinters() + { + $msg = get_class($this)."::".__FUNCTION__." not implemented"; + dol_syslog($msg, LOG_ERR); + $this->errors[] = $msg; + return []; + } + + /** + * Print selected file + * + * @param string $file file + * @param string $module module + * @param string $subdir subdir for file + * @return int 0 if OK, >0 if KO + */ + public function printFile($file, $module, $subdir = '') + { + $msg = get_class($this)."::".__FUNCTION__." not implemented"; + dol_syslog($msg, LOG_ERR); + $this->errors[] = $msg; + return 1; + } } diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index eac957eaaa442..eb23451323469 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.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 @@ -69,16 +70,6 @@ class printing_printgcp extends PrintingDriver */ public $google_secret = ''; - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); - /** * @var DoliDB Database handler. */ @@ -110,9 +101,9 @@ public function __construct($db) if (!$conf->oauth->enabled) { $this->conf[] = array( - 'varname'=>'PRINTGCP_INFO', - 'info'=>$langs->transnoentitiesnoconv("WarningModuleNotActive", "OAuth"), - 'type'=>'info', + 'varname' => 'PRINTGCP_INFO', + 'info' => $langs->transnoentitiesnoconv("WarningModuleNotActive", "OAuth"), + 'type' => 'info', ); } else { $keyforprovider = ''; // @FIXME @@ -131,6 +122,7 @@ public function __construct($db) $access = ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? 'HasAccessToken' : 'NoAccessToken'); $serviceFactory = new \OAuth\ServiceFactory(); $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array()); + '@phan-var-force OAuth\OAuth2\Service\Google $apiService'; // createService is only ServiceInterface $token_ok = true; try { $token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE); @@ -158,13 +150,13 @@ public function __construct($db) } } if ($this->google_id != '' && $this->google_secret != '') { - $this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info'); + $this->conf[] = array('varname' => 'PRINTGCP_INFO', 'info' => 'GoogleAuthConfigured', 'type' => 'info'); $this->conf[] = array( - 'varname'=>'PRINTGCP_TOKEN_ACCESS', - 'info'=>$access, - 'type'=>'info', - 'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), - 'delete'=>($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp') : '') + 'varname' => 'PRINTGCP_TOKEN_ACCESS', + 'info' => $access, + 'type' => 'info', + 'renew' => $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), + 'delete' => ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp') : '') ); if ($token_ok) { $expiredat = ''; @@ -181,9 +173,9 @@ public function __construct($db) $expiredat = dol_print_date($endoflife, "dayhour"); } - $this->conf[] = array('varname'=>'TOKEN_REFRESH', 'info'=>((!empty($refreshtoken)) ? 'Yes' : 'No'), 'type'=>'info'); - $this->conf[] = array('varname'=>'TOKEN_EXPIRED', 'info'=>($expire ? 'Yes' : 'No'), 'type'=>'info'); - $this->conf[] = array('varname'=>'TOKEN_EXPIRE_AT', 'info'=>($expiredat), 'type'=>'info'); + $this->conf[] = array('varname' => 'TOKEN_REFRESH', 'info' => ((!empty($refreshtoken)) ? 'Yes' : 'No'), 'type' => 'info'); + $this->conf[] = array('varname' => 'TOKEN_EXPIRED', 'info' => ($expire ? 'Yes' : 'No'), 'type' => 'info'); + $this->conf[] = array('varname' => 'TOKEN_EXPIRE_AT', 'info' => ($expiredat), 'type' => 'info'); } /* if ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)) { @@ -193,11 +185,11 @@ public function __construct($db) $this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink'); }*/ } else { - $this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthNotConfigured', 'type'=>'info'); + $this->conf[] = array('varname' => 'PRINTGCP_INFO', 'info' => 'GoogleAuthNotConfigured', 'type' => 'info'); } } // do not display submit button - $this->conf[] = array('enabled'=>0, 'type'=>'submit'); + $this->conf[] = array('enabled' => 0, 'type' => 'submit'); } /** @@ -250,7 +242,7 @@ public function listAvailablePrinters() /** * Return list of available printers * - * @return array list of printers + * @return array{available:array} list of printers */ public function getlistAvailablePrinters() { @@ -269,6 +261,7 @@ public function getlistAvailablePrinters() ); $serviceFactory = new \OAuth\ServiceFactory(); $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array()); + '@phan-var-force OAuth\OAuth2\Service\Google $apiService'; // createService is only ServiceInterface // Check if we have auth token $token_ok = true; try { @@ -380,12 +373,12 @@ public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $conte global $conf; // Check if printer id if (empty($printerid)) { - return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'No provided printer ID'); + return array('status' => 0, 'errorcode' => '', 'errormessage' => 'No provided printer ID'); } // Open the file which needs to be print $handle = fopen($filepath, "rb"); if (!$handle) { - return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'Could not read the file.'); + return array('status' => 0, 'errorcode' => '', 'errormessage' => 'Could not read the file.'); } // Read file content $contents = fread($handle, filesize($filepath)); @@ -411,6 +404,7 @@ public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $conte ); $serviceFactory = new \OAuth\ServiceFactory(); $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array()); + '@phan-var-force OAuth\OAuth2\Service\Google $apiService'; // createService is only ServiceInterface // Check if we have auth token and refresh it $token_ok = true; @@ -463,6 +457,7 @@ public function listJobs() ); $serviceFactory = new \OAuth\ServiceFactory(); $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array()); + '@phan-var-force OAuth\OAuth2\Service\Google $apiService'; // createService is only ServiceInterface // Check if we have auth token $token_ok = true; try { diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 54a844efc4d46..65cafd09939c0 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -86,21 +86,6 @@ class printing_printipp extends PrintingDriver */ public $ssl; - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); - - /** - * @var DoliDB Database handler. - */ - public $db; - /** * Constructor diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 13d913dc4605e..5fba8d46469a6 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 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 @@ -39,7 +40,7 @@ class doc_generic_product_odt extends ModelePDFProduct { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -193,13 +194,13 @@ public function info($langs) * * @param Product $object Object source to build document * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $product, $langs, $conf, $mysoc, $hookmanager, $user; @@ -322,7 +323,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -381,7 +382,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -407,7 +408,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $array_lines = $this->get_substitutionarray_each_var_object($supplierprice, $outputlangs); complete_substitutions_array($array_lines, $outputlangs, $object, $supplierprice, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$array_lines, 'line'=>$supplierprice); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$array_lines, 'line' => $supplierprice); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($array_lines as $key => $val) { try { @@ -437,7 +438,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -459,14 +460,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index eacccaf96f746..9f72337a0aab3 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -61,7 +61,7 @@ class pdf_standard extends ModelePDFProduct /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -107,17 +107,17 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build pdf onto disk * * @param Product $object Object source to build document * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $db, $hookmanager; @@ -339,7 +339,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -566,7 +566,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 308be664dcf01..51d3943314c33 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -119,13 +119,17 @@ public function info($langs) /** * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs + * @param ?Translate $langs Object langs * @param Product|string $objproduct Object product - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ - public function getExample($langs, $objproduct = '', $type = -1) + public function getExample($langs = null, $objproduct = '', $type = -1) { + if (!$langs instanceof Translate) { + $langs = $GLOBALS['langs']; + '@phan-var-force Translate $langs'; + } $exampleproduct = $exampleservice = ''; if ($type == 0 || $type == -1) { diff --git a/htdocs/core/modules/product/mod_codeproduct_leopard.php b/htdocs/core/modules/product/mod_codeproduct_leopard.php index 8dfab9d177dd7..81eba6df26c89 100644 --- a/htdocs/core/modules/product/mod_codeproduct_leopard.php +++ b/htdocs/core/modules/product/mod_codeproduct_leopard.php @@ -72,12 +72,12 @@ public function info($langs) /** * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs - * @param Product $objproduct Object product - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) - * @return string Return string example + * @param ?Translate $langs Object langs + * @param Product|string $objproduct Object product + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @return string Return string example */ - public function getExample($langs, $objproduct = null, $type = -1) + public function getExample($langs = null, $objproduct = '', $type = -1) { return ''; } diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index bf0959be7430f..249a19b73e1f3 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -41,20 +41,35 @@ abstract class ModelePDFProduct extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $dbs Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ - public static function liste_modeles($dbs, $maxfilenamelength = 0) + public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable $type = 'product'; $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $list = getListOfModels($dbs, $type, $maxfilenamelength); + $list = getListOfModels($db, $type, $maxfilenamelength); return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build document + * + * @param Product $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } /** @@ -185,4 +200,15 @@ public function verif_prefixIsUsed() // phpcs:enable return 0; } + + + /** + * Return an example of result returned by getNextValue + * + * @param ?Translate $langs Object langs + * @param Product|string $objproduct Object product + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @return string Return string example + */ + abstract public function getExample($langs = null, $objproduct = '', $type = -1); } diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index c910326b2da00..41031d83d28b2 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -38,7 +38,7 @@ class mod_lot_advanced extends ModeleNumRefBatch { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -134,9 +134,9 @@ public function getExample() /** * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param Productlot $object Object we need next value for - * @return string|int Value if OK, 0 if KO + * @param Societe $objsoc Object thirdparty + * @param Productlot $object Object we need next value for + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php index 4a7de7a4499f8..2b238c9893fde 100644 --- a/htdocs/core/modules/product_batch/mod_lot_free.php +++ b/htdocs/core/modules/product_batch/mod_lot_free.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2006-2009 Laurent Destailleur * 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 @@ -80,11 +81,11 @@ public function getExample() } /** - * Return an example of result returned by getNextValue + * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param Productlot $object Object we need next value for - * @return string Return next value + * @param Societe $objsoc Object thirdparty + * @param Productlot $object Object we need next value for + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php index c3e3aa366483f..5041233185517 100644 --- a/htdocs/core/modules/product_batch/mod_lot_standard.php +++ b/htdocs/core/modules/product_batch/mod_lot_standard.php @@ -34,7 +34,7 @@ class mod_lot_standard extends ModeleNumRefBatch { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -116,9 +116,9 @@ public function canBeActivated($object) /** * Return next free value * - * @param Societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param Productlot $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index a204337c47ef9..d8c53915883da 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -38,7 +38,7 @@ class mod_sn_advanced extends ModeleNumRefBatch { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -133,9 +133,9 @@ public function getExample() /** * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param Productlot $object Object we need next value for - * @return string|int Value if OK, 0 if KO + * @param Societe $objsoc Object thirdparty + * @param Productlot $object Object we need next value for + * @return string|int<-1,0> Value if OK, <=0 */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/product_batch/mod_sn_free.php b/htdocs/core/modules/product_batch/mod_sn_free.php index 87d3e5e62cdde..61ce112289acd 100644 --- a/htdocs/core/modules/product_batch/mod_sn_free.php +++ b/htdocs/core/modules/product_batch/mod_sn_free.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2006-2009 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,7 +39,7 @@ class mod_sn_free extends ModeleNumRefBatch * Therefore, the implementation must remain as open as possible. */ - // variables inherited from ModeleThirdPartyCode class + // variables inherited from ModeleNumRefBatch class public $name = 'sn_free'; public $version = 'dolibarr'; @@ -86,11 +87,11 @@ public function getExample() } /** - * Return an example of result returned by getNextValue + * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param Productlot $object Object we need next value for - * @return string Return next value + * @param Societe $objsoc Object thirdparty + * @param Productlot $object Object we need next value for + * @return string|int<-1,0> Value if OK, <=0 */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php index 4354bb57328d8..5348aa206c2a5 100644 --- a/htdocs/core/modules/product_batch/mod_sn_standard.php +++ b/htdocs/core/modules/product_batch/mod_sn_standard.php @@ -34,7 +34,7 @@ class mod_sn_standard extends ModeleNumRefBatch { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -116,9 +116,9 @@ public function canBeActivated($object) /** * Return next free value * - * @param Societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param Productlot $object Object we need next value for - * @return string|int String if OK, <0 if KO + * @return string|int<-1,0> Value if OK, <=0 */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/product_batch/modules_product_batch.class.php b/htdocs/core/modules/product_batch/modules_product_batch.class.php index d38e5eef379e0..6048716a9115f 100644 --- a/htdocs/core/modules/product_batch/modules_product_batch.class.php +++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * 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 @@ -21,14 +22,14 @@ /** - * \class ModeleProductCode + * \class ModelePDFProductBatch * \brief Parent class for product code generators */ /** - * \file htdocs/core/modules/contract/modules_contract.php - * \ingroup contract - * \brief File with parent class for generating contracts to PDF and File of class to manage contract numbering + * \file htdocs/core/modules/product_batch/modules_product_batch.class.php + * \ingroup product_batch + * \brief File with parent class for generating product batches to PDF and File of class to manage their numbering */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; @@ -44,9 +45,9 @@ abstract class ModelePDFProductBatch extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -58,6 +59,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) $list = getListOfModels($db, $type, $maxfilenamelength); return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build document + * + * @param Productlot $object Object source to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } /** @@ -65,5 +81,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefBatch extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Societe $objsoc Object thirdparty + * @param Productlot $object Object we need next value for + * @return string|int<-1,0> String if OK, <0 if KO + */ + abstract public function getNextValue($objsoc, $object); } diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index c07cea2dbc8f6..a9fd662de5b57 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -80,7 +80,7 @@ class doc_generic_project_odt extends ModelePDFProjects { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -147,18 +147,18 @@ public function get_substitutionarray_object($object, $outputlangs, $array_key = } $resarray = array( - $array_key.'_id'=>$object->id, - $array_key.'_ref'=>$object->ref, - $array_key.'_title'=>$object->title, - $array_key.'_description'=>$object->description, - $array_key.'_date_creation'=>dol_print_date($object->date_c, 'day'), - $array_key.'_date_modification'=>dol_print_date($object->date_m, 'day'), - $array_key.'_date_start'=>dol_print_date($object->date_start, 'day'), - $array_key.'_date_end'=>dol_print_date($object->date_end, 'day'), - $array_key.'_note_private'=>$object->note_private, - $array_key.'_note_public'=>$object->note_public, - $array_key.'_public'=>$object->public, - $array_key.'_statut'=>$object->getLibStatut() + $array_key.'_id' => $object->id, + $array_key.'_ref' => $object->ref, + $array_key.'_title' => $object->title, + $array_key.'_description' => $object->description, + $array_key.'_date_creation' => dol_print_date($object->date_c, 'day'), + $array_key.'_date_modification' => dol_print_date($object->date_m, 'day'), + $array_key.'_date_start' => dol_print_date($object->date_start, 'day'), + $array_key.'_date_end' => dol_print_date($object->date_end, 'day'), + $array_key.'_note_private' => $object->note_private, + $array_key.'_note_public' => $object->note_public, + $array_key.'_public' => $object->public, + $array_key.'_statut' => $object->getLibStatut() ); require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -183,23 +183,23 @@ public function get_substitutionarray_tasks(Task $task, $outputlangs) { // phpcs:enable $resarray = array( - 'task_ref'=>$task->ref, - 'task_fk_project'=>$task->fk_project, - 'task_projectref'=>$task->projectref, - 'task_projectlabel'=>$task->projectlabel, - 'task_label'=>$task->label, - 'task_description'=>$task->description, - 'task_fk_parent'=>$task->fk_task_parent, - 'task_duration'=>$task->duration, - 'task_duration_hour'=>convertSecondToTime($task->duration, 'all'), - 'task_planned_workload'=>$task->planned_workload, - 'task_planned_workload_hour'=>convertSecondToTime($task->planned_workload, 'all'), - 'task_progress'=>$task->progress, - 'task_public'=>$task->public, - 'task_date_start'=>dol_print_date($task->date_start, 'day'), - 'task_date_end'=>dol_print_date($task->date_end, 'day'), - 'task_note_private'=>$task->note_private, - 'task_note_public'=>$task->note_public + 'task_ref' => $task->ref, + 'task_fk_project' => $task->fk_project, + 'task_projectref' => $task->projectref, + 'task_projectlabel' => $task->projectlabel, + 'task_label' => $task->label, + 'task_description' => $task->description, + 'task_fk_parent' => $task->fk_task_parent, + 'task_duration' => $task->duration, + 'task_duration_hour' => convertSecondToTime($task->duration, 'all'), + 'task_planned_workload' => $task->planned_workload, + 'task_planned_workload_hour' => convertSecondToTime($task->planned_workload, 'all'), + 'task_progress' => $task->progress, + 'task_public' => $task->public, + 'task_date_start' => dol_print_date($task->date_start, 'day'), + 'task_date_end' => dol_print_date($task->date_end, 'day'), + 'task_note_private' => $task->note_private, + 'task_note_public' => $task->note_public ); require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -226,15 +226,15 @@ public function get_substitutionarray_project_contacts($contact, $outputlangs) $pc = 'projcontacts_'; // prefix to avoid typos $ret = array( - $pc.'id'=>$contact['id'], - $pc.'rowid'=>$contact['rowid'], - $pc.'role'=>$contact['libelle'], - $pc.'lastname'=>$contact['lastname'], - $pc.'firstname'=>$contact['firstname'], - $pc.'civility'=>$contact['civility'], - $pc.'fullcivname'=>$contact['fullname'], - $pc.'socname'=>$contact['socname'], - $pc.'email'=>$contact['email'] + $pc.'id' => $contact['id'], + $pc.'rowid' => $contact['rowid'], + $pc.'role' => $contact['libelle'], + $pc.'lastname' => $contact['lastname'], + $pc.'firstname' => $contact['firstname'], + $pc.'civility' => $contact['civility'], + $pc.'fullcivname' => $contact['fullname'], + $pc.'socname' => $contact['socname'], + $pc.'email' => $contact['email'] ); if ($contact['source'] == 'external') { @@ -281,9 +281,9 @@ public function get_substitutionarray_project_file($file, $outputlangs) { // phpcs:enable return array( - 'projfile_name'=>$file['name'], - 'projfile_date'=>dol_print_date($file['date'], 'day'), - 'projfile_size'=>$file['size'] + 'projfile_name' => $file['name'], + 'projfile_date' => dol_print_date($file['date'], 'day'), + 'projfile_size' => $file['size'] ); } @@ -301,13 +301,13 @@ public function get_substitutionarray_project_reference($refdetail, $outputlangs global $conf; return array( - 'projref_type'=>$refdetail['type'], - 'projref_ref'=>$refdetail['ref'], - 'projref_date'=>dol_print_date($refdetail['date'], 'day'), - 'projref_socname'=>$refdetail['socname'], - 'projref_amountht'=>price($refdetail['amountht'], 0, $outputlangs), - 'projref_amountttc'=>price($refdetail['amountttc'], 0, $outputlangs), - 'projref_status'=>$refdetail['status'] + 'projref_type' => $refdetail['type'], + 'projref_ref' => $refdetail['ref'], + 'projref_date' => dol_print_date($refdetail['date'], 'day'), + 'projref_socname' => $refdetail['socname'], + 'projref_amountht' => price($refdetail['amountht'], 0, $outputlangs), + 'projref_amountttc' => price($refdetail['amountttc'], 0, $outputlangs), + 'projref_status' => $refdetail['status'] ); } @@ -347,18 +347,18 @@ public function get_substitutionarray_taskstime($tasktime, $outputlangs) { // phpcs:enable return array( - 'tasktime_rowid'=>$tasktime['rowid'], - 'tasktime_task_date'=>dol_print_date($tasktime['task_date'], 'day'), - 'tasktime_task_duration_sec'=>$tasktime['task_duration'], - 'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'], 'all'), - 'tasktime_note'=>$tasktime['note'], - 'tasktime_fk_user'=>$tasktime['fk_user'], - 'tasktime_user_name'=>$tasktime['name'], - 'tasktime_user_first'=>$tasktime['firstname'], - 'tasktime_fullcivname'=>$tasktime['fullcivname'], - 'tasktime_amountht'=>$tasktime['amountht'], - 'tasktime_amountttc'=>$tasktime['amountttc'], - 'tasktime_thm'=>$tasktime['thm'], + 'tasktime_rowid' => $tasktime['rowid'], + 'tasktime_task_date' => dol_print_date($tasktime['task_date'], 'day'), + 'tasktime_task_duration_sec' => $tasktime['task_duration'], + 'tasktime_task_duration' => convertSecondToTime($tasktime['task_duration'], 'all'), + 'tasktime_note' => $tasktime['note'], + 'tasktime_fk_user' => $tasktime['fk_user'], + 'tasktime_user_name' => $tasktime['name'], + 'tasktime_user_first' => $tasktime['firstname'], + 'tasktime_fullcivname' => $tasktime['fullcivname'], + 'tasktime_amountht' => $tasktime['amountht'], + 'tasktime_amountttc' => $tasktime['amountttc'], + 'tasktime_thm' => $tasktime['thm'], ); } @@ -374,9 +374,9 @@ public function get_substitutionarray_task_file($file, $outputlangs) { // phpcs:enable return array( - 'tasksfile_name'=>$file['name'], - 'tasksfile_date'=>dol_print_date($file['date'], 'day'), - 'tasksfile_size'=>$file['size'] + 'tasksfile_name' => $file['name'], + 'tasksfile_date' => dol_print_date($file['date'], 'day'), + 'tasksfile_size' => $file['size'] ); } @@ -407,7 +407,7 @@ public function info($langs) // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PROJECT_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString('PROJECT_ADDON_PDF_ODT_PATH')))); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -488,9 +488,9 @@ public function info($langs) * @param Project $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @return int 1 if OK, <=0 if KO + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath) + public function write_file($object, $outputlangs, $srctemplatepath = '') { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -601,7 +601,7 @@ public function write_file($object, $outputlangs, $srctemplatepath) ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Open and load template @@ -643,7 +643,7 @@ public function write_file($object, $outputlangs, $srctemplatepath) complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -1117,7 +1117,7 @@ public function write_file($object, $outputlangs, $srctemplatepath) } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks @@ -1138,14 +1138,14 @@ public function write_file($object, $outputlangs, $srctemplatepath) return -1; } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 797d643523f8b..7ded9a0413264 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -77,7 +77,7 @@ class pdf_baleine extends ModelePDFProjects /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -141,11 +141,12 @@ public function __construct($db) /** * Function to build pdf project onto disk * - * @param Project $object Object project a generer - * @param Translate $outputlangs Lang output object - * @return int 1 if OK, <=0 if KO + * @param Project $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs) + public function write_file($object, $outputlangs, $srctemplatepath = '') { // phpcs:enable global $conf, $hookmanager, $langs, $user; @@ -274,7 +275,7 @@ public function write_file($object, $outputlangs) $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 2, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -470,7 +471,7 @@ public function write_file($object, $outputlangs) // Footer of the page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index e17ac35914fb7..0fd734b845c71 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -78,7 +78,7 @@ class pdf_beluga extends ModelePDFProjects /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -168,13 +168,14 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Fonction generant le projet sur le disque + * Function generating the project on disk * - * @param Project $object Object project a generer - * @param Translate $outputlangs Lang output object - * @return int 1 if OK, <=0 if KO + * @param Project $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs) + public function write_file($object, $outputlangs, $srctemplatepath = '') { // phpcs:enable global $conf, $hookmanager, $langs, $user; @@ -307,7 +308,7 @@ public function write_file($object, $outputlangs) $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 2, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -658,8 +659,8 @@ public function write_file($object, $outputlangs) $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputstatut, 1, 'R', false, 1, '', '', true, 0, true); if ($qualifiedfortotal) { - $total_ht = $total_ht + $element->total_ht; - $total_ttc = $total_ttc + $element->total_ttc; + $total_ht += $element->total_ht; + $total_ttc += $element->total_ttc; } $nexY = $pdf->GetY(); $curY = $nexY; @@ -702,7 +703,7 @@ public function write_file($object, $outputlangs) // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 9422abeacd594..420c33cc81b33 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -71,7 +71,7 @@ class pdf_timespent extends ModelePDFProjects /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -136,11 +136,12 @@ public function __construct($db) /** * Function to build pdf project onto disk * - * @param Project $object Object project a generer - * @param Translate $outputlangs Lang output object - * @return int 1 if OK, <=0 if KO + * @param Project $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs) + public function write_file($object, $outputlangs, $srctemplatepath = '') { // phpcs:enable global $conf, $hookmanager, $langs, $user; @@ -269,7 +270,7 @@ public function write_file($object, $outputlangs) $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 2, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -468,7 +469,7 @@ public function write_file($object, $outputlangs) // Footer of the page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index a411154425c64..1d4df75aaf296 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -35,7 +35,7 @@ class mod_project_simple extends ModeleNumRefProjects { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -123,9 +123,9 @@ public function canBeActivated($object) /** * Return next value * - * @param Societe $objsoc Object third party - * @param Project $project Object project - * @return string|-1 Value if OK, -1 if KO + * @param Societe $objsoc Object third party + * @param Project $project Object project + * @return string|int<-1,0> Value if OK, 0 if KO */ public function getNextValue($objsoc, $project) { diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 9d05daa85d915..93215ba2bf0f9 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.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 @@ -38,7 +39,7 @@ class mod_project_universal extends ModeleNumRefProjects /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -132,9 +133,9 @@ public function getExample() /** * Return next value * - * @param Societe $objsoc Object third party - * @param Project $project Object project - * @return string|int Value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param Project $project Object project + * @return string|int<-1,0> Value if OK, 0 if KO */ public function getNextValue($objsoc, $project) { diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index d19476d727705..d9b1d9a1758ac 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.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 @@ -47,9 +48,9 @@ abstract class ModelePDFProjects extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -62,6 +63,18 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf project onto disk + * + * @param Project $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = ''); + // phpcs:enable } @@ -71,5 +84,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefProjects extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param Project $project Object project + * @return string|int<-1,0> Value if OK, 0 if KO + */ + abstract public function getNextValue($objsoc, $project); } diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index b330aaac9b245..2fe4d3b930505 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -79,7 +79,7 @@ class doc_generic_task_odt extends ModelePDFTask { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -452,12 +452,12 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param Commande $object Object source to build document + * @param Project $object Object source to build document * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @return int 1 if OK, <=0 if KO + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath) + public function write_file($object, $outputlangs, $srctemplatepath = '') { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -531,8 +531,8 @@ public function write_file($object, $outputlangs, $srctemplatepath) // Make substitution $substitutionarray = array( - '__FROM_NAME__' => $this->emetteur->name, - '__FROM_EMAIL__' => $this->emetteur->email, + '__FROM_NAME__' => $this->emetteur->name, + '__FROM_EMAIL__' => $this->emetteur->email, ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook @@ -547,10 +547,10 @@ public function write_file($object, $outputlangs, $srctemplatepath) $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->project->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->project->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { @@ -607,8 +607,6 @@ public function write_file($object, $outputlangs, $srctemplatepath) $odfHandler->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) { dol_syslog($e->getMessage(), LOG_INFO); - } catch (SegmentException $e) { - dol_syslog($e->getMessage(), LOG_INFO); } } @@ -621,9 +619,16 @@ public function write_file($object, $outputlangs, $srctemplatepath) $contact_arrray = array_merge($contact_arrray, $contact_temp); } } - if ((is_array($contact_arrray) && count($contact_arrray) > 0)) { + // Check for segment + $foundtagforlines = 1; + try { $listlinestaskres = $odfHandler->setSegment('tasksressources'); - + } catch (OdfExceptionSegmentNotFound $e) { + // We may arrive here if tags for lines not present into template + $foundtagforlines = 0; + dol_syslog($e->getMessage(), LOG_INFO); + } + if ($foundtagforlines && (is_array($contact_arrray) && count($contact_arrray) > 0)) { foreach ($contact_arrray as $contact) { if ($contact['source'] == 'internal') { $objectdetail = new User($this->db); @@ -644,8 +649,6 @@ public function write_file($object, $outputlangs, $srctemplatepath) foreach ($tmparray as $key => $val) { try { $listlinestaskres->setVars($key, $val, true, 'UTF-8'); - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); } catch (SegmentException $e) { dol_syslog($e->getMessage(), LOG_INFO); } @@ -655,6 +658,16 @@ public function write_file($object, $outputlangs, $srctemplatepath) $odfHandler->mergeSegment($listlinestaskres); } + // Check for segment + $foundtagforlines = 1; + try { + $listlinestasktime = $odfHandler->setSegment('taskstimes'); + } catch (OdfExceptionSegmentNotFound $e) { + // We may arrive here if tags for lines not present into template + $foundtagforlines = 0; + dol_syslog($e->getMessage(), LOG_INFO); + } + // Time resources $sql = "SELECT t.rowid, t.element_date as task_date, t.element_duration as task_duration, t.fk_user, t.note"; $sql .= ", u.lastname, u.firstname"; @@ -666,17 +679,17 @@ public function write_file($object, $outputlangs, $srctemplatepath) $sql .= " ORDER BY t.element_date DESC"; $resql = $this->db->query($sql); - if ($resql) { + if ($foundtagforlines && $resql) { $num = $this->db->num_rows($resql); $i = 0; $tasks = array(); - $listlinestasktime = $odfHandler->setSegment('taskstimes'); + while ($i < $num) { $row = $this->db->fetch_array($resql); if (!empty($row['fk_user'])) { $objectdetail = new User($this->db); $objectdetail->fetch($row['fk_user']); - // TODO Use a cache to aoid fetch for same user + // TODO Use a cache to avoid fetch for same user $row['fullcivname'] = $objectdetail->getFullName($outputlangs, 1); } else { $row['fullcivname'] = ''; @@ -687,8 +700,6 @@ public function write_file($object, $outputlangs, $srctemplatepath) foreach ($tmparray as $key => $val) { try { $listlinestasktime->setVars($key, $val, true, 'UTF-8'); - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); } catch (SegmentException $e) { dol_syslog($e->getMessage(), LOG_INFO); } @@ -703,29 +714,35 @@ public function write_file($object, $outputlangs, $srctemplatepath) // Replace tags of project files - $listtasksfiles = $odfHandler->setSegment('tasksfiles'); - - $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref); - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1); - - - foreach ($filearray as $filedetail) { - $tmparray = $this->get_substitutionarray_task_file($filedetail, $outputlangs); - //dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true)); - foreach ($tmparray as $key => $val) { - try { - $listtasksfiles->setVars($key, $val, true, 'UTF-8'); - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); - } catch (SegmentException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + // Check for segment + $foundtagforlines = 1; + try { + $listtasksfiles = $odfHandler->setSegment('tasksfiles'); + } catch (OdfExceptionSegmentNotFound $e) { + // We may arrive here if tags for lines not present into template + $foundtagforlines = 0; + dol_syslog($e->getMessage(), LOG_INFO); + } + if ($foundtagforlines) { + $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1); + + foreach ($filearray as $filedetail) { + $tmparray = $this->get_substitutionarray_task_file($filedetail, $outputlangs); + //dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true)); + foreach ($tmparray as $key => $val) { + try { + $listtasksfiles->setVars($key, $val, true, 'UTF-8'); + } catch (SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } } + $listtasksfiles->merge(); } - $listtasksfiles->merge(); - } - //$listlines->merge(); + //$listlines->merge(); - $odfHandler->mergeSegment($listtasksfiles); + $odfHandler->mergeSegment($listtasksfiles); + } } catch (OdfException $e) { $this->error = $e->getMessage(); dol_syslog($this->error, LOG_WARNING); @@ -733,35 +750,40 @@ public function write_file($object, $outputlangs, $srctemplatepath) } - // Replace tags of project files + // Check for segment + $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('projectfiles'); + } catch (OdfExceptionSegmentNotFound $e) { + // We may arrive here if tags for lines not present into template + $foundtagforlines = 0; + dol_syslog($e->getMessage(), LOG_INFO); + } + if ($foundtagforlines) { + try { + $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($object->ref); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1); - $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($object->ref); - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1); - - - foreach ($filearray as $filedetail) { - //dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true)); - $tmparray = $this->get_substitutionarray_project_file($filedetail, $outputlangs); + foreach ($filearray as $filedetail) { + //dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true)); + $tmparray = $this->get_substitutionarray_project_file($filedetail, $outputlangs); - foreach ($tmparray as $key => $val) { - try { - $listlines->setVars($key, $val, true, 'UTF-8'); - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); - } catch (SegmentException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + foreach ($tmparray as $key => $val) { + try { + $listlines->setVars($key, $val, true, 'UTF-8'); + } catch (SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } } + $listlines->merge(); } - $listlines->merge(); + $odfHandler->mergeSegment($listlines); + } catch (OdfException $e) { + $this->error = $e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + return -1; } - $odfHandler->mergeSegment($listlines); - } catch (OdfException $e) { - $this->error = $e->getMessage(); - dol_syslog($this->error, LOG_WARNING); - return -1; } // Replace tags of lines for contacts @@ -773,10 +795,17 @@ public function write_file($object, $outputlangs, $srctemplatepath) $contact_arrray = array_merge($contact_arrray, $contact_temp); } } - if ((is_array($contact_arrray) && count($contact_arrray) > 0)) { + // Check for segment + $foundtagforlines = 1; + try { + $listlines = $odfHandler->setSegment('projectcontacts'); + } catch (OdfExceptionSegmentNotFound $e) { + // We may arrive here if tags for lines not present into template + $foundtagforlines = 0; + dol_syslog($e->getMessage(), LOG_INFO); + } + if ($foundtagforlines && (is_array($contact_arrray) && count($contact_arrray) > 0)) { try { - $listlines = $odfHandler->setSegment('projectcontacts'); - foreach ($contact_arrray as $contact) { if ($contact['source'] == 'internal') { $objectdetail = new User($this->db); @@ -797,8 +826,6 @@ public function write_file($object, $outputlangs, $srctemplatepath) foreach ($tmparray as $key => $val) { try { $listlines->setVars($key, $val, true, 'UTF-8'); - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); } catch (SegmentException $e) { dol_syslog($e->getMessage(), LOG_INFO); } diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index b523fefad8cf5..a7a0f3a5a8590 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -35,7 +35,7 @@ class mod_task_simple extends ModeleNumRefTask { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -124,9 +124,9 @@ public function canBeActivated($object) /** * Return next value * - * @param Societe|string $objsoc Object third party - * @param Task|string $object Object Task - * @return string|-1 Value if OK, -1 if KO + * @param Societe|string $objsoc Object third party + * @param Project|string $object Object Project + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index 33f1ee5ac7dfd..5aff9ed611459 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.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 @@ -33,7 +34,7 @@ class mod_task_universal extends ModeleNumRefTask { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -121,11 +122,11 @@ public function getExample() /** * Return next value * - * @param Societe|string $objsoc Object third party - * @param Task|string $object Object task - * @return string|int Value if OK, 0 if KO + * @param Societe|string $objsoc Object third party + * @param Project|string $object Object Project + * @return string|int<-1,0> Value if OK, <=0 if KO */ - public function getNextValue($objsoc = '', $object = '') + public function getNextValue($objsoc, $object) { global $db, $conf; diff --git a/htdocs/core/modules/project/task/modules_task.php b/htdocs/core/modules/project/task/modules_task.php index f42e094ea21ad..1fdba1e4d7bd6 100644 --- a/htdocs/core/modules/project/task/modules_task.php +++ b/htdocs/core/modules/project/task/modules_task.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010 Regis Houssin * Copyright (C) 2010 Florian Henry * 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 @@ -38,9 +39,9 @@ abstract class ModelePDFTask extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -53,6 +54,19 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param Project $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = ''); + // phpcs:enable } @@ -62,5 +76,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefTask extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe|string $objsoc Object third party + * @param Project|string $object Object Project + * @return string|int<-1,0> Value if OK, <=0 if KO + */ + abstract public function getNextValue($objsoc, $object); } diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 9f60a58023493..f42656414af22 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2016 Charlie Benke * 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 @@ -40,7 +41,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -230,14 +231,14 @@ public function info($langs) * Function to build a document on disk using the generic odt module. * * @param Propal $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 20786148b66e4..6e44e5fcd38b6 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -76,7 +76,7 @@ class pdf_azur extends ModelePDFPropales /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -170,10 +170,10 @@ public function __construct($db) * @param Propal $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -753,7 +753,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } //If propal merge product PDF is active @@ -1105,7 +1105,7 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs $this->atleastoneratenotnull = 0; if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { - $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])); if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { // Nothing to do } else { diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 126af77e588fb..34026f6c4defc 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -69,12 +69,12 @@ class pdf_cyan extends ModelePDFPropales /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; /** - * @var array Array of columns + * @var array Array of document table columns */ public $cols; @@ -147,10 +147,10 @@ public function __construct($db) * @param Propal $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -530,7 +530,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $posyafter = $tab_top_newpage; } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $posyafter + 6; } else { $height_note = 0; @@ -871,7 +871,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } //If propal merge product PDF is active @@ -1209,7 +1209,7 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan $this->atleastoneratenotnull = 0; if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { - $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])); if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { // Nothing to do } else { @@ -1938,7 +1938,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ); // Image of product - $rank = $rank + 10; + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm @@ -1959,7 +1959,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } - $rank = $rank + 10; + $rank += 10; $this->cols['vat'] = array( 'rank' => $rank, 'status' => false, @@ -1974,7 +1974,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['vat']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -1996,7 +1996,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['subprice']['width'] += (2 * ($tmpwidth - 10)); } - $rank = $rank + 10; + $rank += 10; $this->cols['qty'] = array( 'rank' => $rank, 'width' => 16, // in mm @@ -2007,7 +2007,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['unit'] = array( 'rank' => $rank, 'width' => 11, // in mm @@ -2021,7 +2021,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['unit']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['discount'] = array( 'rank' => $rank, 'width' => 13, // in mm @@ -2035,22 +2035,22 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['discount']['status'] = true; } - $rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_PROPAL_HIDE_PRICE_EXCL_TAX') ? true : false, + 'status' => !getDolGlobalString('PDF_PROPAL_HIDE_PRICE_EXCL_TAX'), 'title' => array( 'textkey' => 'TotalHTShort' ), 'border-left' => true, // add left line separator ); - $rank = $rank + 1010; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1010; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalincltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_PROPAL_SHOW_PRICE_INCL_TAX') ? false : true, + 'status' => getDolGlobalBool('PDF_PROPAL_SHOW_PRICE_INCL_TAX'), 'title' => array( 'textkey' => 'TotalTTCShort' ), diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index b601a7b1217b3..b6396ca96a053 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -35,7 +35,7 @@ class mod_propale_marbre extends ModeleNumRefPropales { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -126,7 +126,7 @@ public function canBeActivated($object) * * @param Societe $objsoc Object third party * @param Propal $propal Object commercial proposal - * @return string|-1 Next value, -1 if KO + * @return string|int<-1,0> Next value, <=0 if KO */ public function getNextValue($objsoc, $propal) { diff --git a/htdocs/core/modules/propale/mod_propale_saphir.php b/htdocs/core/modules/propale/mod_propale_saphir.php index 56a70eacf8e98..8f3e6402b6304 100644 --- a/htdocs/core/modules/propale/mod_propale_saphir.php +++ b/htdocs/core/modules/propale/mod_propale_saphir.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * 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 @@ -36,7 +37,7 @@ class mod_propale_saphir extends ModeleNumRefPropales { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -129,9 +130,9 @@ public function getExample() /** * Return next value * - * @param Societe $objsoc Object third party - * @param Propal $propal Object commercial proposal - * @return string|int Value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param Propal $propal Object commercial proposal + * @return string|int<-1,0> Next value, <=0 if KO */ public function getNextValue($objsoc, $propal) { diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index 9b20d84c164b3..e6eecffff448b 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 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 @@ -59,9 +60,9 @@ abstract class ModelePDFPropales extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -74,6 +75,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build document + * + * @param Propal $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } @@ -82,5 +98,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefPropales extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param Propal $propal Object commercial proposal + * @return string|int<-1,0> Next value, <=0 if KO + */ + abstract public function getNextValue($objsoc, $propal); } diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 13dc9da2488b6..8112697b973dc 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -3,6 +3,8 @@ * Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2015-2018 Charlene BENKE * Copyright (C) 2020 Maxime DEMAREST + * 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 @@ -201,7 +203,7 @@ public function write_file($_dir, $month, $year, $outputlangs) $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn as p"; break; } - $sql .= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year, $month))."' AND '".$this->db->idate(dol_get_last_day($year, $month))."'"; + $sql .= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day((int) $year, (int) $month))."' AND '".$this->db->idate(dol_get_last_day((int) $year, (int) $month))."'"; $sql .= " AND p.entity = ".$conf->entity; $result = $this->db->query($sql); if ($result) { @@ -234,7 +236,7 @@ public function write_file($_dir, $month, $year, $outputlangs) $sql .= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid "; } $sql .= " AND f.entity IN (".getEntity('invoice').")"; - $sql .= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year, $month))."' AND '".$this->db->idate(dol_get_last_day($year, $month))."'"; + $sql .= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day((int) $year, (int) $month))."' AND '".$this->db->idate(dol_get_last_day((int) $year, (int) $month))."'"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } @@ -272,7 +274,7 @@ public function write_file($_dir, $month, $year, $outputlangs) $sql .= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid "; } $sql .= " AND f.entity IN (".getEntity('invoice').")"; - $sql .= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year, $month))."' AND '".$this->db->idate(dol_get_last_day($year, $month))."'"; + $sql .= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day((int) $year, (int) $month))."' AND '".$this->db->idate(dol_get_last_day((int) $year, (int) $month))."'"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } @@ -353,7 +355,7 @@ public function write_file($_dir, $month, $year, $outputlangs) $this->Body($pdf, 1, $lines, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -525,7 +527,7 @@ public function Body(&$pdf, $page, $lines, $outputlangs) $pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][4], 0, 'R', 1); - $yp = $yp + 5; + $yp += 5; $total_page += $lines[$j][9]; if (($this->doc_type == 'client' && getDolGlobalString('PAYMENTS_REPORT_GROUP_BY_MOD')) || ($this->doc_type == 'fourn' && getDolGlobalString('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD'))) { $total_mod += $lines[$j][9]; @@ -547,7 +549,7 @@ public function Body(&$pdf, $page, $lines, $outputlangs) // Payment amount $pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][6], 0, 'R', 0); - $yp = $yp + 5; + $yp += 5; if ($oldprowid != $lines[$j][7]) { $oldprowid = $lines[$j][7]; @@ -567,7 +569,7 @@ public function Body(&$pdf, $page, $lines, $outputlangs) $pdf->SetFont('', '', $default_font_size - 1); $mod = $lines[$j + 1][2]; $total_mod = 0; - $yp = $yp + 5; + $yp += 5; if ($yp > $this->tab_height - 5) { $page++; $pdf->AddPage(); diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 6d8c91419f932..d0ed471cfebd3 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -1,6 +1,7 @@ * 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 @@ -37,7 +38,7 @@ class doc_generic_reception_odt extends ModelePdfReception { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -192,13 +193,13 @@ public function info($langs) * * @param Reception $object Object source to build document * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -320,7 +321,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -377,7 +378,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { try { @@ -410,7 +411,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -441,7 +442,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -462,14 +463,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails return -1; } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 5ad5462ad1f36..1004d3d83c98d 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -35,7 +35,7 @@ class pdf_squille extends ModelePdfReception { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -129,13 +129,13 @@ public function __construct(DoliDB $db) /** * Function to build pdf onto disk * - * @param Reception $object Object reception to generate (or id if old method) - * @param Translate $outputlangs Lang output object + * @param Reception $object Object reception to generate (or id if old method) + * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -265,7 +265,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(128, 128, 128); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -366,7 +366,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -642,7 +642,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -1001,10 +1001,10 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) { $text .= ' ('.$linkedobject->ref_client.')'; } - $Yoff = $Yoff + 8; + $Yoff += 8; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); - $Yoff = $Yoff + 3; + $Yoff += 3; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R'); } diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php index 10b12439776f3..1b0f9510e1f75 100644 --- a/htdocs/core/modules/reception/mod_reception_beryl.php +++ b/htdocs/core/modules/reception/mod_reception_beryl.php @@ -99,9 +99,9 @@ public function canBeActivated($object) /** * Return next value * - * @param Societe $objsoc Third party object - * @param Reception $reception Reception object - * @return string|-1 Value if OK, -1 if KO + * @param Societe $objsoc Third party object + * @param ?Reception $reception Reception object + * @return string|int<-1,0> Value if OK, -1 if KO */ public function getNextValue($objsoc, $reception) { diff --git a/htdocs/core/modules/reception/mod_reception_moonstone.php b/htdocs/core/modules/reception/mod_reception_moonstone.php index 98ff78d3bf5dd..de514911410a9 100644 --- a/htdocs/core/modules/reception/mod_reception_moonstone.php +++ b/htdocs/core/modules/reception/mod_reception_moonstone.php @@ -1,6 +1,7 @@ * 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 @@ -98,9 +99,9 @@ public function getExample() /** * Return next value * - * @param Societe $objsoc Third party object - * @param Reception|null $reception Reception object - * @return string|int Value if OK, 0 if KO + * @param Societe $objsoc Third party object + * @param ?Reception $reception Reception object + * @return string|int<-1,0> Value if OK, -1 if KO */ public function getNextValue($objsoc, $reception) { diff --git a/htdocs/core/modules/reception/modules_reception.php b/htdocs/core/modules/reception/modules_reception.php index 75f6d309cd79a..9324e5b73fbd7 100644 --- a/htdocs/core/modules/reception/modules_reception.php +++ b/htdocs/core/modules/reception/modules_reception.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,9 +36,9 @@ abstract class ModelePdfReception extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -50,6 +51,22 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document + * + * @param Reception $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } @@ -58,5 +75,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModelNumRefReception extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe $objsoc Third party object + * @param ?Reception $reception Reception object + * @return string|int<-1,0> Value if OK, -1 if KO + */ + abstract public function getNextValue($objsoc, $reception); } diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 5a135ea49ef7d..2e5e7ed21dd5c 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2011 Laurent Destailleur * Copyright (C) 2016 Charlie Benke * 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 @@ -37,7 +38,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -195,17 +196,17 @@ public function info($langs) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build a document on disk using the generic odt module. * - * @param Societe $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param Societe $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -374,7 +375,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Replace variables into document @@ -406,7 +407,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -436,14 +437,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails return -1; } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 9f3630574974e..566d7bb70f0ba 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -160,13 +160,17 @@ public function info($langs) /** * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs + * @param ?Translate $langs Object langs * @param Societe|string $objsoc Object thirdparty - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ - public function getExample($langs, $objsoc = '', $type = -1) + public function getExample($langs = null, $objsoc = '', $type = -1) { + if (!$langs instanceof Translate) { + $langs = $GLOBALS['langs']; + '@phan-var-force Translate $langs'; + } $examplecust = ''; $examplesup = ''; $errmsg = array( @@ -289,8 +293,8 @@ public function verif_prefixIsUsed() * @param DoliDB $db Database handler * @param string $code Code to check/correct * @param Societe $soc Object third party - * @param int $type 0 = customer/prospect , 1 = supplier - * @return int 0 if OK + * @param int<0,1> $type 0 = customer/prospect , 1 = supplier + * @return int<-6,0> 0 if OK * -1 ErrorBadCustomerCodeSyntax * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed diff --git a/htdocs/core/modules/societe/mod_codeclient_leopard.php b/htdocs/core/modules/societe/mod_codeclient_leopard.php index 39c7bda525b5e..e7509a07e3b3a 100644 --- a/htdocs/core/modules/societe/mod_codeclient_leopard.php +++ b/htdocs/core/modules/societe/mod_codeclient_leopard.php @@ -77,12 +77,12 @@ public function info($langs) /** * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs + * @param ?Translate $langs Object langs * @param Societe|string $objsoc Object thirdparty - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ - public function getExample($langs, $objsoc = '', $type = -1) + public function getExample($langs = null, $objsoc = '', $type = -1) { return ''; } @@ -106,12 +106,14 @@ public function getNextValue($objsoc = '', $type = -1) * @param DoliDB $db Database handler * @param string $code Code to check/correct * @param Societe $soc Object third party - * @param int $type 0 = customer/prospect , 1 = supplier - * @return int 0 if OK + * @param int<0,1> $type 0 = customer/prospect , 1 = supplier + * @return int<-6,0> 0 if OK * -1 ErrorBadCustomerCodeSyntax * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired + * -5 NotConfigured - Setup empty so any value may be ok or not + * -6 Other (see this->error) */ public function verif($db, &$code, $soc, $type) { diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index b0f6cc1114a2a..5eb500d61c9e5 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -76,12 +76,12 @@ public function info($langs) /** * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs + * @param ?Translate $langs Object langs * @param Societe|string $objsoc Object thirdparty - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ - public function getExample($langs, $objsoc = '', $type = -1) + public function getExample($langs = null, $objsoc = '', $type = -1) { return $this->prefixcustomer.'0901-00001
    '.$this->prefixsupplier.'0901-00001'; } @@ -151,12 +151,14 @@ public function getNextValue($objsoc = '', $type = -1) * @param DoliDB $db Database handler * @param string $code Code to check/correct * @param Societe $soc Object third party - * @param int $type 0 = customer/prospect , 1 = supplier - * @return int 0 if OK + * @param int<0,1> $type 0 = customer/prospect , 1 = supplier + * @return int<-6,0> 0 if OK * -1 ErrorBadCustomerCodeSyntax * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired + * -5 NotConfigured - Setup empty so any value may be ok or not + * -6 Other (see this->error) */ public function verif($db, &$code, $soc, $type) { diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index 64b65be81e557..0161aff09d6d8 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -45,7 +45,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -130,12 +130,12 @@ public function info($langs) /** * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs + * @param ?Translate $langs Object langs * @param Societe|string $objsoc Object thirdparty - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ - public function getExample($langs, $objsoc = '', $type = -1) + public function getExample($langs = null, $objsoc = '', $type = -1) { $s = ''; $s .= $this->prefixcustomeraccountancycode.'CUSTCODE'; diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index 598733e6feeb6..28686db0ed699 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -40,7 +40,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -159,16 +159,20 @@ public function info($langs) } /** - * Return an example of result returned by getNextValue + * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs - * @param Societe|string $objsoc Object thirdparty - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) - * @return string Example + * @param ?Translate $langs Object langs + * @param Societe|string $objsoc Object thirdparty + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @return string Return string example */ - public function getExample($langs, $objsoc = '', $type = -1) + public function getExample($langs = null, $objsoc = '', $type = -1) { global $conf, $mysoc; + if (!$langs instanceof Translate) { + $langs = $GLOBALS['langs']; + '@phan-var-force Translate $langs'; + } $s = $langs->trans("ThirdPartyName").": ".$mysoc->name; $s .= "
    \n"; @@ -253,9 +257,9 @@ public function get_code($db, $societe, $type = '') } if ($type == 'supplier') { - $this->code = $prefix.strtoupper(substr($codetouse, 0, $widthsupplier - $a)).$i; + $this->code = $prefix.strtoupper(substr($codetouse, 0, (int) $widthsupplier - $a)).$i; } elseif ($type == 'customer') { - $this->code = $prefix.strtoupper(substr($codetouse, 0, $widthcustomer - $a)).$i; + $this->code = $prefix.strtoupper(substr($codetouse, 0, (int) $widthcustomer - $a)).$i; } $disponibility = $this->checkIfAccountancyCodeIsAlreadyUsed($db, $this->code, $type); diff --git a/htdocs/core/modules/societe/mod_codecompta_panicum.php b/htdocs/core/modules/societe/mod_codecompta_panicum.php index 9dd740313f93c..f16bb7b7ea42f 100644 --- a/htdocs/core/modules/societe/mod_codecompta_panicum.php +++ b/htdocs/core/modules/societe/mod_codecompta_panicum.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2010 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,7 +44,7 @@ class mod_codecompta_panicum extends ModeleAccountancyCode /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -69,15 +70,16 @@ public function info($langs) return $langs->trans("ModuleCompanyCode".$this->name); } + /** - * Return an example of result returned by getNextValue + * Return an example of result returned by getNextValue * - * @param Translate $langs Object langs - * @param Societe|string $objsoc Object thirdparty - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) - * @return string Example + * @param ?Translate $langs Object langs + * @param Societe|string $objsoc Object thirdparty + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @return string Return string example */ - public function getExample($langs, $objsoc = '', $type = -1) + public function getExample($langs = null, $objsoc = '', $type = -1) { return ''; } @@ -100,7 +102,7 @@ public function get_code($db, $societe, $type = '') if ($type == 'supplier') { $this->code = (($societe->code_compta_fournisseur != "") ? $societe->code_compta_fournisseur : ''); } else { - $this->code = (($societe->code_compta != "") ? $societe->code_compta : ''); + $this->code = (($societe->code_compta_client != "") ? $societe->code_compta_client : ''); } } diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index f5ac07fb2fffe..c4e65c4fded91 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -39,21 +39,37 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $dbs Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ - public static function liste_modeles($dbs, $maxfilenamelength = 0) + public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable $type = 'company'; $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $list = getListOfModels($dbs, $type, $maxfilenamelength); + $list = getListOfModels($db, $type, $maxfilenamelength); return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param Societe $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } /** @@ -69,6 +85,17 @@ abstract class ModeleThirdPartyCode extends CommonNumRefGenerator abstract public function __construct($db); + /** + * Return an example of result returned by getNextValue + * + * @param ?Translate $langs Object langs + * @param Societe|string $objsoc Object thirdparty + * @param int<-1,2> $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @return string Return string example + */ + //abstract public function getExample($langs = null, $objsoc = '', $type = -1); + + /** * Return next value available * @@ -85,11 +112,11 @@ public function getNextValue($objsoc = '', $type = -1) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoie la liste des modeles de numérotation + * Return list of active generation modules * - * @param DoliDB $dbs Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array|int List of numbers + * @param DoliDB $dbs Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($dbs, $maxfilenamelength = 0) { @@ -123,8 +150,6 @@ public static function liste_modeles($dbs, $maxfilenamelength = 0) */ public function getToolTip($langs, $soc, $type) { - global $conf; - $langs->loadLangs(array("admin", "companies")); $strikestart = ''; @@ -194,6 +219,23 @@ public function verif_prefixIsUsed() // phpcs:enable return 0; } + + /** + * Check validity of code according to its rules + * + * @param DoliDB $db Database handler + * @param string $code Code to check/correct + * @param Societe $soc Object third party + * @param int<0,1> $type 0 = customer/prospect , 1 = supplier + * @return int<-6,0> 0 if OK + * -1 ErrorBadCustomerCodeSyntax + * -2 ErrorCustomerCodeRequired + * -3 ErrorCustomerCodeAlreadyUsed + * -4 ErrorPrefixRequired + * -5 NotConfigured - Setup empty so any value may be ok or not + * -6 Other (see this->error) + */ + abstract public function verif($db, &$code, $soc, $type); } diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index d4d838f3475ab..fce466a44125c 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 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 @@ -38,7 +39,7 @@ class doc_generic_stock_odt extends ModelePDFStock { /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -196,12 +197,12 @@ public function info($langs) * @param Entrepot $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $stock, $langs, $conf, $mysoc, $hookmanager, $user; @@ -321,7 +322,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -379,7 +380,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -411,7 +412,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $array_lines = $this->get_substitutionarray_each_var_object($supplierprice, $outputlangs); complete_substitutions_array($array_lines, $outputlangs, $object, $supplierprice, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$array_lines, 'line'=>$supplierprice); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$array_lines, 'line' => $supplierprice); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($array_lines as $key => $val) { try { @@ -442,7 +443,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -470,7 +471,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php index e54427d429adc..9224e7d503cb4 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php @@ -121,15 +121,15 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build a document on disk * * @param Entrepot $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -508,7 +508,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -540,7 +540,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/stock/modules_stock.php b/htdocs/core/modules/stock/modules_stock.php index cd5ad31db4469..c354d0ed43c27 100644 --- a/htdocs/core/modules/stock/modules_stock.php +++ b/htdocs/core/modules/stock/modules_stock.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 @@ -44,7 +45,7 @@ abstract class ModelePDFStock extends CommonDocGenerator public $type; /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -53,9 +54,9 @@ abstract class ModelePDFStock extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -68,4 +69,20 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk + * + * @param Entrepot $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 82e331db31a4a..9cdea4485c8d8 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -62,7 +62,7 @@ class pdf_eagle extends ModelePDFStockTransfer /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -120,7 +120,7 @@ public function __construct(DoliDB $db) // Get source company $this->emetteur = $mysoc; - if (!$this->emetteur->country_code) { + if (empty($this->emetteur->country_code)) { $this->emetteur->country_code = substr($langs->defaultlang, -2); } @@ -170,10 +170,10 @@ public function __construct(DoliDB $db) * @param StockTransfer $object Object StockTransfer to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -192,7 +192,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $outputlangs->charset_output = 'ISO-8859-1'; } - // Load traductions files required by page + // Load translation files required by page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); global $outputlangsbis; @@ -264,7 +264,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } if ($conf->stocktransfer->dir_output) { - // Definition de $dir et $file + // Definition of $dir and $file if ($object->specimen) { $dir = $conf->stocktransfer->dir_output; $file = $dir."/SPECIMEN.pdf"; @@ -321,14 +321,14 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(128, 128, 128); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("Shipment")); + $pdf->SetSubject($outputlangs->transnoentities("StockTransfer")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); } @@ -348,7 +348,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetTextColor(0, 0, 0); $tab_top = 90; // position of top tab - $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift: 10); + $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; @@ -426,7 +426,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(192, 192, 192); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $nexY + 6; } else { $height_note = 0; @@ -728,7 +728,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -755,7 +755,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede return 0; } } else { - $this->error = $langs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "STOCKTRANSFER_OUTPUTDIR"); return 0; } } @@ -1010,14 +1010,15 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // phpcs:enable global $conf, $langs; - $langs->load("orders"); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies")); $default_font_size = pdf_getPDFFontSize($outputlangs); pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if ($object->statut == 0 && (getDolGlobalString('SHIPPING_DRAFT_WATERMARK'))) { + if ($object->statut == 0 && (getDolGlobalString('STOCKTRANSFER_DRAFT_WATERMARK'))) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SHIPPING_DRAFT_WATERMARK); } @@ -1115,6 +1116,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $classname = ucfirst($origin); $linkedobject = new $classname($this->db); + '@phan-var-force CommonObject $linkedobject'; $result = $linkedobject->fetch($origin_id); if ($result >= 0) { //$linkedobject->fetchObjectLinked() Get all linked object to the $linkedobject (commonly order) into $linkedobject->linkedObjects @@ -1124,10 +1126,10 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) { $text .= ' ('.$linkedobject->ref_client.')'; } - $Yoff = $Yoff + 8; + $Yoff += 8; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); - $Yoff = $Yoff + 3; + $Yoff += 3; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R'); } @@ -1272,6 +1274,6 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { // phpcs:enable $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); - return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + return pdf_pagefoot($pdf, $outputlangs, 'STOCKTRANSFER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 24ceb7b885568..b6fd341fc6de6 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -71,7 +71,7 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -86,7 +86,7 @@ public function __construct($db) global $langs, $mysoc; // Translations - $langs->loadLangs(array("main", "bills", "products")); + $langs->loadLangs(array("main", "bills", "products", "stocks")); $this->db = $db; $this->name = $langs->trans("StockTransferSheetProforma"); @@ -135,21 +135,23 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build pdf onto disk + * Function to build pdf onto disk * - * @param Object $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param StockTransfer $object Object StockTransfer to generate (or id if old method) + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; + '@phan-var-force StockTransfer $object'; + if (!is_object($outputlangs)) { $outputlangs = $langs; } @@ -158,14 +160,16 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $outputlangs->charset_output = 'ISO-8859-1'; } - // Load translation files required by the page - $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); + // Load translation files required by page + $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); + + global $outputlangsbis; + $outputlangsbis = null; if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { - global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')); - $outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); + $outputlangsbis->loadLangs(array("main", "bills", "orders", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch")); } $nblines = is_array($object->lines) ? count($object->lines) : 0; @@ -178,7 +182,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Loop on each lines to detect if there is at least one image to show $realpatharray = array(); $this->atleastonephoto = false; - if (getDolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')) { + if (getDolGlobalString('MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE')) { $objphoto = new Product($this->db); for ($i = 0; $i < $nblines; $i++) { @@ -261,14 +265,18 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede global $action; $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + // Set nblines with the new facture lines content after hook + $nblines = is_array($object->lines) ? count($object->lines) : 0; + // Create pdf instance $pdf = pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $default_font_size = pdf_getPDFFontSize($outputlangs); $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) + $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) { $pdf->setPrintHeader(false); @@ -276,7 +284,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { + if (!getDolGlobalString('MAIN_DISABLE_FPDI') && getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); } @@ -286,10 +294,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("PdfOrderTitle")); + $pdf->SetSubject($outputlangs->transnoentities("StockTransferSheetProforma")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle").($object->thirdparty ? " ".$outputlangs->convToOutputCharset($object->thirdparty->name) : '')); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); } @@ -324,7 +332,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $tab_height = 130; // Incoterm - if ($conf->incoterm->enabled) { + $height_incoterms = 0; + if (isModEnabled('incoterm')) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { $tab_top -= 2; @@ -339,6 +348,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); $tab_top = $nexY + 6; + $height_incoterms += 4; } } @@ -479,7 +489,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $posyafter + 6; } else { $height_note = 0; @@ -562,8 +572,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); + $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text @@ -682,6 +692,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $tvaligne = $object->lines[$i]->total_tva; } + /* $localtax1ligne = $object->lines[$i]->total_localtax1; $localtax2ligne = $object->lines[$i]->total_localtax2; $localtax1_rate = $object->lines[$i]->localtax1_tx; @@ -689,11 +700,6 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $localtax1_type = $object->lines[$i]->localtax1_type; $localtax2_type = $object->lines[$i]->localtax2_type; - // TODO remise_percent is an obsolete field for object parent - /*if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; - if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; - if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;*/ - $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records @@ -727,6 +733,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->tva[$vatrate] = 0; } $this->tva[$vatrate] += $tvaligne; + */ // Add line if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { @@ -781,17 +788,13 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; - // Affiche zone infos - // ! No paiement information for this model ! - //$posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); - - // Affiche zone totaux + // Display total area $posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); - // Pied de page + // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -835,6 +838,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs) { global $conf, $mysoc; + '@phan-var-force Commande|Propal|Facture $object'; // availability_code,... does not exist on Facture. + $default_font_size = pdf_getPDFFontSize($outputlangs); $pdf->SetFont('', '', $default_font_size - 1); @@ -906,7 +911,15 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs) $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; - } elseif ($object->availability_code || $object->availability) { // Show availability conditions + } elseif (property_exists($object, 'availability_code') + && property_exists($object, 'availability') + && ( + $object->availability_code + || $object->availability + ) + ) { + // Show availability conditions + $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; @@ -1158,11 +1171,11 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ /** * Show top header of page. * - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $showaddress 0=no, 1=yes - * @param Translate $outputlangs Object lang for output - * @param string $titlekey Translation key to show as title of document + * @param TCPDF $pdf Object PDF + * @param Object $object Object to show + * @param int<0,1> $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @param string $titlekey Translation key to show as title of document * @return float|int Return topshift value */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "StockTransferSheetProforma") @@ -1170,6 +1183,8 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek // phpcs:enable global $conf, $langs; + '@phan-var-force StockTransfer $object'; + // Load traductions files required by page $outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies")); @@ -1178,7 +1193,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if ($object->statut == 0 && getDolGlobalString('COMMANDE_DRAFT_WATERMARK')) { + if ($object->statut == 0 && getDolGlobalString('STOCKTRANSFER_DRAFT_WATERMARK')) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', getDolGlobalString('COMMANDE_DRAFT_WATERMARK')); } @@ -1188,7 +1203,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek $w = 110; $posy = $this->marge_haute; - $posx = $this->page_largeur - $this->marge_droite - 100; + $posx = $this->page_largeur - $this->marge_droite - $w; $pdf->SetXY($this->marge_gauche, $posy); @@ -1219,21 +1234,18 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek } } - $pdf->SetFont('', 'B', $default_font_size + 3); - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $title = $outputlangs->transnoentities($titlekey); - $pdf->MultiCell($w, 3, $title, '', 'R'); + $pdf->SetDrawColor(128, 128, 128); - $pdf->SetFont('', 'B', $default_font_size); + $posx = $this->page_largeur - $w - $this->marge_droite; + $posy = $this->marge_haute; - $posy += 5; + $pdf->SetFont('', 'B', $default_font_size + 2); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); + $title = $outputlangs->transnoentities("StockTransferSheet").' '.$object->ref; + $pdf->MultiCell($w, 4, $title, '', 'R'); - $posy += 1; - $pdf->SetFont('', '', $default_font_size - 1); + $pdf->SetFont('', '', $default_font_size + 1); // Date prévue depart if (!empty($object->date_prevue_depart)) { @@ -1267,6 +1279,13 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateReelleArrivee")." : ".dol_print_date($object->date_reelle_arrivee, "day", false, $outputlangs, true), '', 'R'); } + if (!empty($object->thirdparty->code_client)) { + $posy += 4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + } + if ($object->ref_client) { $posy += 5; $pdf->SetXY($posx, $posy); @@ -1369,7 +1388,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx, $posy - 5); - $pdf->MultiCell(66, 5, $outputlangs->transnoentities("Sender").":", 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender").":", 0, 'L'); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1); @@ -1414,8 +1433,8 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek // Show recipient $widthrecbox = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100; if ($this->page_largeur < 210) { - $widthrecbox = 84; - } // To work with US executive format + $widthrecbox = 84; // To work with US executive format + } $posy = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42; $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { @@ -1452,17 +1471,19 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek /** * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF - * @param Object $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * @param TCPDF $pdf PDF + * @param StockTransfer $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { // phpcs:enable + '@phan-var-force StockTransfer $object'; + $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); - return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + return pdf_pagefoot($pdf, $outputlangs, 'STOCKTRANSFER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } @@ -1470,7 +1491,7 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) /** * Define Array Column Field * - * @param object $object common object + * @param CommonObject $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc @@ -1529,7 +1550,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = $rank + 10; + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm @@ -1549,7 +1570,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } - $rank = $rank + 10; + $rank += 10; $this->cols['vat'] = array( 'rank' => $rank, 'status' => false, @@ -1565,7 +1586,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['vat']['status'] = true; }*/ - $rank = $rank + 10; + $rank += 10; $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -1587,7 +1608,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['subprice']['width'] += (2 * ($tmpwidth - 10)); } - $rank = $rank + 10; + $rank += 10; $this->cols['qty'] = array( 'rank' => $rank, 'width' => 16, // in mm @@ -1598,7 +1619,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['unit'] = array( 'rank' => $rank, 'width' => 11, // in mm @@ -1612,7 +1633,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['unit']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['discount'] = array( 'rank' => $rank, 'width' => 13, // in mm @@ -1626,7 +1647,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['discount']['status'] = true; } - $rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php index cb77d500fdda0..6238778766891 100644 --- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php +++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +38,7 @@ class mod_stocktransfer_advanced extends ModeleNumRefStockTransfer { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -126,7 +127,7 @@ public function getExample() * Return next free value * * @param StockTransfer $object Object we need next value for - * @return string|0 Value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php index 57e7f238fc23d..2df9df5bbc52c 100644 --- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php +++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php @@ -35,7 +35,7 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -121,7 +121,7 @@ public function canBeActivated($object) * Return next free value * * @param StockTransfer $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @return string|int<-1,0> Value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/stocktransfer/modules_stocktransfer.php b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php index c68ae5d3d7a33..beeecc065092b 100644 --- a/htdocs/core/modules/stocktransfer/modules_stocktransfer.php +++ b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php @@ -7,6 +7,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García * 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 @@ -43,9 +44,9 @@ abstract class ModelePDFStockTransfer extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -58,6 +59,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build document onto disk + * + * @param StockTransfer $object Object StockTransfer to generate (or id if old method) + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, 0=KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } @@ -67,5 +83,11 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefStockTransfer extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param StockTransfer $object Object we need next value for + * @return string|int<-1,0> Value if OK, 0 if KO + */ + abstract public function getNextValue($object); } diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index c84c52cb7291f..9d602601c39fd 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2018-2019 Philippe Grand * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019 Tim Otte + * 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 doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices public $issuer; /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -198,15 +199,15 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param Commande $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param FactureFournisseur $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, <=0=KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -323,7 +324,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -379,7 +380,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -413,7 +414,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -445,7 +446,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -467,14 +468,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index f226baf46dac4..1ed55a909bc43 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -66,7 +66,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -147,15 +147,15 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build pdf onto disk + * Function to build a document on disk using the generic odt module. * * @param FactureFournisseur $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, <=0=KO */ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -571,7 +571,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 68b728b839c7e..d56d50ab247b0 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -37,7 +37,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -175,10 +175,10 @@ public function canBeActivated($object) /** * Return next value * - * @param Societe $objsoc Object third party + * @param Societe $objsoc Object third party * @param FactureFournisseur $object Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string|-1 Value if OK, -1 if KO + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,0> Value if OK, -1 if KO */ public function getNextValue($objsoc, $object, $mode = 'next') { diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 7f10f50c0f370..e8029ccd03360 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2016-2021 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 @@ -39,7 +40,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -150,10 +151,10 @@ public function getExample() /** * Return next value * - * @param Societe $objsoc Object third party + * @param Societe $objsoc Object third party * @param FactureFournisseur $object Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string|int Value if OK, 0 if KO + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $object, $mode = 'next') { diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index f10db41de1251..daa9fa1c0f770 100644 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -3,6 +3,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013-2016 Philippe Grand * 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 @@ -37,11 +38,11 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator { // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation models + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of numbers + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -54,6 +55,22 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param FactureFournisseur $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1=OK, <=0=KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } /** @@ -61,5 +78,13 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefSuppliersInvoices extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param FactureFournisseur $object Object invoice + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,0> Value if OK, <=0 if KO + */ + abstract public function getNextValue($objsoc, $object, $mode = 'next'); } diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index a7d4da8c27864..847f1cd1b6049 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2018-2019 Philippe Grand * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019 Tim Otte + * 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 doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders public $issuer; /** - * @var string Dolibarr version of the loaded document + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -195,15 +196,15 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param Commande $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param CommandeFournisseur $object Object source to generate (or id if old method) + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -319,7 +320,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text $newfreetext = ''; @@ -374,7 +375,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -408,7 +409,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -440,7 +441,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -462,14 +463,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 6510d928ca117..b9429ebe685fb 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -70,7 +70,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -135,17 +135,17 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build pdf onto disk + * Function to build pdf onto disk * - * @param CommandeFournisseur $object Id of object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param CommandeFournisseur $object Object source to generate (or id if old method) + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs = null, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $mysoc, $nblines; @@ -469,7 +469,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $posyafter + 6; } else { $height_note = 0; @@ -791,7 +791,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -1340,7 +1340,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $top_shift = 0; // Show list of linked objects $current_y = $pdf->getY(); - $posx = $posx+10; + $posx += 10; $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); if ($current_y < $pdf->getY()) { $top_shift = $pdf->getY() - $current_y; @@ -1531,7 +1531,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = $rank + 10; + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm @@ -1551,7 +1551,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } - $rank = $rank + 10; + $rank += 10; $this->cols['vat'] = array( 'rank' => $rank, 'status' => false, @@ -1566,7 +1566,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['vat']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -1581,7 +1581,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['subprice']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['qty'] = array( 'rank' => $rank, 'width' => 16, // in mm @@ -1592,7 +1592,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['unit'] = array( 'rank' => $rank, 'width' => 11, // in mm @@ -1606,7 +1606,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['unit']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['discount'] = array( 'rank' => $rank, 'width' => 13, // in mm @@ -1620,7 +1620,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['discount']['status'] = true; } - $rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 46c55a6924452..657b9d05a598c 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -69,7 +69,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -160,17 +160,17 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build pdf onto disk + * Function to build pdf onto disk * - * @param CommandeFournisseur $object Id of object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param CommandeFournisseur $object Object source to generate (or id if old method) + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs = null, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $mysoc, $nblines; @@ -668,7 +668,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index 6eb57b73d825d..2e5efa815f153 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -35,7 +35,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -132,9 +132,9 @@ public function canBeActivated($object) /** * Return next value * - * @param Societe|string $objsoc Object third party + * @param Societe|string $objsoc Object third party * @param CommandeFournisseur $object Object - * @return string Value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 2ddbb51428ed8..350e22302ea7f 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -36,7 +36,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -129,11 +129,11 @@ public function getExample() } /** - * Return next value + * Return next value * - * @param Societe|string $objsoc Object third party + * @param Societe|string $objsoc Object third party * @param CommandeFournisseur $object Object - * @return string|int Value if OK, 0 if KO + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index d9d87cc31138b..e58b00e36d14f 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2011-2016 Philippe Grand * 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 @@ -57,11 +58,11 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation models + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -74,14 +75,36 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build document + * + * @param CommandeFournisseur $object Object source to generate (or id if old method) + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } /** - * Parent Class of numbering models of suppliers orders references + * Parent Class of numbering models of supplier order references */ abstract class ModeleNumRefSuppliersOrders extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe|string $objsoc Object third party + * @param CommandeFournisseur $object Object + * @return string|int<-1,0> Value if OK, <=0 if KO + */ + abstract public function getNextValue($objsoc, $object); } diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php index 4cfd1a03d79eb..426c4336fc4a3 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2022 Ferran Marcet * 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 @@ -67,7 +68,7 @@ class pdf_standard_supplierpayment extends ModelePDFSuppliersPayments /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -146,15 +147,15 @@ public function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build pdf onto disk + * Function to build pdf onto disk * - * @param PaiementFourn $object Id of object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param PaiementFourn $object Object source to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -449,7 +450,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', // Footer page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index 268a87a84bf45..886b0ea5fc26b 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.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 @@ -33,7 +34,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -120,9 +121,9 @@ public function getExample() /** * Return next free value * - * @param Societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param PaiementFourn $object Object we need next value for - * @return string|int Next value if OK, 0 if KO + * @return string|int<-1,0> Next value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php index 30f323ecc819f..1ad94cae993bb 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php @@ -33,7 +33,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -121,9 +121,9 @@ public function canBeActivated($object) /** * Return next free value * - * @param Societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param PaiementFourn $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @return string|int<-1,0> Next value if OK, <=0 if KO */ public function getNextValue($objsoc, $object) { diff --git a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php index a748d734d518c..235a0091a2463 100644 --- a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php +++ b/htdocs/core/modules/supplier_payment/modules_supplier_payment.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,11 +28,11 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator { // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation models + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of numbers + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -44,6 +45,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build document + * + * @param PaiementFourn $object Object source to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } /** @@ -53,5 +69,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefSupplierPayments extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Societe $objsoc Object thirdparty + * @param PaiementFourn $object Object we need next value for + * @return string|int<-1,0> Next value if OK, <=0 if KO + */ + abstract public function getNextValue($objsoc, $object); } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index db87bed9cce49..572d5d56515f4 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2016 Charlie Benke * 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 @@ -40,7 +41,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -216,15 +217,15 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param Propal $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param SupplierProposal $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -347,7 +348,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -405,7 +406,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -439,7 +440,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -470,7 +471,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -491,14 +492,14 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails return -1; } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index c68cc55cb0976..5c4c64f79678e 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -67,7 +67,7 @@ class pdf_aurore extends ModelePDFSupplierProposal /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -156,13 +156,13 @@ public function __construct($db) /** * Function to build pdf onto disk * - * @param SupplierProposal $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param SupplierProposal $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -658,7 +658,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -909,7 +909,7 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs $this->atleastoneratenotnull = 0; if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { - $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])); if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { // Nothing to do } else { @@ -1200,11 +1200,11 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ /** * Show top header of page. * - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $showaddress 0=no, 1=yes - * @param Translate $outputlangs Object lang for output - * @return float|int Return topshift value + * @param TCPDF $pdf Object PDF + * @param CommonObject $object Object to show + * @param int<0,1> $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return float|int Return topshift value */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index 2783aedc45464..a1e702ce89177 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -69,7 +69,7 @@ class pdf_zenith extends ModelePDFSupplierProposal /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -136,15 +136,15 @@ public function __construct($db) /** * Function to build pdf onto disk * - * @param SupplierProposal $object Id of object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param SupplierProposal $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs = null, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $mysoc, $nblines; @@ -468,7 +468,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } } - $tab_height = $tab_height - $height_note; + $tab_height -= $height_note; $tab_top = $posyafter + 6; } else { $height_note = 0; @@ -788,7 +788,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); @@ -1497,7 +1497,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = $rank + 10; + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm @@ -1517,7 +1517,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide } - $rank = $rank + 10; + $rank += 10; $this->cols['vat'] = array( 'rank' => $rank, 'status' => false, @@ -1532,7 +1532,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['vat']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 19, // in mm @@ -1547,7 +1547,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['subprice']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['qty'] = array( 'rank' => $rank, 'width' => 16, // in mm @@ -1558,7 +1558,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - $rank = $rank + 10; + $rank += 10; $this->cols['unit'] = array( 'rank' => $rank, 'width' => 11, // in mm @@ -1572,7 +1572,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['unit']['status'] = true; } - $rank = $rank + 10; + $rank += 10; $this->cols['discount'] = array( 'rank' => $rank, 'width' => 13, // in mm @@ -1586,7 +1586,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['discount']['status'] = true; } - $rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 + $rank += 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php index ad61e3a55b2ee..b9cdf6a3b780c 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -35,7 +35,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -124,9 +124,9 @@ public function canBeActivated($object) /** * Return next value * - * @param Societe $objsoc Object third party + * @param Societe $objsoc Object third party * @param SupplierProposal $supplier_proposal Object commercial proposal - * @return string|-1 Next value if OK, -1 if KO + * @return string|int<-1,0> Next value if OK, -1 if KO */ public function getNextValue($objsoc, $supplier_proposal) { diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index 3c06e708c5ac8..dd730510e54f3 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -124,9 +125,9 @@ public function getExample() /** * Return next value * - * @param Societe $objsoc Object third party + * @param Societe $objsoc Object third party * @param SupplierProposal $supplier_proposal Object commercial proposal - * @return string|int Value if OK, 0 if KO + * @return string|int<-1,0> Next value if OK, -1 if KO */ public function getNextValue($objsoc, $supplier_proposal) { diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php index 84517038a74b6..8186048e26313 100644 --- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php +++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 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 @@ -41,9 +42,9 @@ abstract class ModelePDFSupplierProposal extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -56,6 +57,22 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param SupplierProposal $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } @@ -64,5 +81,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefSupplierProposal extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param SupplierProposal $supplier_proposal Object commercial proposal + * @return string|int<-1,0> Next value if OK, -1 if KO + */ + abstract public function getNextValue($objsoc, $supplier_proposal); } diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 78e1c4c4772d3..df3ceedcfd508 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -159,6 +159,7 @@ public function export($content, $suffixinfilename = '') print 'Failed to open log file '.($dolibarr_main_prod ? basename($logfile) : $logfile); } } else { + // @phan-suppress-next-line PhanPluginDuplicateArrayKey $logLevels = array( LOG_EMERG => 'EMERG', LOG_ALERT => 'ALERT', diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php index 7ac31b4929e10..6d57bad5c0f92 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php @@ -36,7 +36,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos { /** * Dolibarr version of the loaded document 'development', 'experimental', 'dolibarr' - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -131,10 +131,10 @@ public function canBeActivated($object) * ALTER TABLE llx_facture ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'TC' THEN CAST(SUBSTRING(ref FROM 10) AS SIGNED) ELSE 0 END) PERSISTENT; * ALTER TABLE llx_facture ADD INDEX calculated_numrefonly_idx (calculated_numrefonly); * - * @param Societe $objsoc Object third party - * @param Facture $invoice Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string|int Next ref value or last ref if $mode is 'last' + * @param ?Societe $objsoc Object third party + * @param ?Facture $invoice Object invoice + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,0> Next ref value or last ref if $mode is 'last' */ public function getNextValue($objsoc = null, $invoice = null, $mode = 'next') { diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php index e11fa61a3b0ec..6b677761158d7 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2020 Open-DSI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +38,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos { /** * Dolibarr version of the loaded document 'development', 'experimental', 'dolibarr' - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -118,10 +119,10 @@ public function getExample() /** * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param Facture $invoice Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string|int Next value if OK, 0 if KO + * @param ?Societe $objsoc Object third party + * @param ?Facture $invoice Object invoice + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,0> Next ref value or last ref if $mode is 'last' */ public function getNextValue($objsoc = null, $invoice = null, $mode = 'next') { @@ -142,7 +143,7 @@ public function getNextValue($objsoc = null, $invoice = null, $mode = 'next') $date = (empty($invoice->date) ? dol_now() : $invoice->date); $pos_source = is_object($invoice) && $invoice->pos_source > 0 ? $invoice->pos_source : 0; - $mask = str_replace('{TN}', $pos_source, $mask); + $mask = str_replace('{TN}', (string) $pos_source, $mask); $numFinal = get_next_value($db, $mask, 'facture', 'ref', '', $objsoc, $date, $mode, false, null, $entity); return $numFinal; diff --git a/htdocs/core/modules/takepos/modules_takepos.php b/htdocs/core/modules/takepos/modules_takepos.php index 88894d4fa8a88..6307bd42e0a2e 100644 --- a/htdocs/core/modules/takepos/modules_takepos.php +++ b/htdocs/core/modules/takepos/modules_takepos.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Philippe Grand * Copyright (C) 2020 Open-DSI + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,5 +35,13 @@ */ abstract class ModeleNumRefTakepos extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param ?Societe $objsoc Object third party + * @param ?Facture $invoice Object invoice + * @param string $mode 'next' for next value or 'last' for last value + * @return string|int<-1,0> Next ref value or last ref if $mode is 'last' + */ + abstract public function getNextValue($objsoc = null, $invoice = null, $mode = 'next'); } diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index c488f8035b508..5648398db3006 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -39,7 +39,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -184,15 +184,15 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param User $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param User $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -337,7 +337,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); $object->fetch_optionals(); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { try { @@ -366,7 +366,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -394,7 +394,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php index 8c476eb91a743..59db009125f49 100644 --- a/htdocs/core/modules/ticket/mod_ticket_simple.php +++ b/htdocs/core/modules/ticket/mod_ticket_simple.php @@ -34,7 +34,7 @@ class mod_ticket_simple extends ModeleNumRefTicket { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -119,9 +119,9 @@ public function canBeActivated($object) /** * Return next value * - * @param Societe $objsoc Object third party - * @param Ticket $ticket Object ticket - * @return string|-1 Value if OK, -1 if KO + * @param Societe $objsoc Object third party + * @param Ticket $ticket Object ticket + * @return string|int<-1,0> Value if OK, <=0 if KO */ public function getNextValue($objsoc, $ticket) { diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index 1b1c58820dec5..81b263a931e96 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.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 @@ -32,7 +33,7 @@ class mod_ticket_universal extends ModeleNumRefTicket { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -125,9 +126,9 @@ public function getExample() /** * Return next value * - * @param Societe $objsoc Object third party - * @param Ticket $ticket Object ticket - * @return string|int Next value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param Ticket $ticket Object ticket + * @return string|int<-1,0> Next value if OK, <=-1 if KO */ public function getNextValue($objsoc, $ticket) { diff --git a/htdocs/core/modules/ticket/modules_ticket.php b/htdocs/core/modules/ticket/modules_ticket.php index 0278ade325dee..7d152e898cc78 100644 --- a/htdocs/core/modules/ticket/modules_ticket.php +++ b/htdocs/core/modules/ticket/modules_ticket.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2014 Regis Houssin * Copyright (C) 2014 Marcos García * Copyright (C) 2020 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 @@ -38,9 +39,9 @@ abstract class ModelePDFTicket extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -53,6 +54,23 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param User $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } @@ -61,5 +79,12 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefTicket extends CommonNumRefGenerator { - // No overload code + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param Ticket $ticket Object ticket + * @return string|int<-1,0> Next value if OK, <=-1 if KO + */ + abstract public function getNextValue($objsoc, $ticket); } diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 8dd43bbdc32d1..20a002a708268 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -39,7 +39,7 @@ class doc_generic_user_odt extends ModelePDFUser { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -218,15 +218,15 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param User $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param User $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -368,7 +368,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); $object->fetch_optionals(); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { try { @@ -397,7 +397,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -425,7 +425,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/user/modules_user.class.php b/htdocs/core/modules/user/modules_user.class.php index d20e5e95eb8ec..953c23c6ab5ef 100644 --- a/htdocs/core/modules/user/modules_user.class.php +++ b/htdocs/core/modules/user/modules_user.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * 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 @@ -21,17 +22,17 @@ /** - * \class ModeleProductCode + * \class ModelePDFUser * \brief Parent class for product code generators */ /** - * \file htdocs/core/modules/contract/modules_contract.php + * \file htdocs/core/modules/user/modules_user.class.php * \ingroup contract * \brief File with parent class for generating contracts to PDF and File of class to manage contract numbering */ - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; /** * Parent class to manage intervention document templates @@ -46,11 +47,11 @@ abstract class ModelePDFUser extends CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation modules + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -62,4 +63,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) $list = getListOfModels($db, $type, $maxfilenamelength); return $list; } + + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document + * + * @param User $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 475a1f555fe12..80755e65b2cfd 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 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 @@ -40,7 +41,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; @@ -217,17 +218,17 @@ public function info($langs) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build a document on disk using the generic odt module. * - * @param UserGroup $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1 if OK, <=0 if KO + * @param UserGroup $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO */ - public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -346,7 +347,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text @@ -404,7 +405,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails complete_substitutions_array($tmparray, $outputlangs, $object); $object->fetch_optionals(); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { try { @@ -437,7 +438,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails unset($tmparray['object_pass_indatabase']); complete_substitutions_array($tmparray, $outputlangs, $object, $user, "completesubstitutionarray_users"); // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$u); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $u); $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { try { @@ -470,7 +471,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file @@ -498,7 +499,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { diff --git a/htdocs/core/modules/usergroup/modules_usergroup.class.php b/htdocs/core/modules/usergroup/modules_usergroup.class.php index 0e31611b3dbe5..9526f08f6cdcb 100644 --- a/htdocs/core/modules/usergroup/modules_usergroup.class.php +++ b/htdocs/core/modules/usergroup/modules_usergroup.class.php @@ -35,11 +35,11 @@ abstract class ModelePDFUserGroup extends CommonDocGenerator { // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of active generation modules + * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -51,4 +51,20 @@ public static function liste_modeles($db, $maxfilenamelength = 0) $list = getListOfModels($db, $type, $maxfilenamelength); return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param UserGroup $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); + // phpcs:enable } diff --git a/htdocs/core/modules/workstation/mod_workstation_advanced.php b/htdocs/core/modules/workstation/mod_workstation_advanced.php index dad2c124224c3..f372547a3958b 100644 --- a/htdocs/core/modules/workstation/mod_workstation_advanced.php +++ b/htdocs/core/modules/workstation/mod_workstation_advanced.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +38,7 @@ class mod_workstation_advanced extends ModeleNumRefWorkstation { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -126,7 +127,7 @@ public function getExample() * Return next free value * * @param Workstation $object Object we need next value for - * @return string|int Next value if OK, 0 if KO + * @return string|int<-1,0> Next value if OK, <=0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/workstation/mod_workstation_standard.php b/htdocs/core/modules/workstation/mod_workstation_standard.php index c68952f36a61d..7beeb90cd694f 100644 --- a/htdocs/core/modules/workstation/mod_workstation_standard.php +++ b/htdocs/core/modules/workstation/mod_workstation_standard.php @@ -34,7 +34,7 @@ class mod_workstation_standard extends ModeleNumRefWorkstation { /** * Dolibarr version of the loaded document - * @var string + * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' @@ -117,8 +117,8 @@ public function canBeActivated($object) /** * Return next free value * - * @param Workstation $object Object we need next value for - * @return string|-1 Next value if OK, -1 if KO + * @param Workstation $object Object we need next value for + * @return string|int<-1,0> Next value if OK, <=0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/workstation/modules_workstation.php b/htdocs/core/modules/workstation/modules_workstation.php index afa884c27d7f1..74f2f13062453 100644 --- a/htdocs/core/modules/workstation/modules_workstation.php +++ b/htdocs/core/modules/workstation/modules_workstation.php @@ -7,6 +7,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,9 +44,9 @@ abstract class ModelePDFWorkstation extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -58,6 +59,21 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Workstation $object Object source to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int<0,1> $hidedetails Do not show line details + * @param int<0,1> $hidedesc Do not show desc + * @param int<0,1> $hideref Do not show ref + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0); } @@ -66,5 +82,11 @@ public static function liste_modeles($db, $maxfilenamelength = 0) */ abstract class ModeleNumRefWorkstation extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Workstation $object Object we need next value for + * @return string|int<-1,0> Next value if OK, <=0 if KO + */ + abstract public function getNextValue($object); } diff --git a/htdocs/core/multicompany_page.php b/htdocs/core/multicompany_page.php index a047ef7496836..6ef07a97011fd 100644 --- a/htdocs/core/multicompany_page.php +++ b/htdocs/core/multicompany_page.php @@ -58,6 +58,9 @@ $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); +if (!isModEnabled('multicompany')) { + httponly_accessforbidden('No multicompany module enabled'); +} /* @@ -92,45 +95,47 @@ print '
    '; //print '
    '; +// Define $multicompanyList +$multicompanyList = ''; $bookmarkList = ''; if (!isModEnabled('multicompany')) { $langs->load("admin"); - $bookmarkList .= '
    '.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).''; - $bookmarkList .= '

    '; + $multicompanyList .= '
    '.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).''; + $multicompanyList .= '

    '; +} elseif (!empty($user->entity) && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { // Should not be accessible if the option to centralize users on the main entity is not activated + $langs->load("errors"); + $multicompanyList .= '
    '.$langs->trans("ErrorForbidden").''; + $multicompanyList .= '

    '; } else { // Instantiate hooks of thirdparty module $hookmanager->initHooks(array('multicompany')); - // Define $bookmarks - $multicompanyList = ''; - $searchForm = ''; - - if (is_object($mc)) { - $listofentities = $mc->getEntitiesList($user->login, false, true); + $listofentities = $mc->getEntitiesList(true, false, true); } else { $listofentities = array(); } - $multicompanyList .= '
    '; print ''."\n"; diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 94a7f99081015..254442a8df4a8 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -223,7 +223,8 @@ function init_typeoffields(type) } print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha') ? GETPOST('type', 'alpha') : $type, $typewecanchangeinto); } else { - print getPictoForType($type).$type2label[$type]; + print getPictoForType($type); + print $type2label[$type]; print ''; } ?> diff --git a/htdocs/core/tpl/bloc_showhide.tpl.php b/htdocs/core/tpl/bloc_showhide.tpl.php index 8af7c7665db8e..cc93012cc0671 100644 --- a/htdocs/core/tpl/bloc_showhide.tpl.php +++ b/htdocs/core/tpl/bloc_showhide.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 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 @@ -25,10 +26,10 @@ $hide = true; // Hide by default if (isset($parameters['showblocbydefault'])) { - $hide = (empty($parameters['showblocbydefault']) ? true : false); + $hide = empty($parameters['showblocbydefault']); } if (isset($object->extraparams[$blocname]['showhide'])) { - $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false); + $hide = empty($object->extraparams[$blocname]['showhide']); } ?> diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index e1db02bd58c34..86fdedacb872a 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -43,7 +43,7 @@ // If field is a computed field, we make computation to get value if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) { $objectoffield = $object; //For compatibility with the computed formula - $value = dol_eval((int) $extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '2'); + $value = dol_eval((string) $extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '2'); if (is_numeric(price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { $obj->$tmpkey = price2num($value); } diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index ad282d70a4393..d9c860a050fbb 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -44,14 +44,14 @@ $morecss = ''; $preselectedvalues = (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]); // Here $preselectedvalues can be an array('start'=>int, 'end'=>int) or an int - echo $extrafields->showInputField($key, $preselectedvalues, '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); + print $extrafields->showInputField($key, $preselectedvalues, '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); } else { // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') $morecss = ''; if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) { $morecss = 'maxwidth200'; } - echo $extrafields->showInputField($key, (!isset($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); + print $extrafields->showInputField($key, (!isset($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); } print ''; } diff --git a/htdocs/core/tpl/formlayoutai.tpl.php b/htdocs/core/tpl/formlayoutai.tpl.php index 8cf9f934d32ca..3ab9c3631a012 100644 --- a/htdocs/core/tpl/formlayoutai.tpl.php +++ b/htdocs/core/tpl/formlayoutai.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 @@ -40,6 +41,14 @@ '; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 8a123b4149420..7b18cc1a4e92c 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2011-2022 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 @@ -162,10 +163,10 @@