diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index d7463d62172..280dc3a83cc 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -67,9 +67,12 @@ where
In uppercase if you want to have the log comment appears into the generated ChangeLog file.
The keyword can be ommitted if your commit does not fit in any of the following categories:
+
- Fix/FIX: for a bug fix
- New/NEW: for an unreferenced new feature (Opening a feature request and using close is prefered)
- Close/CLOSE: for closing a referenced feature request
+- Perf/PERF: for performance enhancement
+- Qual/QUAL: for quality code enhancement or re-engeneering
#### Issuenum
If your commit fixes a referenced bug or feature request.
@@ -96,10 +99,10 @@ Try to keep lines under 120 characters.
FIX|Fix #456 Short description (where #456 is number of bug fix, if it exists. In upper case to appear into ChangeLog)
or
-NEW|New Short description (In upper case to appear into ChangeLog, use this if you add a feature not tracked, otherwise use CLOSE #456)
-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)
+or
Short description (when the commit is not introducing feature nor closing a bug)
Long description (Can span accross multiple lines).
@@ -119,7 +122,7 @@ 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 add a 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.
+* 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.
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR (A label is added in such a case).
diff --git a/.github/workflows/code_quality_qodana.yml b/.github/workflows/code_quality_qodana.yml.disabled
similarity index 90%
rename from .github/workflows/code_quality_qodana.yml
rename to .github/workflows/code_quality_qodana.yml.disabled
index cb08ea9b4cd..f9296bf377e 100644
--- a/.github/workflows/code_quality_qodana.yml
+++ b/.github/workflows/code_quality_qodana.yml.disabled
@@ -21,7 +21,7 @@ jobs:
fetch-depth: 1
#php-version: '7.1'
- name: 'Qodana Scan'
- uses: JetBrains/qodana-action@v2023.1.5
+ uses: JetBrains/qodana-action@v2023.2.1
#with:
# php-version: '7.1'
env:
diff --git a/.github/workflows/exakat.yml.disabled b/.github/workflows/exakat.yml
similarity index 63%
rename from .github/workflows/exakat.yml.disabled
rename to .github/workflows/exakat.yml
index 1e9121a0e00..0b33ede5f4f 100644
--- a/.github/workflows/exakat.yml.disabled
+++ b/.github/workflows/exakat.yml
@@ -2,8 +2,9 @@
name: "Exakat analysis"
on:
+ # execute once a month, the 1st
schedule:
- - cron: "0 20 * * *"
+ - cron: "0 20 1 * *"
workflow_dispatch:
branches:
- develop
@@ -15,11 +16,13 @@ jobs:
exakat:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Exakat
uses: docker://exakat/exakat-ga
with:
- ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/AddZero,Structures/DropElseAfterReturn,Structures/IfWithSameConditions,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/ExitUsage,Structures/RepeatedPrint,Structures/RepeatedRegex,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
- ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test'
\ No newline at end of file
+ ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/AddZero,Structures/DropElseAfterReturn,Structures/IfWithSameConditions,Structures/MergeIfThen,Structures/NestedTernary,Structures/ElseIfElseif,Structures/ExitUsage,Structures/RepeatedPrint,Structures/RepeatedRegex,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
+ ignore_dirs: '/htdocs/includes/,/htdocs/install/doctemplates/,/build/,/dev/,/doc/,/scripts/,/test/'
+ file_extensions: php
+ project_reports: Perfile
\ No newline at end of file
diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml
index 560891f1ef1..1bb1184586f 100644
--- a/.github/workflows/phpcs.yml
+++ b/.github/workflows/phpcs.yml
@@ -11,7 +11,7 @@ jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
fetch-depth: 50 # important!
diff --git a/.github/workflows/phpcsfixer.yml.disabled b/.github/workflows/phpcsfixer.yml.disabled
index 5c74397ecfc..959ba5ad801 100644
--- a/.github/workflows/phpcsfixer.yml.disabled
+++ b/.github/workflows/phpcsfixer.yml.disabled
@@ -1,6 +1,8 @@
name: GitHub CI PHPCS and PHPCBF
-on: push
+on:
+ pull_request:
+ types: [opened]
#on:
# push:
# paths:
@@ -11,7 +13,7 @@ jobs:
# uses: ./.github/workflows/files_changed.yaml
# with:
# folder_path: .*
-
+
linter_name:
name: Run & fix PHP Code Sniffer
runs-on: ubuntu-latest
@@ -19,7 +21,9 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
- fetch-depth: 10
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
+ ref: ${{ github.event.pull_request.head.ref }}
+ # fetch-depth: 10
- name: echo Get list of all changed files
run: |
@@ -39,6 +43,21 @@ jobs:
phpcs_ref_name: ${{github.ref_name}}
phpcs_github_event_name: ${{github.event_name}}
phpcs_files: ${{ needs.filesChanged.outputs.all_changed_files }}
- - uses: stefanzweifel/git-auto-commit-action@v4 # auto commit the fixes action for GitHub
+
+ #- uses: stefanzweifel/git-auto-commit-action@v4 # auto commit the fixes action for GitHub
+ # with:
+ # commit_message: Fix PHPCS errors by GitHub PHPCSfixer action
+
+ - name: Commit changes
+ uses: EndBug/add-and-commit@v9.1.3
with:
- commit_message: Fix PHPCS errors by GitHub PHPCSfixer action
+ default_author: github_actions
+ committer_name: GitHub Actions
+ committer_email: actions@github.com
+ #author_name: PHP CS fixer
+ #author_email: eldy@destailleur.fr
+ #committer_name: PHP CS fixer
+ #committer_email: eldy@destailleur.fr
+ message: 'PHP CS fixer github action'
+ add: '*.php'
+
diff --git a/.gitignore b/.gitignore
index 8c639a26540..cc8b27dae67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,11 +59,6 @@ package-lock.json
doc/install.lock
/.asciidoctorconfig.adoc
-# Qodana
-.idea/vcs.xml
-.idea/modules.xml
-.idea/workspace.xml
-.idea/inspectionProfiles/Project_Default.xml
-.idea/jsLinters/jshint.xml
+.idea
/composer.json
/composer.lock
diff --git a/.idea/php.xml b/.idea/php.xml
deleted file mode 100644
index f324872a8ba..00000000000
--- a/.idea/php.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
deleted file mode 100644
index 058a0ba8b48..00000000000
--- a/.scrutinizer.yml
+++ /dev/null
@@ -1,236 +0,0 @@
-# .scrutinizer.yml
-#build:
-# - php-scrutinizer-run
-build:
- nodes:
- analysis:
- tests:
- override:
- - command: php-scrutinizer-run
- idle_timeout: 8000
- #- php-scrutinizer-run --sub-project-dir=htdocs/admin
-
-imports:
- - php
-
-filter:
- excluded_paths:
- - build/
- - dev/
- - doc/
- - documents/
- - node_modules/
- - test/
- - htdocs/custom/
- - htdocs/includes/
- - htdocs/install/doctemplates/
- #dependency_paths:
- # - htdocs/includes/
- paths:
- - htdocs/*
- - scripts/*
-
-tools:
- # php_analyzer. Doc on https://scrutinizer-ci.com/docs/tools/php/php-analyzer/
- php_analyzer:
- enabled: true
- extensions:
- - php
- #dependency_paths:
- # - htdocs/includes/
- filter:
- excluded_paths:
- - build/
- - dev/
- - doc/
- - documents/
- - htdocs/custom/
- - htdocs/includes/
- - htdocs/install/doctemplates/
- - htdocs/core/class/lessc.class.php
- - node_modules/
- - test/
- paths:
- - htdocs/*
- - scripts/*
- config:
- parameter_reference_check:
- enabled: true
- checkstyle:
- enabled: false
- no_trailing_whitespace: true
- naming:
- enabled: true
- local_variable: ^[a-z][a-zA-Z0-9]*$
- abstract_class_name: ^Abstract|Factory$
- utility_class_name: Utils?$
- constant_name: ^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$
- property_name: ^[a-z][a-zA-Z0-9]*$
- method_name: ^(?:[a-z]|__)[a-zA-Z0-9]*$
- parameter_name: ^[a-z][a-zA-Z0-9]*$
- interface_name: ^[A-Z][a-zA-Z0-9]*Interface$
- type_name: ^[A-Z][a-zA-Z0-9]*$
- exception_name: ^[A-Z][a-zA-Z0-9]*Exception$
- isser_method_name: ^(?:is|has|should|may|supports)
- unreachable_code:
- enabled: true
- check_access_control:
- enabled: true
- typo_checks:
- enabled: true
- check_variables:
- enabled: true
- check_calls:
- enabled: true
- too_many_arguments: true
- missing_argument: true
- argument_type_checks: lenient # Allowed Values: "disabled", "lenient", "strict"
- suspicious_code:
- enabled: true
- overriding_parameter: false
- overriding_closure_use: true
- parameter_closure_use_conflict: true
- parameter_multiple_times: true
- non_existent_class_in_instanceof_check: true
- non_existent_class_in_catch_clause: true
- assignment_of_null_return: true
- non_commented_switch_fallthrough: true
- non_commented_empty_catch_block: true
- overriding_private_members: true
- use_statement_alias_conflict: true
- precedence_in_condition_assignment: true
- dead_assignments:
- enabled: true
- verify_php_doc_comments:
- enabled: false
- parameters: true
- return: true
- suggest_more_specific_types: true
- ask_for_return_if_not_inferrable: true
- ask_for_param_type_annotation: true
- loops_must_use_braces:
- enabled: true
- check_usage_context:
- enabled: true
- simplify_boolean_return:
- enabled: false
- phpunit_checks:
- enabled: false
- reflection_checks:
- enabled: true
-
- # Checks Common Precedence Mistakes
- precedence_checks:
- enabled: true
- assignment_in_condition: true
- comparison_of_bit_result: true
- basic_semantic_checks:
- enabled: true
- # Disabled unused code. In most cases, we want to keep it.
- unused_code:
- enabled: false
- deprecation_checks:
- enabled: true
- useless_function_calls:
- enabled: true
- metrics_lack_of_cohesion_methods:
- enabled: true
- metrics_coupling:
- enabled: true
- stable_code:
- namespace_prefixes: []
- classes: []
- doctrine_parameter_binding:
- enabled: false
- doctrine_entity_manager_injection:
- enabled: false
- symfony_request_injection:
- enabled: false
- doc_comment_fixes:
- enabled: true
- reflection_fixes:
- enabled: false
- use_statement_fixes:
- enabled: true
- remove_unused: true
- # Whether you would like multiple imports in one USE statement to be preserved, e.g. ``use A, B;``.
- preserve_multiple: false
- # Whether you would like to preserve blank lines between use statements.
- preserve_blanklines: false
- order_alphabetically: false
- # To use specific config for a specific path, use path_configs: (see example on page https://scrutinizer-ci.com/docs/configuration/tool_config_structure)
-
- # php_depend
- #php_pdepend:
- # enabled: false
- # configuration_file: null
- # suffixes:
- # - php
- # excluded_dirs: { }
- # filter:
- # excluded_paths:
- # - 'build/*'
- # - 'dev/*'
- # - 'doc/*'
- # - 'test/*'
- # - 'htdocs/includes/*'
- # paths: { }
-
- # change tracking
- #php_changetracking:
- # enabled: false
- # bug_patterns:
- # - '\bfix(?:es|ed)?\b'
- # feature_patterns:
- # - '\badd(?:s|ed)?\b'
- # - '\bimplement(?:s|ed)?\b'
- # filter:
- # excluded_paths:
- # - 'build/*'
- # - 'dev/*'
- # - 'doc/*'
- # - 'documents/*'
- # - 'htdocs/includes/*'
- # - 'node_modules/*'
- # - 'test/*'
- # paths: { }
-
- # Similar code detection
- #php_sim:
- # enabled: false
- # min_mass: 30
- # filter:
- # excluded_paths:
- # - 'build/*'
- # - 'dev/*'
- # - 'doc/*'
- # - 'documents/*'
- # - 'htdocs/includes/*'
- # - 'node_modules/*'
- # - 'test/*'
- # paths: { }
-
- # Coding-Style / Bug Detection
- #js_hint:
- # enabled: false
- # use_native_config: true
- # extensions:
- # - js
- # filter:
- # excluded_paths:
- # - 'build/*'
- # - 'dev/*'
- # - 'doc/*'
- # - 'documents/*'
- # - 'htdocs/includes/*'
- # - 'node_modules/*'
- # - 'test/*'
- # paths: { }
- # config: { }
- # path_configs: { }
-
-
-before_commands: { }
-after_commands: { }
-artifacts: { }
-build_failure_conditions: { }
diff --git a/.stickler.yml b/.stickler.yml
deleted file mode 100644
index 642dec27412..00000000000
--- a/.stickler.yml
+++ /dev/null
@@ -1,14 +0,0 @@
----
-linters:
- phpcs:
- standard: 'dev/setup/codesniffer/ruleset.xml'
- extensions: 'php'
- tab_width: 4
- fixer: true
-
-fixers:
- enable: true
-
-files:
- ignore:
- - 'htdocs/includes/*'
diff --git a/.travis.yml b/.travis.yml
index a5e26790005..19fb70cbc93 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ dist: focal
language: generic
-scan_logs: false
+#scan_logs: false
git:
depth: 1
@@ -325,22 +325,24 @@ script:
echo
- |
- echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)"
+ echo "Checking coding style (only for 1 version to not overload travis and avoid duplicate tests)"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
- if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
+ #if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
+ if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
fi
set +e
echo
- |
- echo "Checking missing debug"
+ echo "Checking missing debug (only for 1 version to not overload travis and avoid duplicate tests)"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
- if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
+ #if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
+ if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
fi
set +e
@@ -371,6 +373,7 @@ script:
echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE
echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE
#cat $INSTALL_FORCED_FILE
+ echo
- |
echo "Upgrading Dolibarr"
@@ -436,15 +439,22 @@ script:
php upgrade.php 17.0.0 18.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade17001800.log
php upgrade2.php 17.0.0 18.0.0 > $TRAVIS_BUILD_DIR/upgrade17001800-2.log
php step5.php 17.0.0 18.0.0 > $TRAVIS_BUILD_DIR/upgrade17001800-3.log
+ php upgrade.php 18.0.0 19.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade18001900.log || cat $TRAVIS_BUILD_DIR/upgrade18001900.log
+ php upgrade2.php 18.0.0 19.0.0 > $TRAVIS_BUILD_DIR/upgrade18001900-2.log || cat $TRAVIS_BUILD_DIR/upgrade18001900-2.log
+ php step5.php 18.0.0 19.0.0 > $TRAVIS_BUILD_DIR/upgrade18001900-3.log || cat $TRAVIS_BUILD_DIR/upgrade18001900-3.log
+ set +e
+ echo
- #show table content and log
+ - |
+ echo Show some debug info like table content or log
#echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
- #cat $TRAVIS_BUILD_DIR/upgrade500600.log
+ cat $TRAVIS_BUILD_DIR/upgrade18001900.log
+ echo
- |
echo Result of migration scripts
ls -alrt $TRAVIS_BUILD_DIR/
-
+
echo Show content of last file
cat $TRAVIS_BUILD_DIR/"$(ls -rt $TRAVIS_BUILD_DIR/ | tail -n1)"
@@ -463,6 +473,7 @@ script:
echo
#cat /tmp/dolibarr_install.log
cat $TRAVIS_BUILD_DIR/enablemodule.log
+ echo
- |
echo "Unit testing"
@@ -472,6 +483,7 @@ script:
phpunitresult=$?
echo "Phpunit return code = $phpunitresult"
set +e
+ echo
after_script:
- |
diff --git a/COPYRIGHT b/COPYRIGHT
index 2485625914a..96c39a39650 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -52,7 +52,7 @@ bacon, dasprid, swiss-qr-bill, kmukku, symfony/validator
JS libraries:
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
ChartJS 3.7.1 MIT License Yes JS library for graph
-CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG
+CKEditor 4.22.1 LGPL-2.1+ Yes Editor WYSIWYG
jQuery 3.6.4 MIT License Yes JS library
jQuery UI 1.13.2 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
diff --git a/ChangeLog b/ChangeLog
index 33335d77545..1c7e4933f98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,27 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
+***** ChangeLog for 19.0.0 compared to 18.0.0 *****
+
+For users:
+----------
+...
+
+For developers or integrators:
+------------------------------
+...
+
+
+WARNING:
+
+Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
+* The property ->brouillon has been removed from all classes. It was not reliable and was a duplicate of ->status == self::STATUS_DRAFT.
+* The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead.
+* Recheck setup of your module workflow to see if you need to enable the new setting to have shipment set to billed automatically
+ when an invoice from a shipment is validated (and if your process is to make invoice on shipment and not on order).
+* It was possible to use a variable $soc or $right inside a php code condition of some extrafields properties, this is no more true (this vars are no more defined globaly).
+
+
***** ChangeLog for 18.0.1 compared to 18.0.0 *****
FIX: Adding a product in recurring invoice does not use the correct VAT
FIX: API /product/getAttributes
@@ -39,8 +60,8 @@ FIX: when adding new times on a survey, all hours would be erased.
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
-For uses:
----------
+For users:
+----------
NEW: PHP 8.2 compatibility (not yet complete).
NEW: Module Workstations Management upgraded to stable status.
@@ -53,66 +74,56 @@ NEW: Accountancy - Manage intra-community VAT on supplier invoices - FPC22
NEW: Accountancy - iSuiteExpert export model
NEW: Accountancy - Quadratus export with attachments in accountancy export
NEW: Accountancy - Can filter on a custom group of accounts. Perf or ledger list.
+NEW: Accountancy - Can select the export format during export of journals
+NEW: Accountancy - sort of column of custom group of account
NEW: Can upload a file with drag and drop on purchase invoice, vats, salaries and social contributions
NEW: Authentication: #22740 add OpenID Connect impl
NEW: Authentication: add experimental support for Google OAuth2 connexion
NEW: Authentication: can now edit service name for OAuth token
-NEW: Add a public virtual card page for each user
-NEW: Add a status on supplier price ref (WIP to close a supplier ref)
NEW: add bookmarks in selectable landing pages for users
NEW: Add column ext_payment_site into societe_rib to allow multiple payment mode
NEW: add convertion of images to webp for a single image in website media editor
NEW: Add CRC for currency symbol before amount
-NEW: add customer code to invoices listing
NEW: Add filter on nb of generation done in list of recurring invoices
NEW: Add filters and sort on product unit column
NEW: Add link to edit VAT list from error message of missing VAT
NEW: add margins in paiement/card.php
NEW: Add mass action delete on VAT
-NEW: Add origin info when create a product batch when created from a movement stock
NEW: Add possibility to choose format #21426
-NEW: Add SQL contraint on product_stock table to allow only exsting product and warehouse #23543
-NEW: Add STRIPE_DEBUG, a way to log Stripe IPN
NEW: An external module can modify the quick search fields
-NEW: Auto activate some modules on install (Export/Import/Wysiwyg editor)
-NEW: Autofill email form with the email template with status "Default" on
-NEW: Bank name no more mandatory on creation. Can be generated if empty.
-NEW: Bank: Add fields zip, town, country for owner of a bank account
+NEW: Bank: Bank name no more mandatory on creation. Can be generated if empty.
+NEW: Bank: Add fields zip, town, country for owner of a bank account
NEW: batch referential objets
NEW: Can add the add now link on date into addfieldvalue()
+NEW: Can add an array of several links in date selector
NEW: Can bin accounting line for a given month
-NEW: Can edit account on miscellaneous payment (if not transfered)
NEW: Can edit inline the VAT number from supplier tab
-NEW: Can fill date of salary payment with date of start of salary
NEW: Can go back to draft on shipment when stock change not on validate
NEW: Can modify bank account of sepa payment (if file not sent yet)
-NEW: Customers: add date due and labels into customer comm card
-NEW: Can select the export format during export of journals
NEW: Can set a checkbox in formconfirm by clicking on the label
-NEW: Can set flag default value on email templates
NEW: Can set the page "List of opportunities" as landing page
-NEW: Can show the sql request used on emailing selection
+NEW: Can show the SQL request used on emailing selection
NEW: can stay on edit field when errors occurs
NEW: comment in api_mymodule for seperate methods
-NEW: constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT
NEW: create email substitution variable for intervention signature URL
+NEW: Contacts: presend mass action in contact list
+NEW: Contacts: hook printFieldListFrom in contact list
+NEW: Customers: add date due and labels into customer comm card
NEW: Debug the custom CSS feature to avoid a directory search/scan at
NEW: dev name
NEW: Disable bad reputation product price
-NEW: dolExplodeIntoArray can accept regex
-NEW: dol_sort_array can sort on alphabetical order even if val is num
-NEW: element time integration code + SQL
+NEW: Email: autofill email form with the email template with status "Default" on
NEW: Email: don't have closed contact proposed as receiver for the mails
+NEW: Email: can set flag default value on email templates
NEW: Email-Collector: add field reply-to in email collector as possible filter
NEW: Email-Collector: substitute date now in email collector
NEW: Email-Collector: operation type in email collector to load or create contact
NEW: Email-Collector: easier setup - can also use ! for negative search
+NEW: Email-Templates: show module into list of email templates
NEW: Events: can add any contact on events if global MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT is set at 1
NEW: Events: list with color
-NEW: expend/collapse list of social networks
-NEW: Filter on amount and qty on list of service's contracts
+NEW: Events: remove default percentage for event creation url
NEW: formconfirm can support field with format datetime
-NEW: getCommonSubstitutionArray to have more substitute keys
NEW: GeoIP: Can test a geoip conversion from the geoip setup page
NEW: GUI: add a CSS editor into the admin GUI
NEW: GUI: add dropdown button actions (example on Create button on project)
@@ -123,16 +134,17 @@ NEW: GUI: can set background style with MAIN_LOGIN_BACKGROUND_STYLE
NEW: Help: Tooltip to explain how to add a photo on a product
NEW: Help: Possibility to link to German pages in help
NEW: helper functions for dates + small demo case
-NEW: hook printFieldListFrom in contact list
+NEW: HR - Salary: can fill date of salary payment with date of start of salary
NEW: HR - Salary: can modify the date of payment of a salary (if not reconciled)
NEW: HR - Salary: date for salary payment includes the hour/min
NEW: HR - Salary: adding button Send Email on the salary file
NEW: Import: filter on entity in import
NEW: Import: map table to element for get entity in import
NEW: inc.php: handle parameters from argv
-NEW: Invoice - show category of operations
+NEW: Installation: Auto activate some modules on install (Export/Import/Wysiwyg editor)
+NEW: Invoice: show category of operations
+NEW: Invoice: add customer code to invoices listing
NEW: Keep a link between user created from recruitment and application
-NEW: List product in orders
NEW: Mass Actions: Better responsive for mass actions
NEW: Members: add numbering modules for members
NEW: Members: add widget box_members_by_tags.php
@@ -146,75 +158,75 @@ NEW: No overwrite of optionals during put() contact
NEW: Notifications: add Customer Order delivered (ORDER_NEW) in module Notification
NEW: Notifications: for Sign or Refused Propal from Online Page
NEW: Now we can edit amount on VAT and salaries clone action
-NEW: only get openned contact from liste_contact function, to not have acces to closed contact as mail receiver
+NEW: only get opened contact from liste_contact function, to not have access to closed contact as mail receiver
+NEW: Option: MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660
NEW: Option to manage deposit slips for more payment modes (not only
NEW: Option to show column for field and line selection on the left
NEW: Orders: add sub total in order list det
+NEW: Orders: list product in orders
NEW: Orders export: allow to export field 'shipment method'
NEW: payment default values when supplier order created from reception
-NEW: Payment : manage contracts
-NEW: presend mass action in contact list
+NEW: Payment: manage contracts
+NEW: Payment: sepaStripe now creates the payment mode with type pm_ using new API
+NEW: Payment: add partial payment reason "withholding tax"
+NEW: Payment: Can edit account on miscellaneous payment (if not transfered)
NEW: Print PDF: category of operation for crabe PDF model
NEW: Print PDF: Name and date to print on PDF Sign
NEW: Print PDF: Use the more recent PDF templates for documents by default on a fresh install
+NEW: Print PDF: Option PDF_SHOW_PHONE_AFTER_USER_CONTACT to show phone after specific assigned contact on PDF
+NEW: Print PDF: Option PDF_SHOW_EMAIL_AFTER_USER_CONTACT to show email after specific assigned contact on PDF
NEW: product images on popup are cached
+NEW: Products: Add origin info when create a product batch when created from a movement stock
NEW: Products: Add statistics by amount on statistics of products.
+NEW: Products: Add SQL contraint on product_stock table to allow only existing product and warehouse #23543
NEW: Proposals: filter for Signed+Billed in proposals
NEW: Proposals: can modify margin rates in offers like VAT rates
NEW: Proposals: option filter for NoSalesRepresentativeAffected in proposals list
-NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key
+NEW: Proposals: constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT
NEW: Reception: can receive more than qty ordered on reception
NEW: referential objects of batch
-NEW: remove default percentage for event creation url
NEW: remove keys whose table element is the same as element in map list
NEW: repair script skip views
+NEW: search on time spent duration range
NEW: Security: Save date to invalidate other session into user table
NEW: Security: Invalidate all sessions of a user when password is modified.
-NEW: search on time spent duration range
-NEW: sepaStripe now creates the payment mode with type pm_ using new API
-NEW: set payment default values when supplier order created from reception
+NEW: Service Contracts: Filter on amount and qty on list of service's contracts
NEW: set today start time at beginning
-NEW: Show counter of access of website in website list
NEW: Show main currency in company info user tooltip
-NEW: Show module into list of emails templates
-NEW: Show picto into the combobox of widgets
NEW: Show supplier invoice ref of direct debit transfer tab invoices
-NEW: show supplier name in getNomUrl of supplier order
-NEW: sort of column of custom group of account
-NEW: Supplier Invoices: add ability of ODT support to supplier invoices
+NEW: Social Networks: expend/collapse list of social networks
NEW: Stock limit for alert and desired optimal stock by product and warehouse import
NEW: Stock: Add warehouse create and modify triggers.
NEW: Stock: Can select several warehouses into the view stock at date in past
+NEW: Stripe: add STRIPE_DEBUG, a way to log Stripe IPN
+NEW: Supplier Invoices: add ability of ODT support to supplier invoices
+NEW: Supplier Order: show supplier name in getNomUrl of supplier order
+NEW: Supplier Order: set payment default values when supplier order created from reception
+NEW: Supplier Price: Add a status on supplier price ref (WIP to close a supplier ref)
NEW: Support different bank account for several direct debit payments
NEW: Support multiselect in the warehouse selection combo box
-NEW: Option: MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660
NEW: Survey: Comment on survey is possible only after vote.
-NEW: tables: llx_element_time to store time spent on several elements (mo, ticket...)
NEW: TakePOS: adapt category and product pictures sizes on TakePOS
NEW: TakePOS: limit load products in TakePOS
NEW: The batch for remind on due date can be setup for using validation date
-NEW: The refresh link for imap collector is always visible
-NEW: The upgrade process can be done by creating a file upgrade.unlock
-NEW: Tickets: --Send an email when ticket assigned--
+NEW: The refresh link for IMAP collector is always visible
+NEW: Third-Party: use an ajax component to switch prospection status on thirdparty list
NEW: Tickets: Send a notification email when ticket assigned
NEW: Tickets: set ticket status to answered if the client has answered from the public interface
NEW: Tickets: added an option to display the progress of tickets on the public interface
NEW: Tickets: add link to thirdparty tickets history
NEW: Tickets: notify also the contributor affected to a ticket if a new message public is post (add global TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR)
+NEW: Upgrades: The upgrade process can be done by creating a file upgrade.unlock
NEW: Use a cache file for external RSS in calendar
NEW: Use by default the domain $dolibarr_main_url_root for SMTP HELO
-NEW: use more recent model by default
+NEW: Users: add a public virtual card page for each user
NEW: VAT can be modified during add of line
NEW: Website Module: Increment website counter on each page access in website module
-NEW: write all fields and their properties in asciidoc format
-NEW: Can add an array of several links in date selector
-NEW: Option PDF_SHOW_PHONE_AFTER_USER_CONTACT to show phone after specific assigned contact on PDF
-NEW: Option PDF_SHOW_EMAIL_AFTER_USER_CONTACT to show email after specific assigned contact on PDF
+NEW: Website Module: Show counter of access of website in website list
+NEW: Widgets: Show picto into the combobox of widgets
NEW: Widgets: Implement MAIN_ACTIVATE_FILECACHE on birthday widget
NEW: Widgets: Add widget "The next upcoming events"
NEW: Widgets: Add widget of open opportunities
-NEW: use an ajax component to switch prospection status on thirdparty list
-NEW: Add partial payment reason "withholding tax"
@@ -224,18 +236,28 @@ For developers or integrators:
NEW: Make it possible to select hours and minutes in form_confirm
NEW: add triggers on mailing
NEW: Add a trigger when create a shipping line batch and fix propagate missing errors
-NEW: add function for listiong objects from directory
+NEW: add function for listing objects from directory
NEW: add helplist property to describe fields of objects
-NEW: add hook in loadLotStock() in html.formproduct.class.php file, add hook 'llxFooter', Add hook online sign
-NEW: Update lib parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0, jquery, Stripe.
-NEW: Support contact in post() document API
-NEW: More APIs (update currency rate, upload of supplier documents, ...)
+NEW: API: Support contact in post() document API
+NEW: API: more APIs (update currency rate, upload of supplier documents, ...)
+NEW: Hooks: printFieldListFrom in contact list
+NEW: Hooks: add hook in loadLotStock() in html.formproduct.class.php file
+NEW: Hooks: add hook 'llxFooter'
+NEW: Hooks: add hook online sign
+NEW: Hooks: add sent info in the parameters provided to the hook sendMailAfter
+NEW: Libraries: Update libs parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0, jquery, Stripe.
NEW: ModuleBuilder: updating in modulbuilder on tab Menu when adding object
NEW: ModuleBuilder: add/edit permissions
NEW: ModuleBuilder: better generated documentation
-NEW: add sent info in the parameters provided to the hook sendMailAfter
NEW: add setAsSelectUser into factory for generic setup page
NEW: add option keepspace into dol_string_nospecialchar()
+NEW: dol_sort_array can sort on alphabetical order even if val is num
+NEW: dolExplodeIntoArray can accept regex
+NEW: element time integration code + SQL
+NEW: tables: llx_element_time to store time spent on several elements (mo, ticket...)
+NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key
+NEW: getCommonSubstitutionArray to have more substitute keys
+NEW: write all fields and their properties in asciidoc format
WARNING:
diff --git a/SECURITY.md b/SECURITY.md
index 2c93a201151..a64518800a4 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -48,7 +48,7 @@ Reports are processed around once a month.
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
-* The version to analyze must be the last version available into "develop" branch or into last stable "vX.Y" released version.
+* The version to analyze must be the last version available into "develop" branch or into last stable "vX.Y" released version. Reports on vulnerabilities already fixed (so already reported) into the develop branch will not be validated.
* $dolibarr_main_prod must be set to 1 into conf.php
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
* $dolibarr_main_force_https must be set to something else than 0.
diff --git a/build/exe/doliwamp/Makefile b/build/exe/doliwamp/Makefile
index 8e446931c74..3344232b177 100644
--- a/build/exe/doliwamp/Makefile
+++ b/build/exe/doliwamp/Makefile
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------#
-# Makefile
+# Makefile to build UsedPort exe
#-------------------------------------------------------------------#
# 1.0 Laurent Destailleur Creation
#-------------------------------------------------------------------#
diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl
index b7586e3909f..5862f3f2970 100755
--- a/build/makepack-dolibarr.pl
+++ b/build/makepack-dolibarr.pl
@@ -2,7 +2,7 @@
#----------------------------------------------------------------------------
# \file build/makepack-dolibarr.pl
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
-# \author (c)2004-2020 Laurent Destailleur
+# \author (c)2004-2023 Laurent Destailleur
#
# This is list of constant you can set to have generated packages moved into a specific dir:
#DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'
@@ -369,12 +369,12 @@ if ($nboftargetok) {
}
if (! $BUILD || $BUILD eq '0-rc') # For a major version
{
- print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\|CLOSE\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/CLOSE/NEW/g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
+ print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\|PERF\|SEC\|QUAL\|CLOSE\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/CLOSE/NEW/g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
}
else # For a maintenance release
{
- #print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/CLOSE/NEW/g\'| sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
- print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. | grep -v "Merge branch" | grep -v "Merge pull" | grep "^ " | sed -e "s/^[0-9a-z]* *//" | grep -e \'^FIX\|NEW\|CLOSE\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/CLOSE/NEW/g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
+ #print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\|PERF\|SEC\|QUAL\|CLOSE\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/CLOSE/NEW/g\'| sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
+ print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. | grep -v "Merge branch" | grep -v "Merge pull" | grep "^ " | sed -e "s/^[0-9a-z]* *//" | grep -e \'^FIX\|NEW\|PERF\|SEC\|QUAL\|CLOSE\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/CLOSE/NEW/g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
}
print "\n";
if (! $ret)
@@ -627,11 +627,11 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`;
- $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/examples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
+ $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/examples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`;
diff --git a/build/phpstan/README b/build/phpstan/README
index 4ecde9baca5..097aac0d3c4 100644
--- a/build/phpstan/README
+++ b/build/phpstan/README
@@ -1,9 +1,21 @@
-PHPStan
-
-https://phpstan.org
+PHPStan (https://phpstan.org)
+-----------------------------
PHPStan requires PHP >= 7.1
-Install: composer require --dev phpstan/phpstan
+Config File is: ./phpstan.neon
-Config File: phpstan.neon
+Install phpstan:
+cd git; mkdir phpstan
+cd phpstan
+composer require --dev phpstan/phpstan
+
+Build report from CLI:
+cd git/dolibarr; mv htdocs/custom /tmp/
+php ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/commande/class
+php ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table
+mv /tmp/custom htdocs
+
+Build HTML report from Cron:
+Example of line to add into a cron to generate a HTML report:
+0 1 5 * * cd /home/dolibarr/preview.dolibarr.org/dolibarr; chmod -R u+w /home/dolibarr/preview.dolibarr.org/dolibarr; git pull; /home/dolibarr/phpstan/vendor/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=github | awk ' BEGIN{ print "Date "strftime("%Y-%m-%d")" " } { print $0" " } END{ print NR } ' > /home/dolibarr/doxygen.dolibarr.org/phpstan/index.html
diff --git a/build/rector/README b/build/rector/README
new file mode 100644
index 00000000000..7e8bd115682
--- /dev/null
+++ b/build/rector/README
@@ -0,0 +1,8 @@
+How to use Rector to fix code
+-----------------------------
+
+First, move rector.php file into htdocs
+
+Then install rector.
+
+Then ...
\ No newline at end of file
diff --git a/htdocs/rector.php b/build/rector/rector.php
similarity index 100%
rename from htdocs/rector.php
rename to build/rector/rector.php
diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt
index dd2ef0023de..89d87a4ab14 100644
--- a/dev/dolibarr_changes.txt
+++ b/dev/dolibarr_changes.txt
@@ -185,6 +185,23 @@ with:
return strval($number);
}
+* Add this at begin of tcpdf_autoconfig.php
+
+ // @CHANGE LDR DOCUMENT_ROOT fix for IIS Webserver
+ if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) {
+ if (isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['PHP_SELF'])) {
+ $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])));
+ } elseif(isset($_SERVER['PATH_TRANSLATED'])) {
+ $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])));
+ } else {
+ // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www')
+ $_SERVER['DOCUMENT_ROOT'] = '/';
+ }
+ }
+ $_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT']);
+ if (substr($_SERVER['DOCUMENT_ROOT'], -1) != '/') {
+ $_SERVER['DOCUMENT_ROOT'] .= '/';
+ }
TCPDI:
diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php
index 1d231a7fd7a..0278f0c3bef 100755
--- a/dev/examples/code/create_invoice.php
+++ b/dev/examples/code/create_invoice.php
@@ -40,7 +40,7 @@ $error=0;
// -------------------- START OF YOUR CODE HERE --------------------
// Include Dolibarr environment
-require_once $path."../../htdocs/master.inc.php";
+require_once $path."../../../htdocs/master.inc.php";
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.
//$langs->setDefaultLang('en_US'); // To change default language of $langs
diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php
index a851ac3cbc5..6d43e323191 100755
--- a/dev/examples/code/create_order.php
+++ b/dev/examples/code/create_order.php
@@ -40,7 +40,7 @@ $error=0;
// -------------------- START OF YOUR CODE HERE --------------------
// Include Dolibarr environment
-require_once $path."../../htdocs/master.inc.php";
+require_once $path."../../../htdocs/master.inc.php";
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.
//$langs->setDefaultLang('en_US'); // To change default language of $langs
diff --git a/dev/examples/code/create_product.php b/dev/examples/code/create_product.php
index 8f742065f2f..e3c8c3c9d76 100755
--- a/dev/examples/code/create_product.php
+++ b/dev/examples/code/create_product.php
@@ -40,7 +40,7 @@ $error=0;
// -------------------- START OF YOUR CODE HERE --------------------
// Include Dolibarr environment
-require_once $path."../../htdocs/master.inc.php";
+require_once $path."../../../htdocs/master.inc.php";
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.
//$langs->setDefaultLang('en_US'); // To change default language of $langs
diff --git a/dev/examples/code/create_user.php b/dev/examples/code/create_user.php
index e374fec531d..fb24c6aa39a 100755
--- a/dev/examples/code/create_user.php
+++ b/dev/examples/code/create_user.php
@@ -40,7 +40,7 @@ $error=0;
// -------------------- START OF YOUR CODE HERE --------------------
// Include Dolibarr environment
-require_once $path."../../htdocs/master.inc.php";
+require_once $path."../../../htdocs/master.inc.php";
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.
//$langs->setDefaultLang('en_US'); // To change default language of $langs
diff --git a/dev/examples/code/get_contracts.php b/dev/examples/code/get_contracts.php
index 40bee133d11..1b30e6b2e17 100755
--- a/dev/examples/code/get_contracts.php
+++ b/dev/examples/code/get_contracts.php
@@ -40,7 +40,7 @@ $error=0;
// -------------------- START OF YOUR CODE HERE --------------------
// Include Dolibarr environment
-require_once $path."../../htdocs/master.inc.php";
+require_once $path."../../../htdocs/master.inc.php";
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.
//$langs->setDefaultLang('en_US'); // To change default language of $langs
diff --git a/dev/examples/zapier/package.json b/dev/examples/zapier/package.json
index 8852928771f..ef70b2af8fd 100644
--- a/dev/examples/zapier/package.json
+++ b/dev/examples/zapier/package.json
@@ -15,7 +15,7 @@
"npm": ">=5.6.0"
},
"dependencies": {
- "zapier-platform-core": "11.3.1"
+ "zapier-platform-core": "15.0.1"
},
"devDependencies": {
"mocha": "^5.2.0",
diff --git a/dev/initdemo/mysqldump_dolibarr_3.5.0.sql b/dev/initdemo/mysqldump_dolibarr_3.5.0.sql
index 64eead005ed..c6d16c22e45 100644
--- a/dev/initdemo/mysqldump_dolibarr_3.5.0.sql
+++ b/dev/initdemo/mysqldump_dolibarr_3.5.0.sql
@@ -4655,75 +4655,6 @@ INSERT INTO `llx_menu` VALUES (19289,'all',1,'cashdesk','top','cashdesk',0,NULL,
/*!40000 ALTER TABLE `llx_menu` ENABLE KEYS */;
UNLOCK TABLES;
---
--- Table structure for table `llx_milestone`
---
-
-DROP TABLE IF EXISTS `llx_milestone`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `llx_milestone` (
- `rowid` int(11) NOT NULL AUTO_INCREMENT,
- `fk_element` int(11) NOT NULL,
- `elementtype` varchar(16) NOT NULL,
- `label` varchar(255) NOT NULL,
- `options` varchar(255) DEFAULT NULL,
- `priority` int(11) DEFAULT '0',
- `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `fk_user_modif` int(11) DEFAULT NULL,
- PRIMARY KEY (`rowid`),
- UNIQUE KEY `uk_milestone_fk_element` (`fk_element`,`elementtype`),
- KEY `idx_milestone_fk_user_modif` (`fk_user_modif`),
- CONSTRAINT `fk_milestone_fk_user_modif` FOREIGN KEY (`fk_user_modif`) REFERENCES `llx_user` (`rowid`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `llx_milestone`
---
-
-LOCK TABLES `llx_milestone` WRITE;
-/*!40000 ALTER TABLE `llx_milestone` DISABLE KEYS */;
-INSERT INTO `llx_milestone` VALUES (2,779,'facture','azerty',NULL,0,'2013-03-09 12:19:30',NULL),(3,780,'facture','fsdf',NULL,0,'2013-03-09 13:01:08',NULL),(4,781,'facture','hhh',NULL,0,'2013-03-09 14:06:37',NULL);
-/*!40000 ALTER TABLE `llx_milestone` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `llx_monitoring_probes`
---
-
-DROP TABLE IF EXISTS `llx_monitoring_probes`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `llx_monitoring_probes` (
- `rowid` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(64) NOT NULL,
- `groupname` varchar(64) DEFAULT NULL,
- `url` varchar(250) NOT NULL,
- `useproxy` int(11) DEFAULT '0',
- `checkkey` varchar(250) DEFAULT NULL,
- `maxval` int(11) DEFAULT NULL,
- `frequency` int(11) DEFAULT '60',
- `active` int(11) DEFAULT '1',
- `status` int(11) DEFAULT '0',
- `lastreset` datetime DEFAULT NULL,
- `oldesterrortext` text,
- `oldesterrordate` datetime DEFAULT NULL,
- PRIMARY KEY (`rowid`),
- UNIQUE KEY `uk_monitoring_probes` (`title`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `llx_monitoring_probes`
---
-
-LOCK TABLES `llx_monitoring_probes` WRITE;
-/*!40000 ALTER TABLE `llx_monitoring_probes` DISABLE KEYS */;
-INSERT INTO `llx_monitoring_probes` VALUES (1,'aaa',NULL,'http://www.chiensderace.com',0,'chiens',1000,10,1,1,'2011-04-20 23:46:41',NULL,NULL),(2,'ChatsDeRace',NULL,'http://www.chatsderace.com',0,'chats',1000,5,1,1,'2011-04-20 23:46:41',NULL,NULL);
-/*!40000 ALTER TABLE `llx_monitoring_probes` ENABLE KEYS */;
-UNLOCK TABLES;
-
--
-- Table structure for table `llx_notify`
--
diff --git a/dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf b/dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf
index 1356df80115..43163cf5d9a 100644
--- a/dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf
+++ b/dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf
@@ -13,7 +13,7 @@
# fail2ban-client status web-accesslog-limit403
#
# To test rule file on a existing log file
-# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf
+# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf --print-all-matched
failregex = - - .*HTTP/[0-9]+(.[0-9]+)?" 403
ignoreregex =
diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf
index 2eedad18821..13d2b99d095 100644
--- a/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf
+++ b/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf
@@ -13,7 +13,7 @@
# fail2ban-client status web-dolibarr-limitpublic
#
# To test rule file on a existing log file
-# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf
+# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf --print-all-matched
failregex = ^ [A-Z\s]+ \s+--- Access to .*/public/
ignoreregex =
diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf
index dd6694c1a6f..79ca5c2fb95 100644
--- a/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf
+++ b/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf
@@ -13,7 +13,7 @@
# fail2ban-client status web-dolibarr-rulesbruteforce
#
# To test rule file on a existing log file
-# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf
+# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf --print-all-matched
failregex = ^ [A-Z\s]+ \s+functions_.*::check_user_.* Authentication KO
ignoreregex =
diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf
index 8cc20dd4be4..0316a7e7774 100644
--- a/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf
+++ b/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf
@@ -13,7 +13,7 @@
# fail2ban-client status web-dolibarr-rulespassforgotten
#
# To test rule file on a existing log file
-# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf
+# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf --print-all-matched
failregex = ^ [A-Z\s]+ \s+--- Access to .*/passwordforgotten.php - action=buildnewpassword
ignoreregex =
diff --git a/dev/setup/qodana/README.md b/dev/setup/qodana/README.md
index 37b465cabc9..aa7ce3013d5 100644
--- a/dev/setup/qodana/README.md
+++ b/dev/setup/qodana/README.md
@@ -3,10 +3,10 @@ QODANA TUTO
This README explains how to use qodana to generate static analytics reports on the code
Install docker
+ apt install docker
-
-Install qodana
-
+Install qodana into ~/.loca/bin/qodana
+ curl -fsSL https://jb.gg/qodana-cli/install | bash
To run inspection on CLI
cd ~/git/dirtoscan
diff --git a/dev/setup/sonarqube/README.md b/dev/setup/sonarqube/README.md
new file mode 100644
index 00000000000..efb98f337a3
--- /dev/null
+++ b/dev/setup/sonarqube/README.md
@@ -0,0 +1,15 @@
+= Install SonarQube locally
+
+Check you are using Install Java SDK 17
+java --version must show 61
+
+To install java sdk 17 on ubuntu:
+sudo apt update
+sudo apt install -y openjdk-17-jdk
+
+Unzip the sonar package into a directory
+
+Edit the file conf/sonar.properties to modify port 9000 and 9001 (already used by Eclipse or xdebug) into 9080 and 9081
+
+Launch sonar with
+bin/linux*/sonar.sh console
diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php
new file mode 100755
index 00000000000..0f0895a3ecc
--- /dev/null
+++ b/dev/tools/apstats.php
@@ -0,0 +1,426 @@
+#!/usr/bin/env php
+
+ *
+ * This 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 dev/tools/apstats.php
+ * \brief Script to report Advanced Statistics on a coding project
+ */
+
+
+$sapi_type = php_sapi_name();
+$script_file = basename(__FILE__);
+$path = dirname(__FILE__) . '/';
+
+// Test si mode batch
+$sapi_type = php_sapi_name();
+if (substr($sapi_type, 0, 3) == 'cgi') {
+ echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
+ exit();
+}
+
+error_reporting(E_ALL & ~ E_DEPRECATED);
+define('PRODUCT', "apstats");
+define('VERSION', "1.0");
+
+
+print '***** '.constant('PRODUCT').' - '.constant('VERSION').' *****'."\n";
+if (empty($argv[1])) {
+ print 'You must run this tool being into the root of the project.'."\n";
+ print 'Usage: '.constant('PRODUCT').'.php pathto/outputfile.html [--dir-scc=pathtoscc] [--dir-phpstan=pathtophpstan]'."\n";
+ print 'Example: '.constant('PRODUCT').'.php documents/apstats/index.html --dir-scc=/snap/bin --dir-phpstan=~/git/phpstan/htdocs/includes/bin';
+ exit(0);
+}
+
+$outputpath = $argv[1];
+$outputdir = dirname($outputpath);
+$outputfile = basename($outputpath);
+
+if (! is_dir($outputdir)) {
+ print 'Error: dir '.$outputdir.' does not exists or is not writable'."\n";
+ exit(1);
+}
+
+$dirscc = '';
+$dirphpstan = '';
+
+$i = 0;
+while ($i < $argc) {
+ $reg = array();
+ if (preg_match('/--dir-scc=(.*)$/', $argv[$i], $reg)) {
+ $dirscc = $reg[1];
+ }
+ if (preg_match('/--dir-phpstan=(.*)$/', $argv[$i], $reg)) {
+ $dirphpstan = $reg[1];
+ }
+ $i++;
+}
+
+
+// Count lines of code of Dolibarr itself
+/*
+$commandcheck = 'cloc . --exclude-dir=includes --exclude-dir=custom --ignore-whitespace --vcs=git';
+$resexec = shell_exec($commandcheck);
+$resexec = (int) (empty($resexec) ? 0 : trim($resexec));
+
+
+// Count lines of code of external dependencies
+$commandcheck = 'cloc htdocs/includes --ignore-whitespace --vcs=git';
+$resexec = shell_exec($commandcheck);
+$resexec = (int) (empty($resexec) ? 0 : trim($resexec));
+*/
+
+// Count lines of code of application
+$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=includes,custom';
+print 'Execute SCC to count lines of code in project: '.$commandcheck."\n";
+$output_arrproj = array();
+$resexecproj = 0;
+exec($commandcheck, $output_arrproj, $resexecproj);
+
+
+// Count lines of code of dependencies
+$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes';
+print 'Execute SCC to count lines of code in dependencies: '.$commandcheck."\n";
+$output_arrdep = array();
+$resexecdep = 0;
+exec($commandcheck, $output_arrdep, $resexecdep);
+
+
+// Get technical debt
+$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github';
+print 'Execute PHPStan to get the technical debt: '.$commandcheck."\n";
+$output_arrtd = array();
+$resexectd = 0;
+exec($commandcheck, $output_arrtd, $resexectd);
+
+$arrayoflineofcode = array();
+$arraycocomo = array();
+$arrayofmetrics = array(
+ 'proj'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0),
+ 'dep'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0)
+);
+
+// Analyse $output_arrproj
+foreach (array('proj', 'dep') as $source) {
+ print 'Analyze SCC result for lines of code for '.$source."\n";
+ if ($source == 'proj') {
+ $output_arr = &$output_arrproj;
+ } elseif ($source == 'dep') {
+ $output_arr = &$output_arrdep;
+ } else {
+ print 'Bad value for $source';
+ die();
+ }
+
+ foreach ($output_arr as $line) {
+ if (preg_match('/^(───|Language|Total)/', $line)) {
+ continue;
+ }
+
+ //print $line." \n";
+
+ if (preg_match('/^Estimated Cost.*\$(.*)/i', $line, $reg)) {
+ $arraycocomo[$source]['currency'] = preg_replace('/[^\d\.]/', '', str_replace(array(',', ' '), array('', ''), $reg[1]));
+ }
+ if (preg_match('/^Estimated Schedule Effort.*\s([\d\s,]+)/i', $line, $reg)) {
+ $arraycocomo[$source]['effort'] = str_replace(array(',', ' '), array('.', ''), $reg[1]);
+ }
+ if (preg_match('/^Estimated People.*\s([\d\s,]+)/i', $line, $reg)) {
+ $arraycocomo[$source]['people'] = str_replace(array(',', ' '), array('.', ''), $reg[1]);
+ }
+ if (preg_match('/^Processed\s(\d+)\s/i', $line, $reg)) {
+ $arrayofmetrics[$source]['Bytes'] = $reg[1];
+ }
+
+ if (preg_match('/^(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/', $line, $reg)) {
+ $arrayoflineofcode[$source][$reg[1]]['Files'] = $reg[2];
+ $arrayoflineofcode[$source][$reg[1]]['Lines'] = $reg[3];
+ $arrayoflineofcode[$source][$reg[1]]['Blanks'] = $reg[4];
+ $arrayoflineofcode[$source][$reg[1]]['Comments'] = $reg[5];
+ $arrayoflineofcode[$source][$reg[1]]['Code'] = $reg[6];
+ $arrayoflineofcode[$source][$reg[1]]['Complexity'] = $reg[7];
+ }
+ }
+
+ if (!empty($arrayoflineofcode[$source])) {
+ foreach ($arrayoflineofcode[$source] as $key => $val) {
+ $arrayofmetrics[$source]['Files'] += $val['Files'];
+ $arrayofmetrics[$source]['Lines'] += $val['Lines'];
+ $arrayofmetrics[$source]['Blanks'] += $val['Blanks'];
+ $arrayofmetrics[$source]['Comments'] += $val['Comments'];
+ $arrayofmetrics[$source]['Code'] += $val['Code'];
+ $arrayofmetrics[$source]['Complexity'] += $val['Complexity'];
+ }
+ }
+}
+
+
+/*
+ * View
+ */
+
+$html = ''."\n";
+$html .= ''."\n";
+$html .= ''."\n";
+$html .= ''."\n";
+$html .= ''."\n";
+$html .= '
+'."\n";
+
+$html .= ''."\n";
+
+$html .= ''."\n";
+$html .= '
';
-if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
+if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
+ // Number of letters for lettering (3 by default (AAA), min 2 (AA))
+ print '
';
- if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) {
+ if (getDolGlobalInt('ACCOUNTANCY_SHOW_PROD_DESC')) {
// TODO ADJUST DESCRIPTION SIZE
// print '
' . $obj->description . '
';
// TODO: we should set a user defined value to adjust user square / wide screen size
- $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
+ $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
print '
';
print '';
diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php
index 03efcf7aea5..06dfa06ce1a 100644
--- a/htdocs/admin/limits.php
+++ b/htdocs/admin/limits.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2007-2022 Laurent Destailleur
* Copyright (C) 2009-2018 Regis Houssin
* Copyright (C) 2010 Juanjo Menent
+ * Copyright (C) 2023 Alexandre Spangaro
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -262,6 +263,7 @@ if (empty($mysoc->country_code)) {
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
+ $sql .= " AND t.entity IN (".getEntity('c_tva').")";
$sql .= " ORDER BY t.taux ASC";
$resql = $db->query($sql);
if ($resql) {
diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php
index 82d05113b8b..8a276d68e27 100644
--- a/htdocs/admin/mails_emailing.php
+++ b/htdocs/admin/mails_emailing.php
@@ -598,7 +598,7 @@ if ($action == 'edit') {
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
} else {
- print yn(0).' ('.$langs->trans("NotSupported").')';
+ print ''.yn(0).' ('.$langs->trans("NotSupported").')';
}
print '
';
@@ -611,7 +611,7 @@ if ($action == 'edit') {
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
} else {
- print yn(0).' ('.$langs->trans("NotSupported").')';
+ print ''.yn(0).' ('.$langs->trans("NotSupported").')';
}
print '';
}
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index 6d0267f802a..4a7c644df19 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -116,14 +116,14 @@ if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue = array();
-$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content";
+$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabfieldvalue[25] .= ',content_lines';
}
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert = array();
-$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content";
+$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabfieldinsert[25] .= ',content_lines';
}
@@ -168,6 +168,7 @@ $tabhelp[25] = array(
'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"),
'position'=>$langs->trans("PositionIntoComboList"),
'topic'=>''.$helpsubstit.'',
+ 'email_from'=>$langs->trans('ForceEmailFrom'),
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
'defaultfortype'=>$langs->trans("DefaultForTypeDesc"),
'content'=>''.$helpsubstit.'',
@@ -575,7 +576,7 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu
$morejs = array();
$morecss = array();
-$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, defaultfortype, content_lines, content, enabled, active";
+$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates";
$sql .= " WHERE entity IN (".getEntity('email_template').")";
if (!$user->admin) {
@@ -805,15 +806,18 @@ if ($action == 'create') {
print '
';
+ // Action column
+ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($obj->rowid, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print '';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
// Ref
if (!empty($arrayfields['b.rowid']['checked'])) {
print '
';
@@ -1405,6 +1442,7 @@ if ($resql) {
$reg = array();
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction
if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) {
+ // Example: $reg[1] = 'CustomerInvoicePayment', 'SupplierInvoicePayment', ... (or on old version: 'WithdrawalPayment', 'BankTransferPayment')
$labeltoshow = $langs->trans($reg[1]);
} else {
if ($objp->label == '(payment_salary)') {
@@ -1779,16 +1817,18 @@ if ($resql) {
}
// Action column
- if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- $selected = 0;
- if (in_array($obj->rowid, $arrayofselected)) {
- $selected = 1;
+ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($obj->rowid, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print '
';
$texte .= '';
@@ -461,6 +451,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
// Replace tags of object + external modules
$tmparray = array_merge($tmparray, $this->get_substitutionarray_shipment($object, $outputlangs));
+ $tmparray = array_merge($tmparray, $this->get_substitutionarray_other($outputlangs));
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook
@@ -494,7 +485,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
}
if ($foundtagforlines) {
foreach ($object->lines as $line) {
- $tmparray = $this->get_substitutionarray_shipment_lines($line, $outputlangs);
+ $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);
diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
index 297013ed8ac..668666b24d3 100644
--- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
@@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2014-2015 Marcos García
* Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2023 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
@@ -67,47 +68,6 @@ class pdf_espadon extends ModelePdfExpedition
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * Issuer
- * @var Societe object that emits
- */
- public $emetteur;
-
/**
* Constructor
@@ -116,7 +76,7 @@ class pdf_espadon extends ModelePdfExpedition
*/
public function __construct(DoliDB $db)
{
- global $conf, $langs, $mysoc;
+ global $langs, $mysoc;
$this->db = $db;
$this->name = "espadon";
@@ -1325,7 +1285,7 @@ class pdf_espadon extends ModelePdfExpedition
$this->cols['subprice'] = array(
'rank' => $rank,
'width' => 19, // in mm
- 'status' => !empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT) ? 1 : 0,
+ 'status' => !empty($conf->global->SHIPPING_PDF_DISPLAY_AMOUNT_HT) ? 1 : 0,
'title' => array(
'textkey' => 'PriceUHT'
),
@@ -1336,7 +1296,7 @@ class pdf_espadon extends ModelePdfExpedition
$this->cols['totalexcltax'] = array(
'rank' => $rank,
'width' => 26, // in mm
- 'status' => !empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT) ? 1 : 0,
+ 'status' => !empty($conf->global->SHIPPING_PDF_DISPLAY_AMOUNT_HT) ? 1 : 0,
'title' => array(
'textkey' => 'TotalHT'
),
diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
index 1d8e0c3f19e..7dfa66c3bf7 100644
--- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
@@ -68,47 +68,6 @@ class pdf_merou extends ModelePdfExpedition
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * Issuer
- * @var Societe
- */
- public $emetteur;
-
/**
* Constructor
@@ -117,7 +76,7 @@ class pdf_merou extends ModelePdfExpedition
*/
public function __construct(DoliDB $db)
{
- global $conf, $langs, $mysoc;
+ global $langs, $mysoc;
$this->db = $db;
$this->name = "merou";
diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
index 11635c6511b..477c1280a49 100644
--- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
@@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2014-2015 Marcos García
- * Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2018-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
@@ -68,46 +68,9 @@ class pdf_rouget extends ModelePdfExpedition
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * Issuer
- * @var Societe object that emits
- */
- public $emetteur;
+ public $posxweightvol;
+ public $posxqtytoship;
+ public $posxqtyordered;
/**
diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php
index aae32f0f459..a90fc7c6653 100644
--- a/htdocs/core/modules/expedition/mod_expedition_ribera.php
+++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php
@@ -56,11 +56,12 @@ class mod_expedition_ribera extends ModelNumRefExpedition
/**
* Return default description of numbering model
*
- * @return string text description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
- global $conf, $langs, $db;
+ global $langs, $db;
$langs->load("bills");
@@ -81,7 +82,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
$texte .= '';
$texte .= '';
diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php
index aa1628e7482..29c9299fb73 100644
--- a/htdocs/core/modules/expedition/mod_expedition_safor.php
+++ b/htdocs/core/modules/expedition/mod_expedition_safor.php
@@ -57,9 +57,10 @@ class mod_expedition_safor extends ModelNumRefExpedition
/**
* Return default description of numbering model
*
- * @return string text description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -80,9 +81,10 @@ class mod_expedition_safor extends ModelNumRefExpedition
/**
* Test if existing numbers make problems with numbering
*
- * @return boolean false if conflit, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
@@ -142,7 +144,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
return -1;
}
- $date = time();
+ $date = $shipment->date_creation;
$yymm = strftime("%y%m", $date);
if ($max >= (pow(10, 4) - 1)) {
diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php
index 5c638e71425..249a2bc46e3 100644
--- a/htdocs/core/modules/expedition/modules_expedition.php
+++ b/htdocs/core/modules/expedition/modules_expedition.php
@@ -29,19 +29,16 @@
* \brief File that contains parent class for sending receipts models
* and parent class for sending receipts numbering models
*/
- require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
+
/**
* Parent class of sending receipts models
*/
abstract class ModelePdfExpedition extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation models
@@ -67,94 +64,7 @@ abstract class ModelePdfExpedition extends CommonDocGenerator
/**
* Parent Class of numbering models of sending receipts references
*/
-abstract class ModelNumRefExpedition
+abstract class ModelNumRefExpedition extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /** Return if a model can be used or not
- *
- * @return boolean true if model can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Return default description of numbering model
- *
- * @return string text description
- */
- public function info()
- {
- global $langs;
- $langs->load("sendings");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Returns numbering example
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("sendings");
- return $langs->trans("NoExample");
- }
-
- /**
- * Test if existing numbers make problems with numbering
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Returns next value assigned
- *
- * @param Societe $objsoc Third party object
- * @param Object $shipment Shipment object
- * @return string Value
- */
- public function getNextValue($objsoc, $shipment)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Returns version of the numbering model
- *
- * @return string Value
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- }
- if ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- }
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
- if ($this->version) {
- return $this->version;
- }
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
index ec409109d2d..c2d4799f75a 100644
--- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
@@ -75,12 +75,6 @@ class pdf_standard extends ModeleExpenseReport
*/
public $version = 'dolibarr';
- /**
- * Issuer
- * @var Societe
- */
- public $emetteur;
-
public $posxpiece;
public $posxcomment;
public $posxtva;
diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php
index b25ac15345b..1a5e05a03fa 100644
--- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php
+++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php
@@ -57,9 +57,10 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
/**
* Return description of numbering model
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -81,9 +82,10 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php
index 920861f2b3e..b0aa791e228 100644
--- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php
+++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.php
@@ -57,9 +57,10 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $db, $conf, $langs;
@@ -85,7 +86,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
$mask = empty($conf->global->EXPENSEREPORT_SAND_MASK) ? '' : $conf->global->EXPENSEREPORT_SAND_MASK;
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php
index e3e8f6f67d3..b7222eb725c 100644
--- a/htdocs/core/modules/expensereport/modules_expensereport.php
+++ b/htdocs/core/modules/expensereport/modules_expensereport.php
@@ -16,6 +16,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
/**
@@ -23,47 +24,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
*/
abstract class ModeleExpenseReport extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active models generation
@@ -104,96 +64,9 @@ function expensereport_pdf_create(DoliDB $db, ExpenseReport $object, $message, $
}
/**
- * \class ModeleNumRefExpenseReport
- * \brief Parent class for numbering masks of expense reports
+ * Parent class for numbering masks of expense reports
*/
-
-abstract class ModeleNumRefExpenseReport
+abstract class ModeleNumRefExpenseReport extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /**
- * Return if a model can be used or not
- *
- * @return boolean true if model can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering model
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("orders");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Returns an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("trips");
- return $langs->trans("NoExample");
- }
-
- /**
- * Test whether the numbers already in force in the base do not cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Returns next assigned value
- *
- * @param Object $object Object we need next value for
- * @return string Value
- */
- public function getNextValue($object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Returns the version of the numbering module
- *
- * @return string Value
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- } elseif ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- } elseif ($this->version == 'dolibarr') {
- return DOL_VERSION;
- } elseif ($this->version) {
- return $this->version;
- } else {
- return $langs->trans("NotAvailable");
- }
- }
+ // No overload code
}
diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php
index ea7480cf15c..2d04c63d175 100644
--- a/htdocs/core/modules/export/export_excel2007.modules.php
+++ b/htdocs/core/modules/export/export_excel2007.modules.php
@@ -361,7 +361,10 @@ class ExportExcel2007 extends ModeleExports
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss');
} else {
if ($typefield == 'Text' || $typefield == 'TextAuto') {
- $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, (string) $newvalue);
+ // If $newvalue start with an equal sign we don't want it to be interpreted as a formula, so we add a '. Such transformation should be
+ // done by SetCellValueByColumnAndRow but it is not, so we do it ourself.
+ $newvalue = (dol_substr($newvalue, 0, 1) === '=' ? '\'' : '') . $newvalue;
+ $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $newvalue);
$coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate();
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
$this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php
index 40ee75a1749..956639f0135 100644
--- a/htdocs/core/modules/export/export_tsv.modules.php
+++ b/htdocs/core/modules/export/export_tsv.modules.php
@@ -230,7 +230,7 @@ class ExportTsv extends ModeleExports
* Output record line into file
*
* @param array $array_selected_sorted Array with list of field to export
- * @param resource $objp A record from a fetch with all fields from select
+ * @param Resource $objp A record from a fetch with all fields from select
* @param Translate $outputlangs Object lang to translate values
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
diff --git a/htdocs/core/modules/export/exportcsv.class.php b/htdocs/core/modules/export/exportcsv.class.php
index 674bbe71a9c..0e8c0a602ba 100644
--- a/htdocs/core/modules/export/exportcsv.class.php
+++ b/htdocs/core/modules/export/exportcsv.class.php
@@ -213,7 +213,7 @@ class ExportCsv extends ModeleExports
* Output record line into file
*
* @param array $array_selected_sorted Array with list of field to export
- * @param resource $objp A record from a fetch with all fields from select
+ * @param Resource $objp A record from a fetch with all fields from select
* @param Translate $outputlangs Object lang to translate values
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
diff --git a/htdocs/core/modules/export/modules_export.php b/htdocs/core/modules/export/modules_export.php
index dc96e526130..c55fa7d2a61 100644
--- a/htdocs/core/modules/export/modules_export.php
+++ b/htdocs/core/modules/export/modules_export.php
@@ -37,12 +37,43 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
public $driverlabel = array();
+ public $driverdesc = array();
+
public $driverversion = array();
public $liblabel = array();
public $libversion = array();
+ /**
+ * @var string picto
+ */
+ public $picto;
+
+ /**
+ * @var string description
+ */
+ public $desc;
+
+ /**
+ * @var string escape
+ */
+ public $escape;
+
+ /**
+ * @var string enclosure
+ */
+ public $enclosure;
+
+ /**
+ * @var int col
+ */
+ public $col;
+
+ /**
+ * @var int disabled
+ */
+ public $disabled;
/**
* Load into memory list of available export format
@@ -76,6 +107,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
require_once $file;
if (class_exists($classname)) {
$module = new $classname($db);
+ // var_dump($classname);
// Picto
$this->picto[$module->id] = $module->picto;
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 b74934d96a4..679548c3d72 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
@@ -39,12 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_invoice_odt extends ModelePDFFactures
{
- /**
- * Issuer
- * @var Societe Object that emits
- */
- public $emetteur;
-
/**
* Dolibarr version of the loaded document
* @var string
@@ -59,7 +53,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
*/
public function __construct($db)
{
- global $conf, $langs, $mysoc;
+ global $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main", "companies"));
@@ -142,17 +136,18 @@ class doc_generic_invoice_odt extends ModelePDFFactures
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
+ $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
// Add list of substitution keys
$texthelp .= ' '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").' ';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '
';
@@ -111,7 +112,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
*/
public function getExample()
{
- global $conf, $langs, $mysoc;
+ global $mysoc;
$old_code_client = $mysoc->code_client;
$old_code_type = $mysoc->typent_code;
diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php
index 0e6ce61093b..67a0d0d6662 100644
--- a/htdocs/core/modules/facture/mod_facture_terre.php
+++ b/htdocs/core/modules/facture/mod_facture_terre.php
@@ -88,9 +88,10 @@ class mod_facture_terre extends ModeleNumRefFactures
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
$langs->load("bills");
@@ -111,9 +112,10 @@ class mod_facture_terre extends ModeleNumRefFactures
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $langs, $conf, $db;
diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php
index 8467868cd4a..d57d604f11c 100644
--- a/htdocs/core/modules/facture/modules_facture.php
+++ b/htdocs/core/modules/facture/modules_facture.php
@@ -28,6 +28,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit
@@ -39,11 +40,6 @@ use Sprain\SwissQrBill;
*/
abstract class ModelePDFFactures extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
public $posxpicture;
public $posxtva;
public $posxup;
@@ -61,6 +57,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator
public $atleastonediscount = 0;
public $atleastoneratenotnull = 0;
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -251,95 +248,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator
/**
* Parent class of invoice reference numbering templates
*/
-abstract class ModeleNumRefFactures
+abstract class ModeleNumRefFactures extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering pattern
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("bills");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("bills");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @param Societe $objsoc Objet societe
- * @param Facture $invoice Objet facture
- * @param string $mode 'next' for next value or 'last' for last value
- * @return string Value
- */
- public function getNextValue($objsoc, $invoice, $mode = 'next')
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Renvoi version du modele de numerotation
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- } elseif ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- } elseif ($this->version == 'dolibarr') {
- return DOL_VERSION;
- } elseif ($this->version) {
- return $this->version;
- } else {
- return $langs->trans("NotAvailable");
- }
- }
+ // No overload code
}
diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
index d42f85cb3cf..f6b0ed7ea9b 100644
--- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
+++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
@@ -70,46 +70,6 @@ class pdf_soleil extends ModelePDFFicheinter
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * Issuer
- * @var Societe Object that emits
- */
- public $emetteur;
/**
* Constructor
@@ -118,7 +78,7 @@ class pdf_soleil extends ModelePDFFicheinter
*/
public function __construct($db)
{
- global $conf, $langs, $mysoc;
+ global $langs, $mysoc;
$this->db = $db;
$this->name = 'soleil';
diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php
index d1f313e1bd5..8f014e68111 100644
--- a/htdocs/core/modules/fichinter/mod_arctic.php
+++ b/htdocs/core/modules/fichinter/mod_arctic.php
@@ -59,11 +59,12 @@ class mod_arctic extends ModeleNumRefFicheinter
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
- global $db, $conf, $langs;
+ global $db, $langs;
$langs->load("bills");
@@ -86,7 +87,7 @@ class mod_arctic extends ModeleNumRefFicheinter
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php
index b2ffe3a7e98..85411d143b9 100644
--- a/htdocs/core/modules/fichinter/mod_pacific.php
+++ b/htdocs/core/modules/fichinter/mod_pacific.php
@@ -59,9 +59,10 @@ class mod_pacific extends ModeleNumRefFicheinter
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -81,9 +82,10 @@ class mod_pacific extends ModeleNumRefFicheinter
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $langs, $conf, $db;
diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php
index 8cf126fc4af..ba39c364c1d 100644
--- a/htdocs/core/modules/fichinter/modules_fichinter.php
+++ b/htdocs/core/modules/fichinter/modules_fichinter.php
@@ -27,6 +27,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
/**
@@ -34,12 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
*/
abstract class ModelePDFFicheinter extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -65,96 +60,9 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator
/**
* Parent class numbering models of intervention sheet references
*/
-abstract class ModeleNumRefFicheinter
+abstract class ModeleNumRefFicheinter extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering template
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("ficheinter");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Return a numbering example
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("ficheinter");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Return the next assigned value
- *
- * @param Societe $objsoc Object thirdparty
- * @param Object $object Object we need next value for
- * @return string Value if KO, <0 if KO
- */
- public function getNextValue($objsoc = 0, $object = '')
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Return the version of the numbering module
- *
- * @return string Value
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- } elseif ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- } elseif ($this->version == 'dolibarr') {
- return DOL_VERSION;
- } elseif ($this->version) {
- return $this->version;
- } else {
- return $langs->trans("NotAvailable");
- }
- }
+ // No overload code
}
@@ -174,7 +82,7 @@ abstract class ModeleNumRefFicheinter
function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
- global $conf, $langs, $user;
+ global $conf, $langs;
$langs->load("ficheinter");
$error = 0;
diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php
index ce780a0ba58..954f33d8f2a 100644
--- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php
+++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php
@@ -61,11 +61,12 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
/**
* Return default description of numbering model
*
- * @return string text description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
- global $db, $conf, $langs;
+ global $db, $langs;
$langs->load("bills");
@@ -86,7 +87,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
$texte .= '';
$texte .= '';
diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php
index fd2271198bc..110e27b755e 100644
--- a/htdocs/core/modules/holiday/mod_holiday_madonna.php
+++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php
@@ -63,9 +63,10 @@ class mod_holiday_madonna extends ModelNumRefHolidays
/**
* Return default description of numbering model
*
- * @return string text description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -86,9 +87,10 @@ class mod_holiday_madonna extends ModelNumRefHolidays
/**
* Test if existing numbers make problems with numbering
*
- * @return boolean false if conflit, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php
index e38801a052e..ef57eff7aa4 100644
--- a/htdocs/core/modules/holiday/modules_holiday.php
+++ b/htdocs/core/modules/holiday/modules_holiday.php
@@ -30,7 +30,8 @@
* \brief File with parent class for generating holiday 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';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
/**
@@ -38,12 +39,6 @@
*/
abstract class ModelePDFHoliday extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -69,90 +64,7 @@ abstract class ModelePDFHoliday extends CommonDocGenerator
/**
* Parent class for all holidays numbering modules
*/
-class ModelNumRefHolidays
+class ModelNumRefHolidays extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Return default description of numbering model
- *
- * @return string text description
- */
- public function info()
- {
- global $langs;
- $langs->load("holiday");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Return numbering example
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("holiday");
- return $langs->trans("NoExample");
- }
-
- /**
- * Test if existing numbers make problems with numbering
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Return next value
- *
- * @param Societe $objsoc third party object
- * @param Object $holiday Holiday object
- * @return string Value if OK, 0 if KO
- */
- public function getNextValue($objsoc, $holiday)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Return numbering version module
- *
- * @return string Value
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- } elseif ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- } elseif ($this->version == 'dolibarr') {
- return DOL_VERSION;
- } elseif ($this->version) {
- return $this->version;
- } else {
- return $langs->trans("NotAvailable");
- }
- }
+ // No overload code
}
diff --git a/htdocs/core/modules/hrm/mod_evaluation_advanced.php b/htdocs/core/modules/hrm/mod_evaluation_advanced.php
index 7369032e165..71fb0024d93 100644
--- a/htdocs/core/modules/hrm/mod_evaluation_advanced.php
+++ b/htdocs/core/modules/hrm/mod_evaluation_advanced.php
@@ -54,11 +54,12 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
- global $conf, $langs, $db;
+ global $langs, $db;
$langs->load("bills");
@@ -81,7 +82,7 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
diff --git a/htdocs/core/modules/hrm/mod_evaluation_standard.php b/htdocs/core/modules/hrm/mod_evaluation_standard.php
index b6b517b8fb9..17fab7a3bc0 100644
--- a/htdocs/core/modules/hrm/mod_evaluation_standard.php
+++ b/htdocs/core/modules/hrm/mod_evaluation_standard.php
@@ -52,9 +52,10 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
diff --git a/htdocs/core/modules/hrm/modules_evaluation.php b/htdocs/core/modules/hrm/modules_evaluation.php
index adde109f60b..1e10efcd599 100644
--- a/htdocs/core/modules/hrm/modules_evaluation.php
+++ b/htdocs/core/modules/hrm/modules_evaluation.php
@@ -29,6 +29,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
@@ -37,7 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
*/
abstract class ModelePDFEvaluation extends CommonDocGenerator
{
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -64,96 +64,7 @@ abstract class ModelePDFEvaluation extends CommonDocGenerator
/**
* Parent class to manage numbering of Evaluation
*/
-abstract class ModeleNumRefEvaluation
+abstract class ModeleNumRefEvaluation extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering template
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("hrm");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Returns an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("hrm");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @param Object $object Object we need next value for
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated($object)
- {
- return true;
- }
-
- /**
- * Returns next assigned value
- *
- * @param Object $object Object we need next value for
- * @return string Valeur
- */
- public function getNextValue($object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Returns version of numbering module
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- }
- if ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- }
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
- if ($this->version) {
- return $this->version;
- }
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index 29cd8ca5a21..70371759c26 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -38,18 +38,6 @@ class ImportCsv extends ModeleImports
*/
public $db;
- public $datatoimport;
-
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /**
- * @var string[] Error codes (or messages)
- */
- public $errors = array();
-
/**
* @var string Code of driver
*/
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index c05fabc5968..2cc901bdda1 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -42,18 +42,6 @@ class ImportXlsx extends ModeleImports
*/
public $db;
- public $datatoimport;
-
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /**
- * @var string[] Error codes (or messages)
- */
- public $errors = array();
-
/**
* @var string Code of driver
*/
diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php
index 5b665c8e2cf..8e24e1e3093 100644
--- a/htdocs/core/modules/import/modules_import.php
+++ b/htdocs/core/modules/import/modules_import.php
@@ -42,6 +42,16 @@ class ModeleImports
*/
public $error = '';
+ /**
+ * @var string[] Error codes (or messages)
+ */
+ public $errors = array();
+
+ /**
+ * @var string[] warnings codes (or messages)
+ */
+ public $warnings = array();
+
/**
* @var string Code of driver
*/
@@ -75,8 +85,35 @@ class ModeleImports
public $libversion = array();
+ /**
+ * @var string charset
+ */
public $charset;
+ /**
+ * @var string picto
+ */
+ public $picto;
+
+ /**
+ * @var string description
+ */
+ public $desc;
+
+ /**
+ * @var string escape
+ */
+ public $escape;
+
+ /**
+ * @var string enclosure
+ */
+ public $enclosure;
+
+ /**
+ * @var Societe thirdparty
+ */
+ public $thirdpartyobject;
/**
* @var array Element mapping from table name
diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php
index 111943e99e0..7a40e1cdbda 100644
--- a/htdocs/core/modules/mailings/advthirdparties.modules.php
+++ b/htdocs/core/modules/mailings/advthirdparties.modules.php
@@ -37,11 +37,6 @@ class mailing_advthirdparties extends MailingTargets
*/
public $picto = 'company';
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
public $enabled = 'isModEnabled("societe")';
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index 772c9900573..8452dacce1e 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -45,11 +45,6 @@ class mailing_contacts1 extends MailingTargets
*/
public $picto = 'contact';
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
/**
* Constructor
diff --git a/htdocs/core/modules/mailings/eventorganization.modules.php b/htdocs/core/modules/mailings/eventorganization.modules.php
index 2a8e06693b9..73eea96f8c5 100644
--- a/htdocs/core/modules/mailings/eventorganization.modules.php
+++ b/htdocs/core/modules/mailings/eventorganization.modules.php
@@ -39,11 +39,6 @@ class mailing_eventorganization extends MailingTargets
*/
public $picto = 'conferenceorbooth';
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
public $enabled = 'isModEnabled("eventorganization")';
diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php
index 2096aeff135..aa8f0f5859a 100644
--- a/htdocs/core/modules/mailings/fraise.modules.php
+++ b/htdocs/core/modules/mailings/fraise.modules.php
@@ -48,10 +48,6 @@ class mailing_fraise extends MailingTargets
*/
public $picto = 'user';
- /**
- * @var DoliDB Database handler.
- */
- public $db;
/**
* Constructor
diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php
index 28c9e6cc034..632e228ad69 100644
--- a/htdocs/core/modules/mailings/modules_mailings.php
+++ b/htdocs/core/modules/mailings/modules_mailings.php
@@ -32,30 +32,45 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
class MailingTargets // This can't be abstract as it is used for some method
{
/**
- * @var DoliDB Database handler.
+ * @var DoliDb Database handler (result of a new DoliDB)
*/
public $db;
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+ /**
+ * @var array of errors
+ */
+ public $errors;
+
/**
* @var string Condition to be enabled
*/
public $enabled;
/**
- * @var string Error code (or message)
+ * @var string Name of the module
*/
- public $error = '';
+ public $name;
+ /**
+ * @var string Description of the module
+ */
+ public $desc;
+
+ /**
+ * @var string Tooltip to show after description of the module
+ */
public $tooltip = '';
/**
- * @var string The SQL string used to find the recipients
+ * @var string To store the SQL string used to find the recipients
*/
public $sql;
- public $desc;
-
- public $name;
public $evenunsubscribe = 0; // Set this to 1 if you want to flag you also want to include email in target that has opt-out.
diff --git a/htdocs/core/modules/mailings/partnership.modules.php b/htdocs/core/modules/mailings/partnership.modules.php
index 3e947b6ed93..48fabd3b0fe 100644
--- a/htdocs/core/modules/mailings/partnership.modules.php
+++ b/htdocs/core/modules/mailings/partnership.modules.php
@@ -39,11 +39,6 @@ class mailing_partnership extends MailingTargets
*/
public $picto = 'partnership';
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
public $enabled = 'isModEnabled("partnership")';
@@ -86,6 +81,9 @@ class mailing_partnership extends MailingTargets
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
}
+ if (GETPOSTISSET('filter_status_partnership') && GETPOSTINT('filter_status_partnership') >= 0) {
+ $sql .= " AND p.status = ".GETPOSTINT('filter_status_partnership');
+ }
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
@@ -102,6 +100,9 @@ class mailing_partnership extends MailingTargets
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
}
+ if (GETPOSTISSET('filter_status_partnership') && GETPOSTINT('filter_status_partnership') >= 0) {
+ $sql .= " AND p.status = ".GETPOSTINT('filter_status_partnership');
+ }
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
@@ -214,13 +215,13 @@ class mailing_partnership extends MailingTargets
*/
public function formFilter()
{
- global $conf, $langs;
+ global $conf, $langs, $form;
$langs->load("companies");
$s = ' ';
+ // filter_status_thirdparties
+ include_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
+ $tmppartnership = new Partnership($this->db);
+ $dummy = $tmppartnership->getLibStatut(0); // We call this only to have $tmppartnership->labelStatus loaded
+
+ $s .= $form->selectarray('filter_status_partnership', $tmppartnership->labelStatus, GETPOST('filter_status_partnership'), $langs->trans("Status"));
+
return $s;
}
diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php
index 2d2dd7e1809..cd93813cf68 100644
--- a/htdocs/core/modules/mailings/pomme.modules.php
+++ b/htdocs/core/modules/mailings/pomme.modules.php
@@ -41,11 +41,6 @@ class mailing_pomme extends MailingTargets
*/
public $picto = 'user';
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
/**
* Constructor
diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php
index e678dab33ed..16194db6862 100644
--- a/htdocs/core/modules/mailings/thirdparties.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties.modules.php
@@ -38,11 +38,6 @@ class mailing_thirdparties extends MailingTargets
*/
public $picto = 'company';
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
/**
* Constructor
diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
index 6c6812759d7..0cf133df273 100644
--- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
@@ -36,11 +36,6 @@ class mailing_thirdparties_services_expired extends MailingTargets
*/
public $picto = 'company';
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
public $arrayofproducts = array();
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 2076e156bac..9823db229c1 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
@@ -36,11 +36,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_member_odt extends ModelePDFMember
{
- /**
- * @var Societe Issuer
- */
- public $emetteur;
-
/**
* Dolibarr version of the loaded document
* @var string
@@ -101,7 +96,7 @@ class doc_generic_member_odt extends ModelePDFMember
*/
public function info($langs)
{
- global $conf, $langs;
+ global $langs;
// Load translation files required by the page
$langs->loadLangs(array('companies', 'errors'));
@@ -138,17 +133,18 @@ class doc_generic_member_odt extends ModelePDFMember
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
+ $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
// Add list of substitution keys
$texthelp .= ' '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").' ';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '
';
$texte .= '';
$texte .= '';
diff --git a/htdocs/core/modules/member/mod_member_advanced.php b/htdocs/core/modules/member/mod_member_advanced.php
index d33b3d405e3..221b55fa24e 100644
--- a/htdocs/core/modules/member/mod_member_advanced.php
+++ b/htdocs/core/modules/member/mod_member_advanced.php
@@ -62,9 +62,10 @@ class mod_member_advanced extends ModeleNumRefMembers
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("AdvancedNumRefModelDesc", $this->prefix);
@@ -86,9 +87,10 @@ class mod_member_advanced extends ModeleNumRefMembers
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
diff --git a/htdocs/core/modules/member/mod_member_simple.php b/htdocs/core/modules/member/mod_member_simple.php
index 92f374cd01d..bc52459f79c 100644
--- a/htdocs/core/modules/member/mod_member_simple.php
+++ b/htdocs/core/modules/member/mod_member_simple.php
@@ -62,9 +62,10 @@ class mod_member_simple extends ModeleNumRefMembers
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleRefNumRefModelDesc");
@@ -86,9 +87,10 @@ class mod_member_simple extends ModeleNumRefMembers
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if KO (there is a conflict), true if OK
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
diff --git a/htdocs/core/modules/member/modules_member.class.php b/htdocs/core/modules/member/modules_member.class.php
index 41fbbacf2b3..476b9d848aa 100644
--- a/htdocs/core/modules/member/modules_member.class.php
+++ b/htdocs/core/modules/member/modules_member.class.php
@@ -27,19 +27,15 @@
* \brief File with parent class for generating members to PDF
*/
- require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
+
/**
* Parent class to manage intervention document templates
*/
abstract class ModelePDFMember extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -65,9 +61,8 @@ abstract class ModelePDFMember extends CommonDocGenerator
/**
* Classe mere des modeles de numerotation des references de members
*/
-abstract class ModeleNumRefMembers
+abstract class ModeleNumRefMembers extends CommonNumRefGenerator
{
-
public $code_modifiable; // Editable code
public $code_modifiable_invalide; // Modified code if it is invalid
@@ -76,101 +71,6 @@ abstract class ModeleNumRefMembers
public $code_null; //
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering pattern
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("members");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Return name of module
- *
- * @return string Module name
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("members");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @param Societe $objsoc Object third party
- * @param Object $object Object we need next value for
- * @return string Valeur
- */
- public function getNextValue($objsoc, $object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Renvoi version du module numerotation
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- } elseif ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- } elseif ($this->version == 'dolibarr') {
- return DOL_VERSION;
- } elseif ($this->version) {
- return $this->version;
- } else {
- return $langs->trans("NotAvailable");
- }
- }
/**
* Return description of module parameters
@@ -193,10 +93,10 @@ abstract class ModeleNumRefMembers
}
$s = '';
- $s .= $langs->trans("Name").': '.$this->getName().' ';
+ $s .= $langs->trans("Name").': '.$this->getName($langs).' ';
$s .= $langs->trans("Version").': '.$this->getVersion().' ';
$s .= $langs->trans("MemberCodeDesc").' ';
- $s .= $langs->trans("ValidityControledByModule").': '.$this->getName().' ';
+ $s .= $langs->trans("ValidityControledByModule").': '.$this->getName($langs).' ';
$s .= ' ';
$s .= ''.$langs->trans("ThisIsModuleRules").': ';
diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php
index 43a7128b1d0..3d451bd93d6 100644
--- a/htdocs/core/modules/modAgenda.class.php
+++ b/htdocs/core/modules/modAgenda.class.php
@@ -214,7 +214,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/index.php',
'langs'=>'agenda',
'position'=>86,
- 'perms'=>'$user->rights->agenda->myactions->read || $user->rights->resource->read',
+ 'perms'=>'$user->hasRight("agenda", "myactions", "read") || $user->hasRight("resource", "read")',
'enabled'=>'isModEnabled("agenda") || isModEnabled("resource")',
'target'=>'',
'user'=>2,
@@ -230,7 +230,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda',
'langs'=>'agenda',
'position'=>100,
- 'perms'=>'$user->rights->agenda->myactions->read',
+ 'perms'=>'$user->hasRight("agenda", "myactions", "read")',
'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2,
@@ -244,7 +244,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create',
'langs'=>'commercial',
'position'=>101,
- 'perms'=>'($user->hasRight("agenda", "myactions", "create")||$user->hasRight("agenda", "allactions", "create"))',
+ 'perms'=>'($user->hasRight("agenda", "myactions", "create") || $user->hasRight("agenda", "allactions", "create"))',
'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
@@ -259,7 +259,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda',
'langs'=>'agenda',
'position'=>140,
- 'perms'=>'$user->rights->agenda->myactions->read',
+ 'perms'=>'$user->hasRight("agenda", "myactions", "read")',
'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
@@ -273,7 +273,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
'langs'=>'agenda',
'position'=>141,
- 'perms'=>'$user->rights->agenda->myactions->read',
+ 'perms'=>'$user->hasRight("agenda", "myactions", "read")',
'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
@@ -287,7 +287,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
'langs'=>'agenda',
'position'=>142,
- 'perms'=>'$user->rights->agenda->myactions->read',
+ 'perms'=>'$user->hasRight("agenda", "myactions", "read")',
'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
@@ -301,8 +301,8 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
'langs'=>'agenda',
'position'=>143,
- 'perms'=>'$user->rights->agenda->allactions->read',
- 'enabled'=>'$user->rights->agenda->allactions->read',
+ 'perms'=>'$user->hasRight("agenda", "allactions", "read")',
+ 'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
);
@@ -315,8 +315,8 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
'langs'=>'agenda',
'position'=>144,
- 'perms'=>'$user->rights->agenda->allactions->read',
- 'enabled'=>'$user->rights->agenda->allactions->read',
+ 'perms'=>'$user->hasRight("agenda", "allactions", "read")',
+ 'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
);
@@ -331,7 +331,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda',
'langs'=>'agenda',
'position'=>110,
- 'perms'=>'$user->rights->agenda->myactions->read',
+ 'perms'=>'$user->hasRight("agenda", "myactions", "read")',
'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
@@ -345,7 +345,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
'langs'=>'agenda',
'position'=>111,
- 'perms'=>'$user->rights->agenda->myactions->read',
+ 'perms'=>'$user->hasRight("agenda", "myactions", "read")',
'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
@@ -359,7 +359,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
'langs'=>'agenda',
'position'=>112,
- 'perms'=>'$user->rights->agenda->myactions->read',
+ 'perms'=>'$user->hasRight("agenda", "myactions", "read")',
'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
@@ -373,8 +373,8 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
'langs'=>'agenda',
'position'=>113,
- 'perms'=>'$user->rights->agenda->allactions->read',
- 'enabled'=>'$user->rights->agenda->allactions->read',
+ 'perms'=>'$user->hasRight("agenda", "allactions", "read")',
+ 'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
);
@@ -387,8 +387,8 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
'langs'=>'agenda',
'position'=>114,
- 'perms'=>'$user->rights->agenda->allactions->read',
- 'enabled'=>'$user->rights->agenda->allactions->read',
+ 'perms'=>'$user->hasRight("agenda", "allactions", "read")',
+ 'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
);
@@ -402,7 +402,7 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda',
'langs'=>'agenda',
'position'=>160,
- 'perms'=>'$user->rights->agenda->allactions->read',
+ 'perms'=>'$user->hasRight("agenda", "allactions", "read")',
'enabled'=>'isModEnabled("agenda")',
'target'=>'',
'user'=>2
@@ -417,8 +417,8 @@ class modAgenda extends DolibarrModules
'url'=>'/categories/index.php?mainmenu=agenda&leftmenu=agenda&type=10',
'langs' => 'agenda',
'position' => 170,
- 'perms' => '$user->rights->agenda->allactions->read',
- 'enabled' => '$conf->categorie->enabled',
+ 'perms' => '$user->hasRight("agenda", "allactions", "read")',
+ 'enabled' => 'isModEnabled("categorie")',
'target' => '',
'user' => 2
);
diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php
index 4ac93f87c9a..9621904ebe6 100644
--- a/htdocs/core/modules/modApi.class.php
+++ b/htdocs/core/modules/modApi.class.php
@@ -20,7 +20,8 @@
/**
* \defgroup api Module Api
- * \brief Descriptor file for Api modulee
+ * \brief Module for API (REST) management
+ *
* \file htdocs/core/modules/modApi.class.php
* \ingroup api
* \brief Description and activation file for the module Api
@@ -162,7 +163,6 @@ class modApi extends DolibarrModules
'langs'=>'modulebuilder',
'position'=>100,
'perms'=>'1',
- //'enabled'=>'isModEnabled("api") && preg_match(\'/^(devtools)/\',$leftmenu)',
'enabled'=>'isModEnabled("api")',
'target'=>'_apiexplorer',
'user'=>0);
diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php
index ef0f1b7166a..861bca9c1d2 100644
--- a/htdocs/core/modules/modBarcode.class.php
+++ b/htdocs/core/modules/modBarcode.class.php
@@ -82,14 +82,14 @@ class modBarcode extends DolibarrModules
$this->rights[$r][0] = 301; // id de la permission
$this->rights[$r][1] = 'Generate PDF sheets of barcodes'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
- $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
+ $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'read';
$r++;
$this->rights[$r][0] = 304; // id de la permission
$this->rights[$r][1] = 'Read barcodes'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
- $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
+ $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire_advance';
$r++;
diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php
index d8c95c3c26b..c3b642626a9 100644
--- a/htdocs/core/modules/modBom.class.php
+++ b/htdocs/core/modules/modBom.class.php
@@ -89,8 +89,8 @@ class modBom extends DolibarrModules
'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
- 'css' => array('/bom/css/bom.css.php'), // Set this to relative path of css file if module has its own css file
- 'js' => array('/bom/js/bom.js.php'), // Set this to relative path of js file if module must load a js on all pages
+ 'css' => array('/bom/css/bom.css.php'), // Set this to relative path of css file if module has its own css file
+ 'js' => array('/bom/js/bom.js.php'), // Set this to relative path of js file if module must load a js on all pages
'hooks' => array('data'=>array('hookcontext1','hookcontext2'), 'entity'=>'0'), // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
'moduleforexternal' => 0 // Set this to 1 if feature of module are opened to external users
*/
diff --git a/htdocs/core/modules/modBookCal.class.php b/htdocs/core/modules/modBookCal.class.php
index 935293fedc4..07237b63d45 100644
--- a/htdocs/core/modules/modBookCal.class.php
+++ b/htdocs/core/modules/modBookCal.class.php
@@ -135,7 +135,7 @@ class modBookCal extends DolibarrModules
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
// The language file dedicated to your module
- $this->langfiles = array("bookcal@bookcal");
+ $this->langfiles = array("bookcal");
// Prerequisites
$this->phpmin = array(7, 0); // Minimum version of PHP required by module
@@ -259,21 +259,37 @@ class modBookCal extends DolibarrModules
$r = 0;
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
- $this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
- $this->rights[$r][1] = 'Read objects of BookCal'; // Permission label
+ $this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 1);
+ $this->rights[$r][1] = 'Read objects of BookCal';
$this->rights[$r][4] = 'availabilities';
- $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->bookcal->availabilities->read)
+ $this->rights[$r][5] = 'read';
$r++;
- $this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
- $this->rights[$r][1] = 'Create/Update objects of BookCal'; // Permission label
+ $this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 2);
+ $this->rights[$r][1] = 'Create/Update objects of BookCal';
$this->rights[$r][4] = 'availabilities';
- $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->bookcal->availabilities->write)
+ $this->rights[$r][5] = 'write';
$r++;
- $this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
- $this->rights[$r][1] = 'Delete objects of BookCal'; // Permission label
+ $this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 3);
+ $this->rights[$r][1] = 'Delete objects of BookCal';
$this->rights[$r][4] = 'availabilities';
- $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->bookcal->availabilities->delete)
+ $this->rights[$r][5] = 'delete';
$r++;
+ $this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 1);
+ $this->rights[$r][1] = 'Read Calendar object of BookCal';
+ $this->rights[$r][4] = 'calendar';
+ $this->rights[$r][5] = 'read';
+ $r++;
+ $this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 2);
+ $this->rights[$r][1] = 'Create/Update Calendar object of BookCal';
+ $this->rights[$r][4] = 'calendar';
+ $this->rights[$r][5] = 'write';
+ $r++;
+ $this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 3);
+ $this->rights[$r][1] = 'Delete Calendar object of BookCal';
+ $this->rights[$r][4] = 'calendar';
+ $this->rights[$r][5] = 'delete';
+ $r++;
+
/* END MODULEBUILDER PERMISSIONS */
// Main menu entries to add
@@ -281,7 +297,7 @@ class modBookCal extends DolibarrModules
$r = 0;
// Add here entries to declare new menus
/* BEGIN MODULEBUILDER TOPMENU */
- $this->menu[$r++] = array(
+ /*$this->menu[$r++] = array(
'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'top', // This is a Top menu entry
'titre'=>'ModuleBookCalName',
@@ -289,14 +305,73 @@ class modBookCal extends DolibarrModules
'mainmenu'=>'bookcal',
'leftmenu'=>'',
'url'=>'/bookcal/bookcalindex.php',
- 'langs'=>'bookcal@bookcal', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+ 'langs'=>'bookcal', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000 + $r,
'enabled'=>'$conf->bookcal->enabled', // Define condition to show or hide menu entry. Use '$conf->bookcal->enabled' if entry must be visible if module is enabled.
- 'perms'=>'1', // Use 'perms'=>'$user->rights->bookcal->availabilities->read' if you want your menu with a permission rules
+ 'perms'=>'$user->rights->bookcal->availabilities->read', // Use 'perms'=>'$user->rights->bookcal->availabilities->read' if you want your menu with a permission rules
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
- );
+ );*/
/* END MODULEBUILDER TOPMENU */
+
+ /* BEGIN MODULEBUILDER LEFTMENU CALENDAR */
+ $this->menu[$r++] = array(
+ 'fk_menu'=>'fk_mainmenu=agenda',
+ 'type'=>'left',
+ 'titre'=> 'MenuBookcalIndex',
+ 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em92"'),
+ 'mainmenu'=>'agenda',
+ 'leftmenu'=> 'bookcal',
+ 'url'=> '/bookcal/bookcalindex.php',
+ 'langs'=> 'bookcal',
+ 'position'=> 1100+$r,
+ 'enabled'=> '1',
+ 'perms'=> '$user->rights->bookcal->calendar->read',
+ 'user'=> 0
+ );
+
+ $this->menu[$r++]=array(
+ // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal',
+ // This is a Left menu entry
+ 'type'=>'left',
+ 'titre'=>'Calendar',
+ 'mainmenu'=>'agenda',
+ 'leftmenu'=>'bookcal_calendar_list',
+ 'url'=>'/bookcal/calendar_list.php',
+ // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+ 'langs'=>'bookcal',
+ 'position'=>1100+$r,
+ // Define condition to show or hide menu entry. Use '$conf->bookcal->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+ 'enabled'=>'$conf->bookcal->enabled',
+ // Use 'perms'=>'$user->rights->bookcal->level1->level2' if you want your menu with a permission rules
+ 'perms'=>'$user->rights->bookcal->calendar->read',
+ 'target'=>'',
+ // 0=Menu for internal users, 1=external users, 2=both
+ 'user'=>2,
+ );
+ $this->menu[$r++]=array(
+ // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal_calendar_list',
+ // This is a Left menu entry
+ 'type'=>'left',
+ 'titre'=>'NewCalendar',
+ 'mainmenu'=>'agenda',
+ 'leftmenu'=>'bookcal_new',
+ 'url'=>'/bookcal/calendar_card.php?action=create',
+ // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+ 'langs'=>'bookcal',
+ 'position'=>1100+$r,
+ // Define condition to show or hide menu entry. Use '$conf->bookcal->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+ 'enabled'=>'$conf->bookcal->enabled',
+ // Use 'perms'=>'$user->rights->bookcal->level1->level2' if you want your menu with a permission rules
+ 'perms'=>'$user->rights->bookcal->calendar->read',
+ 'target'=>'',
+ // 0=Menu for internal users, 1=external users, 2=both
+ 'user'=>2
+ );
+ /* END MODULEBUILDER LEFTMENU CALENDAR */
+
/* BEGIN MODULEBUILDER LEFTMENU AVAILABILITIES
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=bookcal', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
@@ -345,40 +420,40 @@ class modBookCal extends DolibarrModules
$this->menu[$r++]=array(
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'fk_menu'=>'fk_mainmenu=bookcal',
+ 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal',
// This is a Left menu entry
'type'=>'left',
- 'titre'=>'List Availabilities',
- 'mainmenu'=>'bookcal',
+ 'titre'=>'Availabilities',
+ 'mainmenu'=>'agenda',
'leftmenu'=>'bookcal_availabilities',
'url'=>'/bookcal/availabilities_list.php',
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
- 'langs'=>'bookcal@bookcal',
- 'position'=>1100+$r,
+ 'langs'=>'bookcal',
+ 'position'=>1200+$r,
// Define condition to show or hide menu entry. Use '$conf->bookcal->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->bookcal->enabled',
// Use 'perms'=>'$user->rights->bookcal->level1->level2' if you want your menu with a permission rules
- 'perms'=>'1',
+ 'perms'=>'$user->rights->bookcal->availabilities->read',
'target'=>'',
// 0=Menu for internal users, 1=external users, 2=both
'user'=>2,
);
$this->menu[$r++]=array(
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'fk_menu'=>'fk_mainmenu=bookcal,fk_leftmenu=bookcal_availabilities',
+ 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal_availabilities',
// This is a Left menu entry
'type'=>'left',
- 'titre'=>'New Availabilities',
- 'mainmenu'=>'bookcal',
+ 'titre'=>'NewAvailabilities',
+ 'mainmenu'=>'agenda',
'leftmenu'=>'bookcal_availabilities',
'url'=>'/bookcal/availabilities_card.php?action=create',
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
- 'langs'=>'bookcal@bookcal',
- 'position'=>1100+$r,
+ 'langs'=>'bookcal',
+ 'position'=>1200+$r,
// Define condition to show or hide menu entry. Use '$conf->bookcal->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->bookcal->enabled',
// Use 'perms'=>'$user->rights->bookcal->level1->level2' if you want your menu with a permission rules
- 'perms'=>'1',
+ 'perms'=>'$user->rights->bookcal->availabilities->read',
'target'=>'',
// 0=Menu for internal users, 1=external users, 2=both
'user'=>2
diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php
index be8f1954959..6c485f912f9 100644
--- a/htdocs/core/modules/modComptabilite.class.php
+++ b/htdocs/core/modules/modComptabilite.class.php
@@ -19,11 +19,12 @@
*/
/**
- * \defgroup comptabilite Module comptabilite
- * \brief Module pour inclure des fonctions de comptabilite (gestion de comptes comptables et rapports)
- * \file htdocs/core/modules/modComptabilite.class.php
- * \ingroup comptabilite
- * \brief Description and activation file for the module simple accountancy
+ * \defgroup comptabilite Module Comptabilite
+ * \brief Module to include accounting functions (account management and reporting)
+ *
+ * \file htdocs/core/modules/modComptabilite.class.php
+ * \ingroup comptabilite
+ * \brief Description and activation file for the module simple accountancy
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
diff --git a/htdocs/core/modules/modDebugBar.class.php b/htdocs/core/modules/modDebugBar.class.php
index ae2bdcfffc8..ed76bb32672 100644
--- a/htdocs/core/modules/modDebugBar.class.php
+++ b/htdocs/core/modules/modDebugBar.class.php
@@ -82,7 +82,7 @@ class modDebugBar extends DolibarrModules
$this->rights[1][0] = 431; // id de la permission
$this->rights[1][1] = 'Use Debug Bar'; // libelle de la permission
$this->rights[1][2] = 'u'; // type de la permission (deprecie a ce jour)
- $this->rights[1][3] = 1; // La permission est-elle une permission par defaut
+ $this->rights[1][3] = 0; // La permission est-elle une permission par defaut
$this->rights[1][4] = 'read';
}
diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php
index 88b239917f6..6c4488dfbb7 100644
--- a/htdocs/core/modules/modDeplacement.class.php
+++ b/htdocs/core/modules/modDeplacement.class.php
@@ -80,7 +80,7 @@ class modDeplacement extends DolibarrModules
$this->rights[1][0] = 171;
$this->rights[1][1] = 'Lire ses notes de frais et deplacements et celles de sa hierarchy';
$this->rights[1][2] = 'r';
- $this->rights[1][3] = 1;
+ $this->rights[1][3] = 0;
$this->rights[1][4] = 'lire';
$this->rights[2][0] = 172;
diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php
index c5c790ca28c..3af26350325 100644
--- a/htdocs/core/modules/modDon.class.php
+++ b/htdocs/core/modules/modDon.class.php
@@ -121,7 +121,7 @@ class modDon extends DolibarrModules
$this->rights[1][0] = 701;
$this->rights[1][1] = 'Lire les dons';
$this->rights[1][2] = 'r';
- $this->rights[1][3] = 1;
+ $this->rights[1][3] = 0;
$this->rights[1][4] = 'lire';
$this->rights[2][0] = 702;
diff --git a/htdocs/core/modules/modDynamicPrices.class.php b/htdocs/core/modules/modDynamicPrices.class.php
index 23a0f892014..bfaf11dbf4c 100644
--- a/htdocs/core/modules/modDynamicPrices.class.php
+++ b/htdocs/core/modules/modDynamicPrices.class.php
@@ -84,4 +84,27 @@ class modDynamicPrices extends DolibarrModules
$this->rights_class = 'dynamicprices';
$r = 0;
}
+
+ /**
+ * 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
+ * @return int 1 if OK, 0 if KO
+ */
+ public function init($options = '')
+ {
+ $result = $this->_load_tables('/install/mysql/', 'dynamicprices');
+ if ($result < 0) {
+ return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
+ }
+
+ // Remove permissions and default values
+ $this->remove($options);
+
+ $sql = array();
+
+ return $this->_init($sql, $options);
+ }
}
diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php
index 719468c076b..b99e2c5b00b 100644
--- a/htdocs/core/modules/modECM.class.php
+++ b/htdocs/core/modules/modECM.class.php
@@ -16,11 +16,13 @@
* along with this program. If not, see .
*/
-/** \defgroup ecm Module ecm
- * \brief Module for ECM (Electronic Content Management)
- * \file htdocs/core/modules/modECM.class.php
- * \ingroup ecm
- * \brief Description and activation file for the module ECM
+/**
+ * \defgroup ecm Module ECM
+ * \brief Module ECM (Electronic Content Management) to manage Documents
+ *
+ * \file htdocs/core/modules/modECM.class.php
+ * \ingroup ecm
+ * \brief Description and activation file for the module ECM
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
diff --git a/htdocs/core/modules/modEmailCollector.class.php b/htdocs/core/modules/modEmailCollector.class.php
index 0a8f67016e1..cf9f0dbc5f1 100644
--- a/htdocs/core/modules/modEmailCollector.class.php
+++ b/htdocs/core/modules/modEmailCollector.class.php
@@ -16,8 +16,8 @@
*/
/**
- * \defgroup emailcollector Module emailcollector
- * \brief emailcollector module descriptor.
+ * \defgroup emailcollector Module Emailcollector
+ * \brief Module to collect emails
*
* \file htdocs/core/modules/modEmailCollector.class.php
* \ingroup emailcollector
@@ -91,8 +91,6 @@ class modEmailCollector extends DolibarrModules
$this->requiredby = array(); // List of module ids to disable if this one is disabled
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->langfiles = array("admin");
- $this->phpmin = array(7, 0); // Minimum version of PHP required by module
- $this->need_dolibarr_version = array(7, 0); // Minimum version of Dolibarr required by module
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
//$this->automatic_activation = array('FR'=>'davWasAutomaticallyActivatedBecauseOfYourCountryChoice');
@@ -159,7 +157,7 @@ class modEmailCollector extends DolibarrModules
// 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'=>'Email collector', 'priority'=>50, 'jobtype'=>'method', 'class'=>'/emailcollector/class/emailcollector.class.php', 'objectname'=>'EmailCollector', 'method'=>'doCollect', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>5, 'unitfrequency'=>60, 'status'=>1, 'test'=>'$conf->emailcollector->enabled')
+ 0=>array('label'=>'Email collector', 'priority'=>50, 'jobtype'=>'method', 'class'=>'/emailcollector/class/emailcollector.class.php', 'objectname'=>'EmailCollector', 'method'=>'doCollect', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>5, 'unitfrequency'=>60, 'status'=>1, 'test'=>'isModEnabled("emailcollector")')
);
diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php
index 3b6b4e10c82..9fdef7671c3 100644
--- a/htdocs/core/modules/modExpedition.class.php
+++ b/htdocs/core/modules/modExpedition.class.php
@@ -20,11 +20,12 @@
*/
/**
- * \defgroup expedition Module shipping
- * \brief Module pour gerer les expeditions de produits
- * \file htdocs/core/modules/modExpedition.class.php
- * \ingroup expedition
- * \brief Description and activation file for the module Expedition
+ * \defgroup expedition Module Shipping
+ * \brief Module to manage product shipments
+ *
+ * \file htdocs/core/modules/modExpedition.class.php
+ * \ingroup expedition
+ * \brief Description and activation file for the module Expedition
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
@@ -245,7 +246,7 @@ class modExpedition extends DolibarrModules
$this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'ThirdParty', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'd.nom'=>'State', 'co.label'=>'Country',
'co.code'=>'CountryCode', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5',
- 's.idprof6'=>'ProfId6', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_customer'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation",
+ 's.idprof6'=>'ProfId6', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_customer'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_valid'=>"DateValidation",
'c.date_delivery'=>"DateDeliveryPlanned", 'c.tracking_number'=>"TrackingNumber", 'c.height'=>"Height", 'c.width'=>"Width", 'c.size'=>"Depth",
'c.size_units'=>'SizeUnits', 'c.weight'=>"Weight", 'c.weight_units'=>"WeightUnits", 'c.fk_statut'=>'Status', 'c.note_public'=>"NotePublic",
'ed.rowid'=>'LineId', 'cd.description'=>'Description', 'ed.qty'=>"Qty", 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel',
@@ -262,7 +263,7 @@ class modExpedition extends DolibarrModules
//);
$this->export_TypeFields_array[$r] = array(
's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text',
- 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_customer'=>"Text", 'c.date_creation'=>"Date",
+ 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_customer'=>"Text", 'c.date_creation'=>"Date", 'c.date_valid'=>"Date",
'c.date_delivery'=>"Date", 'c.tracking_number'=>"Numeric", 'c.height'=>"Numeric", 'c.width'=>"Numeric", 'c.weight'=>"Numeric", 'c.fk_statut'=>'Status',
'c.note_public'=>"Text", 'ed.qty'=>"Numeric", 'd.nom'=>'Text'
);
@@ -270,7 +271,7 @@ class modExpedition extends DolibarrModules
's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company',
'co.code'=>'company', 's.fk_pays'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.siret'=>'company', 's.idprof4'=>'company',
's.idprof5'=>'company', 's.idprof6'=>'company', 'c.rowid'=>"shipment", 'c.ref'=>"shipment", 'c.ref_customer'=>"shipment", 'c.fk_soc'=>"shipment",
- 'c.date_creation'=>"shipment", 'c.date_delivery'=>"shipment", 'c.tracking_number'=>'shipment', 'c.height'=>"shipment", 'c.width'=>"shipment",
+ 'c.date_creation'=>"shipment", 'c.date_valid'=>"shipment", 'c.date_delivery'=>"shipment", 'c.tracking_number'=>'shipment', 'c.height'=>"shipment", 'c.width'=>"shipment",
'c.size'=>'shipment', 'c.size_units'=>'shipment', 'c.weight'=>"shipment", 'c.weight_units'=>'shipment', 'c.fk_statut'=>"shipment", 'c.note_public'=>"shipment",
'ed.rowid'=>'shipment_line', 'cd.description'=>'shipment_line', 'ed.qty'=>"shipment_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product',
'p.weight'=>'product', 'p.weight_units'=>'product', 'p.volume'=>'product', 'p.volume_units'=>'product'
diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php
index 536aabd086c..a1ab6b43026 100644
--- a/htdocs/core/modules/modExpenseReport.class.php
+++ b/htdocs/core/modules/modExpenseReport.class.php
@@ -245,6 +245,11 @@ class modExpenseReport extends DolibarrModules
{
global $conf;
+ $result = $this->_load_tables('/install/mysql/', 'expensereport');
+ if ($result < 0) {
+ return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
+ }
+
// Remove permissions and default values
$this->remove($options);
diff --git a/htdocs/core/modules/modExport.class.php b/htdocs/core/modules/modExport.class.php
index df996a312bf..7f36c78273b 100644
--- a/htdocs/core/modules/modExport.class.php
+++ b/htdocs/core/modules/modExport.class.php
@@ -17,11 +17,12 @@
*/
/**
- * \defgroup export Module export
- * \brief Module generique pour realiser des exports de donnees en base
- * \file htdocs/core/modules/modExport.class.php
- * \ingroup export
- * \brief Description and activation file for the module export
+ * \defgroup export Module Export
+ * \brief Module to manage data exports from Dolibarr database
+ *
+ * \file htdocs/core/modules/modExport.class.php
+ * \ingroup export
+ * \brief Description and activation file for the module export
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php
index 81a8e6224cf..3127a0d76bb 100644
--- a/htdocs/core/modules/modFournisseur.class.php
+++ b/htdocs/core/modules/modFournisseur.class.php
@@ -21,10 +21,12 @@
*/
/**
- * \defgroup fournisseur Module suppliers
- * \file htdocs/core/modules/modFournisseur.class.php
- * \ingroup fournisseur
- * \brief Description and activation file for the module Supplier
+ * \defgroup fournisseur Module suppliers
+ * \brief Module to manage suppliers relations and activities
+ *
+ * \file htdocs/core/modules/modFournisseur.class.php
+ * \ingroup fournisseur
+ * \brief Description and activation file for the module Supplier
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php
index f4295f53193..cd625811860 100644
--- a/htdocs/core/modules/modHRM.class.php
+++ b/htdocs/core/modules/modHRM.class.php
@@ -17,10 +17,12 @@
*/
/**
- * \defgroup HRM Module hrm
- * \file htdocs/core/modules/modHRM.class.php
- * \ingroup HRM
- * \brief Description and activation file for the module HRM
+ * \defgroup HRM Module hrm
+ * \brief Module for Human Resource Management (HRM)
+ *
+ * \file htdocs/core/modules/modHRM.class.php
+ * \ingroup HRM
+ * \brief Description and activation file for the module HRM
*/
include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php";
diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php
index 630320adaaf..ad4d135f491 100644
--- a/htdocs/core/modules/modHoliday.class.php
+++ b/htdocs/core/modules/modHoliday.class.php
@@ -23,7 +23,8 @@
/**
* \defgroup holiday Module holiday
- * \brief Module de gestion des congés
+ * \brief Module for leave/vacation management
+ *
* \file htdocs/core/modules/modHoliday.class.php
* \ingroup holiday
* \brief Description and activation file for the module holiday
diff --git a/htdocs/core/modules/modLabel.class.php b/htdocs/core/modules/modLabel.class.php
index dff42653c3c..693f0764e08 100644
--- a/htdocs/core/modules/modLabel.class.php
+++ b/htdocs/core/modules/modLabel.class.php
@@ -78,7 +78,7 @@ class modLabel extends DolibarrModules
$this->rights[1][0] = 601; // id de la permission
$this->rights[1][1] = 'Read stickers';
- $this->rights[1][3] = 1; // La permission est-elle une permission par defaut
+ $this->rights[1][3] = 0; // La permission est-elle une permission par defaut
$this->rights[1][4] = 'lire';
$this->rights[2][0] = 602; // id de la permission
diff --git a/htdocs/core/modules/modLdap.class.php b/htdocs/core/modules/modLdap.class.php
index 2b02a1b58c1..9eb9ce60c7b 100644
--- a/htdocs/core/modules/modLdap.class.php
+++ b/htdocs/core/modules/modLdap.class.php
@@ -86,6 +86,7 @@ class modLdap extends DolibarrModules
12=>array('LDAP_FIELD_FAX', 'chaine', 'facsimiletelephonenumber', '', 0),
13=>array('LDAP_FIELD_MOBILE', 'chaine', 'mobile', '', 0),
14=>array('LDAP_GROUP_FILTER', 'chaine', '&(objectClass=groupOfNames)', '', 0),
+ 15=>array('LDAP_USERACCOUNTCONTROL', 'int', 512, '', 0),
);
// Boxes
diff --git a/htdocs/core/modules/modMrp.class.php b/htdocs/core/modules/modMrp.class.php
index f315a4594c4..caf221bfd83 100644
--- a/htdocs/core/modules/modMrp.class.php
+++ b/htdocs/core/modules/modMrp.class.php
@@ -20,7 +20,7 @@
/**
* \defgroup mrp Module Mrp
- * \brief Mrp module descriptor.
+ * \brief Module to manage Manufacturing Orders (MO)
*
* \file htdocs/core/modules/modMrp.class.php
* \ingroup mrp
diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php
index 63086fd9112..0e59169bda3 100644
--- a/htdocs/core/modules/modNotification.class.php
+++ b/htdocs/core/modules/modNotification.class.php
@@ -17,11 +17,12 @@
*/
/**
- * \defgroup notification Module email notification
- * \brief Module pour gerer les notifications (par mail ou autre)
- * \file htdocs/core/modules/modNotification.class.php
- * \ingroup notification
- * \brief Description and activation file for the module Notification
+ * \defgroup notification Module notification
+ * \brief Module for managing notifications (by e-mail or other means)
+ *
+ * \file htdocs/core/modules/modNotification.class.php
+ * \ingroup notification
+ * \brief Description and activation file for the module Notification
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php
index b8aafc853fb..48244ae0455 100644
--- a/htdocs/core/modules/modPartnership.class.php
+++ b/htdocs/core/modules/modPartnership.class.php
@@ -253,8 +253,8 @@ class modPartnership extends DolibarrModules
$datestart=dol_mktime(21, 15, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']);
$this->cronjobs = array(
- 0 => array('priority'=>60, 'label'=>'CancelPartnershipForExpiredMembers', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doCancelStatusOfMemberPartnership', 'parameters'=>'', 'comment'=>'Cancel status of partnership when subscription is expired + x days.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>1, 'test'=>'$conf->partnership->enabled', 'datestart'=>$datestart),
- 1 => array('priority'=>61, 'label'=>'PartnershipCheckBacklink', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doWarningOfPartnershipIfDolibarrBacklinkNotfound', 'parameters'=>'', 'comment'=>'Warning of partnership if Dolibarr backlink not found on partner website.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>0, 'test'=>'$conf->partnership->enabled', 'datestart'=>$datestart),
+ 0 => array('priority'=>60, 'label'=>'CancelPartnershipForExpiredMembers', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doCancelStatusOfMemberPartnership', 'parameters'=>'', 'comment'=>'Cancel status of partnership when subscription is expired + x days.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>1, 'test'=>'isModEnabled("partnership")', 'datestart'=>$datestart),
+ 1 => array('priority'=>61, 'label'=>'PartnershipCheckBacklink', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doWarningOfPartnershipIfDolibarrBacklinkNotfound', 'parameters'=>'', 'comment'=>'Add a warning on partnership record if the backlink keyword is not found on the partner website.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>0, 'test'=>'isModEnabled("partnership")', 'datestart'=>$datestart),
);
// Permissions provided by this module
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index d8192a37df4..560fd286c2b 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -68,7 +68,7 @@ class modProduct extends DolibarrModules
// Dependencies
$this->hidden = false; // A condition to hide module
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
- $this->requiredby = array("modStock", "modBarcode", "modProductBatch", "modVariants"); // List of module ids to disable if this one is disabled
+ $this->requiredby = array("modStock", "modBarcode", "modProductBatch", "modVariants", "modBom"); // List of module ids to disable if this one is disabled
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->phpmin = array(7, 0); // Minimum version of PHP required by module
@@ -356,7 +356,7 @@ class modProduct extends DolibarrModules
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
- $this->export_sql_end[$r] .= ' AND pr.date_price = (SELECT MAX(pr2.date_price) FROM '.MAIN_DB_PREFIX.'product_price as pr2 WHERE pr2.fk_product = pr.fk_product AND pr2.entity IN ('.getEntity('product').'))'; // export only latest prices not full history
+ $this->export_sql_end[$r] .= ' AND pr.date_price = (SELECT MAX(pr2.date_price) FROM '.MAIN_DB_PREFIX.'product_price as pr2 WHERE pr2.fk_product = pr.fk_product AND pr2.price_level = pr.price_level AND pr2.entity IN ('.getEntity('product').'))'; // export only latest prices not full history
$this->export_sql_end[$r] .= ' ORDER BY p.ref, pr.price_level';
}
@@ -368,6 +368,7 @@ class modProduct extends DolibarrModules
$this->export_permission[$r] = array(array("produit", "export"));
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label",
's.nom'=>'ThirdParty',
+ 's.code_client'=>'CodeClient',
'pr.price_base_type'=>"PriceBase",
'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC",
'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
@@ -379,6 +380,7 @@ class modProduct extends DolibarrModules
}
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", 'p.label'=>"Label",
's.nom'=>'company',
+ 's.code_client'=>'company',
'pr.price_base_type'=>"product", 'pr.price'=>"product",
'pr.price_ttc'=>"product",
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php
index 2461118572a..b7beb1f4d92 100644
--- a/htdocs/core/modules/modPropale.class.php
+++ b/htdocs/core/modules/modPropale.class.php
@@ -104,6 +104,13 @@ class modPropale extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
+ $this->const[$r][0] = "PROPOSAL_ALLOW_ONLINESIGN";
+ $this->const[$r][1] = "chaine";
+ $this->const[$r][2] = "1";
+ $this->const[$r][3] = "";
+ $this->const[$r][4] = 0;
+ $r++;
+
/*$this->const[$r][0] = "PROPALE_DRAFT_WATERMARK";
$this->const[$r][2] = "__(Draft)__";
$this->const[$r][3] = 'Watermark to show on draft proposals';
diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php
index d6341e6279d..7a606b9c0a8 100644
--- a/htdocs/core/modules/modReception.class.php
+++ b/htdocs/core/modules/modReception.class.php
@@ -16,11 +16,12 @@
*/
/**
- * \defgroup reception Module reception
- * \brief Module pour gerer les réceptions de produits
- * \file htdocs/core/modules/modReception.class.php
- * \ingroup reception
- * \brief Description and activation file for the module Reception
+ * \defgroup reception Module Reception
+ * \brief Module to manage receptions of products
+ *
+ * \file htdocs/core/modules/modReception.class.php
+ * \ingroup reception
+ * \brief Description and activation file for the module Reception
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php
index 2d17038f43e..16da9c88def 100644
--- a/htdocs/core/modules/modStock.class.php
+++ b/htdocs/core/modules/modStock.class.php
@@ -235,23 +235,32 @@ class modStock extends DolibarrModules
'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.seuil_stock_alerte'=>'StockLimit',
+ 'p.seuil_stock_alerte'=>'StockLimit', 'p.barcode'=>'BarCode', 'bt.libelle'=>'BarcodeType',
);
+ if (isModEnabled('barcode')) {
+ $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
+ }
$this->export_TypeFields_array[$r] = array(
'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'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.pmp'=>'Numeric', 'p.cost_price'=>'Numeric',
'ps.reel'=>'Numeric',
- 'p.seuil_stock_alerte'=>'Numeric',
+ 'p.seuil_stock_alerte'=>'Numeric', 'p.barcode'=>'Text', 'bt.libelle'=>'List:c_barcode_type:libelle',
);
+ if (isModEnabled('barcode')) {
+ $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
+ }
$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',
'ps.reel'=>'stock',
- 'p.seuil_stock_alerte'=>'product',
+ 'p.seuil_stock_alerte'=>'product', 'p.barcode'=>'product', 'bt.libelle'=>'c_barcode_type',
); // We define here only fields that use another icon that the one defined into export_icon
+ if (isModEnabled('barcode')) {
+ $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
+ }
$this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet
$this->export_dependencies_array[$r] = array('stock'=>array('p.rowid', 'e.rowid')); // We must keep this until the aggregate_array is used. To have a unique key, if we ask a field of a child, to avoid the DISTINCT to discard them.
$keyforselect = 'product';
@@ -261,7 +270,10 @@ class modStock extends DolibarrModules
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ps.reel'=>'Stock'));
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
- $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON extra.fk_object = p.rowid, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e';
+ $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON extra.fk_object = p.rowid';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_barcode_type as bt ON bt.rowid = p.fk_barcode_type';
+ $this->export_sql_end[$r] .= ', '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e';
$this->export_sql_end[$r] .= ' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid';
$this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')';
@@ -284,6 +296,9 @@ class modStock extends DolibarrModules
'pb.rowid'=>'Id', 'pb.batch'=>'Batch', 'pb.qty'=>'Qty',
'pl.eatby'=>'EatByDate', 'pl.sellby'=>'SellByDate'
);
+ if (isModEnabled('barcode')) {
+ $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
+ }
$this->export_TypeFields_array[$r] = array(
'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",
@@ -292,6 +307,9 @@ class modStock extends DolibarrModules
'pb.batch'=>'Text', 'pb.qty'=>'Numeric',
'pl.eatby'=>'Date', 'pl.sellby'=>'Date'
);
+ if (isModEnabled('barcode')) {
+ $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
+ }
$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",
@@ -299,6 +317,9 @@ class modStock extends DolibarrModules
'pb.rowid'=>'batch', 'pb.batch'=>'batch', 'pb.qty'=>'batch',
'pl.eatby'=>'batch', 'pl.sellby'=>'batch'
); // We define here only fields that use another icon that the one defined into export_icon
+ if (isModEnabled('barcode')) {
+ $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
+ }
$this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet
$this->export_dependencies_array[$r] = array('stockbatch'=>array('pb.rowid'), 'batch'=>array('pb.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
$keyforselect = 'product_lot';
@@ -329,12 +350,18 @@ class modStock extends DolibarrModules
'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'
);
+ if (isModEnabled('barcode')) {
+ $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
+ }
$this->export_TypeFields_array[$r] = array(
'sm.rowid'=>'Numeric', 'sm.value'=>'Numeric', 'sm.datem'=>'Date', 'sm.batch'=>'Text', 'sm.label'=>'Text', 'sm.inventorycode'=>'Text',
'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'
);
+ if (isModEnabled('barcode')) {
+ $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
+ }
$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",
@@ -345,6 +372,9 @@ class modStock extends DolibarrModules
$this->export_TypeFields_array[$r]['sm.batch'] = 'Text';
$this->export_entities_array[$r]['sm.batch'] = 'movement';
}
+ if (isModEnabled('barcode')) {
+ $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
+ }
$this->export_aggregate_array[$r] = array('sm.value'=>'SUM'); // TODO Not used yet
$this->export_dependencies_array[$r] = array('movement'=>array('sm.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php
index 0fa0da9dcdb..8a2cbf68bab 100644
--- a/htdocs/core/modules/modSyslog.class.php
+++ b/htdocs/core/modules/modSyslog.class.php
@@ -17,11 +17,12 @@
*/
/**
- * \defgroup syslog Module syslog
- * \brief Module pour gerer les messages d'erreur dans syslog
- * \file htdocs/core/modules/modSyslog.class.php
- * \ingroup syslog
- * \brief Description and activation file for the module syslog
+ * \defgroup syslog Module Syslog
+ * \brief Module to manage error messages in syslog
+ *
+ * \file htdocs/core/modules/modSyslog.class.php
+ * \ingroup syslog
+ * \brief Description and activation file for the module syslog
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php
index f0380fb6410..de56f544a30 100644
--- a/htdocs/core/modules/modTicket.class.php
+++ b/htdocs/core/modules/modTicket.class.php
@@ -119,7 +119,8 @@ class modTicket extends DolibarrModules
11 => array('TICKET_MESSAGE_MAIL_SIGNATURE', 'chaine', $default_footer, 'Signature to use by default for messages sent from Dolibarr', 0),
12 => array('MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER', 'chaine', "1", 'Disable the rendering of headers in tickets', 0),
13 => array('MAIN_SECURITY_ENABLECAPTCHA_TICKET', 'chaine', getDolGlobalInt('MAIN_SECURITY_ENABLECAPTCHA_TICKET'), 'Enable captcha code by default', 0),
- 14 => array('TICKET_SHOW_COMPANY_LOGO', 'chaine', getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO'), 'Enable logo header on ticket public page', 0)
+ 14 => array('TICKET_SHOW_COMPANY_LOGO', 'chaine', getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO'), 'Enable logo header on ticket public page', 0),
+ 15 => array('TICKET_SHOW_COMPANY_FOOTER', 'chaine', getDolGlobalInt('TICKET_SHOW_COMPANY_FOOTER'), 'Enable footer on ticket public page', 0)
);
diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php
index df5cfba961f..4fce2b8021f 100644
--- a/htdocs/core/modules/modUser.class.php
+++ b/htdocs/core/modules/modUser.class.php
@@ -18,11 +18,12 @@
*/
/**
- * \defgroup user Module user management
- * \brief Module pour gerer les utilisateurs
- * \file htdocs/core/modules/modUser.class.php
- * \ingroup user
- * \brief Description and activation file for the module users
+ * \defgroup user Module user management
+ * \brief Module to manage users and usergroups
+ *
+ * \file htdocs/core/modules/modUser.class.php
+ * \ingroup user
+ * \brief Description and activation file for the module users
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
diff --git a/htdocs/core/modules/modZapier.class.php b/htdocs/core/modules/modZapier.class.php
index f3d187cf3bb..c89a9603365 100644
--- a/htdocs/core/modules/modZapier.class.php
+++ b/htdocs/core/modules/modZapier.class.php
@@ -229,7 +229,7 @@ class modZapier extends DolibarrModules
// Permission label
$this->rights[$r][1] = 'Read myobject of Zapier';
// Permission by default for new user (0/1)
- $this->rights[$r][3] = 1;
+ $this->rights[$r][3] = 0;
// In php code, permission will be checked by test if ($user->rights->zapier->level1->level2)
$this->rights[$r][4] = 'read';
// In php code, permission will be checked by test if ($user->rights->zapier->level1->level2)
@@ -237,13 +237,13 @@ class modZapier extends DolibarrModules
$r++;
$this->rights[$r][0] = $this->numero + $r;
$this->rights[$r][1] = 'Create/Update myobject of Zapier';
- $this->rights[$r][3] = 1;
+ $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'write';
$this->rights[$r][5] = '';
$r++;
$this->rights[$r][0] = $this->numero + $r;
$this->rights[$r][1] = 'Delete myobject of Zapier';
- $this->rights[$r][3] = 1;
+ $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'delete';
$this->rights[$r][5] = '';
diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php
index d15ae20170b..ac53946bb06 100644
--- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php
@@ -37,44 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
*/
class pdf_standard extends ModelePDFMovement
{
- /**
- * @var DoliDb Database handler
- */
- public $db;
-
- /**
- * @var string model name
- */
- public $name;
-
- /**
- * @var string model description (short text)
- */
- public $description;
-
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
- /**
- * @var string document type
- */
- public $type;
-
- /**
- * Dolibarr version of the loaded document
- * @var string
- */
- public $version = 'dolibarr';
-
- /**
- * Issuer
- * @var Societe Object that emits
- */
- public $emetteur;
-
-
public $wref;
public $posxidref;
public $posxdatemouv;
@@ -116,7 +83,6 @@ class pdf_standard extends ModelePDFMovement
$this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
$this->option_logo = 1; // Display logo
- $this->option_codestockservice = 0; // Display stock-service code
$this->option_multilang = 1; // Available in several languages
$this->option_freetext = 0; // Support add of a personalised text
@@ -719,6 +685,14 @@ class pdf_standard extends ModelePDFMovement
dol_print_error($this->db);
}
+ // Display notes
+ $notetoshow = empty($object->note_public) ? '' : $object->note_public;
+ // Extrafields in note
+ $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
+ if (!empty($extranote)) {
+ $notetoshow = dol_concatdesc($notetoshow, $extranote);
+ }
+
if ($notetoshow) {
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
diff --git a/htdocs/core/modules/movement/modules_movement.php b/htdocs/core/modules/movement/modules_movement.php
index a058d685114..0525793a715 100644
--- a/htdocs/core/modules/movement/modules_movement.php
+++ b/htdocs/core/modules/movement/modules_movement.php
@@ -31,47 +31,25 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
abstract class ModelePDFMovement extends CommonDocGenerator
{
/**
- * @var string Error code (or message)
+ * @var DoliDb Database handler
*/
- public $error = '';
+ public $db;
/**
- * @var int page_largeur
+ * @var string model description (short text)
*/
- public $page_largeur;
+ public $description;
/**
- * @var int page_hauteur
+ * @var string document type
*/
- public $page_hauteur;
+ public $type;
/**
- * @var array format
+ * Dolibarr version of the loaded document
+ * @var string
*/
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
-
- public $option_codestockservice;
+ public $version = 'dolibarr';
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
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 fe18e6eb6ea..f24f77cb946 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
@@ -40,12 +40,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_mo_odt extends ModelePDFMo
{
- /**
- * Issuer
- * @var Societe
- */
- public $emetteur;
-
/**
* @var string Dolibarr version of the loaded document
*/
@@ -142,17 +136,18 @@ class doc_generic_mo_odt extends ModelePDFMo
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
+ $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
// Add list of substitution keys
$texthelp .= ' '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").' ';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '
';
$texte .= '';
$texte .= '';
diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
index 62e5f062514..7be587e7c0e 100644
--- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
+++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
@@ -5,7 +5,7 @@
* Copyright (C) 2010-2014 Juanjo Menent
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017 Ferran Marcet
- * Copyright (C) 2018-2021 Frédéric France
+ * Copyright (C) 2018-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
@@ -73,47 +73,6 @@ class pdf_vinci extends ModelePDFMo
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * Issuer
- * @var Societe object that emits
- */
- public $emetteur;
-
/**
* Constructor
@@ -122,7 +81,7 @@ class pdf_vinci extends ModelePDFMo
*/
public function __construct($db)
{
- global $conf, $langs, $mysoc;
+ global $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main", "bills"));
@@ -1010,9 +969,10 @@ class pdf_vinci extends ModelePDFMo
$pdf->SetFont('', '', $default_font_size - 2);
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 - 4);
- $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
+ // $title = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
+ $title = '';
+ $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($title) + 3), $tab_top - 4);
+ $pdf->MultiCell(($pdf->GetStringWidth($title) + 3), 2, $title);
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
diff --git a/htdocs/core/modules/mrp/mod_mo_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php
index cd134537ea2..2fc5985cc84 100644
--- a/htdocs/core/modules/mrp/mod_mo_advanced.php
+++ b/htdocs/core/modules/mrp/mod_mo_advanced.php
@@ -55,9 +55,10 @@ class mod_mo_advanced extends ModeleNumRefMos
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $conf, $langs, $db;
@@ -82,7 +83,7 @@ class mod_mo_advanced extends ModeleNumRefMos
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
diff --git a/htdocs/core/modules/mrp/mod_mo_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php
index d47b4eb708e..c27c36c8849 100644
--- a/htdocs/core/modules/mrp/mod_mo_standard.php
+++ b/htdocs/core/modules/mrp/mod_mo_standard.php
@@ -51,9 +51,10 @@ class mod_mo_standard extends ModeleNumRefMos
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -75,9 +76,10 @@ class mod_mo_standard extends ModeleNumRefMos
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
diff --git a/htdocs/core/modules/mrp/modules_mo.php b/htdocs/core/modules/mrp/modules_mo.php
index 5c741f28d47..9d542be1208 100644
--- a/htdocs/core/modules/mrp/modules_mo.php
+++ b/htdocs/core/modules/mrp/modules_mo.php
@@ -30,6 +30,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
@@ -38,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
*/
abstract class ModelePDFMo extends CommonDocGenerator
{
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -61,100 +61,10 @@ abstract class ModelePDFMo extends CommonDocGenerator
}
-
/**
* Parent class to manage numbering of MOs
*/
-abstract class ModeleNumRefMos
+abstract class ModeleNumRefMos extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering template
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("mrp");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Returns an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("mrp");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Returns next assigned value
- *
- * @param Societe $objsoc Object thirdparty
- * @param Object $object Object we need next value for
- * @return string Valeur
- */
- public function getNextValue($objsoc, $object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Returns version of numbering module
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- }
- if ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- }
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
- if ($this->version) {
- return $this->version;
- }
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php
index 7f654222044..abaf5921cdc 100644
--- a/htdocs/core/modules/oauth/google_oauthcallback.php
+++ b/htdocs/core/modules/oauth/google_oauthcallback.php
@@ -263,6 +263,7 @@ if (!GETPOST('code')) {
dol_syslog("userinfo=".var_export($userinfo, true));
$useremail = $userinfo['email'];
+
/*
$useremailverified = $userinfo['email_verified'];
$useremailuniq = $userinfo['sub'];
@@ -280,6 +281,12 @@ if (!GETPOST('code')) {
// Verify that the ID token is properly signed by the issuer. Google-issued tokens are signed using one of the certificates found at the URI specified in the jwks_uri metadata value of the Discovery document.
// TODO
+ // Verify that email is a verified email
+ /*if (empty($userinfo['email_verified'])) {
+ setEventMessages($langs->trans('Bad value for email, emai lwas not verified by Google'), null, 'errors');
+ $errorincheck++;
+ }*/
+
// 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');
diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php
index 6125053cbb4..6fe019dde3b 100644
--- a/htdocs/core/modules/payment/mod_payment_ant.php
+++ b/htdocs/core/modules/payment/mod_payment_ant.php
@@ -57,9 +57,10 @@ class mod_payment_ant extends ModeleNumRefPayments
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $db, $langs;
@@ -84,7 +85,7 @@ class mod_payment_ant extends ModeleNumRefPayments
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php
index d3259db513c..466bb81ea09 100644
--- a/htdocs/core/modules/payment/mod_payment_cicada.php
+++ b/htdocs/core/modules/payment/mod_payment_cicada.php
@@ -58,9 +58,10 @@ class mod_payment_cicada extends ModeleNumRefPayments
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -82,9 +83,10 @@ class mod_payment_cicada extends ModeleNumRefPayments
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
diff --git a/htdocs/core/modules/payment/modules_payment.php b/htdocs/core/modules/payment/modules_payment.php
index 68b864fe94d..d0913c71e23 100644
--- a/htdocs/core/modules/payment/modules_payment.php
+++ b/htdocs/core/modules/payment/modules_payment.php
@@ -16,96 +16,12 @@
* or see https://www.gnu.org/
*/
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
+
/**
- * \class ModeleNumRefPayments
- * \brief Payment numbering references mother class
+ * Payment numbering references mother class
*/
-
-abstract class ModeleNumRefPayments
+abstract class ModeleNumRefPayments extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Return the default description of numbering module
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("bills");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Return numbering example
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("bills");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Returns the next value
- *
- * @param Societe $objsoc Object thirdparty
- * @param Object $object Object we need next value for
- * @return string Valeur
- */
- public function getNextValue($objsoc, $object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Returns the module numbering version
- *
- * @return string Value
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- } elseif ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- } elseif ($this->version == 'dolibarr') {
- return DOL_VERSION;
- } elseif ($this->version) {
- return $this->version;
- } else {
- return $langs->trans("NotAvailable");
- }
- }
+ // No overload code
}
diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php
index 26268e7c183..6eb74a2e93d 100644
--- a/htdocs/core/modules/printing/modules_printing.php
+++ b/htdocs/core/modules/printing/modules_printing.php
@@ -1,6 +1,6 @@
+ * Copyright (C) 2014-2023 Frederic 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
@@ -41,6 +41,20 @@ class PrintingDriver
*/
public $error = '';
+ /**
+ * @var string Name
+ */
+ public $name;
+
+ /**
+ * @var string Description
+ */
+ public $desc;
+
+ /**
+ * @var string Html string returned for print
+ */
+ public $resprint;
/**
* 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 2728bf266c2..821aa6d8836 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
@@ -37,12 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_product_odt extends ModelePDFProduct
{
- /**
- * Issuer
- * @var Societe
- */
- public $emetteur;
-
/**
* Dolibarr version of the loaded document
* @var string
@@ -140,17 +134,18 @@ class doc_generic_product_odt extends ModelePDFProduct
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
+ $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
// Add list of substitution keys
$texthelp .= ' '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").' ';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '
';
diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php
index e5f5e7e09eb..934b7c3a5c0 100644
--- a/htdocs/core/modules/product/modules_product.class.php
+++ b/htdocs/core/modules/product/modules_product.class.php
@@ -26,54 +26,15 @@
* \brief File with parent class for generating products to PDF and File of class to manage product numbering
*/
- require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
+
/**
* Parent class to manage intervention document templates
*/
abstract class ModelePDFProduct extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -97,56 +58,8 @@ abstract class ModelePDFProduct extends CommonDocGenerator
/**
* Class template for classes of numbering product
*/
-abstract class ModeleProductCode
+abstract class ModeleProductCode extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /** Returns the default description of the numbering pattern
- *
- * @param Translate $langs Object langs
- * @return string Descriptive text
- */
- public function info($langs)
- {
- $langs->load("bills");
- return $langs->trans("NoDescription");
- }
-
- /** Renvoi nom module
- *
- * @param Translate $langs Object langs
- * @return string Nom du module
- */
- public function getNom($langs)
- {
- return empty($this->name) ? $this->nom : $this->name;
- }
-
-
- /** Return an example of numbering
- *
- * @param Translate $langs Object langs
- * @return string Example
- */
- public function getExample($langs)
- {
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
/**
* Return next value available
*
@@ -160,31 +73,6 @@ abstract class ModeleProductCode
return $langs->trans("Function_getNextValue_InModuleNotWorking");
}
-
- /** Return version of module
- *
- * @return string Version
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- }
- if ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- }
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
- if ($this->version) {
- return $this->version;
- }
- return $langs->trans("NotAvailable");
- }
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi la liste des modeles de numérotation
diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php
index 27cc509ea02..18c5cba5b46 100644
--- a/htdocs/core/modules/product_batch/mod_lot_advanced.php
+++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php
@@ -55,9 +55,10 @@ class mod_lot_advanced extends ModeleNumRefBatch
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $conf, $langs, $db;
@@ -85,7 +86,7 @@ class mod_lot_advanced extends ModeleNumRefBatch
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
// Option to enable custom masks per product
$texte .= '
';
diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php
index 8d14a25374f..bcba82c0ad5 100644
--- a/htdocs/core/modules/product_batch/mod_lot_free.php
+++ b/htdocs/core/modules/product_batch/mod_lot_free.php
@@ -1,7 +1,7 @@
* Copyright (C) 2006-2009 Laurent Destailleur
- * Copyright (C) 2022 Frédéric France
+ * Copyright (C) 2022-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
@@ -83,15 +83,25 @@ class mod_lot_free extends ModeleNumRefBatch
/**
* Return description of module
*
- * @return string Description of module
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
$langs->load("companies");
return $langs->trans("LeopardNumRefModelDesc");
}
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ return $this->getNextValue(null, null);
+ }
/**
* Return an example of result returned by getNextValue
diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php
index ef3918fd167..843aa1dd78b 100644
--- a/htdocs/core/modules/product_batch/mod_lot_standard.php
+++ b/htdocs/core/modules/product_batch/mod_lot_standard.php
@@ -52,9 +52,10 @@ class mod_lot_standard extends ModeleNumRefBatch
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -76,9 +77,10 @@ class mod_lot_standard extends ModeleNumRefBatch
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if KO (there is a conflict), true if OK
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php
index 91fc99a1363..fb6866742ff 100644
--- a/htdocs/core/modules/product_batch/mod_sn_advanced.php
+++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php
@@ -55,9 +55,10 @@ class mod_sn_advanced extends ModeleNumRefBatch
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $conf, $langs, $db;
@@ -85,7 +86,7 @@ class mod_sn_advanced extends ModeleNumRefBatch
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
// Option to enable custom masks per product
$texte .= '
';
diff --git a/htdocs/core/modules/product_batch/mod_sn_free.php b/htdocs/core/modules/product_batch/mod_sn_free.php
index 8ada51fb93b..c663833b8d4 100644
--- a/htdocs/core/modules/product_batch/mod_sn_free.php
+++ b/htdocs/core/modules/product_batch/mod_sn_free.php
@@ -79,15 +79,25 @@ class mod_sn_free extends ModeleNumRefBatch
/**
* Return description of module
*
- * @return string Description of module
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
$langs->load("companies");
return $langs->trans("LeopardNumRefModelDesc");
}
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ return $this->getNextValue(null, null);
+ }
/**
* Return an example of result returned by getNextValue
@@ -98,7 +108,6 @@ class mod_sn_free extends ModeleNumRefBatch
*/
public function getNextValue($objsoc, $object)
{
- global $langs;
return '';
}
}
diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php
index ccd49d03b8f..e1fdb0febb8 100644
--- a/htdocs/core/modules/product_batch/mod_sn_standard.php
+++ b/htdocs/core/modules/product_batch/mod_sn_standard.php
@@ -52,9 +52,10 @@ class mod_sn_standard extends ModeleNumRefBatch
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -76,9 +77,10 @@ class mod_sn_standard extends ModeleNumRefBatch
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if KO (there is a conflict), true if OK
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
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 d596ffeb111..d38e5eef379 100644
--- a/htdocs/core/modules/product_batch/modules_product_batch.class.php
+++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php
@@ -31,19 +31,15 @@
* \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';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
+
/**
* Parent class to manage intervention document templates
*/
abstract class ModelePDFProductBatch extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -67,85 +63,7 @@ abstract class ModelePDFProductBatch extends CommonDocGenerator
/**
* Parent class to manage numbering of batch products
*/
-abstract class ModeleNumRefBatch
+abstract class ModeleNumRefBatch extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering template
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("productbatch");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Returns an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("productbatch");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Returns next assigned value
- *
- * @param Societe $objsoc Object thirdparty
- * @param Productlot $object Object we need next value for
- * @return string Valeur
- */
- public function getNextValue($objsoc, $object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Returns version of numbering module
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
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 e8c1357e7a2..7259a2859a0 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
@@ -77,12 +77,6 @@ if (isModEnabled('expedition')) {
*/
class doc_generic_project_odt extends ModelePDFProjects
{
- /**
- * Issuer
- * @var Societe
- */
- public $emetteur;
-
/**
* Dolibarr version of the loaded document
* @var string
@@ -97,7 +91,7 @@ class doc_generic_project_odt extends ModelePDFProjects
*/
public function __construct($db)
{
- global $conf, $langs, $mysoc;
+ global $langs, $mysoc;
// Load traductions files required by page
$langs->loadLangs(array("companies", "main"));
@@ -407,12 +401,12 @@ class doc_generic_project_odt extends ModelePDFProjects
$form = new Form($this->db);
$texte = $this->description.". \n";
- $texte .= '';
diff --git a/htdocs/core/modules/reception/modules_reception.php b/htdocs/core/modules/reception/modules_reception.php
index 1536b550fff..75f6d309cd7 100644
--- a/htdocs/core/modules/reception/modules_reception.php
+++ b/htdocs/core/modules/reception/modules_reception.php
@@ -22,16 +22,15 @@
* \brief File that contains parent class for sending receipts models
* and parent class for sending receipts numbering models
*/
- require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
/**
* Parent class of sending receipts models
*/
abstract class ModelePdfReception extends CommonDocGenerator
{
- public $error = '';
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -57,89 +56,7 @@ abstract class ModelePdfReception extends CommonDocGenerator
/**
* Parent Class of numbering models of sending receipts references
*/
-abstract class ModelNumRefReception
+abstract class ModelNumRefReception extends CommonNumRefGenerator
{
- public $error = '';
-
- public $version;
-
-
- /**
- * Return if a model can be used or not
- *
- * @return boolean true if model can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Return default description of numbering model
- *
- * @return string text description
- */
- public function info()
- {
- global $langs;
- $langs->load("reception");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Returns numbering example
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("reception");
- return $langs->trans("NoExample");
- }
-
- /**
- * Test if existing numbers make problems with numbering
- *
- * @return boolean false if conflit, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Returns next value assigned
- *
- * @param Societe $objsoc Third party object
- * @param Object $reception Reception object
- * @return string Value
- */
- public function getNextValue($objsoc, $reception)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Returns version of the numbering model
- *
- * @return string Value
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- } elseif ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- } elseif ($this->version == 'dolibarr') {
- return DOL_VERSION;
- } elseif ($this->version) {
- return $this->version;
- }
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
diff --git a/htdocs/core/modules/security/generate/modGeneratePassNone.class.php b/htdocs/core/modules/security/generate/modGeneratePassNone.class.php
index 3ec764c6ab2..66621512b54 100644
--- a/htdocs/core/modules/security/generate/modGeneratePassNone.class.php
+++ b/htdocs/core/modules/security/generate/modGeneratePassNone.class.php
@@ -51,16 +51,6 @@ class modGeneratePassNone extends ModeleGenPassword
*/
public $length2;
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
- public $conf;
- public $lang;
- public $user;
-
-
/**
* Constructor
*
diff --git a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php
index 491ab9757e8..b708404956b 100644
--- a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php
+++ b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php
@@ -65,15 +65,6 @@ class modGeneratePassPerso extends ModeleGenPassword
*/
public $WithoutAmbi = 0;
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
- public $conf;
- public $lang;
- public $user;
-
public $Maj;
public $Min;
public $Nb;
diff --git a/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php b/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php
index b2d0b260ccb..0bab8e8b32b 100644
--- a/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php
+++ b/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php
@@ -51,16 +51,6 @@ class modGeneratePassStandard extends ModeleGenPassword
*/
public $length2;
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
- public $conf;
- public $lang;
- public $user;
-
-
/**
* Constructor
*
diff --git a/htdocs/core/modules/security/generate/modules_genpassword.php b/htdocs/core/modules/security/generate/modules_genpassword.php
index bb1e02774c6..4f5aedc7684 100644
--- a/htdocs/core/modules/security/generate/modules_genpassword.php
+++ b/htdocs/core/modules/security/generate/modules_genpassword.php
@@ -43,6 +43,26 @@ abstract class ModeleGenPassword
*/
public $error = '';
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
+
+ /**
+ * @var Conf dolibarr conf
+ */
+ public $conf;
+
+ /**
+ * @var Translate Translate Object
+ */
+ public $langs;
+
+ /**
+ * @var User user
+ */
+ public $user;
+
/**
* Return if a module can be used or not
*
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 261aeef9ad5..abcbb90877e 100644
--- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
+++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
@@ -37,10 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
class doc_generic_odt extends ModeleThirdPartyDoc
{
/**
- * Issuer
- * @var Societe
+ * @var string Dolibarr version of the loaded document
*/
- public $emetteur;
+ public $version = 'dolibarr';
+
/**
* Constructor
@@ -125,18 +125,19 @@ class doc_generic_odt extends ModeleThirdPartyDoc
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
+ $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
// Add list of substitution keys
$texthelp .= ' '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").' ';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '
';
$texte .= '';
diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
index 23e8deb4aee..35cf7c8e560 100644
--- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
@@ -38,38 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
*/
class pdf_standard extends ModelePDFStock
{
- /**
- * @var DoliDb Database handler
- */
- public $db;
-
- /**
- * @var string model name
- */
- public $name;
-
- /**
- * @var string model description (short text)
- */
- public $description;
-
- /**
- * @var string document type
- */
- public $type;
-
- /**
- * Dolibarr version of the loaded document
- * @var string
- */
- public $version = 'dolibarr';
-
- /**
- * Issuer
- * @var Societe
- */
- public $emetteur;
-
public $wref;
public $posxdesc;
public $posxlabel;
@@ -111,7 +79,6 @@ class pdf_standard extends ModelePDFStock
$this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
$this->option_logo = 1; // Display logo
- $this->option_codestockservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_freetext = 0; // Support add of a personalised text
diff --git a/htdocs/core/modules/stock/modules_stock.php b/htdocs/core/modules/stock/modules_stock.php
index d1dc684d1d2..e0acbea66e5 100644
--- a/htdocs/core/modules/stock/modules_stock.php
+++ b/htdocs/core/modules/stock/modules_stock.php
@@ -24,44 +24,29 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
abstract class ModelePDFStock extends CommonDocGenerator
{
/**
- * @var string Error code (or message)
+ * @var DoliDb Database handler
*/
- public $error = '';
+ public $db;
/**
- * @var int page_largeur
+ * @var string model name
*/
- public $page_largeur;
+ public $name;
/**
- * @var int page_hauteur
+ * @var string model description (short text)
*/
- public $page_hauteur;
+ public $description;
/**
- * @var array format
+ * @var string document type
*/
- public $format;
+ public $type;
/**
- * @var int marge_gauche
+ * @var string Dolibarr version of the loaded document
*/
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
+ public $version = 'dolibarr';
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
index 14ee86bccf0..2774358e2e3 100644
--- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
+++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
@@ -66,46 +66,17 @@ class pdf_eagle extends ModelePDFStockTransfer
public $version = 'dolibarr';
/**
- * @var int page_largeur
+ * @var int posx lot
*/
- public $page_largeur;
+ public $posxlot;
/**
- * @var int page_hauteur
+ * @var int posx weightvol
*/
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * Issuer
- * @var Societe object that emits
- */
- public $emetteur;
-
+ public $posxweightvol;
+ public $posxwarehousesource;
+ public $posxwarehousedestination;
+ public $atLeastOneBatch;
/**
* Constructor
@@ -177,13 +148,13 @@ class pdf_eagle extends ModelePDFStockTransfer
/**
* Function to build pdf onto disk
*
- * @param Object $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 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
*/
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
@@ -461,14 +432,14 @@ class pdf_eagle extends ModelePDFStockTransfer
$object->lines[$i]->fetch_product();
$object->lines[$i]->label = $object->lines[$i]->product->label;
$object->lines[$i]->description = $object->lines[$i]->product->description;
- $object->lines[$i]->weight = $object->lines[$i]->product->weight;
- $object->lines[$i]->weight_units = $object->lines[$i]->product->weight_units;
- $object->lines[$i]->length = $object->lines[$i]->product->length;
- $object->lines[$i]->length_units = $object->lines[$i]->product->length_units;
- $object->lines[$i]->surface = $object->lines[$i]->product->surface;
+ $object->lines[$i]->weight = $object->lines[$i]->product->weight;
+ $object->lines[$i]->weight_units = $object->lines[$i]->product->weight_units;
+ $object->lines[$i]->length = $object->lines[$i]->product->length;
+ $object->lines[$i]->length_units = $object->lines[$i]->product->length_units;
+ $object->lines[$i]->surface = $object->lines[$i]->product->surface;
$object->lines[$i]->surface_units = $object->lines[$i]->product->surface_units;
- $object->lines[$i]->volume = $object->lines[$i]->product->volume;
- $object->lines[$i]->volume_units = $object->lines[$i]->product->volume_units;
+ $object->lines[$i]->volume = $object->lines[$i]->product->volume;
+ $object->lines[$i]->volume_units = $object->lines[$i]->product->volume_units;
$object->lines[$i]->fk_unit = $object->lines[$i]->product->fk_unit;
//var_dump($object->lines[$i]);exit;
}
@@ -673,12 +644,12 @@ class pdf_eagle extends ModelePDFStockTransfer
/**
* Show total to pay
*
- * @param PDF $pdf Object PDF
- * @param Facture $object Object invoice
- * @param int $deja_regle Montant deja regle
- * @param int $posy Position depart
- * @param Translate $outputlangs Objet langs
- * @return int Position pour suite
+ * @param PDF $pdf Object PDF
+ * @param StockTransfer $object Object invoice
+ * @param int $deja_regle Montant deja regle
+ * @param int $posy Position depart
+ * @param Translate $outputlangs Objet langs
+ * @return int Position pour suite
*/
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
@@ -861,10 +832,10 @@ class pdf_eagle extends ModelePDFStockTransfer
}
/**
- * Used to know if at least one line of Stock Transfer object has a batch set
- *
- * @param Object $object Stock Transfer object
- * @return boolean true if at least one line has batch set, false if not
+ * Used to know if at least one line of Stock Transfer object has a batch set
+ *
+ * @param StockTransfer $object Stock Transfer object
+ * @return boolean true if at least one line has batch set, false if not
 */
public function atLeastOneBatch($object)
{
@@ -873,7 +844,9 @@ class pdf_eagle extends ModelePDFStockTransfer
$atLeastOneBatch = false;
- if (empty($conf->productbatch->enabled)) return false;
+ if (!isModEnabled('productbatch')) {
+ return false;
+ }
foreach ($object->lines as $line) {
if (!empty($line->batch)) {
@@ -888,10 +861,10 @@ class pdf_eagle extends ModelePDFStockTransfer
/**
* 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 TCPDF $pdf Object PDF
+ * @param StockTransfer $object Object to show
+ * @param int $showaddress 0=no, 1=yes
+ * @param Translate $outputlangs Object lang for output
* @return void
*/
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
@@ -1147,11 +1120,11 @@ class pdf_eagle extends ModelePDFStockTransfer
/**
* Show footer of page. Need this->emetteur object
*
- * @param PDF $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 PDF $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)
{
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 83f0cb802e9..101ee0f43f6 100644
--- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php
+++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php
@@ -74,47 +74,6 @@ class pdf_eagle_proforma extends ModelePDFCommandes
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * Issuer
- * @var Societe Object that emits
- */
- public $emetteur;
-
/**
* Constructor
@@ -123,7 +82,7 @@ class pdf_eagle_proforma extends ModelePDFCommandes
*/
public function __construct($db)
{
- global $conf, $langs, $mysoc;
+ global $langs, $mysoc;
// Translations
$langs->loadLangs(array("main", "bills", "products"));
diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php
index c19067c019d..8eac5b14f4b 100644
--- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php
+++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php
@@ -55,11 +55,12 @@ class mod_stocktransfer_advanced extends ModeleNumRefStockTransfer
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
- global $conf, $langs, $db;
+ global $langs, $db;
$langs->load("bills");
@@ -82,7 +83,7 @@ class mod_stocktransfer_advanced extends ModeleNumRefStockTransfer
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php
index fc647d3135c..301bee244c0 100644
--- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php
+++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php
@@ -53,9 +53,10 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
diff --git a/htdocs/core/modules/stocktransfer/modules_stocktransfer.php b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php
index 2a7218543e7..c68ae5d3d7a 100644
--- a/htdocs/core/modules/stocktransfer/modules_stocktransfer.php
+++ b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php
@@ -30,6 +30,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
@@ -38,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
*/
abstract class ModelePDFStockTransfer extends CommonDocGenerator
{
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -65,85 +65,7 @@ abstract class ModelePDFStockTransfer extends CommonDocGenerator
/**
* Parent class to manage numbering of StockTransfer
*/
-abstract class ModeleNumRefStockTransfer
+abstract class ModeleNumRefStockTransfer extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering template
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("stocktransfer@stocktransfer");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Returns an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("stocktransfer@stocktransfer");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @param Object $object Object we need next value for
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated($object)
- {
- return true;
- }
-
- /**
- * Returns next assigned value
- *
- * @param Object $object Object we need next value for
- * @return string Valeur
- */
- public function getNextValue($object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Returns version of numbering module
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
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 6031907b305..56175353538 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
@@ -146,17 +146,18 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
+ $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
// Add list of substitution keys
$texthelp .= ' '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").' ';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '
';
$texte .= '';
$texte .= '
';
- $texte .= '';
+ $texte .= '';
$texte .= '
';
// Scan directories
@@ -182,15 +183,10 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
// Add input to upload a new template file.
$texte .= '
';
$texte .= '';
$texte .= '';
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 3dfb6bfd4d2..3172a54711c 100644
--- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
+++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
@@ -69,48 +69,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * Issuer
- * @var Societe object that emits
- */
- public $emetteur;
-
-
/**
* Constructor
@@ -649,12 +607,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/**
* Show total to pay
*
- * @param TCPDF $pdf Object PDF
- * @param Object $object Object invoice
- * @param int $deja_regle Amount already paid (in the currency of invoice)
- * @param int $posy Position depart
- * @param Translate $outputlangs Objet langs
- * @return int Position pour suite
+ * @param TCPDF $pdf Object PDF
+ * @param FactureFournisseur $object Object invoice
+ * @param int $deja_regle Amount already paid (in the currency of invoice)
+ * @param int $posy Position depart
+ * @param Translate $outputlangs Objet langs
+ * @return int Position of cursor after output
*/
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
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 253faa62882..bfb1d006106 100644
--- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
+++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
@@ -66,9 +66,10 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
* Return description of numbering model
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
$langs->load("bills");
@@ -90,9 +91,10 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
* Tests if the numbers already in the database do not cause conflicts that would prevent this numbering.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if KO (there is a conflict), true if OK
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
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 1a86dfbe611..f14a5df4605 100644
--- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php
+++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php
@@ -63,9 +63,10 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
/**
* Returns the description of the model numbering
*
- * @return string Description Text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs, $db;
@@ -95,7 +96,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
$texte .= ':';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '';
diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
index f32ae09ae6d..c42cfc88c8c 100644
--- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
+++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
@@ -26,6 +26,7 @@
* and parent class for supplier invoices numbering models
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
@@ -34,12 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
*/
abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation models
@@ -64,90 +59,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
/**
* Parent Class of numbering models of suppliers invoices references
*/
-abstract class ModeleNumRefSuppliersInvoices
+abstract class ModeleNumRefSuppliersInvoices extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /** Return if a model can be used or not
- *
- * @return boolean true if model can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /** Returns the default description of the model numbering
- *
- * @return string Description Text
- */
- public function info()
- {
- global $langs;
- $langs->load("invoices");
- return $langs->trans("NoDescription");
- }
-
- /** Returns a numbering example
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("invoices");
- return $langs->trans("NoExample");
- }
-
- /** Tests if the numbers already in force in the database do not cause conflicts that would prevent this numbering.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /** Returns next value assigned
- *
- * @param Societe $objsoc Object third party
- * @param Object $object Object
- * @param string $mode 'next' for next value or 'last' for last value
- * @return string Value if OK, 0 if KO
- */
- public function getNextValue($objsoc, $object, $mode = 'next')
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /** Returns version of the model numbering
- *
- * @return string Value
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- }
- if ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- }
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
- if ($this->version) {
- return $this->version;
- }
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
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 285be7c2799..1d5f194e9ab 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
@@ -142,17 +142,18 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
+ $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
// Add list of substitution keys
$texthelp .= ' '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").' ';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '
';
$texte .= '';
$texte .= '
';
- $texte .= '';
+ $texte .= '';
$texte .= '
';
// Scan directories
@@ -178,15 +179,10 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
// Add input to upload a new template file.
$texte .= '
';
$texte .= '';
$texte .= '';
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 84c13dc0ee6..b2739678701 100644
--- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
@@ -69,47 +69,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * Issuer
- * @var Societe
- */
- public $emetteur;
-
/**
* Constructor
diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php
new file mode 100644
index 00000000000..d876d5a6b12
--- /dev/null
+++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php
@@ -0,0 +1,1617 @@
+
+ * Copyright (C) 2005-2011 Regis Houssin
+ * Copyright (C) 2007 Franky Van Liedekerke
+ * Copyright (C) 2010-2014 Juanjo Menent
+ * Copyright (C) 2015 Marcos García
+ * Copyright (C) 2017 Ferran Marcet
+ * Copyright (C) 2018-2022 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/
+ */
+
+/**
+ * \file htdocs/core/modules/supplir_proposal/doc/pdf_zenith.modules.php
+ * \ingroup fournisseur
+ * \brief File of class to generate suppliers proposals from zenith model
+ */
+
+require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_proposal/modules_supplier_proposal.php';
+require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
+
+
+/**
+ * Class to generate the supplier proposals with the zenith model
+ */
+class pdf_zenith extends ModelePDFSupplierProposal
+{
+ /**
+ * @var DoliDb Database handler
+ */
+ public $db;
+
+ /**
+ * @var string model name
+ */
+ public $name;
+
+ /**
+ * @var string model description (short text)
+ */
+ public $description;
+
+ /**
+ * @var int Save the name of generated file as the main doc when generating a doc with this template
+ */
+ public $update_main_doc_field;
+
+ /**
+ * @var string document type
+ */
+ public $type;
+
+ /**
+ * Dolibarr version of the loaded document
+ * @var string
+ */
+ public $version = 'dolibarr';
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
+ global $conf, $langs, $mysoc;
+
+ // Load translation files required by the page
+ $langs->loadLangs(array("main", "bills"));
+
+ $this->db = $db;
+ $this->name = "zenith";
+ $this->description = $langs->trans('DocModelZenithDescription');
+ $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
+
+ // Page size for A4 format
+ $this->type = 'pdf';
+ $formatarray = pdf_getFormat();
+ $this->page_largeur = $formatarray['width'];
+ $this->page_hauteur = $formatarray['height'];
+ $this->format = array($this->page_largeur, $this->page_hauteur);
+ $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
+ $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
+ $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
+ $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
+
+ $this->option_logo = 1; // Display logo
+ $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
+ $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
+ $this->option_freetext = 1; // Support add of a personalised text
+ $this->option_draft_watermark = 1; // Support add of a watermark on drafts
+
+ // Get source company
+ $this->emetteur = $mysoc;
+ if (empty($this->emetteur->country_code)) {
+ $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
+ }
+
+ // Define position of columns
+ $this->posxdesc = $this->marge_gauche + 1; // For module retrocompatibility support durring PDF transition: TODO remove this at the end
+
+ $this->tabTitleHeight = 5; // default height
+
+ $this->tva = array();
+ $this->tva_array = array();
+ $this->localtax1 = array();
+ $this->localtax2 = array();
+ $this->atleastoneratenotnull = 0;
+ $this->atleastonediscount = 0;
+ }
+
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * 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
+ */
+ public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
+ // phpcs:enable
+ global $user, $langs, $conf, $hookmanager, $mysoc, $nblines;
+
+ if (!is_object($outputlangs)) {
+ $outputlangs = $langs;
+ }
+ // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
+ if (!empty($conf->global->MAIN_USE_FPDF)) {
+ $outputlangs->charset_output = 'ISO-8859-1';
+ }
+
+ // Load translation files required by the page
+ $outputlangs->loadLangs(array("main", "supplier_proposal", "companies", "bills", "dict", "products"));
+
+ global $outputlangsbis;
+ $outputlangsbis = null;
+ if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
+ $outputlangsbis = new Translate('', $conf);
+ $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
+ $outputlangsbis->loadLangs(array("main", "supplier_proposal", "companies", "bills", "dict", "products"));
+ }
+
+ $nblines = count($object->lines);
+
+ $hidetop = 0;
+ if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) {
+ $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
+ }
+
+ // Loop on each lines to detect if there is at least one image to show
+ $realpatharray = array();
+ if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) {
+ for ($i = 0; $i < $nblines; $i++) {
+ if (empty($object->lines[$i]->fk_product)) {
+ continue;
+ }
+
+ $objphoto = new Product($this->db);
+ $objphoto->fetch($object->lines[$i]->fk_product);
+
+ if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
+ $pdir = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
+ $dir = $conf->product->dir_output.'/'.$pdir;
+ } else {
+ $pdir = get_exdir($objphoto->id, 0, 0, 0, $objphoto, 'product');
+ $dir = $conf->product->dir_output.'/'.$pdir;
+ }
+
+ $realpath = '';
+ foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
+ if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
+ if ($obj['photo_vignette']) {
+ $filename = $obj['photo_vignette'];
+ } else {
+ $filename = $obj['photo'];
+ }
+ } else {
+ $filename = $obj['photo'];
+ }
+ $realpath = $dir.$filename;
+ break;
+ }
+
+ if ($realpath) {
+ $realpatharray[$i] = $realpath;
+ }
+ }
+ }
+ if (count($realpatharray) == 0) {
+ $this->posxpicture = $this->posxtva;
+ }
+
+ if ($conf->supplier_proposal->dir_output) {
+ $object->fetch_thirdparty();
+
+ $deja_regle = 0;
+ $amount_credit_notes_included = 0;
+ $amount_deposits_included = 0;
+ //$amount_credit_notes_included = $object->getSumCreditNotesUsed();
+ //$amount_deposits_included = $object->getSumDepositsUsed();
+
+ // Definition of $dir and $file
+ if ($object->specimen) {
+ $dir = $conf->supplier_proposal->dir_output;
+ $file = $dir."/SPECIMEN.pdf";
+ } else {
+ $objectref = dol_sanitizeFileName($object->ref);
+ $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier);
+ $dir = $conf->supplier_proposal->dir_output.'/'.$objectref;
+ $file = $dir."/".$objectref.".pdf";
+ if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) {
+ $file = $dir."/".$objectref.($objectrefsupplier ? "_".$objectrefsupplier : "").".pdf";
+ }
+ }
+
+ if (!file_exists($dir)) {
+ if (dol_mkdir($dir) < 0) {
+ $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
+ return 0;
+ }
+ }
+
+ if (file_exists($dir)) {
+ // Add pdfgeneration hook
+ if (!is_object($hookmanager)) {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager = new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+
+ $nblines = count($object->lines);
+
+ $pdf = pdf_getInstance($this->format);
+ $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
+ $heightforinfotot = 50; // Height reserved to output the info and total part
+ $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
+ $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
+ if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
+ $heightforfooter += 6;
+ }
+ $pdf->SetAutoPageBreak(1, 0);
+
+ if (class_exists('TCPDF')) {
+ $pdf->setPrintHeader(false);
+ $pdf->setPrintFooter(false);
+ }
+ $pdf->SetFont(pdf_getPDFFont($outputlangs));
+ // Set path to the background PDF File
+ if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
+ $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
+ $tplidx = $pdf->importPage(1);
+ }
+
+ $pdf->Open();
+ $pagenb = 0;
+ $pdf->SetDrawColor(128, 128, 128);
+
+ $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
+ $pdf->SetSubject($outputlangs->transnoentities("SupplierProposal"));
+ $pdf->SetCreator("Dolibarr ".DOL_VERSION);
+ $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
+ $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SupplierProposal")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
+ if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
+ $pdf->SetCompression(false);
+ }
+
+ $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
+
+ // Does we have at least one line with discount $this->atleastonediscount
+ foreach ($object->lines as $line) {
+ if ($line->remise_percent) {
+ $this->atleastonediscount = true;
+ break;
+ }
+ }
+
+ // New page
+ $pdf->AddPage();
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
+ $pagenb++;
+ $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
+ $pdf->SetFont('', '', $default_font_size - 1);
+ $pdf->MultiCell(0, 3, ''); // Set interline to 3
+ $pdf->SetTextColor(0, 0, 0);
+
+ $tab_top = 90 + $top_shift;
+ $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
+
+ $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
+
+ // Incoterm
+ if (isModEnabled('incoterm')) {
+ $desc_incoterms = $object->getIncotermsForPDF();
+ if ($desc_incoterms) {
+ $tab_top -= 2;
+
+ $pdf->SetFont('', '', $default_font_size - 1);
+ $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
+ $nexY = $pdf->GetY();
+ $height_incoterms = $nexY - $tab_top;
+
+ // Rect takes a length in 3rd parameter
+ $pdf->SetDrawColor(192, 192, 192);
+ $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
+
+ $tab_top = $nexY + 6;
+ }
+ }
+
+ // Affiche notes
+ $notetoshow = empty($object->note_public) ? '' : $object->note_public;
+
+ // Extrafields in note
+ $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
+ if (!empty($extranote)) {
+ $notetoshow = dol_concatdesc($notetoshow, $extranote);
+ }
+
+ $pagenb = $pdf->getPage();
+ if ($notetoshow) {
+ $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
+ $pageposbeforenote = $pagenb;
+
+ $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
+ complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
+ $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
+
+ $tab_top -= 2;
+
+ $pdf->startTransaction();
+
+ $pdf->SetFont('', '', $default_font_size - 1);
+ $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
+ // Description
+ $pageposafternote = $pdf->getPage();
+ $posyafter = $pdf->GetY();
+
+ if ($pageposafternote > $pageposbeforenote) {
+ $pdf->rollbackTransaction(true);
+
+ // prepar pages to receive notes
+ while ($pagenb < $pageposafternote) {
+ $pdf->AddPage();
+ $pagenb++;
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
+ $this->_pagehead($pdf, $object, 0, $outputlangs);
+ }
+ // $this->_pagefoot($pdf,$object,$outputlangs,1);
+ $pdf->setTopMargin($tab_top_newpage);
+ // The only function to edit the bottom margin of current page to set it.
+ $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
+ }
+
+ // back to start
+ $pdf->setPage($pageposbeforenote);
+ $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
+ $pdf->SetFont('', '', $default_font_size - 1);
+ $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
+ $pageposafternote = $pdf->getPage();
+
+ $posyafter = $pdf->GetY();
+
+ if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) { // There is no space left for total+free text
+ $pdf->AddPage('', '', true);
+ $pagenb++;
+ $pageposafternote++;
+ $pdf->setPage($pageposafternote);
+ $pdf->setTopMargin($tab_top_newpage);
+ // The only function to edit the bottom margin of current page to set it.
+ $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
+ //$posyafter = $tab_top_newpage;
+ }
+
+
+ // apply note frame to previus pages
+ $i = $pageposbeforenote;
+ while ($i < $pageposafternote) {
+ $pdf->setPage($i);
+
+
+ $pdf->SetDrawColor(128, 128, 128);
+ // Draw note frame
+ if ($i > $pageposbeforenote) {
+ $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
+ $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
+ } else {
+ $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
+ $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
+ }
+
+ // Add footer
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ $this->_pagefoot($pdf, $object, $outputlangs, 1);
+
+ $i++;
+ }
+
+ // apply note frame to last page
+ $pdf->setPage($pageposafternote);
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
+ $this->_pagehead($pdf, $object, 0, $outputlangs);
+ }
+ $height_note = $posyafter - $tab_top_newpage;
+ $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
+ } else {
+ // No pagebreak
+ $pdf->commitTransaction();
+ $posyafter = $pdf->GetY();
+ $height_note = $posyafter - $tab_top;
+ $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
+
+
+ if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
+ // not enough space, need to add page
+ $pdf->AddPage('', '', true);
+ $pagenb++;
+ $pageposafternote++;
+ $pdf->setPage($pageposafternote);
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
+ $this->_pagehead($pdf, $object, 0, $outputlangs);
+ }
+
+ $posyafter = $tab_top_newpage;
+ }
+ }
+
+ $tab_height = $tab_height - $height_note;
+ $tab_top = $posyafter + 6;
+ } else {
+ $height_note = 0;
+ }
+
+ // Use new auto collum system
+ $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
+
+ $nexY = $tab_top + $this->tabTitleHeight;
+
+ // Loop on each lines
+ $pageposbeforeprintlines = $pdf->getPage();
+ $pagenb = $pageposbeforeprintlines;
+ for ($i = 0; $i < $nblines; $i++) {
+ $curY = $nexY;
+ $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
+ $pdf->SetTextColor(0, 0, 0);
+
+ // Define size of image if we need it
+ $imglinesize = array();
+ if (!empty($realpatharray[$i])) {
+ $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
+ }
+
+ $pdf->setTopMargin($tab_top_newpage);
+ $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore = $pdf->getPage();
+
+ $showpricebeforepagebreak = 1;
+ $posYAfterImage = 0;
+ $posYAfterDescription = 0;
+
+ // We start with Photo of product line
+ if ($this->getColumnStatus('photo')) {
+ // We start with Photo of product line
+ if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
+ $pdf->AddPage('', '', true);
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
+ $pdf->setPage($pageposbefore + 1);
+
+ $curY = $tab_top_newpage;
+
+ // Allows data in the first page if description is long enough to break in multiples pages
+ if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
+ $showpricebeforepagebreak = 1;
+ } else {
+ $showpricebeforepagebreak = 0;
+ }
+ }
+
+ if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
+ $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
+ // $pdf->Image does not increase value return by getY, so we save it manually
+ $posYAfterImage = $curY + $imglinesize['height'];
+ }
+ }
+ // Description of product line
+ $curX = $this->posxdesc - 1;
+ $showpricebeforepagebreak = 1;
+
+ if ($this->getColumnStatus('desc')) {
+ $pdf->startTransaction();
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
+
+ $pageposafter = $pdf->getPage();
+ if ($pageposafter > $pageposbefore) { // There is a pagebreak
+ $pdf->rollbackTransaction(true);
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
+
+ $pageposafter = $pdf->getPage();
+ $posyafter = $pdf->GetY();
+ if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
+ if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
+ $pdf->AddPage('', '', true);
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
+ //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
+ $pdf->setPage($pageposafter + 1);
+ }
+ } else {
+ // We found a page break
+ // Allows data in the first page if description is long enough to break in multiples pages
+ if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
+ $showpricebeforepagebreak = 1;
+ } else {
+ $showpricebeforepagebreak = 0;
+ }
+ }
+ } else // No pagebreak
+ {
+ $pdf->commitTransaction();
+ }
+ $posYAfterDescription = $pdf->GetY();
+ }
+
+ $nexY = $pdf->GetY();
+ $pageposafter = $pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setTopMargin($this->marge_haute);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
+ // We suppose that a too long description is moved completely on next page
+ if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
+ $pdf->setPage($pageposafter);
+ $curY = $tab_top_newpage;
+ }
+
+ $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
+
+ // VAT Rate
+ if ($this->getColumnStatus('vat')) {
+ $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
+ $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate);
+ $nexY = max($pdf->GetY(), $nexY);
+ }
+
+ // Unit price before discount
+ if ($this->getColumnStatus('subprice')) {
+ $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
+ $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax);
+ $nexY = max($pdf->GetY(), $nexY);
+ }
+
+ // Quantity
+ // Enough for 6 chars
+ if ($this->getColumnStatus('qty')) {
+ $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
+ $this->printStdColumnContent($pdf, $curY, 'qty', $qty);
+ $nexY = max($pdf->GetY(), $nexY);
+ }
+
+
+ // Unit
+ if ($this->getColumnStatus('unit')) {
+ $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
+ $this->printStdColumnContent($pdf, $curY, 'unit', $unit);
+ $nexY = max($pdf->GetY(), $nexY);
+ }
+
+ // Discount on line
+ if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent) {
+ $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
+ $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent);
+ $nexY = max($pdf->GetY(), $nexY);
+ }
+
+ // Total HT line
+ if ($this->getColumnStatus('totalexcltax')) {
+ $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
+ $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax);
+ $nexY = max($pdf->GetY(), $nexY);
+ }
+
+ // Extrafields
+ if (!empty($object->lines[$i]->array_options)) {
+ foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
+ if ($this->getColumnStatus($extrafieldColKey)) {
+ $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
+ $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue);
+ $nexY = max($pdf->GetY(), $nexY);
+ }
+ }
+ }
+
+ $parameters = array(
+ 'object' => $object,
+ 'i' => $i,
+ 'pdf' =>& $pdf,
+ 'curY' =>& $curY,
+ 'nexY' =>& $nexY,
+ 'outputlangs' => $outputlangs,
+ 'hidedetails' => $hidedetails
+ );
+ $reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook
+
+
+ // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
+ if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) {
+ $tvaligne = $object->lines[$i]->multicurrency_total_tva;
+ } else {
+ $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;
+ $localtax2_rate = $object->lines[$i]->localtax2_tx;
+ $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 (!empty($object->remise_percent)) {
+ $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
+ }
+ if (!empty($object->remise_percent)) {
+ $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
+ }
+ if (!empty($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
+ if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
+ && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
+ $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $mysoc, $object->thirdparty);
+ $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : '';
+ $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : '';
+ }
+
+ // retrieve global local tax
+ if ($localtax1_type && $localtax1ligne != 0) {
+ if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
+ $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
+ } else {
+ $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
+ }
+ }
+ if ($localtax2_type && $localtax2ligne != 0) {
+ if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
+ $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
+ } else {
+ $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
+ }
+ }
+
+ if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
+ $vatrate .= '*';
+ }
+
+ // Fill $this->tva and $this->tva_array
+ if (!isset($this->tva[$vatrate])) {
+ $this->tva[$vatrate] = 0;
+ }
+ $this->tva[$vatrate] += $tvaligne;
+ $vatcode = $object->lines[$i]->vat_src_code;
+ if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
+ $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
+ }
+ $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
+
+ if ($posYAfterImage > $posYAfterDescription) {
+ $nexY = $posYAfterImage;
+ }
+
+ // Add line
+ if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
+ $pdf->setPage($pageposafter);
+ $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
+ //$pdf->SetDrawColor(190,190,200);
+ $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
+ $pdf->SetLineStyle(array('dash'=>0));
+ }
+
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter) {
+ $pdf->setPage($pagenb);
+ if ($pagenb == $pageposbeforeprintlines) {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
+ } else {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
+ }
+ $this->_pagefoot($pdf, $object, $outputlangs, 1);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
+ $this->_pagehead($pdf, $object, 0, $outputlangs);
+ }
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
+ }
+ if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
+ if ($pagenb == $pageposafter) {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
+ } else {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
+ }
+ $this->_pagefoot($pdf, $object, $outputlangs, 1);
+ // New page
+ $pdf->AddPage();
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
+ $pagenb++;
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
+ $this->_pagehead($pdf, $object, 0, $outputlangs);
+ }
+ }
+ }
+
+ // Show square
+ if ($pagenb == $pageposbeforeprintlines) {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
+ $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
+ } else {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
+ $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
+ }
+
+ // Affiche zone infos
+ $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
+
+ // Affiche zone totaux
+ $posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
+
+ // Affiche zone versements
+ if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) {
+ $posy = $this->_tableau_versements($pdf, $object, $posy, $outputlangs);
+ }
+
+ // Pied de page
+ $this->_pagefoot($pdf, $object, $outputlangs);
+ if (method_exists($pdf, 'AliasNbPages')) {
+ $pdf->AliasNbPages();
+ }
+
+ $pdf->Close();
+
+ $pdf->Output($file, 'F');
+
+ // Add pdfgeneration hook
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+ if ($reshook < 0) {
+ $this->error = $hookmanager->error;
+ $this->errors = $hookmanager->errors;
+ }
+
+ dolChmod($file);
+
+ $this->result = array('fullpath'=>$file);
+
+ return 1; // No error
+ } else {
+ $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
+ return 0;
+ }
+ } else {
+ $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR");
+ return 0;
+ }
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Show payments table
+ *
+ * @param TCPDF $pdf Object PDF
+ * @param SupplierProposal $object Object supplier propsal
+ * @param int $posy Position y in PDF
+ * @param Translate $outputlangs Object langs for output
+ * @return int <0 if KO, >0 if OK
+ */
+ protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
+ {
+ // phpcs:enable
+ return 1;
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Show miscellaneous information (payment mode, payment term, ...)
+ *
+ * @param TCPDF $pdf Object PDF
+ * @param SupplierProposal $object Object to show
+ * @param int $posy Y
+ * @param Translate $outputlangs Langs object
+ * @return integer
+ */
+ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
+ {
+ // phpcs:enable
+ global $conf, $mysoc;
+ $default_font_size = pdf_getPDFFontSize($outputlangs);
+
+ $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
+
+ // If France, show VAT mention if not applicable
+ if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
+ $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
+ $pdf->SetXY($this->marge_gauche, $posy);
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
+
+ $posy = $pdf->GetY() + 4;
+ }
+
+ $posxval = 52;
+
+ // Show payments conditions
+ if (!empty($object->cond_reglement_code) || $object->cond_reglement) {
+ $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
+ $pdf->SetXY($this->marge_gauche, $posy);
+ $titre = $outputlangs->transnoentities("PaymentConditions").':';
+ $pdf->MultiCell(80, 4, $titre, 0, 'L');
+
+ $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
+ $pdf->SetXY($posxval, $posy);
+ $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
+ $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
+ $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
+
+ $posy = $pdf->GetY() + 3;
+ }
+
+ // Show payment mode
+ if (!empty($object->mode_reglement_code)) {
+ $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
+ $pdf->SetXY($this->marge_gauche, $posy);
+ $titre = $outputlangs->transnoentities("PaymentMode").':';
+ $pdf->MultiCell(80, 5, $titre, 0, 'L');
+
+ $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
+ $pdf->SetXY($posxval, $posy);
+ $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
+ $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
+
+ $posy = $pdf->GetY() + 2;
+ }
+
+
+ return $posy;
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Show total to pay
+ *
+ * @param TCPDF $pdf Object PDF
+ * @param Facture $object Object invoice
+ * @param int $deja_regle Montant deja regle
+ * @param int $posy Position depart
+ * @param Translate $outputlangs Objet langs
+ * @return int Position pour suite
+ */
+ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
+ {
+ // phpcs:enable
+ global $conf, $mysoc;
+
+ $default_font_size = pdf_getPDFFontSize($outputlangs);
+
+ $tab2_top = $posy;
+ $tab2_hl = 4;
+ $pdf->SetFont('', '', $default_font_size - 1);
+
+ // Tableau total
+ $col1x = 120;
+ $col2x = 170;
+ if ($this->page_largeur < 210) { // To work with US executive format
+ $col2x -= 20;
+ }
+ $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
+
+ $useborder = 0;
+ $index = 0;
+
+ // Total HT
+ $pdf->SetFillColor(255, 255, 255);
+ $pdf->SetXY($col1x, $tab2_top);
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
+
+ $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
+ $pdf->SetXY($col2x, $tab2_top);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, 'R', 1);
+
+ // Show VAT by rates and total
+ $pdf->SetFillColor(248, 248, 248);
+
+ $this->atleastoneratenotnull = 0;
+ foreach ($this->tva as $tvakey => $tvaval) {
+ if ($tvakey > 0) { // On affiche pas taux 0
+ $this->atleastoneratenotnull++;
+
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+
+ $tvacompl = '';
+
+ if (preg_match('/\*/', $tvakey)) {
+ $tvakey = str_replace('*', '', $tvakey);
+ $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
+ }
+
+ $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
+ $totalvat .= vatrate($tvakey, 1).$tvacompl;
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
+
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
+ }
+ }
+ if (!$this->atleastoneratenotnull) { // If no vat at all
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code), 0, 'L', 1);
+
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
+
+ // Total LocalTax1
+ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION == 'localtax1on' && $object->total_localtax1 > 0) {
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code), 0, 'L', 1);
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
+ }
+
+ // Total LocalTax2
+ if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION == 'localtax2on' && $object->total_localtax2 > 0) {
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code), 0, 'L', 1);
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
+ }
+ } else {
+ //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
+ //{
+ //Local tax 1
+ foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
+ if (in_array((string) $localtax_type, array('2', '4', '6'))) {
+ continue;
+ }
+
+ foreach ($localtax_rate as $tvakey => $tvaval) {
+ if ($tvakey != 0) { // On affiche pas taux 0
+ //$this->atleastoneratenotnull++;
+
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+
+ $tvacompl = '';
+ if (preg_match('/\*/', $tvakey)) {
+ $tvakey = str_replace('*', '', $tvakey);
+ $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
+ }
+ $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
+ $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
+
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
+ }
+ }
+ }
+
+ //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
+ //{
+ //Local tax 2
+ foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
+ if (in_array((string) $localtax_type, array('2', '4', '6'))) {
+ continue;
+ }
+
+ foreach ($localtax_rate as $tvakey => $tvaval) {
+ if ($tvakey != 0) { // On affiche pas taux 0
+ //$this->atleastoneratenotnull++;
+
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+
+ $tvacompl = '';
+ if (preg_match('/\*/', $tvakey)) {
+ $tvakey = str_replace('*', '', $tvakey);
+ $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
+ }
+ $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
+ $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
+
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
+ }
+ }
+ }
+ }
+
+ // Total TTC
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->SetFillColor(224, 224, 224);
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
+
+ $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1);
+ $pdf->SetFont('', '', $default_font_size - 1);
+ $pdf->SetTextColor(0, 0, 0);
+
+ $creditnoteamount = 0;
+ $depositsamount = 0;
+ //$creditnoteamount=$object->getSumCreditNotesUsed();
+ //$depositsamount=$object->getSumDepositsUsed();
+ //print "x".$creditnoteamount."-".$depositsamount;exit;
+ $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
+ if (!empty($object->paye)) {
+ $resteapayer = 0;
+ }
+
+ if ($deja_regle > 0) {
+ // Already paid + Deposits
+ $index++;
+
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0);
+
+ $index++;
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->SetFillColor(224, 224, 224);
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
+
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
+
+ $pdf->SetFont('', '', $default_font_size - 1);
+ $pdf->SetTextColor(0, 0, 0);
+ }
+
+ $index++;
+ return ($tab2_top + ($tab2_hl * $index));
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ /**
+ * Show table for lines
+ *
+ * @param TCPDF $pdf Object PDF
+ * @param string $tab_top Top position of table
+ * @param string $tab_height Height of table (rectangle)
+ * @param int $nexY Y (not used)
+ * @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
+ * @param string $currency Currency code
+ * @return void
+ */
+ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ {
+ global $conf;
+
+ // Force to disable hidetop and hidebottom
+ $hidebottom = 0;
+ if ($hidetop) {
+ $hidetop = -1;
+ }
+
+ $currency = !empty($currency) ? $currency : $conf->currency;
+ $default_font_size = pdf_getPDFFontSize($outputlangs);
+
+ // Amount in (at tab_top - 1)
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetFont('', '', $default_font_size - 2);
+
+ 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 - 4);
+ $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
+
+ //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
+ if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
+ $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
+ }
+ }
+
+ $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 takes a length in 3rd parameter and 4th parameter
+
+ $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
+
+ if (empty($hidetop)) {
+ $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter
+ }
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ /**
+ * Show top header of page.
+ *
+ * @param TCPDF $pdf Object PDF
+ * @param CommandeFournisseur $object Object to show
+ * @param int $showaddress 0=no, 1=yes
+ * @param Translate $outputlangs Object lang for output
+ * @return float|int
+ */
+ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ {
+ global $langs, $conf, $mysoc;
+
+ $ltrdirection = 'L';
+ if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
+
+ // Load translation files required by the page
+ $outputlangs->loadLangs(array("main", "supplier_proposal", "companies", "bills", "sendings"));
+
+ $default_font_size = pdf_getPDFFontSize($outputlangs);
+
+ // Do not add the BACKGROUND as this is for suppliers
+ //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
+
+ //Affiche le filigrane brouillon - Print Draft Watermark
+ /*if($object->statut==0 && getDolGlobalString('COMMANDE_DRAFT_WATERMARK'))
+ {
+ pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',getDolGlobalString('COMMANDE_DRAFT_WATERMARK'));
+ }*/
+ //Print content
+
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->SetFont('', 'B', $default_font_size + 3);
+
+ $posx = $this->page_largeur - $this->marge_droite - 100;
+ $posy = $this->marge_haute;
+
+ $pdf->SetXY($this->marge_gauche, $posy);
+
+ // Logo
+ if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
+ if ($this->emetteur->logo) {
+ $logodir = $conf->mycompany->dir_output;
+ if (!empty($conf->mycompany->multidir_output[$object->entity])) {
+ $logodir = $conf->mycompany->multidir_output[$object->entity];
+ }
+ if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
+ $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
+ } else {
+ $logo = $logodir.'/logos/'.$this->emetteur->logo;
+ }
+ if (is_readable($logo)) {
+ $height = pdf_getHeightForLogo($logo);
+ $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
+ } else {
+ $pdf->SetTextColor(200, 0, 0);
+ $pdf->SetFont('', 'B', $default_font_size - 2);
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
+ }
+ } else {
+ $text = $this->emetteur->name;
+ $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
+ }
+ }
+
+ $pdf->SetFont('', 'B', $default_font_size + 3);
+ $pdf->SetXY($posx, $posy);
+ $pdf->SetTextColor(0, 0, 60);
+ $title = $outputlangs->transnoentities("SupplierProposal")." ".$outputlangs->convToOutputCharset($object->ref);
+ $pdf->MultiCell(100, 3, $title, '', 'R');
+ $posy += 1;
+
+ if ($object->ref_supplier) {
+ $posy += 4;
+ $pdf->SetFont('', 'B', $default_font_size);
+ $pdf->SetXY($posx, $posy);
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : ".$outputlangs->convToOutputCharset($object->ref_supplier), '', 'R');
+ $posy += 1;
+ }
+
+ $pdf->SetFont('', '', $default_font_size - 1);
+
+ if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
+ $object->fetch_projet();
+ if (!empty($object->project->ref)) {
+ $posy += 3;
+ $pdf->SetXY($posx, $posy);
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R');
+ }
+ }
+
+ if (!empty($conf->global->PDF_SHOW_PROJECT)) {
+ $object->fetch_projet();
+ if (!empty($object->project->ref)) {
+ $outputlangs->load("projects");
+ $posy += 4;
+ $pdf->SetXY($posx, $posy);
+ $langs->load("projects");
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
+ }
+ }
+
+ if (!empty($object->date)) {
+ $posy += 5;
+ $pdf->SetXY($posx, $posy);
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
+ } else {
+ $posy += 5;
+ $pdf->SetXY($posx, $posy);
+ $pdf->SetTextColor(255, 0, 0);
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Draft"), '', 'R');
+ }
+
+ $pdf->SetTextColor(0, 0, 60);
+ $usehourmin = 'day';
+ if (!empty($conf->global->SUPPLIER_PROPOSAL_USE_HOUR_FOR_DELIVERY_DATE)) {
+ $usehourmin = 'dayhour';
+ }
+ if (!empty($object->delivery_date)) {
+ $posy += 4;
+ $pdf->SetXY($posx - 90, $posy);
+ $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R');
+ }
+
+ if ($object->thirdparty->code_fournisseur) {
+ $posy += 4;
+ $pdf->SetXY($posx, $posy);
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R');
+ }
+
+ // Get contact
+ if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
+ $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
+ if (count($arrayidcontact) > 0) {
+ $usertmp = new User($this->db);
+ $usertmp->fetch($arrayidcontact[0]);
+ $posy += 4;
+ $pdf->SetXY($posx, $posy);
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R');
+ }
+ }
+
+ $posy += 1;
+ $pdf->SetTextColor(0, 0, 60);
+
+ $top_shift = 0;
+ // Show list of linked objects
+ $current_y = $pdf->getY();
+ $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;
+ }
+
+ if ($showaddress) {
+ // Sender properties
+ $carac_emetteur = '';
+ // Add internal contact of object if defined
+ $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
+ if (count($arrayidcontact) > 0) {
+ $object->fetch_user($arrayidcontact[0]);
+ $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
+ $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
+ $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
+ $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
+ $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
+ $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
+ $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
+ $carac_emetteur .= "\n";
+ }
+
+ $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
+
+ // Show sender
+ $posy = 42 + $top_shift;
+ $posx = $this->marge_gauche;
+ if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
+ $posx = $this->page_largeur - $this->marge_droite - 80;
+ }
+ $hautcadre = 40;
+
+ // Show sender frame
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetFont('', '', $default_font_size - 2);
+ $pdf->SetXY($posx, $posy - 5);
+ $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
+ $pdf->SetXY($posx, $posy);
+ $pdf->SetFillColor(230, 230, 230);
+ $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
+ $pdf->SetTextColor(0, 0, 60);
+
+ // Show sender name
+ $pdf->SetXY($posx + 2, $posy + 3);
+ $pdf->SetFont('', 'B', $default_font_size);
+ $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
+ $posy = $pdf->getY();
+
+ // Show sender information
+ $pdf->SetXY($posx + 2, $posy);
+ $pdf->SetFont('', '', $default_font_size - 1);
+ $pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection);
+
+
+
+ // If CUSTOMER contact defined on proposal, we use it. Note: Even if this is a supplier object, the code for external contat that follow order is 'CUSTOMER'
+ $usecontact = false;
+ $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
+ if (count($arrayidcontact) > 0) {
+ $usecontact = true;
+ $result = $object->fetch_contact($arrayidcontact[0]);
+ }
+
+ // Recipient name
+ if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
+ $thirdparty = $object->contact;
+ } else {
+ $thirdparty = $object->thirdparty;
+ }
+
+ $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
+
+ $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
+
+ // Show recipient
+ $widthrecbox = 100;
+ if ($this->page_largeur < 210) {
+ $widthrecbox = 84; // To work with US executive format
+ }
+ $posy = 42 + $top_shift;
+ $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
+ if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
+ $posx = $this->marge_gauche;
+ }
+
+ // Show recipient frame
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetFont('', '', $default_font_size - 2);
+ $pdf->SetXY($posx + 2, $posy - 5);
+ $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
+ $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
+
+ // Show recipient name
+ $pdf->SetXY($posx + 2, $posy + 3);
+ $pdf->SetFont('', 'B', $default_font_size);
+ $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, $ltrdirection);
+
+ $posy = $pdf->getY();
+
+ // Show recipient information
+ $pdf->SetFont('', '', $default_font_size - 1);
+ $pdf->SetXY($posx + 2, $posy);
+ $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
+ }
+
+ return $top_shift;
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ /**
+ * Show footer of page. Need this->emetteur object
+ *
+ * @param TCPDF $pdf PDF
+ * @param CommandeFournisseur $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)
+ {
+ $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
+ return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
+ }
+
+
+
+ /**
+ * Define Array Column Field
+ *
+ * @param Object $object common object
+ * @param Translate $outputlangs langs
+ * @param int $hidedetails Do not show line details
+ * @param int $hidedesc Do not show desc
+ * @param int $hideref Do not show ref
+ * @return void
+ */
+ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
+ global $conf, $hookmanager;
+
+ // Default field style for content
+ $this->defaultContentsFieldsStyle = array(
+ 'align' => 'R', // R,C,L
+ 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ );
+
+ // Default field style for content
+ $this->defaultTitlesFieldsStyle = array(
+ 'align' => 'C', // R,C,L
+ 'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ );
+
+ $rank = 0; // do not use negative rank
+ $this->cols['desc'] = array(
+ 'rank' => $rank,
+ 'width' => false, // only for desc
+ 'status' => true,
+ 'title' => array(
+ 'textkey' => 'Designation', // use lang key is usefull in somme case with module
+ 'align' => 'L',
+ // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
+ // 'label' => ' ', // the final label
+ 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ ),
+ 'content' => array(
+ 'align' => 'L',
+ 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ ),
+ );
+
+ $rank = $rank + 10;
+ $this->cols['photo'] = array(
+ 'rank' => $rank,
+ 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm
+ 'status' => false,
+ 'title' => array(
+ 'textkey' => 'Photo',
+ 'label' => ' '
+ ),
+ 'content' => array(
+ 'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ ),
+ 'border-left' => false, // remove left line separator
+ );
+
+ if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) {
+ $this->cols['photo']['status'] = true;
+ }
+
+
+ $rank = $rank + 10;
+ $this->cols['vat'] = array(
+ 'rank' => $rank,
+ 'status' => false,
+ 'width' => 16, // in mm
+ 'title' => array(
+ 'textkey' => 'VAT'
+ ),
+ 'border-left' => true, // add left line separator
+ );
+
+ if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
+ $this->cols['vat']['status'] = true;
+ }
+
+ $rank = $rank + 10;
+ $this->cols['subprice'] = array(
+ 'rank' => $rank,
+ 'width' => 19, // in mm
+ 'status' => false,
+ 'title' => array(
+ 'textkey' => 'PriceUHT'
+ ),
+ 'border-left' => true, // add left line separator
+ );
+
+ if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE)) {
+ $this->cols['subprice']['status'] = true;
+ }
+
+ $rank = $rank + 10;
+ $this->cols['qty'] = array(
+ 'rank' => $rank,
+ 'width' => 16, // in mm
+ 'status' => true,
+ 'title' => array(
+ 'textkey' => 'Qty'
+ ),
+ 'border-left' => true, // add left line separator
+ );
+
+ $rank = $rank + 10;
+ $this->cols['unit'] = array(
+ 'rank' => $rank,
+ 'width' => 11, // in mm
+ 'status' => false,
+ 'title' => array(
+ 'textkey' => 'Unit'
+ ),
+ 'border-left' => true, // add left line separator
+ );
+ if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
+ $this->cols['unit']['status'] = true;
+ }
+
+ $rank = $rank + 10;
+ $this->cols['discount'] = array(
+ 'rank' => $rank,
+ 'width' => 13, // in mm
+ 'status' => false,
+ 'title' => array(
+ 'textkey' => 'ReductionShort'
+ ),
+ 'border-left' => true, // add left line separator
+ );
+ if ($this->atleastonediscount) {
+ $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
+ $this->cols['totalexcltax'] = array(
+ 'rank' => $rank,
+ 'width' => 26, // in mm
+ 'status' => false,
+ 'title' => array(
+ 'textkey' => 'TotalHT'
+ ),
+ 'border-left' => true, // add left line separator
+ );
+
+ if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN)) {
+ $this->cols['totalexcltax']['status'] = true;
+ }
+
+ // Add extrafields cols
+ if (!empty($object->lines)) {
+ $line = reset($object->lines);
+ $this->defineColumnExtrafield($line, $outputlangs, $hidedetails);
+ }
+
+ $parameters = array(
+ 'object' => $object,
+ 'outputlangs' => $outputlangs,
+ 'hidedetails' => $hidedetails,
+ 'hidedesc' => $hidedesc,
+ 'hideref' => $hideref
+ );
+
+ $reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook
+ if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ } elseif (empty($reshook)) {
+ $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys
+ } else {
+ $this->cols = $hookmanager->resArray;
+ }
+ }
+}
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 cb4f76fa727..f9b91800153 100644
--- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
+++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
@@ -60,9 +60,10 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -84,9 +85,10 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if KO (there is a conflict), true if OK
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
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 e4eecb4fa7b..4601d24c03a 100644
--- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php
+++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php
@@ -60,9 +60,10 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
/**
* Return description of module
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs, $db;
@@ -89,7 +90,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php
index 18655535be3..d54b9629178 100644
--- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php
+++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php
@@ -28,6 +28,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent
@@ -36,12 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis
*/
abstract class ModelePDFSupplierProposal extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -67,96 +62,7 @@ abstract class ModelePDFSupplierProposal extends CommonDocGenerator
/**
* Classe mere des modeles de numerotation des references de propales
*/
-abstract class ModeleNumRefSupplierProposal
+abstract class ModeleNumRefSupplierProposal extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering pattern
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("supplier_proposal");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("supplier_proposal");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @param Societe $objsoc Object third party
- * @param SupplierProposal $supplier_proposal Object commercial proposal
- * @return string Valeur
- */
- public function getNextValue($objsoc, $supplier_proposal)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Renvoi version du module numerotation
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- }
- if ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- }
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
- if ($this->version) {
- return $this->version;
- }
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php
index 2295209bb82..85398f67c31 100644
--- a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php
+++ b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php
@@ -58,9 +58,10 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
@@ -84,9 +85,10 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
* Test if the numbers already in the database do not cause any conflicts that will prevent this
* of conflicts that will prevent this numbering from working.
*
- * @return boolean false if KO (there is a conflict), true if OK
+ * @param Object $object Object we need next value for
+ * @return boolean false if KO (there is a conflict), true if OK
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php
index 3ebc5858ae4..35c7242368f 100644
--- a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php
+++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php
@@ -54,9 +54,10 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
/**
* return description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $db, $langs;
@@ -82,7 +83,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
diff --git a/htdocs/core/modules/takepos/modules_takepos.php b/htdocs/core/modules/takepos/modules_takepos.php
index bd554a85a65..7a296d85f15 100644
--- a/htdocs/core/modules/takepos/modules_takepos.php
+++ b/htdocs/core/modules/takepos/modules_takepos.php
@@ -26,102 +26,13 @@
* \brief File containing the parent class for the numbering of cash register receipts
*/
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
+
/**
- * \class ModeleNumRefTakepos
- * \brief Classe mere des modeles de numerotation des tickets de caisse
+ * Classe mere des modeles de numerotation des tickets de caisse
*/
-abstract class ModeleNumRefTakepos
+abstract class ModeleNumRefTakepos extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
-
- public $version = '';
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering pattern
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("cashdesk@cashdesk");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load('cashdesk@cashdesk');
- return $langs->trans('NoExample');
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @param Societe $objsoc Object thirdparty
- * @param Facture $invoice Object invoice
- * @param string $mode 'next' for next value or 'last' for last value
- * @return string Value if KO, <0 if KO
- */
- public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
- {
- global $langs;
- return $langs->trans('NotAvailable');
- }
-
- /**
- * Renvoi version du modele de numerotation
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans('VersionDevelopment');
- }
- if ($this->version == 'experimental') {
- return $langs->trans('VersionExperimental');
- }
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
- if ($this->version) {
- return $this->version;
- }
- return $langs->trans('NotAvailable');
- }
+ // No overload code
}
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 7aa6b4a07e4..709085d544b 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
@@ -36,11 +36,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_ticket_odt extends ModelePDFTicket
{
- /**
- * @var Societe Issuer
- */
- public $emetteur;
-
/**
* Dolibarr version of the loaded document
* @var string
@@ -55,7 +50,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket
*/
public function __construct($db)
{
- global $conf, $langs, $mysoc;
+ global $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main", "companies"));
@@ -97,7 +92,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket
*/
public function info($langs)
{
- global $conf, $langs;
+ global $langs;
// Load translation files required by the page
$langs->loadLangs(array('companies', 'errors'));
@@ -135,17 +130,18 @@ class doc_generic_ticket_odt extends ModelePDFTicket
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
+ $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
// Add list of substitution keys
$texthelp .= ' '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").' ';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '
';
$texte .= '';
$texte .= '
';
- $texte .= '';
+ $texte .= '';
$texte .= '
';
// Scan directories
@@ -163,23 +159,18 @@ class doc_generic_ticket_odt extends ModelePDFTicket
}
// Add input to upload a new template file.
$texte .= '
';
$texte .= '';
$texte .= '';
diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php
index fdd3cbab86b..00bd01289fa 100644
--- a/htdocs/core/modules/ticket/mod_ticket_simple.php
+++ b/htdocs/core/modules/ticket/mod_ticket_simple.php
@@ -58,9 +58,10 @@ class mod_ticket_simple extends ModeleNumRefTicket
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -80,9 +81,10 @@ class mod_ticket_simple extends ModeleNumRefTicket
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
- * @return boolean false if conflict, true if ok
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated($object)
{
global $conf, $langs, $db;
@@ -121,7 +123,7 @@ class mod_ticket_simple extends ModeleNumRefTicket
*/
public function getNextValue($objsoc, $ticket)
{
- global $db, $conf;
+ global $db;
// First, we get the max value
$posindice = strlen($this->prefix) + 6;
diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php
index 8cd2cd6f614..15398b43f30 100644
--- a/htdocs/core/modules/ticket/mod_ticket_universal.php
+++ b/htdocs/core/modules/ticket/mod_ticket_universal.php
@@ -19,47 +19,48 @@
/**
* \file htdocs/core/modules/ticket/mod_ticket_universal.php
* \ingroup ticket
- * \brief Fichier contenant la classe du modele de numerotation de reference de projet Universal
+ * \brief File with class to manage the numbering module Universal for Ticket references
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/ticket/modules_ticket.php';
/**
- * Classe du modele de numerotation de reference de projet Universal
+ * Class to manage the numbering module Universal for Ticket references
*/
class mod_ticket_universal extends ModeleNumRefTicket
{
/**
- * Dolibarr version of the loaded document
- * @var string
+ * Dolibarr version of the loaded document
+ * @var string
*/
- public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
+ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
- * @var string Error code (or message)
+ * @var string Error code (or message)
*/
public $error = '';
/**
- * @var string Nom du modele
- * @deprecated
- * @see $name
+ * @var string Nom du modele
+ * @deprecated
+ * @see $name
*/
public $nom = 'Universal';
/**
- * @var string model name
+ * @var string model name
*/
public $name = 'Universal';
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
- global $db, $conf, $langs;
+ global $db, $langs;
// Load translation files required by the page
$langs->loadLangs(array("ticket", "admin"));
@@ -79,11 +80,11 @@ class mod_ticket_universal extends ModeleNumRefTicket
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Ticket"), $langs->transnoentities("Ticket"));
$tooltip .= $langs->trans("GenericMaskCodes5");
- // Parametrage du prefix
+ // Prefix settings
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
@@ -126,7 +127,7 @@ class mod_ticket_universal extends ModeleNumRefTicket
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- // On defini critere recherche compteur
+ // We define criterion search counter
$mask = getDolGlobalString("TICKET_UNIVERSAL_MASK");
if (!$mask) {
diff --git a/htdocs/core/modules/ticket/modules_ticket.php b/htdocs/core/modules/ticket/modules_ticket.php
index e5f91264f09..b8c2754ad12 100644
--- a/htdocs/core/modules/ticket/modules_ticket.php
+++ b/htdocs/core/modules/ticket/modules_ticket.php
@@ -26,13 +26,14 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
+
/**
* Parent class for documents models
*/
abstract class ModelePDFTicket extends CommonDocGenerator
{
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -58,100 +59,7 @@ abstract class ModelePDFTicket extends CommonDocGenerator
/**
* Classe mere des modeles de numerotation des references de projets
*/
-abstract class ModeleNumRefTicket
+abstract class ModeleNumRefTicket extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering pattern
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("ticket");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("ticket");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
-
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @param Societe $objsoc Object third party
- * @param Ticket $ticket Object ticket
- * @return string Valeur
- */
- public function getNextValue($objsoc, $ticket)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Renvoi version du module numerotation
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- }
-
- if ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- }
-
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
-
- if ($this->version) {
- return $this->version;
- }
-
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
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 d6e52e2f21e..cb1e28666e6 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
@@ -36,11 +36,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_user_odt extends ModelePDFUser
{
- /**
- * @var Societe Issuer
- */
- public $emetteur;
-
/**
* Dolibarr version of the loaded document
* @var string
@@ -55,7 +50,7 @@ class doc_generic_user_odt extends ModelePDFUser
*/
public function __construct($db)
{
- global $conf, $langs, $mysoc;
+ global $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main", "companies"));
@@ -146,17 +141,18 @@ class doc_generic_user_odt extends ModelePDFUser
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
+ $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
// Add list of substitution keys
$texthelp .= ' '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").' ';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '
';
$texte .= '';
$texte .= '';
diff --git a/htdocs/core/modules/usergroup/modules_usergroup.class.php b/htdocs/core/modules/usergroup/modules_usergroup.class.php
index 2c4aebe1e6f..0e31611b3db 100644
--- a/htdocs/core/modules/usergroup/modules_usergroup.class.php
+++ b/htdocs/core/modules/usergroup/modules_usergroup.class.php
@@ -19,31 +19,20 @@
* or see https://www.gnu.org/
*/
-
-/**
- * \class ModeleProductCode
- * \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
*/
- 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
*/
abstract class ModelePDFUserGroup extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
diff --git a/htdocs/core/modules/workstation/mod_workstation_advanced.php b/htdocs/core/modules/workstation/mod_workstation_advanced.php
index 253e4224b64..6695d26e64c 100644
--- a/htdocs/core/modules/workstation/mod_workstation_advanced.php
+++ b/htdocs/core/modules/workstation/mod_workstation_advanced.php
@@ -55,11 +55,12 @@ class mod_workstation_advanced extends ModeleNumRefWorkstation
/**
* Returns the description of the numbering model
*
- * @return string Descriptive text
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
- global $conf, $langs, $db;
+ global $langs, $db;
$langs->load("bills");
@@ -82,7 +83,7 @@ class mod_workstation_advanced extends ModeleNumRefWorkstation
$texte .= '
'.$langs->trans("Mask").':
';
$texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).'
';
- $texte .= '
';
+ $texte .= '
';
$texte .= '
';
diff --git a/htdocs/core/modules/workstation/mod_workstation_standard.php b/htdocs/core/modules/workstation/mod_workstation_standard.php
index 758783316e4..2ad954e5f2e 100644
--- a/htdocs/core/modules/workstation/mod_workstation_standard.php
+++ b/htdocs/core/modules/workstation/mod_workstation_standard.php
@@ -52,9 +52,10 @@ class mod_workstation_standard extends ModeleNumRefWorkstation
/**
* Return description of numbering module
*
- * @return string Text with description
+ * @param Translate $langs Lang object to use for output
+ * @return string Descriptive text
*/
- public function info()
+ public function info($langs)
{
global $langs;
return $langs->trans("SimpleNumRefNoDateModelDesc", $this->prefix);
diff --git a/htdocs/core/modules/workstation/modules_workstation.php b/htdocs/core/modules/workstation/modules_workstation.php
index cca24834d28..afa884c27d7 100644
--- a/htdocs/core/modules/workstation/modules_workstation.php
+++ b/htdocs/core/modules/workstation/modules_workstation.php
@@ -30,6 +30,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
@@ -38,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
*/
abstract class ModelePDFWorkstation extends CommonDocGenerator
{
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
@@ -61,100 +61,10 @@ abstract class ModelePDFWorkstation extends CommonDocGenerator
}
-
/**
* Parent class to manage numbering of Workstation
*/
-abstract class ModeleNumRefWorkstation
+abstract class ModeleNumRefWorkstation extends CommonNumRefGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
-
- public $version;
-
-
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
-
- /**
- * Returns the default description of the numbering template
- *
- * @return string Descriptive text
- */
- public function info()
- {
- global $langs;
- $langs->load("workstation@workstation");
- return $langs->trans("NoDescription");
- }
-
- /**
- * Returns an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("workstation@workstation");
- return $langs->trans("NoExample");
- }
-
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @param Object $object Object we need next value for
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated($object)
- {
- return true;
- }
-
- /**
- * Returns next assigned value
- *
- * @param Object $object Object we need next value for
- * @return string Valeur
- */
- public function getNextValue($object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
-
- /**
- * Returns version of numbering module
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
-
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- }
- if ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- }
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
- if ($this->version) {
- return $this->version;
- }
- return $langs->trans("NotAvailable");
- }
+ // No overload code
}
diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php
index 68899012433..d4e46dc7789 100644
--- a/htdocs/core/photos_resize.php
+++ b/htdocs/core/photos_resize.php
@@ -554,7 +554,7 @@ if (!empty($conf->use_javascript_ajax)) {
print ''."\n";
print '